public CommandResultViewModel UpdateTenantInfo(TenantViewModel tenantVM) { CommandResultViewModel vm = new CommandResultViewModel(); try { IEMTenantService tenantServ = new EMTenantService(); var isExists = tenantServ.IsExists(tenantVM.TenantName, tenantVM.TenantCode); if (isExists) { vm.CommandResult = EnumCommandResult.MisMatchCondition; vm.Msg = string.Format("客户名称" + tenantVM.TenantName + "已经存在,请重新输入!"); return vm; } EMTenant newTenant = ConvertHelper.ConvertObj<TenantViewModel, EMTenant>(tenantVM); tenantServ.UpdateTenant(newTenant); IUserService serv = new UserService(); serv.Update(newTenant.RegisterUserCode, tenantVM.PhoneNumber); 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; } }
public TenantViewModel GetTenantInfo(string tenantCode) { TenantViewModel model = new TenantViewModel(); try { IEMTenantService tenantServ = new EMTenantService(); EMTenant entity = tenantServ.Select(tenantCode); if (entity != null) return model = ConvertHelper.ConvertObj<EMTenant, TenantViewModel>(entity); else return null; } catch (Exception ex) { Logger.Error(ex.Message, ex); return null; } }
/// <summary> /// 根据客户名称模糊查询客户返回客户列表 FOR YWT /// </summary> /// <param name="param"></param> /// <returns></returns> /// <summary> public AndroidData<List<TenantViewModel>> GetTenantList(PES.GPS.GPSService.MobileQueryService.ViewModel.Android.Params.PTenantCondition param) { AndroidData<List<TenantViewModel>> data = new AndroidData<List<TenantViewModel>>(); if (!param.CheckTicket()) { data.Message = MessageByInvalidTicket; data.ResultCode = ResultCodeEnum.InvalidTicket; } else { try { AndroidInstallation business = new AndroidInstallation(); IList<PES.Guanaco.Entity.Tenant.ETenant> tenantList = business.GetTenantList(param.TenantName); List<TenantViewModel> vmList = new List<TenantViewModel>(); foreach (PES.Guanaco.Entity.Tenant.ETenant info in tenantList) { TenantViewModel vm = new TenantViewModel(); vm.TenantCode = info.TenantCode; vm.TenantName = info.TenantName; vmList.Add(vm); } data.ResultData = vmList; data.ResultCode = ResultCodeEnum.Success; } catch (Exception ex) { data.ResultCode = ResultCodeEnum.Fail; data.Message = ex.Message; } } return data; }
private EMTenant GetEMTenant(string tenantCode, TenantViewModel vm) { return new EMTenant() { TenantName = vm.TenantName, SuperTenantID = vm.SuperTenantID, TenantCode = tenantCode, CreateTime = DateTime.Now, PhoneNumber = vm.PhoneNumber, TenantType = Entity.Enum.EnumTenantType.EndCustomer, IsFreeze = false, Email = vm.Email, QQ = vm.QQ }; }
private RUserInfo CovnertToUserInfo(PES.Guanaco.Entity.Permission.EUser user) { RUserInfo info = new RUserInfo(); info.UserCode = user.UserCode; info.UserName = user.UserName; info.Tenants = new List<TenantViewModel>(); foreach (var o in user.TenantList) { TenantViewModel tenantViewModel = new TenantViewModel(); tenantViewModel.TenantCode = o.TenantCode; tenantViewModel.TenantName = o.TenantDisplayName; info.Tenants.Add(tenantViewModel); } return info; }