コード例 #1
0
 public void SelectAdjustmentVoucher()
 {
     int i = Convert.ToInt32(Session["userid"].ToString());
     AdjustmentService adjService = new AdjustmentService();
     dgvAdjustmentVoucher.DataSource = adjService.getTransactionForAdjVoucher(i.ToString()) ;
     dgvAdjustmentVoucher.DataBind();
 }
コード例 #2
0
        public void FillData()
        {
            AdjustmentService adjService = new AdjustmentService();
            var adjHeader = adjService.getAdjustmentVoucherByID(Convert.ToInt32(AdjustmentVoucherID));
            //Data From DataBase
            // a.ADVID,a.ADVDate,a.ADVStatus,a.employee.EmployeeName ,ApprovedBy =a.employee1.EmployeveName
            Type t = adjHeader.GetType();
            PropertyInfo adj_status = t.GetProperty("ADVStatus");
            PropertyInfo adj_Date = t.GetProperty("ADVDate");
            PropertyInfo adj_EmpName = t.GetProperty("StoreEmpName");

            string status = adj_status.GetValue(adjHeader, null).ToString();
            string date = adj_Date.GetValue(adjHeader, null).ToString();
            string empName = adj_EmpName.GetValue(adjHeader, null).ToString();

            lblDate.Text = date;
            lblStoreClerkID.Text = empName;

            Double total = adjService.getAdjustmentVoucherTotal(Convert.ToInt32(AdjustmentVoucherID));

            if (status == "Pending" )
            {
                int userID = Convert.ToInt32(Session["userid"].ToString());

                string[] roles;
                string role;
                roles= Roles.GetRolesForUser();
                role = roles[0];
                if (role == "Store Manager" && total < 250)
                {
                    btnApprove.Visible = false;
                    btnApprove.Enabled = false;
                    btnReject.Visible = false;
                    btnReject.Enabled = false;

                }
                else if (role == "Store Supervisor" && total >=250)
                {
                    btnApprove.Visible = false;
                    btnApprove.Enabled = false;
                    btnReject.Visible = false;
                    btnReject.Enabled = false;

                }

            }
            else
            {
                btnApprove.Visible = true;
                btnApprove.Enabled = true;

                btnReject.Visible = true;
                btnReject.Enabled = true;
            }

            dgvAdjDetails.DataSource = adjService.getAdjustmentVoucherDetail(Convert.ToInt32(AdjustmentVoucherID));
            dgvAdjDetails.DataBind();
            dgvAdjDetails.Enabled = false;
        }
コード例 #3
0
        public void FillData()
        {
            AdjustmentService adjService = new AdjustmentService();

            dgvAdjustmentVoucher.Visible = false;
            dgvAdjustmentVoucher.Enabled = false;
            btnSubmit.Visible = false;
            dgvAdjDetails.DataSource = adjService.getAdjustmentVoucherDetail(Convert.ToInt32(AdjustmentVoucherID));

            dgvAdjDetails.DataBind();
            dgvAdjDetails.Enabled = false;
        }
コード例 #4
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                AdjustmentService service = new AdjustmentService();
                adjustmentvoucher adjVoucher = new adjustmentvoucher();

                adjVoucher.ADVDate = DateTime.Today;
                int userID = Convert.ToInt32(Session["userid"].ToString());
                adjVoucher.ADVIOrderByEmpID = userID;
               // adjVoucher.ADVApprovedByEMpID = 2;
                adjVoucher.ADVStatus = "Pending";
                double totalPrice = 0;
                List<adjustmentvoucherdetail> detailList = new List<adjustmentvoucherdetail>();

                foreach (GridViewRow i in dgvAdjustmentVoucher.Rows)
                {
                    adjustmentvoucherdetail adjVoucher_details = new adjustmentvoucherdetail();
                    adjVoucher_details.ADVID = Convert.ToInt32(i.Cells[6].Text.ToString());
                    adjVoucher_details.ADVItemID = Convert.ToInt32(i.Cells[0].Text.ToString());
                    adjVoucher_details.ADVItemUnitCost = 0;
                    adjVoucher_details.ADVQuantAdj = Convert.ToInt32(i.Cells[2].Text.ToString());

                    TextBox t = (TextBox)i.FindControl("txtReason");
                    int itemafter = Convert.ToInt32(i.Cells[5].Text.ToString());
                    int quantbefore = itemafter + adjVoucher_details.ADVQuantAdj;
                    adjVoucher_details.ADVReason = t.Text.ToString();
                    adjVoucher_details.ADVItemUnitCost = Convert.ToInt32(i.Cells[3].Text.ToString());
                    adjVoucher_details.ADVQuantBefore = quantbefore;
                    adjVoucher_details.ADVQuantAfter = Convert.ToInt32(i.Cells[5].Text.ToString());
                    adjVoucher_details.ADVAdjustedCost = Convert.ToInt32(i.Cells[4].Text.ToString());

                    detailList.Add(adjVoucher_details);

                    totalPrice = totalPrice + adjVoucher_details.ADVAdjustedCost;
                }

                service.saveAdjustmentVoucher(adjVoucher, detailList ,totalPrice);

                Response.Redirect("ViewStockAdjustmentList.aspx");

            }
            catch (Exception ex)
            {
                Label1.Text = "Un expected error occurs! please contact to admin";
            }
        }
コード例 #5
0
 void acceptAdjustmentVoucher()
 {
     AdjustmentService service = new AdjustmentService();
     dgvStockAdjustmentList.DataSource = service.getAdjustmentVoucher();
     dgvStockAdjustmentList.DataBind();
 }
コード例 #6
0
 public void UpdateAdjustmentVoucher(String status)
 {
     AdjustmentService services = new AdjustmentService();
     int userID = Convert.ToInt32(Session["userid"].ToString());
     services.updateAdjustmentVoucher(Convert.ToInt32(AdjustmentVoucherID), status, userID);
     Response.Redirect("./ViewAdjustmentVoucherListBySupervisor.aspx");
 }