コード例 #1
0
 private int BindUserAccessTypes()
 {
     using (DataTable dt = new BL_UserAccessType().select(new ML_UserAccessType {
         AccessTypeName = null
     }))
     {
         lst_uat.DataSource    = dt;
         lst_uat.DisplayMember = "AccessTypeName";
         lst_uat.ValueMember   = "Key";
         return(dt.Rows.Count);
     }
 }
コード例 #2
0
 private int BindUserAccessTypes()
 {
     using (DataTable dt = new BL_UserAccessType().select(new ML_UserAccessType {
         AccessTypeName = null
     }))
     {
         cbo_user_access_type.Properties.DataSource    = dt;
         cbo_user_access_type.Properties.DisplayMember = "AccessTypeName";
         cbo_user_access_type.Properties.ValueMember   = "Key";
         return(dt.Rows.Count);
     }
 }
コード例 #3
0
 private void btn_save_uat_Click(object sender, EventArgs e)
 {
     try
     {
         if (!IsNewRecord && !hasAccessUpdate)
         {
             ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, "You have no save rights.", "Access Denied");
             return;
         }
         if (txt_new_uat.IsNotEmpty())
         {
             using (DataTable Table = new BL_UserAccessType().selectAll(new ML_UserAccessType {
                 AccessTypeName = txt_new_uat.Text
             }))
             {
                 if (Table.Rows.Count < 1)
                 {
                     if (IsNewRecord)
                     {
                         new BL_UserAccessType().insert(new ML_UserAccessType {
                             AccessTypeName = txt_new_uat.Text.Trim(), UserKey = UniversalVariables.UserKey, UpdatedDate = DateTime.Now.GetFormattedDateString(UniversalVariables.MySQLDateFormat)
                         });
                     }
                     else if (SelectedID > 0)
                     {
                         new BL_UserAccessType().update(new ML_UserAccessType {
                             Key = SelectedID, AccessTypeName = txt_new_uat.Text.Trim(), UserKey = UniversalVariables.UserKey, UpdatedDate = DateTime.Now.GetFormattedDateString(UniversalVariables.MySQLDateFormat)
                         });
                     }
                     LastUAT = txt_new_uat.Text;
                     BindUserAccessTypes();
                     ResetForm(false, true, true, hasAccessInsert, hasAccessDelete, true);
                     SetPrevious();
                 }
                 else
                 {
                     ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, "The entered user access type is already in the database. Please re-check!", "Error");
                 }
             }
         }
         else
         {
             ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Exclamation, "Null value detected for access type name. Please re-check!", "Error!");
         }
     }
     catch (Exception ex)
     {
         AuditFactory.AuditLog(ex);
         ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
     }
 }
コード例 #4
0
 private void BindPrivileges(int Key)
 {
     try
     {
         using (DataTable dt = new BL_UserAccessType().selectUserPrivilege(new ML_UserAccessType {
             Key = Key
         }))
         {
             gc_assigned_privileges.DataSource = dt;
         }
     }
     catch (Exception ex)
     {
         AuditFactory.AuditLog(ex);
         ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
     }
 }