Пример #1
0
        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();
            }
        }
Пример #2
0
        public IActionResult Record(Models.p52RecordViewModelcs v, string rec_oper)
        {
            if (rec_oper == "postback")
            {
                v.RecP51 = Factory.p51OrderBL.Load(v.Rec.p51ID);
                if (v.Rec.p11ID > 0)
                {
                    var cP11 = Factory.p11ClientProductBL.Load(v.Rec.p11ID);
                    v.Rec.p20Code          = cP11.p20Code;
                    v.Rec.p11RecalcUnit2Kg = cP11.p11RecalcUnit2Kg;
                }

                v.Toolbar = new MyToolbarViewModel(v.Rec)
                {
                    IsToArchive = false
                };
                return(View(v));
            }
            if (ModelState.IsValid)
            {
                BO.p52OrderItem c = new BO.p52OrderItem();
                if (v.Rec.pid > 0)
                {
                    c = Factory.p52OrderItemBL.Load(v.Rec.pid);
                }

                c.p52Code       = v.Rec.p52Code;
                c.p51ID         = v.Rec.p51ID;
                c.p11ID         = v.Rec.p11ID;
                c.p52UnitsCount = v.Rec.p52UnitsCount;
                c.p52DateNeeded = v.Rec.p52DateNeeded;

                v.Rec.pid = Factory.p52OrderItemBL.Save(c);
                if (v.Rec.pid > 0)
                {
                    v.SetJavascript_CallOnLoad(v.Rec.p51ID);
                    return(View(v));
                }
            }

            v.Toolbar = new MyToolbarViewModel(v.Rec)
            {
                IsToArchive = false
            };


            this.Notify_RecNotSaved();
            return(View(v));
        }
Пример #3
0
 private void RefreshState_BatchInsertByP11(p52BatchInsertByP11 v)
 {
     if (v.lisP52 == null)
     {
         v.lisP52 = new List <BO.p52OrderItem>();
         var arr = BO.BAS.ConvertString2ListInt(v.p11ids);
         foreach (int intP11ID in arr)
         {
             var recP11 = Factory.p11ClientProductBL.Load(intP11ID);
             var c      = new BO.p52OrderItem()
             {
                 p11ID = intP11ID, p11Code = recP11.p11Code, p11Name = recP11.p11Name, p52UnitsCount = recP11.p11Davka
             };
             v.lisP52.Add(c);
         }
     }
 }
Пример #4
0
        private string Handle_Import(string strFullPath, string strGuid)
        {
            using (var workbook = new XLWorkbook(strFullPath))
            {
                var worksheet = workbook.Worksheets.First();

                for (int row = 2; row < 10000; row++)
                {
                    if (worksheet.Cell(row, 1).Value != null && worksheet.Cell(row, 1).Value.ToString() != "")
                    {
                        string   strP51Code       = worksheet.Cell(row, 1).Value.ToString();
                        string   strP11Code       = worksheet.Cell(row, 2).Value.ToString();
                        double   dblP52UnitsCount = Convert.ToDouble(worksheet.Cell(row, 3).Value);
                        DateTime?datP52DateNeeded = null;
                        try
                        {
                            datP52DateNeeded = Convert.ToDateTime(worksheet.Cell(row, 4).Value);
                        }
                        catch
                        {
                        }

                        string strFce = worksheet.Cell(row, 5).Value.ToString();
                        if (string.IsNullOrEmpty(strFce) == true)
                        {
                            strFce = "A";
                        }

                        var recP51 = Factory.p51OrderBL.LoadByCode(strP51Code, 0);
                        var recP11 = Factory.p11ClientProductBL.LoadByCode(strP11Code, 0);
                        if (recP51 != null && recP11 != null && dblP52UnitsCount > 0)
                        {
                            var c = new BO.p52OrderItem()
                            {
                                p11ID = recP11.pid, p51ID = recP51.pid, p52UnitsCount = dblP52UnitsCount, p52DateNeeded = datP52DateNeeded
                            };
                            if (strFce == "U")
                            {
                                var lisP52 = Factory.p52OrderItemBL.GetList(recP51.pid);
                                if (lisP52.Where(p => p.p11ID == recP11.pid).Count() > 0)
                                {
                                    c = lisP52.Where(p => p.p11ID == recP11.pid).First();
                                    c.p52UnitsCount = dblP52UnitsCount;
                                }
                            }
                            var intP52ID = Factory.p52OrderItemBL.Save(c);
                            if (intP52ID > 0)
                            {
                                var recP52 = Factory.p52OrderItemBL.Load(intP52ID);

                                worksheet.Cell(row, 5).Value = recP52.p52Code;
                            }
                        }
                    }
                }
                worksheet.Cell(1, 5).Value = "Naimportovaný kód";
                workbook.SaveAs(Factory.App.TempFolder + "\\import_vysledek" + strGuid + ".xlsx");
                this.AddMessage("Import dokončen.", "info");
                return("import_vysledek" + strGuid + ".xlsx");
            }
        }