Exemplo n.º 1
0
        private void ManageFormClosingEvent(FormClosingEventArgs e)
        {
            try
            {
                if (MessageBox.Show("Are you sure you want to exit?", "Confirm Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes)
                {
                    if (UniversalVariables.UserKey != 0)
                    {
                        new BL_UsageLog().update(new ML_UsageLog {
                            UserKey = UniversalVariables.UserKey, To = DateTime.Now
                        });
                    }

                    e.Cancel = false;
                }
                else
                {
                    e.Cancel = true;
                }
            }
            catch (Exception ex)
            {
                AuditFactory.AuditLog(ex);
                ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
            }
        }
        public ManageOrganisations()
        {
            try
            {
                InitializeComponent();

                BindCategory();
                BindCountry();

                if (BindOrganisation() == 0)
                {
                    ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Exclamation, "No organisations are available to show. Please add a new organisation!", "Message");
                    btn_new_organisation.PerformClick();
                }

                btn_new_organisation.Enabled    = hasAccessInsert;
                btn_delete_organisation.Enabled = hasAccessDelete;
                btn_save_organisation.Enabled   = (hasAccessInsert || hasAccessUpdate);
            }
            catch (Exception ex)
            {
                AuditFactory.AuditLog(ex);
                ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
            }
        }
Exemplo n.º 3
0
 private void btn_delete_salutation_Click(object sender, EventArgs e)
 {
     try
     {
         if (new BL_Salutation().selectUsage(new ML_Salutation {
             Key = SelectedID
         }) == 0)
         {
             if (ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Warning, string.Format("Are you sure you want to delete the salutation {0} from the database?", lst_salutations.Text)) == System.Windows.Forms.DialogResult.OK)
             {
                 new BL_Salutation().delete(new ML_Salutation {
                     Key = SelectedID, UserKey = UniversalVariables.UserKey
                 });
                 ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Information, string.Format("Salutation {0} has been successfully deleted.", lst_salutations.Text), "Deletion Successful!");
                 BindSalutation();
                 ResetForm(false, true, true, hasAccessInsert, hasAccessDelete, true);
             }
         }
         else
         {
             ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, "The salutation you are trying to delete has been referenced in one or more member records. This salutation cannot be deleted.", "Error");
         }
     }
     catch (Exception ex)
     {
         AuditFactory.AuditLog(ex);
         ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
     }
 }
        private void lst_organisation_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (lst_organisation.SelectedIndex == SelectedIndex)
                {
                    return;
                }

                if (FormDirty)
                {
                    if (ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.YesNo, UniversalVariables.UnsavedData) == DialogResult.Yes)
                    {
                        lst_org_IndexChanged();
                    }
                    else
                    {
                        lst_organisation.SelectedIndex = (int)SelectedIndex;
                    }
                }
                else
                {
                    lst_org_IndexChanged();
                }
            }
            catch (Exception ex)
            {
                AuditFactory.AuditLog(ex);
                ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
            }
        }
Exemplo n.º 5
0
 private void cbo_country_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         if (cbo_country.EditValue != null)
         {
             using (DataTable dt = new BL_City().selectByCountry(new OBALog.Model.ML_City {
                 CountryKey = Convert.ToInt32(cbo_country.EditValue)
             }))
             {
                 cbo_city.Clear();
                 cbo_city.Properties.DataSource    = dt;
                 cbo_city.Properties.DisplayMember = "City";
                 cbo_city.Properties.ValueMember   = "CityKey";
                 cbo_city.SelectFirstIndex();
             }
             FormDirty = true;
         }
     }
     catch (Exception ex)
     {
         AuditFactory.AuditLog(ex);
         ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
     }
 }
