Exemplo n.º 1
0
 protected void LinkButtondelete_click(object sender, System.EventArgs e)
 {
     CSLOrderingARCBAL.LinqToSqlDataContext db = null;
     try
     {
         LinkButton lbdel = sender as LinkButton;
         if (lbdel != null)
         {
             GridViewRow gvr  = (GridViewRow)lbdel.NamingContainer;
             Label       lbl2 = gvr.FindControl("lblProductGradeID") as Label;
             ViewState["ProductGradeID"] = lbl2.Text;
         }
         else
         {
             //Reset
             if (ViewState["ProductGradeID"] != null)
             {
             }
             else
             {
                 //Do a cancel as no value in ViewState
                 btnCancel_Click(sender, e);
             }
         }
         db = new LinqToSqlDataContext();
         Boolean retunStatus = ProductBAL.DeleteProductGrade(Convert.ToInt32(ViewState["ProductGradeID"].ToString()));
         if (retunStatus == true)
         {
             LoadData();
             string script = "alertify.alert('" + ltrGrade.Text + "');";
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
         }
     }
     catch (Exception objException)
     {
         db = new CSLOrderingARCBAL.LinqToSqlDataContext();
         db.USP_SaveErrorDetails(Request.Url.ToString(), "LinkButtondelete_click", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
         db.Dispose();
     }
 }