private void InhaleListP27(int p52id, int p27id) { var mq = new BO.myQuery("p27MszUnit"); mq.IsRecordValid = true; BO.p52OrderItem cP52 = _f.p52OrderItemBL.Load(p52id); BO.p11ClientProduct cP11 = _f.p11ClientProductBL.Load(cP52.p11ID); if (cP11.p10ID_Master > 0) { mq.p25id = _f.p10MasterProductBL.Load(cP11.p10ID_Master).p25ID; //z RecP10 se bere typ zařízení pro combo nabídku zařízení } else { if (cP11.p12ID > 0) { mq.p25id = _f.p12ClientTpvBL.Load(cP11.p12ID).p25ID; //vlastní klientská receptura } } _lisP27 = _f.p27MszUnitBL.GetList(mq).ToList(); if (p27id > 0) { _lisP27 = _lisP27.Where(p => p.pid == p27id).ToList(); } }
private void RefreshState_Record(p41RecordViewModel v) { v.Toolbar = new MyToolbarViewModel(v.Rec); if (v.Rec.p41MasterID > 0 && v.Rec.p52ID == 0) { var c = Factory.p41TaskBL.Load(v.Rec.p41MasterID); v.Rec.p52ID = c.p52ID; //zjistit ID objednávky master zakázky } if (v.Rec.p52ID > 0) { v.RecP52 = Factory.p52OrderItemBL.Load(v.Rec.p52ID); v.RecP51 = Factory.p51OrderBL.Load(v.RecP52.p51ID); BO.p11ClientProduct cP11 = Factory.p11ClientProductBL.Load(v.RecP52.p11ID); if (cP11.p10ID_Master > 0) { v.p25ID = Factory.p10MasterProductBL.Load(cP11.p10ID_Master).p25ID; //z RecP10 se bere typ zařízení pro combo nabídku zařízení } else { if (cP11.p12ID > 0) { v.p25ID = Factory.p12ClientTpvBL.Load(cP11.p12ID).p25ID; //vlastní klientská receptura } } } }
public IActionResult Record(Models.p11RecordViewModel v) { if (ModelState.IsValid) { BO.p11ClientProduct c = new BO.p11ClientProduct(); if (v.Rec.pid > 0) { c = Factory.p11ClientProductBL.Load(v.Rec.pid); } c.b02ID = v.Rec.b02ID; c.p11Code = v.Rec.p11Code; c.p11Name = v.Rec.p11Name; c.p11Memo = v.Rec.p11Memo; c.b02ID = v.Rec.b02ID; c.p11TypeFlag = v.Rec.p11TypeFlag; c.p12ID = v.Rec.p12ID; c.p10ID_Master = v.Rec.p10ID_Master; c.p11UnitPrice = v.Rec.p11UnitPrice; c.p20ID = v.Rec.p20ID; c.p20ID_Pro = v.Rec.p20ID_Pro; c.p11RecalcUnit2Kg = v.Rec.p11RecalcUnit2Kg; c.p11PackagingCode = v.Rec.p11PackagingCode; c.p11Davka = v.Rec.p11Davka; c.p11DavkaMin = v.Rec.p11DavkaMin; c.p11DavkaMax = v.Rec.p11DavkaMax; c.p11SalesPerMonth = v.Rec.p11SalesPerMonth; c.p11UnitsPerPalette = v.Rec.p11UnitsPerPalette; c.ValidUntil = v.Toolbar.GetValidUntil(c); c.ValidFrom = v.Toolbar.GetValidFrom(c); v.Rec.pid = Factory.p11ClientProductBL.Save(c); if (v.Rec.pid > 0) { Factory.o51TagBL.SaveTagging("p11", v.Rec.pid, v.TagPids); v.SetJavascript_CallOnLoad(v.Rec.pid); return(View(v)); } } v.Toolbar = new MyToolbarViewModel(v.Rec); this.Notify_RecNotSaved(); return(View(v)); }
public IActionResult Create(Models.p41CreateViewModel v, string rec_oper, int p27id) { if (rec_oper == "p51id_change") { v.p52ID = 0; v.p52Code = ""; } if (v.p51ID > 0) { v.RecP51 = Factory.p51OrderBL.Load(v.p51ID); } if (v.p52ID > 0) { v.RecP52 = Factory.p52OrderItemBL.Load(v.p52ID); v.RecP51 = Factory.p51OrderBL.Load(v.RecP52.p51ID); } if (rec_oper == "simulation_p51") { if (v.p51ID == 0) { Factory.CurrentUser.AddMessage("Musíte vybrat objednávku."); } else { var simul = new UI.TaskSimulation(Factory); simul.Date0 = getDate0(v); v.Tasks = simul.getTasksByP51(v.p51ID); } } if (rec_oper == "simulation_p52") { if (v.p52ID == 0) { Factory.CurrentUser.AddMessage("Musíte vybrat položku objednávky."); } else { var simul = new UI.TaskSimulation(Factory); simul.Date0 = getDate0(v); v.Tasks = simul.getTasksByP52(v.p52ID, v.p27ID); } } if (rec_oper == "simulation_p52ids") { var simul = new UI.TaskSimulation(Factory); simul.Date0 = getDate0(v); v.Tasks = simul.getTasksByP52IDs(BO.BAS.ConvertString2ListInt(v.SelectedP52IDs)); } if (rec_oper == "newitem") { if (v.Tasks == null) { v.Tasks = new List <BO.p41Task>(); } var c = new BO.p41Task(); if (v.Tasks.Where(p => p.p41PlanEnd != null).Count() > 0) { c.p41PlanStart = v.Tasks.Where(p => p.p41PlanEnd != null).Last().p41PlanEnd; } else { c.p41PlanStart = DateTime.Now.AddHours(1); } c.p41Duration = 60; if (p27id > 0) { c.p27ID = p27id; c.p27Name = Factory.p27MszUnitBL.Load(p27id).p27Name; } if (v.RecP52 != null) { c.p52ID = v.RecP52.pid; c.p52Code = v.RecP52.p52Code; //c.p41Name = v.RecP52.p11Name + " [" + v.RecP52.p11Code + "]"; } v.Tasks.Add(c); return(View(v)); } if (rec_oper == "clear") { v.Tasks = new List <BO.p41Task>(); } if (rec_oper == "delete") { //došlo k virtuálnímu odstranění řádku zakázky - pouze postback } if (rec_oper == "postback") //pouze postback { } if (v.Tasks == null) { v.Tasks = new List <BO.p41Task>(); } if (ModelState.IsValid) { if (rec_oper == "save") { int x = Factory.p41TaskBL.SaveBatch(v.Tasks.Where(p => p.IsTempDeleted == false).ToList()); if (x > 0) { v.SetJavascript_CallOnLoad(0, "p41"); return(View(v)); } } } if (v.RecP52 != null) { BO.p11ClientProduct cP11 = Factory.p11ClientProductBL.Load(v.RecP52.p11ID); if (cP11.p10ID_Master > 0) { v.p25ID = Factory.p10MasterProductBL.Load(cP11.p10ID_Master).p25ID; //z RecP10 se bere typ zařízení pro combo nabídku zařízení } else { if (cP11.p12ID > 0) { v.p25ID = Factory.p12ClientTpvBL.Load(cP11.p12ID).p25ID; //vlastní klientská receptura } } var mq = new BO.myQuery("p27MszUnit"); mq.p25id = v.p25ID; v.lisP27 = Factory.p27MszUnitBL.GetList(mq).ToList(); } return(View(v)); }