Пример #1
0
        public void createDibursement(Disbursement disbursement)
        {
            if (disbursement.DisbursementDetailsCollection.Count != 0)
            {
                disbursement dis = new disbursement();
                dis.disbursementId = disbursement.DisbursementId;
                dis.departmentId = disbursement.DepartmentId;
                dis.date = disbursement.Date;
                dis.status = disbursement.Status;
                dis.deliveryDate = disbursement.Date;
                ctx.disbursements.Add(dis);
                ctx.SaveChanges();

                List<DisbursementDetails> disD = disbursement.DisbursementDetailsCollection;

                foreach (DisbursementDetails ds in disD)
                {
                    disbursementDetail dl = new disbursementDetail();
                    dl.disbursementId = disbursement.DisbursementId;
                    dl.itemId = ds.ItemId;
                    dl.requestQty = ds.RequestedQty;
                    dl.deliveredQty = 0;

                    ctx.disbursementDetails.Add(dl);
                    ctx.SaveChanges();

                }
            }
        }
 public void createEmergencyDisbursement(List<DisbursementDetails> DBList, string depName)
 {
     disbursement d = new disbursement();
     d.disbursementId = "DB"+sFacade.getCodeGeneratorValue_Lingna("DB");
     d.departmentId = departmentFacade.getDepartment_Lingna(depName).departmentId;
     d.date = Convert.ToDateTime(System.DateTime.Now.ToShortDateString());
     d.deliveryDate = Convert.ToDateTime(System.DateTime.Now.ToShortDateString());
     d.status = "Completed";
     dFacade.createDisbursement(d);
     foreach(DisbursementDetails ds in DBList)
     {
         disbursementDetail n = new disbursementDetail();
         n.deliveredQty = ds.DeliveredQty;
         n.disbursementId = d.disbursementId;
         n.itemId = ds.ItemId;
         n.requestQty = ds.RequestedQty;
         cataFacade.updateStockAfterDisbursement_Lingna(ds.DeliveredQty, ds.ItemId);
         dFacade.createDisbursementDetail(n, d);
     }
     sFacade.updateCodeGeneratorValue_Lingna("DB");
 }
Пример #3
0
 public void createDisbursementDetail(disbursementDetail dd, disbursement d)
 {
     var dis = ctx.disbursements.First(o => o.disbursementId == d.disbursementId);
     dis.disbursementDetails.Add(dd);
     ctx.SaveChanges();
 }