Exemplo n.º 6
0
 private void btn_delete_sub_category_Click(object sender, EventArgs e)
 {
     try
     {
         if (SubCategoryID > 0 && lst_sub_categories.SelectedIndex > -1)
         {
             if (new BL_OrganisationSubCategory().selectUsage(new ML_OrganisationSubCategory {
                 Key = SubCategoryID
             }) == 0)
             {
                 if (ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Warning, string.Format("Are you sure you want to delete the sub category {0} from the database?", lst_sub_categories.Text), "Warning") == System.Windows.Forms.DialogResult.OK)
                 {
                     new BL_OrganisationSubCategory().delete(new ML_OrganisationSubCategory {
                         Key = SubCategoryID
                     });
                     ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Warning, string.Format("Sub category {0} has been successfully deleted.", lst_sub_categories.Text), "Deletion Successful.");
                     ResetSubCategoryForm();
                     lst_categories_SelectedIndexChanged(this, new EventArgs());
                 }
             }
             else
             {
                 ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, "The sub category you are trying to delete has been referenced in one or more member records. This sub category cannot be deleted.", "Error");
             }
         }
     }
     catch (Exception ex)
     {
         AuditFactory.AuditLog(ex);
         ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
     }
 }
Exemplo n.º 7
0
        private void validateUnlock()
        {
            try
            {
                DataSet user = new BL_User().checkLogin(new ML_User {
                    LoginId = UniversalVariables.Username, Password = txt_password.Text
                });

                if (user.Tables[0].Rows.Count == 1 && user.Tables[1].Rows.Count > 0)
                {
                    this.Hide();
                    Home.InactivityTimer.Enabled = true;
                    Home.idleFlag = true;
                }
                else
                {
                    ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, "The password you entered is wrong. Please retry!", "Wrong Password");
                }
            }
            catch (Exception ex)
            {
                AuditFactory.AuditLog(ex);
                ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
            }
        }
Exemplo n.º 8
0
        private void btn_save_sub_category_Click(object sender, EventArgs e)
        {
            try
            {
                if (!IsNewSubCategory && !hasAccessUpdate)
                {
                    ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, "You have no save rights.", "Access Denied");
                    return;
                }

                if (txt_new_sub_category.IsNotEmpty())
                {
                    using (DataTable Table = new BL_OrganisationSubCategory().select(new ML_OrganisationSubCategory {
                        SubCategory = txt_new_sub_category.Text
                    }))
                    {
                        if (Table.Rows.Count < 1)
                        {
                            if (IsNewSubCategory)
                            {
                                new BL_OrganisationSubCategory().insert(new ML_OrganisationSubCategory {
                                    CategoryKey = CategoryID, SubCategory = txt_new_sub_category.Text
                                });
                            }
                            else if (SubCategoryID > 0)
                            {
                                new BL_OrganisationSubCategory().update(new ML_OrganisationSubCategory {
                                    Key = SubCategoryID, SubCategory = txt_new_sub_category.Text
                                });
                            }

                            LastCategory    = lst_categories.Text;
                            LastSubCategory = txt_new_sub_category.Text;

                            ResetSubCategoryForm();
                            lst_categories_SelectedIndexChanged(this, new EventArgs());
                            SetPrevious();
                        }
                        else
                        {
                            ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, "The entered sub category is already in the database. Please re-check!", "Error");
                        }
                    }
                }
                else
                {
                    ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Exclamation, "Null value detected for sub category. Please re-check!", "Error!");
                }
            }
            catch (Exception ex)
            {
                AuditFactory.AuditLog(ex);
                ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
            }
        }
 private void btn_new_uat_Click(object sender, EventArgs e)
 {
     try
     {
         ResetForm(true, false, true, false, false, false);
     }
     catch (Exception ex)
     {
         AuditFactory.AuditLog(ex);
         ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
     }
 }
Exemplo n.º 10
0
 private void cbo_user_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         nud_no_of_records_EditValueChanged(this, new EventArgs());
     }
     catch (Exception ex)
     {
         AuditFactory.AuditLog(ex);
         ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
     }
 }
Exemplo n.º 11
0
 private void btn_new_category_Click(object sender, EventArgs e)
 {
     try
     {
         ApplicationUtilities.CheckFormDirty(NewCategory, FormDirty);
     }
     catch (Exception ex)
     {
         AuditFactory.AuditLog(ex);
         ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
     }
 }
Exemplo n.º 12
0
 private void btn_select_all_privileges_Click(object sender, EventArgs e)
 {
     try
     {
         SelectDeselect(true);
     }
     catch (Exception ex)
     {
         AuditFactory.AuditLog(ex);
         ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
     }
 }
