Example #1
0
 public static void Update_user_active(int int_user, bool is_active)
 {
     try
     {
         if (User_ds.Check_user_has_permission(Program.System_user.UserID, Classes.Class_enum.User_permission.EDIT_USER))
         {
             QueriesAdapter().sp_update_user_active(int_user, is_active, Program.System_user.UserID);
         }
         else
         {
             MessageBox.Show("ACCESS DENIED", "ACCESS DENIED", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch (System.Exception e)
     {
         MessageBox.Show("An error has occured. \n" + MethodBase.GetCurrentMethod().DeclaringType.ToString() +
                         "." + MethodBase.GetCurrentMethod().Name + "\n Error:" + e.Message,
                         "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #2
0
 public static void Insert_user(string str_username, string str_name, string str_password, string str_ic_no, System.DateTime date_join)
 {
     try
     {
         if (User_ds.Check_user_has_permission(Program.System_user.UserID, Classes.Class_enum.User_permission.ADD_USER))
         {
             QueriesAdapter().sp_insert_user(str_username, str_name, str_password, str_ic_no, date_join, Program.System_user.UserID);
         }
         else
         {
             MessageBox.Show("ACCESS DENIED", "ACCESS DENIED", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch (System.Exception e)
     {
         MessageBox.Show("An error has occured. \n" + MethodBase.GetCurrentMethod().DeclaringType.ToString() +
                         "." + MethodBase.GetCurrentMethod().Name + "\n Error:" + e.Message,
                         "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #3
0
 /// <summary>
 ///  delete usergroup
 /// </summary>
 /// <param name="str_usergroup"></param>
 public static void Delete_usergroup(string str_usergroup)
 {
     try
     {
         if (User_ds.Check_user_has_permission(Program.System_user.UserID, Classes.Class_enum.User_permission.EDIT_USERGROUP))
         {
             QueriesTableAdapter().sp_delete_usergroup(Program.System_user.UserID, str_usergroup);
         }
         else
         {
             MessageBox.Show("ACCESS DENIED", "ACCESS DENIED", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch (System.Exception e)
     {
         MessageBox.Show("An error has occured. \n" + MethodBase.GetCurrentMethod().DeclaringType.ToString() +
                         "." + MethodBase.GetCurrentMethod().Name + "\n Error:" + e.Message,
                         "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #4
0
 public static void Update_user(int int_user, string str_username, string str_name, string str_ic_no,
                                System.DateTime date_join, System.DateTime?date_leave, byte[] byte_image, string str_usergroup)
 {
     try
     {
         if (User_ds.Check_user_has_permission(Program.System_user.UserID, Classes.Class_enum.User_permission.EDIT_USER))
         {
             UserTableAdapter().sp_update_user(int_user, str_username, str_name, str_ic_no,
                                               date_join, date_leave, byte_image, str_usergroup, Program.System_user.UserID);
         }
         else
         {
             MessageBox.Show("ACCESS DENIED", "ACCESS DENIED", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch (System.Exception e)
     {
         MessageBox.Show("An error has occured. \n" + MethodBase.GetCurrentMethod().DeclaringType.ToString() +
                         "." + MethodBase.GetCurrentMethod().Name + "\n Error:" + e.Message,
                         "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }