Exemplo n.º 1
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (GridView1.Rows.Count > 0)
         {
             foreach (GridViewRow row in GridView1.Rows)
             {
                 int    RequestID       = Int32.Parse((row.FindControl("Label1") as Label).Text);
                 string ItemCode        = (row.FindControl("Label2") as Label).Text;
                 string s               = (row.FindControl("textbox1") as TextBox).Text;
                 string a               = (row.FindControl("Label5") as Label).Text;
                 int    CollectionQty   = Convert.ToInt32(a);
                 int    DisbursementQty = Convert.ToInt32(s);
                 if (DisbursementQty > CollectionQty || DisbursementQty < 0)
                 {
                     Session["count"] = 1;
                 }
             }
         }
         else
         {
             lb_Inform.Text = "No pending Disbursment Now";
         }
     }
     catch (Exception ex)
     {
         lb_Inform.Text  = "Please input Positive Integer";
         Button1.Enabled = true;
     }
     if (Convert.ToInt32(Session["count"]) == 1)
     {
         lb_Inform.Text   = "DisbursementQty can not more than CollectionQty or be negative";
         Session["count"] = 0;
     }
     else
     {
         try
         {
             foreach (GridViewRow row in GridView1.Rows)
             {
                 int    RequestID       = Int32.Parse((row.FindControl("Label1") as Label).Text);
                 string ItemCode        = (row.FindControl("Label2") as Label).Text;
                 string s               = (row.FindControl("textbox1") as TextBox).Text;
                 int    DisbursementQty = Convert.ToInt32(s);
                 StoreBusinessLogic.Disburse(RequestID, ItemCode, DisbursementQty);
             }
             Response.Redirect("~/StorePage/Disbursement List.aspx");
         }
         catch (Exception ex)
         {
             lb_Inform.Text = "Please input Positive Integer";
         }
     }
 }