/// <summary> /// 添加用户 /// </summary> /// <param name="entity">用户信息</param> /// <returns></returns> public int InsertUser(Users entity) { //check if (string.IsNullOrWhiteSpace(entity.UserID)) { throw new BusinessException("必须输入用户ID!"); } if (string.IsNullOrWhiteSpace(entity.UserName)) { throw new BusinessException("必须输入用户名!"); } if (string.IsNullOrWhiteSpace(entity.Password)) { throw new BusinessException("必须输入密码!"); } var userList = UsersMgtDA.GetValidUserListByUserID(entity.UserID); if (userList != null && userList.Count > 0) { throw new BusinessException("用户ID已经存在!"); } entity.UserAuthCode = GuidCode.GetGuid("D"); entity.Password = MD5Encrypt.MD5Encrypt32(string.Format("{0}-{1}", entity.Password, entity.UserAuthCode)).ToLower(); return(UsersMgtDA.InsertUser(entity)); }
private void updateName(IDownloadInfo info) { if (IsLocalDownload) { Name = string.Format($"{info.VideoId}_{info.StreamId}"); } else { Name = GuidCode.ToString(); } }
public ActionResult EditAuthority(EditAuthorityViewModel authority, long groupSysNo = 0) { if (IsPost) { SaveAuthorityCmdDto saveInfo = new SaveAuthorityCmdDto() { Authority = authority.MapTo <AuthorityCmdDto>() }; var result = authService.SaveAuthority(saveInfo); var ajaxResult = AjaxResult.CopyFromResult(result); ajaxResult.SuccessClose = true; return(Json(ajaxResult)); } else { if (authority.SysNo < 1) { if (groupSysNo > 0) { authority.Group = authService.GetAuthorityGroup(new AuthorityGroupFilterDto() { SysNos = new List <long>() { groupSysNo } })?.MapTo <EditAuthorityGroupViewModel>(); authority.Code = GuidCode.GetUniqueCode().ToUpper(); } } else { AuthorityFilterDto filter = new AuthorityFilterDto() { SysNos = new List <long>() { authority.SysNo }, LoadGroup = true }; authority = authService.GetAuthority(filter).MapTo <EditAuthorityViewModel>(); } return(View(authority)); } }