Exemplo n.º 13
0
        private void btn_save_country_Click(object sender, EventArgs e)
        {
            try
            {
                if (!IsNewCountry && !hasAccessUpdate)
                {
                    ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, "You have no save rights.", "Access Denied");
                    return;
                }

                if (txt_new_country.IsNotEmpty())
                {
                    using (DataTable Table = new BL_Country().select(new ML_Country {
                        Country = txt_new_country.Text
                    }))
                    {
                        if (Table.Rows.Count < 1)
                        {
                            if (IsNewCountry)
                            {
                                new BL_Country().insert(new ML_Country {
                                    Country = txt_new_country.Text
                                });
                            }
                            else if (CountryID > 0)
                            {
                                new BL_Country().update(new ML_Country {
                                    Key = CountryID, Country = txt_new_country.Text
                                });
                            }

                            ResetCountryForm();
                            BindCountry();
                            SetPrevious();
                        }
                        else
                        {
                            ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, "The entered country is already in the database. Please re-check!", "Error");
                        }
                    }
                }
                else
                {
                    ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Exclamation, "Null value detected for country. Please re-check!", "Error!");
                }
            }
            catch (Exception ex)
            {
                AuditFactory.AuditLog(ex);
                ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
            }
        }
Exemplo n.º 14
0
        private void btn_save_salutation_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_salutation.IsNotEmpty())
                {
                    using (DataTable Table = new BL_Salutation().select(new ML_Salutation {
                        Salutation = txt_new_salutation.Text
                    }))
                    {
                        if (Table.Rows.Count < 1)
                        {
                            if (IsNewRecord)
                            {
                                new BL_Salutation().insert(new ML_Salutation {
                                    Salutation = txt_new_salutation.Text.Trim(), UserKey = UniversalVariables.UserKey
                                });
                            }
                            else if (SelectedID > 0)
                            {
                                new BL_Salutation().update(new ML_Salutation {
                                    Key = SelectedID, Salutation = txt_new_salutation.Text.Trim(), UserKey = UniversalVariables.UserKey
                                });
                            }

                            BindSalutation();
                            ResetForm(false, true, true, hasAccessInsert, hasAccessDelete, true);
                            SetPrevious();
                        }
                        else
                        {
                            ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, "The entered salutation is already in the database. Please re-check!", "Error");
                        }
                    }
                }
                else
                {
                    ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Exclamation, "Null value detected for salutation. Please re-check!", "Error!");
                }
            }
            catch (Exception ex)
            {
                AuditFactory.AuditLog(ex);
                ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
            }
        }
Exemplo n.º 15
0
 public ViewSessions()
 {
     try
     {
         InitializeComponent();
         BindUsers();
     }
     catch (Exception ex)
     {
         AuditFactory.AuditLog(ex);
         ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
     }
 }
 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);
     }
 }
Exemplo n.º 17
0
        public ResetPassword()
        {
            try
            {
                InitializeComponent();

                lblUserName.Text = UniversalVariables.Username;
            }
            catch (Exception ex)
            {
                AuditFactory.AuditLog(ex);
                ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
            }
        }
Exemplo n.º 18
0
        void btn_Login_Click(object sender, EventArgs e)
        {
            try
            {
                if (LoginForm.txt_loginid.IsNotEmpty() && LoginForm.txt_pwd.IsNotEmpty())
                {
                    DataSet user = new BL_User().checkLogin(new ML_User {
                        LoginId = LoginForm.txt_loginid.Text, Password = LoginForm.txt_pwd.Text
                    });

                    if (user.Tables[0].Rows.Count == 1 && user.Tables[1].Rows.Count > 0)
                    {
                        UniversalVariables.UserKey           = user.Tables[0].Rows[0]["Key"].ToString().ToInt();
                        UniversalVariables.Name              = user.Tables[0].Rows[0]["Name"].ToString();
                        UniversalVariables.UserAccessTypeKey = user.Tables[0].Rows[0]["UserAccessTypeKey"].ToString().ToInt();
                        UniversalVariables.AccessTypeName    = user.Tables[0].Rows[0]["AccessTypeName"].ToString();
                        UniversalVariables.Username          = user.Tables[0].Rows[0]["LoginId"].ToString();

                        UniversalVariables.IsLoggedIn = true;

                        Privileges.UserPrivileges         = user.Tables[1];
                        Configurations.ConfigurationTable = user.Tables[2];

                        lbUserName.Text    = "Logged in as : " + UniversalVariables.Name;
                        lbUserName.Visible = true;
                        MenuStrip1.Enabled = true;

                        SetDefaults(false);
                        SetMainFormPrivileges();
                        LoginForm.Hide();
                    }
                    else
                    {
                        ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, "Wrong username and / or password! Please enter correct details to continue.", "Login Error!");
                        LoginForm.txt_loginid.Focus();
                    }
                }
                else
                {
                    ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, "The username and / or password field/s cannot be blank. Please re-check!", "Login Error!");
                    LoginForm.txt_loginid.Focus();
                }
            }
            catch (Exception ex)
            {
                AuditFactory.AuditLog(ex);
                ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
            }
        }
