Example #1
0
        public void RegisterNewUser()
        {
            _userRoleService = new UserRoleService();
            MD5 md5Hash = MD5.Create();
            // var passwordPolicyConfigEntry = passwordPolicyConfigService.GetPasswordPolicyByUserType(UserType);
            //string password = passwordPolicyConfigEntry == null ? CommonMethods.RandomPassword(true, true, true, true, 9) : CommonMethods.RandomPassword(true, passwordPolicyConfigEntry.RequireUpperCase, passwordPolicyConfigEntry.RequiredNumericChar, passwordPolicyConfigEntry.RequireSpecialChar, passwordPolicyConfigEntry.MinLegth); /*CommonMethods.GeneratePassword();*/
            string password  = "******";
            string ImagePath = "";

            if (ImageFileBase != null)
            {
                var    fileNameWithoutExt = Path.GetFileNameWithoutExtension(ImageFileBase.FileName);
                var    fileExtension      = Path.GetExtension(ImageFileBase.FileName);
                var    finalFileName      = Name + "_ProfileImage" + string.Format("{0:yyMMddhhmmss}", DateTime.Now) + fileExtension;
                string savePath           = Path.Combine(HttpContext.Current.Server.MapPath("/Uploads/"), finalFileName);
                ImageFileBase.SaveAs(savePath);
                ImagePath = "/Uploads/" + finalFileName;
            }
            int? loggedInUserId = AuthenticatedUser.GetUserFromIdentity().UserId;
            User newUser        = new User
            {
                Name           = Name,
                UserName       = UserName,
                Email          = Email,
                Password       = GetMd5Hash(md5Hash, password),
                MobileNumber   = MobileNumber,
                PresentAddress = Address,
                Gender         = Gender,
                SupUser        = false,
                ImageFile      = ImagePath,
                //DepartmentId = DepartmentId,
                //DesignationId = DesignationId,
                CardNo       = CardNo,
                Status       = 1,
                CreatedBy    = loggedInUserId,
                UserType     = UserType,
                EmployeeType = EmployeeType,
                RoleId       = RoleId,
                //ExpireDate = EmployeeType != "Permanent" ? ExpireDate : null
            };

            _userService.AddUser(newUser);
            //new MailerModel().SendRegistationMail(Email, "New User Registration for SCHM Application", Name, UserName, password, ConfigurationManager.AppSettings["WebUrl"].ToString());
        }
Example #2
0
        public void EditUser()
        {
            _userRoleService = new UserRoleService();
            string ImagePath      = "";
            int?   loggedInUserId = AuthenticatedUser.GetUserFromIdentity().UserId;
            User   updateUser     = new User
            {
                Id             = Id,
                Name           = Name,
                UserName       = UserName,
                Email          = Email,
                MobileNumber   = MobileNumber,
                PresentAddress = Address,
                Gender         = Gender,
                //DepartmentId = DepartmentId,
                //DesignationId = DesignationId,
                CardNo       = CardNo,
                RoleId       = RoleId,
                UpdatedAt    = DateTime.Now,
                UpdatedBy    = loggedInUserId,
                UserType     = UserType,
                EmployeeType = EmployeeType,
                //ExpireDate = EmployeeType != "Permanent" ? ExpireDate : null
            };

            if (ImageFileBase != null)
            {
                var    fileNameWithoutExt = Path.GetFileNameWithoutExtension(ImageFileBase.FileName);
                var    fileExtension      = Path.GetExtension(ImageFileBase.FileName);
                var    finalFileName      = Name + "_ProfileImage" + string.Format("{0:yyMMddhhmmss}", DateTime.Now) + fileExtension;
                string savePath           = Path.Combine(HttpContext.Current.Server.MapPath("/Uploads/"), finalFileName);
                ImageFileBase.SaveAs(savePath);
                updateUser.ImageFile = "/Uploads/" + finalFileName;
            }

            _userService.EditUser(updateUser);
        }
Example #3
0
 public void Delete(int id)
 {
     _requisitionService.DeleteRequisition(id, AuthenticatedUser.GetUserFromIdentity().UserId.ToString());
 }
Example #4
0
 public void Edit()
 {
     base.UpdatedAt = DateTime.Now;
     base.UpdatedBy = AuthenticatedUser.GetUserFromIdentity().UserId;
     _requisitionService.EditRequisition(this);
 }
Example #5
0
 public void Delete(int id)
 {
     _StoreService.DeleteStore(id, AuthenticatedUser.GetUserFromIdentity().UserId.ToString());
 }
Example #6
0
 public void Edit()
 {
     base.UpdatedAt = DateTime.Now;
     base.UpdatedBy = AuthenticatedUser.GetUserFromIdentity().UserId;
     _StoreService.EditStore(this);
 }
Example #7
0
 public void Add()
 {
     base.Status    = 1;
     base.CreatedBy = AuthenticatedUser.GetUserFromIdentity().UserId;
     _StoreService.AddStore(this);
 }
Example #8
0
 public void Delete(int id)
 {
     _ProductService.DeletePro(id, AuthenticatedUser.GetUserFromIdentity().UserId.ToString());
 }
Example #9
0
 public void Add()
 {
     base.Status    = 1;
     base.CreatedBy = AuthenticatedUser.GetUserFromIdentity().UserId;
     _ProductService.AddPro(this);
 }
Example #10
0
 public UserRoleModel()
 {
     loggedInUserId    = AuthenticatedUser.GetUserFromIdentity().UserId;
     _roleService      = new UserRoleService();
     this.RoleTaskList = new RoleTaskCheckBoxList().TaskList.OrderBy(x => x.PermissionCategory).ThenBy(x => x.PermissionName).ToList();
 }