public void Extract(Guid srcPackID, string productCode) { Pack pack = PackBLL.Get4Extract(srcPackID); PackBLL.Add(pack.DIN, productCode, pack); if (pack.Status != Pack.StatusX.Produced) { PackBLL.ChangeStatus(pack.ID, Pack.StatusX.Produced, PackTransaction.TypeX.Out_Product); } }
public void Divide(Guid srcPackID, string division, int volume) { Pack pack = PackBLL.Get4Extract(srcPackID); string newProductCode = pack.ProductCode.Substring(0, pack.ProductCode.Length - 2) + division; PackBLL.Add(pack.DIN, newProductCode, volume, orgPack: pack); if (pack.Status != Pack.StatusX.Produced) { PackBLL.ChangeStatus(pack.ID, Pack.StatusX.Produced, PackTransaction.TypeX.Out_Product); } }
public static void Importing() { //Validate database before insert List <string> importedGeo = new List <string>(); RedBloodDataContext importDB; try { importDB = new RedBloodDataContext(ConfigurationManager.ConnectionStrings["ImportingRedBlood_DBConnectionString"].ConnectionString); //try to load whatever data to test connection importDB.Sexes.ToList(); } catch (Exception ex) { throw ex; } string strImportWithInDays = ConfigurationManager.AppSettings["ImportWithInDays"]; int importWithInDays = 1; if (!string.IsNullOrEmpty(strImportWithInDays)) { importWithInDays = strImportWithInDays.ToInt(); } if (importWithInDays < 1) { importWithInDays = 1; } List <Donation> importDINList = importDB.Donations .Where(r => r.CollectedDate.HasValue && (DateTime.Now.Date - r.CollectedDate.Value.Date).Days <= importWithInDays - 1 && r.PeopleID.HasValue && r.CampaignID.HasValue ) .ToList(); RedBloodDataContext db = new RedBloodDataContext(); foreach (Donation item in importDINList) { //Validate DIN Donation innerDIN = DonationBLL.Get(item.DIN); if (innerDIN == null || innerDIN.CollectedDate.HasValue || innerDIN.PeopleID.HasValue ) { continue; } //Campaign Campaign innerCam = CampaignBLL.Get(item.CampaignID.Value); if (innerCam == null) { continue; } //People if (item.People == null) { continue; } Guid?peopleID = ImportPeople(db, item.People); if (!peopleID.HasValue || peopleID.Value == Guid.Empty) { continue; } //Import DIN DonationBLL.Assign(innerDIN.DIN, peopleID.Value, innerCam.ID, item.CollectedDate, item.Actor); DonationBLL.UpdateCollector(innerDIN.DIN, item.Collector); if (item.Pack != null) { PackBLL.Add(innerDIN.DIN, item.Pack.ProductCode, item.Pack.Volume, packDate: item.Pack.Date); DonationBLL.Update(innerDIN.DIN, item.BloodGroup, "ImportingFromMDF"); } } }