Esempio n. 1
0
 protected void btnAccessSave_Click(object sender, EventArgs e)
 {
     try
     {
         foreach (GridViewRow gvr in gvUserProcedure.Rows)
         {
             if ((gvr.FindControl("chkAll") as CheckBox).Checked == true || (gvr.FindControl("chkView") as CheckBox).Checked == true || (gvr.FindControl("chkAdd") as CheckBox).Checked == true || (gvr.FindControl("chkEdit") as CheckBox).Checked == true || (gvr.FindControl("chkDelete") as CheckBox).Checked == true)
             {
                 string lblProcedureId = ((Label)gvr.FindControl("lblProcedureId")).Text;
                 if ((gvr.FindControl("chkAll") as CheckBox).Checked == true)
                 {
                     int i = BLL_QMSDB_Procedures.QMSDBProcedure_Insert_UserAccess(int.Parse(lstUser.SelectedValue), UDFLib.ConvertIntegerToNull(lblProcedureId), 1, 1, 1, 1, UDFLib.ConvertIntegerToNull(Session["USERID"].ToString()));
                 }
                 else
                 {
                     int chkView   = (gvr.FindControl("chkView") as CheckBox).Checked == true ? 1 : 0;
                     int chkAdd    = (gvr.FindControl("chkAdd") as CheckBox).Checked == true ? 1 : 0;
                     int chkEdit   = (gvr.FindControl("chkEdit") as CheckBox).Checked == true ? 1 : 0;
                     int chkDelete = (gvr.FindControl("chkDelete") as CheckBox).Checked == true ? 1 : 0;
                     int i         = BLL_QMSDB_Procedures.QMSDBProcedure_Insert_UserAccess(int.Parse(lstUser.SelectedValue), UDFLib.ConvertIntegerToNull(lblProcedureId), chkView, chkAdd, chkEdit, chkDelete, UDFLib.ConvertIntegerToNull(Session["USERID"].ToString()));
                 }
             }
         }
         BindFolderToUserAccess();
     }
     catch (Exception ex)
     {
         string js = "alert('" + ex.Message.Replace("'", "") + "');";
         ScriptManager.RegisterStartupScript(this, this.GetType(), "script2", js, true);
     }
 }