Ejemplo n.º 1
0
 protected void btn_Save_Click(object sender, EventArgs e)
 {
     try
     {
         DataTable dtcrop = new DataTable();
         dtcrop.Columns.Add("CropCode", typeof(string));
         int j = 0;
         foreach (GridViewRow gr in GVsale.Rows)
         {
             if (((CheckBox)gr.FindControl("chkSelct")).Checked == true)
             {
                 dtcrop.Rows.Add();
                 dtcrop.Rows[j]["CropCode"] = ((Label)gr.FindControl("lblcropcode")).Text;
                 j++;
             }
             if (j == 0)
             {
                 objCommon.ShowAlertMessage("Select atleast one Crop");
             }
         }
         objbe.TVP    = dtcrop;
         objbe.Action = "I";
         dt           = objm.Issustopsale(objbe, conkey);
         if (dt.Rows.Count > 0)
         {
             objCommon.ShowAlertMessage("Not Saved, try again");
             viewdata();
         }
         else
         {
             objCommon.ShowAlertMessage(" Data Saved");
             viewdata();
             Bindata();
         }
     }
     catch (Exception ex)
     {
         ExceptionLogging.SendExcepToDB(ex, Session["UsrName"].ToString(), Request.ServerVariables["REMOTE_ADDR"].ToString());
         Response.Redirect("~/Error.aspx");
     }
 }