Exemplo n.º 19
0
 private void btn_populate_Click(object sender, EventArgs e)
 {
     try
     {
         if (cbo_user.SelectedText != null)
         {
             nud_no_of_records_EditValueChanged(this, new EventArgs());
         }
     }
     catch (Exception ex)
     {
         AuditFactory.AuditLog(ex);
         ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
     }
 }
Exemplo n.º 20
0
        private int GetSortOrder(string v)
        {
            try
            {
                DataTable datatable = (gc_assigned_privileges.DataSource as DataTable);

                //EnumerableRowCollection<object> aa = (from myRow in datatable.AsEnumerable()
                //                                      where myRow.Field<string>("Category") == "Global"
                //                                      select myRow["Priority"]);

                switch (v)
                {
                case "Global":
                    return(datatable.AsEnumerable()
                           .Select(s => new { Category = s.Field <string>("Category"), Priority = s.Field <int>("Priority") })
                           .Distinct()
                           .Where(f => f.Category == "Global")
                           .Distinct()
                           .Select(f => f.Priority).ToList()[0]);

                case "Custom":
                    return(datatable.AsEnumerable()
                           .Select(s => new { Category = s.Field <string>("Category"), Priority = s.Field <int>("Priority") })
                           .Distinct()
                           .Where(f => f.Category == "Custom")
                           .Distinct()
                           .Select(f => f.Priority).ToList()[0]);

                case "Local":
                    return(datatable.AsEnumerable()
                           .Select(s => new { Category = s.Field <string>("Category"), Priority = s.Field <int>("Priority") })
                           .Distinct()
                           .Where(f => f.Category == "Local")
                           .Distinct()
                           .Select(f => f.Priority).ToList()[0]);

                default:
                    return(0);
                }
            }
            catch (Exception ex)
            {
                AuditFactory.AuditLog(ex);
                ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);

                return(0);
            }
        }
Exemplo n.º 21
0
 public TestForm()
 {
     try
     {
         InitializeComponent();
         if (BindPrivileges() == 0 & BindUserAccessTypes() == 0)
         {
             ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, "No privileges and / or user access types are available to show. The system will now exit. Please contact System Administrator!", "Error");
         }
     }
     catch (Exception ex)
     {
         AuditFactory.AuditLog(ex);
         ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
     }
 }
Exemplo n.º 22
0
 private void cbo_country_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         if (cbo_country.EditValue != null)
         {
             BindCity(Convert.ToInt32(cbo_country.EditValue));
             FormDirty = true;
         }
     }
     catch (Exception ex)
     {
         AuditFactory.AuditLog(ex);
         ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
     }
 }
Exemplo n.º 23
0
        public ManageConfigurations()
        {
            InitializeComponent();

            try
            {
                bindInitialData();
                bindConfigurations();
                FormDirty = false;
            }
            catch (Exception ex)
            {
                AuditFactory.AuditLog(ex);
                ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
            }
        }
Exemplo n.º 24
0
 private void nud_no_of_records_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         if (cbo_user.IsNotEmpty())
         {
             gcUserLog.DataSource = new BL_UsageLog().selectByUser(new ML_UsageLog {
                 UserKey = Convert.ToInt32(cbo_user.EditValue)
             }, Convert.ToInt32(nud_no_of_records.EditValue));
         }
     }
     catch (Exception ex)
     {
         AuditFactory.AuditLog(ex);
         ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
     }
 }
