Exemple #1
0
 public static void SetCurrentUser(ERP_User user)
 {
     AppData.CurrentUser = user;
     var role = Users.GetCurrentUserRole();
     AppData.CurrentRole = role.role;
     AppData.CurrentRoleId = role.id;
 }
Exemple #2
0
        public static int AddUser(string username, string password, string first_name, string last_name, string middle_name, int department)
        {
            try
            {
                ERP_User newUser = new ERP_User();
                newUser.username = username;
                newUser.password = BCrypt.HashPassword(password, BCrypt.GenerateSalt());
                newUser.middle_name = middle_name;
                newUser.first_name = first_name;
                newUser.last_name = last_name;
                newUser.department_id = department;
                newUser.first_login = true;
                newUser.theme = "BaseLight";
                newUser.accent = "Blue";
                newUser.modified_by = AppData.CurrentUser.id;
                newUser.created_at = DateTime.Now;
                newUser.updated_at = DateTime.Now;
                Database.ERP.ERP_Users.InsertOnSubmit(newUser);
                Database.ERP.SubmitChanges();

                SendEmail.sendNewUserMail(first_name + " " + last_name, username, password);

                return newUser.id;
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #3
0
 public static ERP_User Save(ERP_User u)
 {
     try
     {
         u.updated_at = DateTime.Now;
         Database.ERP.SubmitChanges();
         return u;
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #4
0
		private void detach_ERP_Users(ERP_User entity)
		{
			this.SendPropertyChanging();
			entity.ERP_Department = null;
		}
Exemple #5
0
 partial void DeleteERP_User(ERP_User instance);
Exemple #6
0
 partial void UpdateERP_User(ERP_User instance);
Exemple #7
0
 partial void InsertERP_User(ERP_User instance);