private void bw_DoWork(object sender, DoWorkEventArgs e) { DupMsg = "Please wait. Saving Data.."; foreach (var item in PromoList) { if (item.DuplicateCode == 0) { SavablePromoList.Add(item); } } PromotionDb db = new PromotionDb(); db.MakePromotion(SavablePromoList); // reset }
private void EventConnector_RollUpdateEvent(object sender, EventArgs e) { PromotionDb db = new PromotionDb(); if (PlistIndex > -1) { List <string> alreadyAssignedList = db.HasAlreadyAssignedOrNot(startYear: NewSessionStartYear, endYear: NewSessionEndYear, cls: PromoList[PlistIndex].NewStudyClass, section: PromoList[PlistIndex].NewSection, roll: PromoList[PlistIndex].NewRoll); if (alreadyAssignedList.Count > 0) { PromoList[PlistIndex].NewRoll = 0; System.Windows.MessageBox.Show("This section & roll already assigned to " + alreadyAssignedList.Count.ToString() + " student(s)"); } else { Promotion prm = PromoList[PlistIndex]; if (prm.NewRoll > 0 && !string.IsNullOrWhiteSpace(prm.NewSection)) { db.MakePromotion(prm); } } MapperData(); } }