Exemplo n.º 25
0
 private void BindFilters()
 {
     try
     {
         using (DataTable dt = new BL_Privilege().selectFilters())
         {
             cbo_filter.Properties.DataSource    = dt;
             cbo_filter.Properties.ValueMember   = "Privilege";
             cbo_filter.Properties.DisplayMember = "Privilege";
         }
     }
     catch (Exception ex)
     {
         AuditFactory.AuditLog(ex);
         ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
     }
 }
Exemplo n.º 26
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);
     }
 }
Exemplo n.º 27
0
        private void gv_assigned_privileges_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            try
            {
                if (e.Column.FieldName == "Allowed")
                {
                    int privilegeKey      = Convert.ToInt32(gv_assigned_privileges.GetRowCellValue(e.RowHandle, "Key"));
                    int userAccessTypeKey = (lst_uat.SelectedItem as DataRowView).Row["Key"].ToString().ToInt();

                    SaveToDatabase((bool)e.Value, privilegeKey, userAccessTypeKey);
                }
            }
            catch (Exception ex)
            {
                AuditFactory.AuditLog(ex);
                ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
            }
        }
 public ManageUserAccessTypes()
 {
     try
     {
         InitializeComponent();
         if (BindUserAccessTypes() == 0)
         {
             ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Exclamation, "No user access types are available to show. Please add a new user access type!", "Message");
             btn_new_uat.PerformClick();
         }
         btn_new_uat.Enabled    = hasAccessInsert;
         btn_delete_uat.Enabled = hasAccessDelete;
         btn_save_uat.Enabled   = (hasAccessInsert || hasAccessUpdate);
     }
     catch (Exception ex)
     {
         AuditFactory.AuditLog(ex);
         ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
     }
 }
 private void btn_delete_uat_Click(object sender, EventArgs e)
 {
     try
     {
         if (ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Warning, string.Format("Are you sure you want to delete the access type {0} from the database?", lst_uat.Text)) == System.Windows.Forms.DialogResult.OK)
         {
             new BL_UserAccessType().delete(new ML_UserAccessType {
                 Key = SelectedID
             });
             ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Information, string.Format("User access type {0} has been successfully deleted.", lst_uat.Text), "Deletion Successful!");
             BindUserAccessTypes();
             ResetForm(false, true, true, hasAccessInsert, hasAccessDelete, true);
         }
     }
     catch (Exception ex)
     {
         AuditFactory.AuditLog(ex);
         ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
     }
 }
Exemplo n.º 30
0
        private void ManageLogin(bool IsLogOut)
        {
            try
            {
                this.lbl_name.Text = string.Empty;
                LoginForm          = new Login();

                if (IsLogOut)
                {
                    new BL_UsageLog().update(new ML_UsageLog {
                        UserKey = UniversalVariables.UserKey, To = DateTime.Now
                    });

                    UniversalVariables.IsLoggedIn = false;

                    LoginForm.btExit.Click    -= btExit_Click;
                    LoginForm.btn_Login.Click -= btn_Login_Click;
                }

                // this.MenuStrip1.Enabled = false;
                LoginForm.btExit.Click    += btExit_Click;
                LoginForm.btn_Login.Click += btn_Login_Click;
                lbUserName.Visible         = false;
                LoginForm.Owner            = this;
                //LoginForm.Parent = this;
                MenuStrip1.Enabled = false;
                LoginForm.Show(this);
                LoginForm.txt_loginid.Text = string.Empty;
                LoginForm.txt_pwd.Text     = string.Empty;
                LoginForm.txt_loginid.Text = "admin";
                LoginForm.txt_pwd.Text     = "aaa111";

                LoginForm.Focus();
                LoginForm.txt_loginid.Focus();
            }
            catch (Exception ex)
            {
                AuditFactory.AuditLog(ex);
                ApplicationUtilities.ShowMessage(UniversalEnum.MessageTypes.Error, ex.Message);
            }
        }