/// <summary> /// 更新门店信息、管理员密码 /// </summary> /// <param name="shopBranch"></param> public static void UpdateShopBranch(ShopBranch shopBranch) { if (isRepeatBranchName(shopBranch.ShopId, shopBranch.Id, shopBranch.ShopBranchName)) { throw new HimallException("门店名称不能重复!"); } Mapper.CreateMap <ShopBranch, ShopBranchInfo>(); ShopBranchInfo info = Mapper.Map <ShopBranch, ShopBranchInfo>(shopBranch); info.AddressPath = RegionApplication.GetRegionPath(info.AddressId); info.AddressPath = info.AddressPath + ","; _shopBranchService.UpdateShopBranch(info); if (!(string.IsNullOrWhiteSpace(shopBranch.PasswordOne) || string.IsNullOrWhiteSpace(shopBranch.PasswordTwo))) { string salt = GetSalt(); string passwrodEncode = GetPasswrodEncode(shopBranch.PasswordOne, salt); _shopBranchService.UpdateShopBranchManagerPwd(shopBranch.Id, shopBranch.UserName, passwrodEncode, salt); } }
/// <summary> /// 更新门店信息、管理员密码 /// </summary> /// <param name="shopBranch"></param> public static void UpdateShopBranch(ShopBranch shopBranch) { if (isRepeatBranchName(shopBranch.ShopId, shopBranch.Id, shopBranch.ShopBranchName)) { throw new HimallException("门店名称不能重复!"); } AutoMapper.Mapper.CreateMap <ShopBranch, ShopBranchInfo>(); var shopBranchInfo = AutoMapper.Mapper.Map <ShopBranch, ShopBranchInfo>(shopBranch); shopBranchInfo.AddressPath = RegionApplication.GetRegionPath(shopBranchInfo.AddressId); //默认在结尾增加分隔符 shopBranchInfo.AddressPath = shopBranchInfo.AddressPath + CommonConst.ADDRESS_PATH_SPLIT; _shopBranchService.UpdateShopBranch(shopBranchInfo); if (!string.IsNullOrWhiteSpace(shopBranch.PasswordOne) && !string.IsNullOrWhiteSpace(shopBranch.PasswordTwo)) { //编辑时可以不输入密码 var salt = GetSalt(); //取salt var encodePwd = GetPasswrodEncode(shopBranch.PasswordOne, salt); _shopBranchService.UpdateShopBranchManagerPwd(shopBranch.Id, shopBranch.UserName, encodePwd, salt); } }