public static void ConfirmRecivedItems(string DI, List <DisbursementDetail> ddlist) { Staff rep = new Staff(); using (InventorySysDBEntities cntx = new InventorySysDBEntities()) { //update disbursmentdetail foreach (DisbursementDetail dd in ddlist) { updateDisbursmentDetail(cntx, dd); } //update disbursment Disbursement disbursment = cntx.Disbursements.Find(DI); rep = StaffController.getRepByDepID(disbursment.Dept_ID); disbursment.Receive_Date = DateTime.Now; disbursment.Status = "Recieved"; // update Requisition List <Requisition> reqList = getRequisitionsByDI(DI); foreach (Requisition req in reqList) { Requisition reqData = cntx.Requisitions.Find(req.Requisition_ID); reqData.Status = "Received"; } cntx.SaveChanges(); } SendNotificationController.SendNotificaition(rep, DI); }
protected void approveBtn_Click(object sender, EventArgs e) { Staff supv = (Staff)Session["LoginStaff"]; string superviserID = supv.Staff_ID;; string voucherId = ViewState["voucherid"].ToString(); DataTable dt = (DataTable)ViewState["DetailTable"]; List <double> priceList = new List <double>(); for (int i = 0; i < dt.Rows.Count; i++) { string code = dt.Rows[i]["Code"].ToString(); string reason = "Adjustment " + "by reson: " + remarkTxtArea.Value; int qty = Convert.ToInt32(dt.Rows[i]["QtyAdj"].ToString()); DateTime updateDate = DateTime.Now; approveAdjControl.AdjIntoItemTxn(voucherId, code, updateDate, reason, qty, superviserID); double d = Convert.ToDouble(dt.Rows[i]["Price"].ToString()); priceList.Add(d); } // System.Windows.Forms.MessageBox.Show("Adjustment has been approved!!!"); Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>alert('Adjustment has been approved!')</script>"); setInitialData();//changes foreach (double p in priceList) { if (p > 250) { SendNotificationController.SendNotificaition(supv, voucherId); break; } } }