public DBProcessResult UserAndTenantModify(UserInfoModifyViewModel userViewModel) { DBProcessResult result = new DBProcessResult(); try { IUserService userService = new UserService(); IEMTenantService tenantService = new EMTenantService(); if (!string.IsNullOrEmpty(userViewModel.Pwd)) { EMUser user = userService.GetUser(userViewModel.UserCode); user.PassWord = userViewModel.Pwd; userService.Update(user); } EMTenant tenant = tenantService.Select(userViewModel.TenantCode); tenant.Email = userViewModel.Email; tenant.QQ = userViewModel.QQ; tenantService.Update(tenant); result.Message = "修改成功!"; result.IsSuccess = true; } catch (Exception ex) { result.IsSuccess = false; result.Message = ex.Message; } return result; }
public CommandResultViewModel UpdateUserCenterMyData(UpdateTenantViewModel model) { CommandResultViewModel vm = new CommandResultViewModel(); try { EMTenantService tenantService = new EMTenantService(); var isExists = tenantService.IsExists(model.TenantName, model.TenantCode); if (isExists) { vm.CommandResult = EnumCommandResult.MisMatchCondition; vm.Msg = string.Format("客户名称" + model.TenantName + "已经存在,请重新输入!"); return vm; } else { EMTenant tenant = tenantService.Select(model.TenantCode); tenant.Email = model.Email; tenant.TenantName = model.TenantName; tenant.PhoneNumber = model.PhoneNumber; tenant.QQ = model.QQ; tenantService.Update(tenant); vm.CommandResult = EnumCommandResult.Success; vm.Msg = "修改成功!"; return vm; } } catch (Exception ex) { Logger.Error(ex.Message, ex); vm.CommandResult = EnumCommandResult.Failed; vm.Msg = ex.Message; return vm; } }
private void UpdateEMTenantLogoUrl(string tenantCode,string logoUrl) { IEMTenantService service = new EMTenantService(); if (!string.IsNullOrEmpty(tenantCode)) { EMTenant emTenant = service.Select(tenantCode); emTenant.LogoUrl = UploadImageHelper.GetImgName(logoUrl); service.Update(emTenant); } }
public CommandResultViewModel UpdateOperateMyData(UpdateTenantViewModel model) { CommandResultViewModel vm = new CommandResultViewModel(); try { EMTenantService tenantService = new EMTenantService(); var isExists = tenantService.IsExists(model.TenantName, model.TenantCode); if (isExists) { vm.CommandResult = EnumCommandResult.MisMatchCondition; vm.Msg = string.Format("客户名称" + model.TenantName + "已经存在,请重新输入!"); return vm; } else { EMTenant tenant = tenantService.Select(model.TenantCode); tenant.Email = model.Email; tenant.TenantName = model.TenantName; tenant.PhoneNumber = model.PhoneNumber; tenant.ContactName = model.ContactName; tenant.QQ = model.QQ; tenant.LogoUrl = UploadImageHelper.GetImgName(model.TenantLogoImgURl); tenant.ExpireTime = model.ExpireTime; tenantService.Update(tenant); vm.CommandResult = EnumCommandResult.Success; vm.Msg = "修改成功!"; } } catch (Exception ex) { Logger.Error("OperateManagerWCFService.UpdateOperateMyData(UpdateTenantViewModel model)失败,错误:" + ex.Message, ex); vm.CommandResult = EnumCommandResult.Failed; vm.Msg = ex.Message; } return vm; }
public bool UploadImage(UploadImageViewModel uploadImageModel) { try { bool bl = UploadImageHelper.GetUpoladImg(uploadImageModel.mapPath, uploadImageModel.imgName, uploadImageModel.buffer); if (bl) { IEMTenantService service = new EMTenantService(); if (!string.IsNullOrEmpty(uploadImageModel.tenantCode)) { EMTenant emTenant = service.Select(uploadImageModel.tenantCode); string oldLogoUrlName = emTenant.LogoUrl; emTenant.LogoUrl = uploadImageModel.imgName; service.Update(emTenant); //判断是否默认图片 if (!string.IsNullOrEmpty(oldLogoUrlName)) { string oldMapPath = uploadImageModel.mapPath + "\\" + oldLogoUrlName; UploadImageHelper.DeleteImage(oldMapPath); } } return true; } else return false; } catch (Exception ex) { Logger.Info("UploadImage(上传图片):"+ex.Message); return false; } }