コード例 #1
0
 //end
 protected void imgBtnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         //Assigning values to properties
         objRoleMaster.RoleId          = "";
         objRoleMaster.RoleName        = txtRoleName.Text.Trim();
         objRoleMaster.RoleDescription = txtRoleDesc.Text.Trim();
         objRoleMaster.EmpCode         = Membership.GetUser().UserName.ToString();
         objRoleMaster.UserType        = ddlUserType.SelectedValue;
         objRoleMaster.ActiveFlag      = rdoStatus.SelectedValue.ToString();
         //Calling SaveData to save Action details and pass type "INSERT_Action" it return "" if record
         //is not already exist otherwise exists
         string strMsg = objRoleMaster.SaveData("INSERT_ROLE");
         if (strMsg == "Exists")
         {
             lblMessage.Text = CommonClass.getErrorWarrning(enuErrorWarrning.DulplicateRecord, enuMessageType.UserMessage, false, "");
         }
         else
         {
             lblMessage.Text = CommonClass.getErrorWarrning(enuErrorWarrning.AddRecord, enuMessageType.UserMessage, false, "");
         }
     }
     catch (Exception ex)
     {
         //Writing Error message to File using CommonClass WriteErrorErrFile method taking arguments as URL of page
         // trace, error message
         CommonClass.WriteErrorErrFile(Request.RawUrl.ToString(), ex.StackTrace.ToString() + "-->" + ex.Message.ToString());
     }
     objCommonClass.BindDataGrid(gvComm, "uspRoleMaster", true, sqlParamSrh, lblRowCount);
     ClearControls();
 }