コード例 #1
0
        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;
            }
        }