using Warehouse.DAL.ProductionPlan;
using Warehouse.DAL.ProductionPlanCheck;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Warehouse.Models.mesModel;

namespace Warehouse.DAL.ProductionPlan
{
    public class ProductionPlanDal
    {
        //白班月份计划
        public List<dynamic> InsertDayProductionPlan(dynamic DayProductionPlan)
        {
            using (var context = new mesModel())
            {
                ProductionPlanCheckDal DayPlan = new ProductionPlanCheckDal();
                string sql = DayPlan.DayProductionPlanSql(DayProductionPlan);
                var res = context.DynamicListFromSql(sql, null);
                return res.ToList();
            }
        }

        //晚班月份计划
        public List<dynamic> InsertNightProductionPlan(dynamic NightProductionPlan)
        {
            using (var context = new mesModel())
            {
                ProductionPlanCheckDal NightPlan = new ProductionPlanCheckDal();
                string sql = NightPlan.NightProductionPlanSql(NightProductionPlan);
                var res = context.DynamicListFromSql(sql, null);
                return res.ToList();
            }
        }

        //白班月份计划查询
        public List<dynamic> SearchDayMonthPlan(string DayWorkshop,string Dayyear,string Daymonth)
        {
            using (var context = new mesModel())
            {
                ProductionPlanCheckDal DayPlan = new ProductionPlanCheckDal();
                string sql = DayPlan.SearchDayMonthPlanSql(DayWorkshop, Dayyear, Daymonth);
                var res = context.DynamicListFromSql(sql, null);
                return res.ToList();
            }
        }

        //晚班月份计划查询
        public List<dynamic> SearchNightMonthPlan(string NightWorkshop,string Nightyear,string Nightmonth)
        {
            using (var context = new mesModel())
            {
                ProductionPlanCheckDal DayPlan = new ProductionPlanCheckDal();
                string sql = DayPlan.SearchNightMonthPlanSql(NightWorkshop, Nightyear, Nightmonth);
                var res = context.DynamicListFromSql(sql, null);
                return res.ToList();
            }
        }
    }
}