/// <summary> /// 添加商家管理员 /// </summary> /// <param name="username"></param> /// <param name="password"></param> /// <param name="salt"></param> /// <returns></returns> public static Manager AddSellerManager(string username, string password, string salt) { var model = ManagerApplication.AddSellerManager(username, password, salt); Manager mManagerInfo = new Manager() { Id = model.Id }; return(mManagerInfo); }
/// <summary> /// 新增门店 /// </summary> public static void AddShopBranch(ShopBranch shopBranch, out long shopBranchId) { if (isRepeatBranchName(shopBranch.ShopId, shopBranch.Id, shopBranch.ShopBranchName)) { throw new MallException("此门店名称已存在,请设置其他名称!"); } var branchManangerInfo = Service.GetShopBranchManagersByName(shopBranch.UserName); if (branchManangerInfo != null) { throw new MallException("此门店管理员账号已存在,请设置其他名称!"); } if (ManagerApplication.CheckUserNameExist(shopBranch.UserName)) { throw new MallException("此门店管理员账号已存在,请设置其他名称!"); } // AutoMapper.Mapper.CreateMap<ShopBranch, Entities.ShopBranchInfo>(); // var shopBranchInfo = AutoMapper.Mapper.Map<ShopBranch, Entities.ShopBranchInfo>(shopBranch); var shopBranchInfo = shopBranch.Map <Entities.ShopBranchInfo>(); shopBranchInfo.AddressPath = RegionApplication.GetRegionPath(shopBranchInfo.AddressId); //默认在结尾增加分隔符 shopBranchInfo.AddressPath = shopBranchInfo.AddressPath + CommonConst.ADDRESS_PATH_SPLIT; Service.AddShopBranch(shopBranchInfo); shopBranchId = shopBranchInfo.Id; var salt = GetSalt(); var shopBranchManagerInfo = new Entities.ShopBranchManagerInfo { CreateDate = DateTime.Now, UserName = shopBranch.UserName, ShopBranchId = shopBranchInfo.Id, PasswordSalt = salt, Password = GetPasswrodEncode(shopBranch.PasswordOne, salt) }; Service.AddShopBranchManagers(shopBranchManagerInfo); shopBranch.Id = shopBranchInfo.Id; }