protected void btnApproveAdjust_Click(object sender, EventArgs e) { /// update adjustmentInfo /// int adjust_id = Convert.ToInt32(ddlAdjustID.SelectedItem.Text); //int ApprovedBy_ID = Convert.ToInt32(System.Web.HttpContext.Current.User.Identity.Name.ToString()); int ApprovedBy_ID = Convert.ToInt32(Session["loginUser"]); DateTime currentDate = DateTime.Now; string status = "Approve"; AdjustmentBLL adjust_bll = new AdjustmentBLL(); string s = adjust_bll.updateAdjustmentInfo(adjust_id, ApprovedBy_ID, currentDate, status); /// update Stock Item Qty /////// foreach (GridViewRow row in gvAdjustmentReport.Rows) { string item_code = row.Cells[1].Text; int qty = Convert.ToInt32(row.Cells[2].Text); StockItemBLL stockItem_bll = new StockItemBLL(); string updateStock_msg = stockItem_bll.updateStockQty(item_code, qty); string desc = stockItem_bll.GetItemDescription(item_code); StockHistoryBLL stockbll = new StockHistoryBLL(); string history_msg = stockbll.AddStockHistoryForAdjustment(item_code, desc, qty, currentDate, ApprovedBy_ID); lblUpdateMsg.Text = updateStock_msg + history_msg; } }
private void FillAdjust_Id_List() { string person = "Supervisor"; lblTest.Text = person; AdjustmentBLL adjust_bll = new AdjustmentBLL(); //var list = adjust_bll.getIDList(); var list = adjust_bll.getAdjust_IDList(person); ddlAdjustID.DataSource = list; ddlAdjustID.DataTextField = "AdjustmentID"; ddlAdjustID.DataValueField = "AdjustmentID"; ddlAdjustID.DataBind(); }
private void FillAdjust_Id_List() { //string person = System.Web.HttpContext.Current.User.Identity.Name.ToString();// need to get login user id string person = Session["loginUser"].ToString(); lblTest.Text = person; AdjustmentBLL adjust_bll = new AdjustmentBLL(); //var list = adjust_bll.getIDList(); IList list = adjust_bll.getAdjust_IDList(person); ddlAdjustID.DataSource = list; ddlAdjustID.DataTextField = "AdjustmentID"; ddlAdjustID.DataValueField = "AdjustmentID"; ddlAdjustID.DataBind(); }
protected void btnSubmit_Click(object sender, EventArgs e) { adjustment_View adjust_view = new adjustment_View(); AdjustmentBLL adjustbll = new AdjustmentBLL(); //int adjustBy_Id = 1005; // int loginUserId = 1002;// current login User who will make Adjustment Report int loginUserId = Convert.ToInt32(Session["loginUser"]); DateTime adjustDate = DateTime.Now; //DateTime adjustDate = DateTime.Today; int itemPrice = Convert.ToInt32(ddlPrice.SelectedItem.Value); //int approvedBy = null; //DateTime approveDate = null; //string approveStatus = null; double total_price = 0; foreach (GridViewRow row in gvAdjustList.Rows) { string item_code = row.Cells[1].Text; int qty = Convert.ToInt32(row.Cells[2].Text); StockItemBLL itemBll = new StockItemBLL(); double price = itemBll.GetItemPrice(item_code); total_price = total_price + (price * qty); /********* Don't delete lbl testing line **********/ //lblPrice.Text = price.ToString(); //lblTotalPrice.Text = total_price.ToString(); // don't delete } string authorizedBy = null; if (total_price <= 250) { authorizedBy = "Supervisor"; } else { authorizedBy = "Manager"; } int adjustid = adjustbll.addAdjustment(loginUserId, adjustDate, authorizedBy); foreach (GridViewRow row in gvAdjustList.Rows) { string item_code = row.Cells[1].Text; int qty = Convert.ToInt32(row.Cells[2].Text); string reason = row.Cells[3].Text; string status = row.Cells[4].Text; AdjustmentDetailsBLL adjust_details_bll = new AdjustmentDetailsBLL(); int adjustment_details_Id = adjust_details_bll.addAdjustmentDetails(adjustid, item_code, qty, reason, status); } Employee emp_bll = new Employee(); //int loginUserId = 1002; string email_body = "Adjustment Report is submitted to Supervier or Manager by StoreClerk"; string email_subj = "Issue Adjustment Report"; string email_msg = SendEmailNotification(loginUserId, email_body, email_subj, authorizedBy); lblSubmitMsg.Text = "Adjustment Report Submittion is successful. " + email_msg; }