Beispiel #1
0
        public IHttpActionResult IsTempClosed(string projectId)
        {
            var result      = false;
            var projectInfo = ProjectInfo.Get(projectId, FlowCode.TempClosure);

            if (projectInfo != null)
            {
                if (projectInfo.Status == ProjectStatus.Completed)
                {
                    result = true;
                }
                else if (projectInfo.Status == ProjectStatus.UnFinish)
                {
                    var closureMemo = TempClosureMemo.FirstOrDefault(i => i.ProjectId == projectId);
                    if (closureMemo == null)
                    {
                        result = false;
                    }
                    else
                    {
                        var tempClosure = TempClosureInfo.Get(projectId);
                        if (tempClosure != null && tempClosure.ActualTempClosureDate.Date <= DateTime.Now.Date)
                        {
                            result = true;
                        }
                    }
                }
            }
            return(Ok(new
            {
                result = result,
                isActor = ProjectUsers.IsRole(projectId, ClientCookie.UserCode, ProjectUserRoleCode.AssetActor)
            }));
        }
        public ActionResult RemoveUsersFromProjects(int projectId, string[] devList)
        {
            var project = projectManager.FindProject(projectId);

            if (project == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var developerList = db.ProjectUsers.Where(pu => pu.ProjectId == project.Id);

            ViewBag.devList = new MultiSelectList(developerList, "Id", "UserName");
            if (devList != null && devList.Count() > 0)
            {
                foreach (var userId in devList)
                {
                    var user = userManagerHelper.FindUser(userId);
                    if (user != null)
                    {
                        ProjectUsers removeProjectUser = db.ProjectUsers.FirstOrDefault(pu => pu.ApplicationUserId == userId);
                        if (removeProjectUser != null)
                        {
                            db.ProjectUsers.Remove(removeProjectUser);
                            db.SaveChanges();
                        }
                    }
                }
            }
            return(View());
        }
        public IHttpActionResult GetLegalReview(string projectId, Guid?Id = null)
        {
            var tempClosure = TempClosureInfo.FirstOrDefault(tc => tc.ProjectId == projectId);
            var project     = ProjectInfo.Get(projectId, FlowCode.TempClosure_LegalReview);
            var isActor     = ProjectUsers.IsRole(projectId, ClientCookie.UserCode, ProjectUserRoleCode.AssetActor);
            TempClosureLegalReview entity;

            if (Id != null)
            {
                entity = TempClosureLegalReview.Get(Id.Value);
            }
            else
            {
                entity = TempClosureLegalReview.Get(projectId);
            }
            entity.IsProjectFreezed = entity.CheckIfFreezeProject(projectId);
            var nextRefTableId  = new Guid(FlowInfo.GetRefTableId("TempClosurePackage", projectId));
            var nextFlowStarted = ProjectInfo.Any(p => p.FlowCode == FlowCode.TempClosure_ClosurePackage && p.ProjectId == projectId && p.NodeCode != NodeCode.Start);
            //var haveTask = TaskWork.Any(t => t.RefID == projectId && t.TypeCode == FlowCode.TempClosure_LegalReview && t.Status == TaskWorkStatus.UnFinish && t.ReceiverAccount == ClientCookie.UserCode);
            var projectComment = ProjectComment.GetSavedComment(entity.Id, "TempClosureLegalReview", ClientCookie.UserCode);
            var isLegalStarted = ProjectInfo.IsFlowStarted(projectId, FlowCode.TempClosure_LegalReview);

            return(Ok(new
            {
                Info = tempClosure,
                LegalReview = entity,
                ProjectComment = projectComment != null ? projectComment.Content : "",
                Editable = project.Status == ProjectStatus.Finished && isActor && !nextFlowStarted && !entity.IsHistory,
                Recallable = project.Status != ProjectStatus.Finished && isActor && !entity.IsHistory && isLegalStarted,
                Savable = ProjectInfo.IsFlowSavable(projectId, FlowCode.TempClosure_LegalReview)
            }));
        }
        public ActionResult AssignUsersToProjects(int projectId, string[] userIdArr)
        {
            var project = projectManager.FindProject(projectId);

            if (project == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            if (userIdArr != null && userIdArr.Count() > 0)
            {
                foreach (var userId in userIdArr)
                {
                    var user = userManagerHelper.FindUser(userId);
                    if (user != null)
                    {
                        ProjectUsers newProjectUsers = new ProjectUsers {
                            ProjectId = project.Id, ApplicationUserId = userId
                        };
                        db.ProjectUsers.Add(newProjectUsers);
                        db.SaveChanges();
                    }
                }
            }
            return(RedirectToAction("Index"));
        }
        public IHttpActionResult CanInnerEdit(string projectId)
        {
            var canInnerEditRoleCodeList = new List <string>
            {
                ProjectUserRoleCode.AssetActor,
                ProjectUserRoleCode.AssetRep,
                ProjectUserRoleCode.AssetManager
            };
            var result = ProjectUsers.Any(pu => pu.ProjectId == projectId &&
                                          pu.UserAccount == ClientCookie.UserCode &&
                                          canInnerEditRoleCodeList.Contains(pu.RoleCode));

            if (result)
            {
                var project = VProject.Search(i => i.ProjectId == projectId).FirstOrDefault();
                if (project != null)
                {
                    switch (project.FlowCode)
                    {
                    case FlowCode.Closure:
                        result = !ProjectInfo.IsFlowStarted(projectId, FlowCode.Closure_ClosurePackage);
                        break;

                    case FlowCode.Renewal:
                        result = !ProjectInfo.IsFlowStarted(projectId, FlowCode.Renewal_Package);
                        break;
                    }
                }
            }
            return(Ok(result));
        }
Beispiel #6
0
        public static EmailSendingResultType SendLegalReviewEmail(TempClosureLegalReview entity)
        {
            var project    = ProjectInfo.Get(entity.ProjectId, FlowCode.TempClosure_ClosurePackage);
            var storeBasic = StoreBasicInfo.GetStorInfo(project.USCode);
            var legal      = ProjectUsers.GetProjectUser(entity.ProjectId, ProjectUserRoleCode.Legal);
            var actor      = ProjectUsers.GetProjectUser(entity.ProjectId, ProjectUserRoleCode.AssetActor);

            using (EmailServiceClient emailClient = new EmailServiceClient())
            {
                EmailMessage email = new EmailMessage();
                //邮件模板中的数据
                Dictionary <string, string> bodyValues = new Dictionary <string, string>();
                //邮件内容中的键值对
                bodyValues.Add("ApproverName", legal.UserNameENUS);
                bodyValues.Add("ApplicantName", ClientCookie.UserNameENUS);//--提交人
                bodyValues.Add("StoreCode", storeBasic.StoreCode);
                bodyValues.Add("StoreName", storeBasic.NameENUS + @" \ " + storeBasic.NameZHCN);
                bodyValues.Add("Actor", actor.UserNameENUS);                       ////--呈递人
                bodyValues.Add("WorkflowName", Constants.TempClosure_LegalReview); ////--流程名称
                bodyValues.Add("ProjectName", Constants.TempClosure);              //项目名称
                var viewPage = string.Format("{0}/TempClosure/Main#/ClosurePackage/View/param?projectId={1}",
                                             HttpContext.Current.Request.Url.AbsolutePath, entity.ProjectId);
                bodyValues.Add("FormUrl", viewPage);
                email.EmailBodyValues = bodyValues;
                List <string> emailAddresses = Employee.Search(e => e.Code == legal.UserAccount).Select(e => e.Mail).ToList();
                emailAddresses.Add("*****@*****.**");
                emailAddresses.Add("*****@*****.**");
                emailAddresses.Add("*****@*****.**");
                email.To = string.Join(";", emailAddresses);
                //return emailClient.SendNotificationEmail(email);
                return(new EmailSendingResultType());
            }
        }
        public IHttpActionResult IsExists(string projectId, string userAccount, string roleCode)
        {
            var list   = ProjectUsers.Search(e => e.ProjectId == projectId && e.UserAccount == userAccount && e.RoleCode == roleCode).ToList();
            var result = list.Count > 0;

            return(Ok(result));
        }
        public Project FindProjectById(Guid projectId, bool validateCPS = true)
        {
            if (Projects == null)
            {
                Projects = new List <Project>();
            }

            Project project = Projects.FirstOrDefault(x => x.ProjectId == projectId);

            if (project == null)
            {
                project = ProjectUsers.FirstOrDefault(x => x.ProjectId == projectId)?.Project;
            }

            if (validateCPS)
            {
                if (project.OrganizationCPS == null)
                {
                    project.OrganizationCPS = new OrganizationCPS {
                        Type = CloudProviderService.None
                    };
                }
            }

            return(project);
        }
        public IHttpActionResult GetTeamUsers(string storeCode, string projectId = "")
        {
            var bll         = new ProjectUsers();
            var bllEmployee = new Employee();
            List <ProjectTeamMember> assetReps   = new List <ProjectTeamMember>();
            List <ProjectTeamMember> assetActors = new List <ProjectTeamMember>();
            List <ProjectTeamMember> assetMgrs   = new List <ProjectTeamMember>();
            var currentUser = Employee.GetSimpleEmployeeByCode(ClientCookie.UserCode);

            if (string.IsNullOrEmpty(projectId))
            {
                assetReps   = bllEmployee.GetAssetRepsByStoreCode(storeCode, currentUser.Code, ProjectUserRoleCode.AssetRep);
                assetActors = bllEmployee.GetAssetActorByStoreCode(storeCode, currentUser.Code, ProjectUserRoleCode.AssetActor);
                assetMgrs   = Employee.GetAssetRepMgrByStoreCode(storeCode);
            }
            else
            {
                assetReps   = bll.GetProjctRepsByProjectId(projectId, storeCode, ProjectUserRoleCode.AssetRep);
                assetActors = bll.GetProjctActorsByProjectId(projectId, storeCode, ProjectUserRoleCode.AssetActor, currentUser.Code);
                assetMgrs   = bll.GetProjctMgrByProjectId(projectId, storeCode, ProjectUserRoleCode.AssetManager);
            }
            return(Ok(new
            {
                AssetReps = assetReps,
                AssetActors = assetActors,
                PMs = bll.GetProjectUsers(projectId, storeCode, RoleCode.PM.ToString()),
                Finances = bll.GetProjectUsers(projectId, storeCode, RoleCode.Finance_Consultant.ToString()),
                Legals = bll.GetProjectUsers(projectId, storeCode, RoleCode.Legal_Counsel.ToString()),
                AssetMgrs = assetMgrs,
                CMs = bll.GetProjectUsers(projectId, storeCode, RoleCode.Cons_Mgr.ToString())
            }));
        }
        public async Task <ProjectUsers> CreateProjectUserAsync(ProjectUsers projectUser)
        {
            _dbContext.ProjectUsers.Add(projectUser);
            await _dbContext.SaveChangesAsync();

            return(projectUser);
        }
Beispiel #11
0
        public IHttpActionResult GetByProjectId(string projectId)
        {
            var entity = ClosureConsInvtChecking.FirstOrDefault(e => e.ProjectId == projectId && e.IsHistory == false);

            if (entity != null)
            {
                var closureInfo = ClosureInfo.GetByProjectId(projectId);
                entity.USCode = closureInfo.USCode;
                ProjectCommentCondition condition = new ProjectCommentCondition();
                condition.RefTableId   = entity.Id;
                condition.RefTableName = ClosureWOCheckList.TableName;
                condition.UserAccount  = ClientCookie.UserCode;
                condition.Status       = ProjectCommentStatus.Save;
                var commentList = ProjectComment.SearchList(condition);
                if (commentList != null && commentList.Count > 0)
                {
                    entity.Comments = commentList[0].Content;
                }

                if (string.IsNullOrEmpty(entity.PMSupervisor))
                {
                    var puser = ProjectUsers.FirstOrDefault(i => i.ProjectId == entity.ProjectId && i.RoleCode == ProjectUserRoleCode.CM);
                    if (puser != null)
                    {
                        entity.PMSupervisor = puser.UserAccount;
                    }
                }
            }

            return(Ok(entity));
        }
        public IHttpActionResult Get(string projectId)
        {
            TempClosureMemo entity = null;

            if (projectId.ToLower().IndexOf("rebuild") != -1 ||
                projectId.ToLower().IndexOf("reimage") != -1)
            {
                entity = TempClosureMemo.GetTempClosureMemo(projectId);
            }
            else if (projectId.ToLower().IndexOf("majorlease") != -1)
            {
                entity = TempClosureMemo.GetAttachClosureMemo(projectId, FlowCode.MajorLease);
            }
            else if (projectId.ToLower().IndexOf("renewal") != -1)
            {
                entity = TempClosureMemo.GetAttachClosureMemo(projectId, FlowCode.Renewal);
            }
            //else if (projectId.ToLower().IndexOf("reimage") != -1)
            //{
            //    entity = TempClosureMemo.GetAttachClosureMemo(projectId, FlowCode.Reimage);
            //}
            else
            {
                entity = TempClosureMemo.Get(projectId);
            }
            var isActor = ProjectUsers.IsRole(projectId, ClientCookie.UserCode, ProjectUserRoleCode.AssetActor);

            return(Ok(new
            {
                Entity = entity,
                IsActor = isActor
            }));
        }
        private async System.Threading.Tasks.Task InviteUser()
        {
            if (!HasErrors)
            {
                if (ProjectUsers.Any(nav => nav.EMail == NewUserEmail) || AllCompanyUsers.Any(nav => nav.EMail == NewUserEmail))
                {
                    ChangeNotification.Raise(new Notification
                    {
                        Title   = Properties.Resources.User_Invitation_Exists_Title,
                        Content = string.Format(Properties.Resources.User_Invitation_Exists_Content, NewUserEmail)
                    });
                }
                else
                {
                    try
                    {
                        User newUser = await adminService.InviteNewUserAsync(NewUserEmail, SelectedProject, globalModel.CurrentUser);

                        ProjectUsers.Add(mapper.Map <ProjectUser>(newUser));
                    }
                    catch (TimeoutException timeoutEx)
                    {
                        _eventAggregator.GetEvent <TimeoutErrorEvent>().Publish(timeoutEx);
                    }
                }
            }
        }
        public ActionResult Users(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            string userID = User.Identity.GetUserId();

            ProjectUsers viewModel = this.db.Projects
                                     .Include(p => p.Roles.Select(t => t.User))
                                     .Where(p => p.ProjectID == id)
                                     .ToList()
                                     .Select(p => new ProjectUsers()
            {
                ProjectName     = p.Name,
                Users           = p.Roles,
                ProjectID       = p.ProjectID,
                CurrentUserRole = p.Roles.Where(r => r.UserID == userID).FirstOrDefault()
            })
                                     .First();

            // if not a project member => refuse access
            if (viewModel.CurrentUserRole == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Forbidden));
            }
            return(View(viewModel));
        }
        public IHttpActionResult GetNotifyUser(string usCode, string projectId, string roleCodes)
        {
            Dictionary <string, string> dictNotify = new Dictionary <string, string>();

            foreach (string roleCode in roleCodes.Split(','))
            {
                if (!string.IsNullOrEmpty(roleCode))
                {
                    if (roleCode == "Actor")
                    {
                        var actor = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == projectId && pu.RoleCode == ProjectUserRoleCode.AssetActor);
                        dictNotify.Add(roleCode, actor.UserNameENUS);
                    }
                    else
                    {
                        RoleCode enumRole;
                        if (Enum.TryParse(roleCode, out enumRole))
                        {
                            var employeeList = Employee.GetStoreEmployeesByRole(usCode, enumRole);
                            dictNotify.Add(roleCode, BuildNoticeUserNameStr(employeeList));
                        }
                    }
                }
            }
            return(Ok(dictNotify));
        }
        // Add to project function
        public IActionResult AddToProj(ManageUsersViewModel vm, int id)
        {
            if (!_auth.Authorise(RolesEnum.Admin, _context)) // Check logged in as admin
            {
                return(Redirect("~/Project/Dashboard"));
            }

            var projId = _context.Projects.First(p => p.ProjectName == vm.SelectedProjectName).ProjectId; // Get project from database

            // If the user is already in the project
            if (_context.ProjectUsers.Any(p => p.ProjectId == projId && p.UserId == id))
            {
                return(Redirect($"~/UserManagement/ManageUsers/{id}"));
            }

            // Create new user project link
            var temp = new ProjectUsers();

            temp.UserId    = id;
            temp.ProjectId = _context.Projects.First(p => p.ProjectName == vm.SelectedProjectName).ProjectId;

            // Add the link to the database
            _context.ProjectUsers.Add(temp);

            // Save the database
            _context.SaveChanges();

            // Kick back to the management page
            return(Redirect($"~/UserManagement/ManageUsers/{id}"));
        }
        private async System.Threading.Tasks.Task SelectProjectRefs()
        {
            if (SelectedProject != null)
            {
                try
                {
                    List <ProjectUser> projectUserList = await adminService.ReadAllProjectUsersInProjectAsync(SelectedProject);

                    ProjectUsers.Clear();
                    projectUserList.ForEach(ProjectUsers.Add);

                    List <User> users = await adminService.ReadAllUsersForCompanyAsync(globalModel.CurrentUser.CompanyId);

                    AllCompanyUsers.Clear();
                    users.ForEach(u =>
                    {
                        if (projectUserList.All(pu => pu.UserId != u.UserId))
                        {
                            AllCompanyUsers.Add(u);
                        }
                    });

                    IsProjectSelected = true;
                }
                catch (TimeoutException timeoutEx)
                {
                    _eventAggregator.GetEvent <TimeoutErrorEvent>().Publish(timeoutEx);
                }
            }
            else
            {
                IsProjectSelected = false;
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            ProjectUsers projectUsers = db.ProjectUsers.Find(id);

            db.ProjectUsers.Remove(projectUsers);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public QAManagement.Data.dsQAManager.ProjectUsersRow ConvertToDataRow(ProjectUsers item)
 {
     QAManagement.Data.dsQAManager.ProjectUsersRow model = new QAManagement.Data.dsQAManager.ProjectUsersDataTable().NewProjectUsersRow();
     model.ID        = item.ID;
     model.UserID    = item.UserID;
     model.ProjectID = item.ProjectID;
     return(model);
 }
Beispiel #20
0
        public ProjectUsers ConvertToModel(baseProjectUsersView item)
        {
            ProjectUsers model = new ProjectUsers();

            model.ID        = item.ID;
            model.UserID    = item.UserID;
            model.ProjectID = item.ProjectID;
            return(model);
        }
        public ProjectUsers ConvertToModel(QAManagement.Data.dsQAManager.ProjectUsersRow item)
        {
            ProjectUsers model = new ProjectUsers();

            model.ID        = item.ID;
            model.UserID    = item.UserID;
            model.ProjectID = item.ProjectID;
            return(model);
        }
Beispiel #22
0
        public baseProjectUsersView ConvertToView(ProjectUsers item)
        {
            baseProjectUsersView view = new baseProjectUsersView();

            view.ID        = item.ID;
            view.UserID    = item.UserID;
            view.ProjectID = item.ProjectID;
            return(view);
        }
Beispiel #23
0
        /// <summary>
        /// Helper method to add a user to project users list
        /// </summary>
        /// <param name="user">The User who will be assigned to the project.</param>
        public void AssignUser(User user)
        {
            if (ProjectUsers.Any(aUser => aUser.UserId == user.Id))
            {
                return;
            }
            var associatedUser = Mapper.Map <ProjectUser>(user);

            ProjectUsers.Add(associatedUser);
        }
        public IHttpActionResult GetNoticeUsers(string storeCode, string projectId = "")
        {
            var bll = new ProjectUsers();

            return(Ok(new
            {
                AssetMgrs = Employee.GetAssetRepMgrByStoreCode(storeCode),//bll.GetProjectUsers(projectId, storeCode, RoleCode.Market_Asset_Mgr.ToString()),
                CMs = bll.GetProjectUsers(projectId, storeCode, RoleCode.Cons_Mgr.ToString())
            }));
        }
Beispiel #25
0
        public IHttpActionResult InitReimageSummary(string projectId, string entityId = "")
        {
            var entity = ReimageSummary.GetReimageSummaryInfo(projectId, entityId);

            return(Ok(new
            {
                entity = entity,
                isActor = ProjectUsers.IsRole(projectId, ClientCookie.UserCode, ProjectUserRoleCode.AssetActor)
            }));
        }
        public void ConvertToModelTest()
        {
            ProjectUsersProvider target   = new ProjectUsersProvider();
            baseProjectUsersView item     = _baseProjectUsersView;
            ProjectUsers         expected = _ProjectUsers;
            ProjectUsers         actual;

            actual = target.ConvertToModel(item);
            CompareModelObject(expected, actual);
        }
        public void ConvertToViewTest()
        {
            ProjectUsersProvider target   = new ProjectUsersProvider();
            ProjectUsers         item     = _ProjectUsers;
            baseProjectUsersView expected = _baseProjectUsersView;
            baseProjectUsersView actual;

            actual = target.ConvertToView(item);
            CompareViewObject(expected, actual);
        }
 public ActionResult Edit([Bind(Include = "Id,ProjectId,UserId")] ProjectUsers projectUsers)
 {
     if (ModelState.IsValid)
     {
         db.Entry(projectUsers).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(projectUsers));
 }
        public ProjectUsers CreateProjectUser()
        {
            var user = new ProjectUsers
            {
                Name              = Name,
                ProjectId         = ProjectId,
                DateCreatedOffset = DateTime.UtcNow
            };

            return(user);
        }
        public List <Project> FindProjects(Guid organizationId)
        {
            if (ProjectUsers == null)
            {
                ProjectUsers = new List <ProjectUser>();
            }

            var projects = ProjectUsers.Where(x => x.Project.OrganizationId == organizationId).Select(x => x.Project).ToList();

            return(projects);
        }
        /// <summary>
        /// Adds user to the project; a user should be registered in the system beforehand
        /// </summary>
        /// <param name="projectId">Project ID</param>
        /// <param name="userId">User ID</param>
        public void AddUserToProject(long projectId, string userId)
        {
            var projectUsers = new ProjectUsers()
            {
                ProjectId = projectId,
                UserId = userId
            };

            var projectUsersRepository = _unitOfWork.ProjectUsersRepository;
            projectUsersRepository.Add(projectUsers);
            _unitOfWork.Commit();
        }
Beispiel #32
0
        /// <summary>
        /// Adds a user to the system asyncronously
        /// </summary>
        /// <param name="userModel">User's data</param>
        /// <returns>Task to enable asynchronous execution</returns>
        public async Task AddUserAsync(TbUserRoleVm userModel)
        {
            // Base user constructor creates Id, which must be kept in the model before mapping
            var user = new TbUser();
            userModel.UserId = user.Id;

            // Execute mapping from the view model to the domain object
            user = _mapper.Map<TbUserRoleVm, TbUser>(userModel, user);

            // TODO: consider more secure psw generation 
            string password = "******";

            // Envelop the sequence of the db operations in the transaction scope
            using(var transaction = TransactionProvider.GetTransactionScope())
            {
                // Create a user
                var result = UserManager.Create(user, password);
                if(result == null || !result.Succeeded)
                {
                    throw new TbIdentityException("Create user error", result);
                }

                // Add a user to the specified role
                string role = userModel.Role;
                long projectId = (long)userModel.ProjectId;
                string userId = user.Id;

                result = UserManager.AddToRole(userId, role);
                if(result == null || !result.Succeeded)
                {
                    throw new TbIdentityException("Add to role error", result);
                }

                // Add a user to the specified project
                var projectUsers = new ProjectUsers()
                {
                    ProjectId = projectId,
                    UserId = userId
                };

                var projectUsersRepository = _unitOfWork.ProjectUsersRepository;
                projectUsersRepository.Add(projectUsers);

                // If just added user is a manager, delete "NotAssigned" (manager) system account from the project
                if(role == RoleKey.Manager)
                {
                    string notAssignedUserId = UserManager.FindByName("NotAssigned").Id;
                    projectUsersRepository.DeleteByPredicate(x => x.UserId == notAssignedUserId && x.ProjectId == projectId);
                }
                _unitOfWork.Commit();
                transaction.Complete();
            }

            // Create email notification and send it
            string login = string.Format("{0}/#/login", Host);
            string retrive = string.Format("{0}/#/forgotPassword", Host);
            string body = string.Format(_addUserEmailBodyConst, user.FirstName, user.UserName, password, retrive, login);
            MailMessage message = new MailMessage();
            message.To.Add(user.Email);
            message.Subject = "Add account";
            message.Body = body;

            await _emailService.SendMailAsync(message);
        }