public static int warn() { BLL.DepotDrugBLL DepotDrugBLL = new BLL.DepotDrugBLL(); BLL.WarningBLL warningBLL = new BLL.WarningBLL(); int warnNum = 0; var wa = warningBLL.GetList(en => DateTime.Now >= en.WarningDays && en.tb_DepotDrug.Num > 0, en => en.tb_DepotDrug); warnNum = wa.Count; //var idlist = wa.Select(en => en.DepotDrugId); //var dep = DepotDrugBLL.GetList(en => !idlist.Contains(en.Id), en => en.tb_DrugInfo); //List<models.tb_Warning> warnList = new List<tb_Warning>(); //foreach(var d in dep) //{ //} //foreach (var w in wa) //{ // idlist.Add(w.DepotDrugId); //} //foreach (var d in dep) //{ // if (!idlist.Exists(x => x == d.Id)) // { // int wd = Convert.ToInt32(Math.Ceiling(d.tb_DrugInfo.Shelf * 0.8)); // tb_Warning Warning = new tb_Warning(); // Warning.DepotDrugId = d.Id; // DateTime ProductionDate = d.ProductionDate; // Warning.WarningDays = ProductionDate.AddDays(wd); // warningBLL.Add(Warning); // } //} //string now = DateTime.Now.ToShortDateString(); //wa = warningBLL.GetList(en => true); //foreach (var w in wa) //{ // if (w.WarningDays.ToShortDateString() == now) // { // warnNum = warnNum + 1; // } //} return(warnNum); }
// // GET: /Test/ public ActionResult Index() { BLL.DepotBLL depotBLL = new BLL.DepotBLL(); BLL.DepotDrugBLL ddb = new BLL.DepotDrugBLL(); return(View()); }