/// <summary> /// 新增公司信息 /// </summary> /// <param name="requestInfo"></param> /// <returns></returns> private EyouSoft.OpenRelation.Model.MResponseInfo CreateCompanyInfo(EyouSoft.OpenRelation.Model.MRequestInfo requestInfo) { EyouSoft.OpenRelation.Model.MResponseInfo responseInfo = new EyouSoft.OpenRelation.Model.MResponseInfo() { IsSuccess = true }; if (requestInfo.RequestSystemType == EyouSoft.OpenRelation.Model.SystemType.Platform) { return(responseInfo); } EyouSoft.OpenRelation.Model.MCUInfo middleInfo = EyouSoft.OpenRelation.Utils.InvertJSON <EyouSoft.OpenRelation.Model.MCUInfo>(requestInfo.InstructionCode); var items = EyouSoft.BLL.OpenStructure.BCompany.CreateInstance().GetCompanyList(middleInfo.CompanyInfo.SystemCompanyId, (int)middleInfo.CompanyInfo.SystemType, null, (int)middleInfo.CompanyInfo.SystemCompanyType); if (items != null && items.Count > 0)//已存在公司对应关系,进行新增用户操作 { requestInfo.InstructionType = EyouSoft.OpenRelation.Model.InstructionType.CreateUser; requestInfo.InstructionCode = EyouSoft.OpenRelation.Utils.ConvertJSON <EyouSoft.OpenRelation.Model.MUserInfo>(middleInfo.UserInfo); return(CreateUserInfo(requestInfo)); } requestInfo.RequestUriString = EyouSoft.OpenRelation.Utils.GetURI(EyouSoft.OpenRelation.Model.SystemType.Platform); responseInfo = HandOut(requestInfo); if (responseInfo.IsSuccess)//创建成功,写对应关系 { EyouSoft.OpenRelation.Model.MRCreateUserInfo rInfo = EyouSoft.OpenRelation.Utils.InvertJSON <EyouSoft.OpenRelation.Model.MRCreateUserInfo>(responseInfo.InstructionCode); EyouSoft.BLL.OpenStructure.BCompany.CreateInstance().AddMCompany(new EyouSoft.Model.OpenStructure.MCompanyInfo() { PlatformCompanyId = rInfo.PlatformCompanyId, SystemCompanyId = middleInfo.CompanyInfo.SystemCompanyId, SystemCompanyType = (int)middleInfo.CompanyInfo.SystemCompanyType, SystemType = (int)middleInfo.CompanyInfo.SystemType }); EyouSoft.BLL.OpenStructure.BUser.CreateInstance().AddMUser(new EyouSoft.Model.OpenStructure.MUserInfo() { PlatformCompanyId = rInfo.PlatformCompanyId, PlatformUserId = rInfo.PlatformUserId, SystemType = (int)middleInfo.UserInfo.SystemType, SystemUserId = middleInfo.UserInfo.SystemUserId }); } return(responseInfo); }
/// <summary> /// 新增用户信息 /// </summary> /// <param name="requestInfo"></param> /// <returns></returns> private EyouSoft.OpenRelation.Model.MResponseInfo CreateUserInfo(EyouSoft.OpenRelation.Model.MRequestInfo requestInfo) { EyouSoft.OpenRelation.Model.MResponseInfo responseInfo = new EyouSoft.OpenRelation.Model.MResponseInfo() { IsSuccess = true }; if (requestInfo.RequestSystemType == EyouSoft.OpenRelation.Model.SystemType.Platform) { return(responseInfo); } EyouSoft.OpenRelation.Model.MUserInfo middleInfo = EyouSoft.OpenRelation.Utils.InvertJSON <EyouSoft.OpenRelation.Model.MUserInfo>(requestInfo.InstructionCode); var items = EyouSoft.BLL.OpenStructure.BCompany.CreateInstance().GetCompanyList(middleInfo.SystemCompanyId, (int)middleInfo.SystemType, null, (int)middleInfo.SystemCompanyType); if (items == null || items.Count < 1) { responseInfo.IsSuccess = true; responseInfo.Desc = "中间处理程序未找到用户与公司对应关系,未处理任何数据!"; return(responseInfo); } middleInfo.SystemCompanyId = items[0].SystemCompanyId; middleInfo.SystemCompanyType = (EyouSoft.OpenRelation.Model.SystemCompanyType)items[0].SystemCompanyType; middleInfo.SystemType = (EyouSoft.OpenRelation.Model.SystemType)items[0].SystemType; middleInfo.PlatformCompanyId = items[0].PlatformCompanyId; requestInfo.RequestUriString = EyouSoft.OpenRelation.Utils.GetURI(EyouSoft.OpenRelation.Model.SystemType.Platform); requestInfo.InstructionCode = EyouSoft.OpenRelation.Utils.ConvertJSON <EyouSoft.OpenRelation.Model.MUserInfo>(middleInfo); responseInfo = HandOut(requestInfo); if (responseInfo.IsSuccess)//创建成功,写对应关系 { EyouSoft.OpenRelation.Model.MRCreateUserInfo rInfo = EyouSoft.OpenRelation.Utils.InvertJSON <EyouSoft.OpenRelation.Model.MRCreateUserInfo>(responseInfo.InstructionCode); EyouSoft.BLL.OpenStructure.BUser.CreateInstance().AddMUser(new EyouSoft.Model.OpenStructure.MUserInfo() { PlatformCompanyId = rInfo.PlatformCompanyId, PlatformUserId = rInfo.PlatformUserId, SystemType = (int)middleInfo.SystemType, SystemUserId = middleInfo.SystemUserId }); } return(responseInfo); }
/// <summary> /// 新增用户信息 /// </summary> /// <param name="requestInfo"></param> /// <returns></returns> private EyouSoft.OpenRelation.Model.MResponseInfo CreateUserInfo(EyouSoft.OpenRelation.Model.MRequestInfo requestInfo) { EyouSoft.OpenRelation.Model.MResponseInfo responseInfo = new EyouSoft.OpenRelation.Model.MResponseInfo() { IsSuccess = true }; if (requestInfo == null) { responseInfo.IsSuccess = false; responseInfo.Desc = "http request post info对象为空!"; return(responseInfo); } EyouSoft.OpenRelation.Model.MUserInfo MiddUser = EyouSoft.OpenRelation.Utils.InvertJSON <EyouSoft.OpenRelation.Model.MUserInfo>(requestInfo.InstructionCode); if (MiddUser == null) { responseInfo.IsSuccess = false; responseInfo.Desc = "Josn对象转为中间平台对象时发生错误!"; return(responseInfo); } //大平台邮箱不能为空 赋值空格 if (string.IsNullOrEmpty(MiddUser.Email)) { MiddUser.Email = " "; } int provinceId, cityId; this.GetProvinceAndCityId(MiddUser.ProvinceName, MiddUser.CityName, out provinceId, out cityId); EyouSoft.Model.CompanyStructure.CompanyUser UserModel = new EyouSoft.Model.CompanyStructure.CompanyUser(); EyouSoft.IBLL.CompanyStructure.ICompanyUser UserBll = EyouSoft.BLL.CompanyStructure.CompanyUser.CreateInstance(); UserModel.PassWordInfo = new EyouSoft.Model.CompanyStructure.PassWord(); UserModel.ContactInfo = new EyouSoft.Model.CompanyStructure.ContactPersonInfo(); UserModel.UserName = MiddUser.UserName.Trim(); UserModel.PassWordInfo.NoEncryptPassword = MiddUser.Password.Trim(); UserModel.ContactInfo.ContactName = MiddUser.RealName.Trim(); UserModel.ContactInfo.ContactSex = GetGender(MiddUser.Gender); UserModel.ContactInfo.Mobile = MiddUser.Mobile.Trim(); UserModel.ContactInfo.Tel = MiddUser.Telephone.Trim(); UserModel.ContactInfo.Fax = MiddUser.Fax.Trim(); UserModel.ContactInfo.Email = MiddUser.Email.Trim(); UserModel.ContactInfo.MSN = MiddUser.MSN.Trim(); UserModel.ContactInfo.QQ = MiddUser.QQ.Trim(); UserModel.OpUserId = MiddUser.SystemUserId; UserModel.IsAdmin = false; UserModel.IsEnable = true; UserModel.CompanyID = MiddUser.PlatformCompanyId; UserModel.DepartId = string.Empty; UserModel.DepartName = string.Empty; UserModel.RoleID = string.Empty; UserModel.ProvinceId = provinceId; UserModel.CityId = cityId; try { responseInfo.IsSuccess = UserBll.Add(UserModel) == EyouSoft.Model.ResultStructure.ResultInfo.Succeed ? true : false; responseInfo.Desc = "新增用户操作执行完成!"; if (responseInfo.IsSuccess) { EyouSoft.OpenRelation.Model.MRCreateUserInfo rInfo = new EyouSoft.OpenRelation.Model.MRCreateUserInfo() { PlatformCompanyId = UserModel.CompanyID, PlatformUserId = UserModel.ID }; responseInfo.InstructionCode = EyouSoft.OpenRelation.Utils.ConvertJSON <EyouSoft.OpenRelation.Model.MRCreateUserInfo>(rInfo); responseInfo.Desc = "新增用户操作执行完成!"; } else { responseInfo.Desc = "创建用户失败,业务逻辑层返回失败信息!"; } } catch (Exception e) { responseInfo.IsSuccess = false; responseInfo.Desc = "新增用户操作执行异常!"; responseInfo.ErrorCode = e.Message + e.StackTrace; } return(responseInfo); }
/// <summary> /// 新增公司信息 /// </summary> /// <param name="requestInfo"></param> /// <returns></returns> private EyouSoft.OpenRelation.Model.MResponseInfo CreateCompanyInfo(EyouSoft.OpenRelation.Model.MRequestInfo requestInfo) { EyouSoft.OpenRelation.Model.MResponseInfo responseInfo = new EyouSoft.OpenRelation.Model.MResponseInfo() { IsSuccess = true }; EyouSoft.OpenRelation.Model.MCUInfo middleInfo = EyouSoft.OpenRelation.Utils.InvertJSON <EyouSoft.OpenRelation.Model.MCUInfo>(requestInfo.InstructionCode); EyouSoft.Model.CompanyStructure.CompanyArchiveInfo companyInfo = new EyouSoft.Model.CompanyStructure.CompanyArchiveInfo(); EyouSoft.Model.CompanyStructure.UserAccount userInfo = new EyouSoft.Model.CompanyStructure.UserAccount(); EyouSoft.Model.CompanyStructure.ContactPersonInfo contactInfo = new EyouSoft.Model.CompanyStructure.ContactPersonInfo(); EyouSoft.Model.CompanyStructure.CompanyRole roleInfo = new EyouSoft.Model.CompanyStructure.CompanyRole(); //大平台邮箱不能为空 赋值空格 if (string.IsNullOrEmpty(middleInfo.UserInfo.Email)) { middleInfo.UserInfo.Email = " "; } if (string.IsNullOrEmpty(middleInfo.CompanyInfo.ContactEmail)) { middleInfo.CompanyInfo.ContactEmail = " "; } int provinceId, cityId; this.GetProvinceAndCityId(middleInfo.CompanyInfo.ProvinceName, middleInfo.CompanyInfo.CityName, out provinceId, out cityId); companyInfo.CompanyName = middleInfo.CompanyInfo.CompanyName; companyInfo.CompanyAddress = middleInfo.CompanyInfo.Address; companyInfo.ProvinceId = provinceId; companyInfo.CityId = cityId; userInfo.UserName = middleInfo.UserInfo.UserName; userInfo.PassWordInfo = new EyouSoft.Model.CompanyStructure.PassWord(middleInfo.UserInfo.Password); contactInfo.ContactName = middleInfo.CompanyInfo.ContactName; contactInfo.Email = middleInfo.CompanyInfo.ContactEmail; contactInfo.Fax = middleInfo.CompanyInfo.ContactFax; contactInfo.Mobile = middleInfo.CompanyInfo.ContactMobile; contactInfo.MSN = middleInfo.CompanyInfo.ContactMSN; contactInfo.QQ = middleInfo.CompanyInfo.ContactQQ; contactInfo.Tel = middleInfo.CompanyInfo.ContactTelephone; contactInfo.ContactSex = GetGender(middleInfo.CompanyInfo.ContactGender); if (middleInfo.CompanyInfo.PlatformCompanyType == EyouSoft.OpenRelation.Model.PlatformCompanyType.ZT) { roleInfo.SetRole(EyouSoft.Model.CompanyStructure.CompanyType.组团); } else if (middleInfo.CompanyInfo.PlatformCompanyType == EyouSoft.OpenRelation.Model.PlatformCompanyType.ZX) { roleInfo.SetRole(EyouSoft.Model.CompanyStructure.CompanyType.专线); } companyInfo.AdminAccount = userInfo; companyInfo.CompanyRole = roleInfo; companyInfo.ContactInfo = contactInfo; try { EyouSoft.Model.ResultStructure.UserResultInfo resultInfo = EyouSoft.BLL.CompanyStructure.CompanyInfo.CreateInstance().Add(companyInfo, string.Empty); if (resultInfo == EyouSoft.Model.ResultStructure.UserResultInfo.Succeed) { responseInfo.IsSuccess = true; responseInfo.Desc = "创建公司成功!"; EyouSoft.OpenRelation.Model.MRCreateUserInfo rInfo = new EyouSoft.OpenRelation.Model.MRCreateUserInfo() { PlatformCompanyId = companyInfo.ID, PlatformUserId = companyInfo.AdminAccount.ID }; responseInfo.InstructionCode = EyouSoft.OpenRelation.Utils.ConvertJSON <EyouSoft.OpenRelation.Model.MRCreateUserInfo>(rInfo); EyouSoft.BLL.CompanyStructure.CompanyInfo.CreateInstance().PassRegister(companyInfo.ID); } else { responseInfo.IsSuccess = false; responseInfo.Desc = "创建公司失败,业务逻辑层返回失败信息!"; } } catch (Exception e) { responseInfo.IsSuccess = false; responseInfo.Desc = "创建公司失败,捕获到异常!"; responseInfo.ErrorCode = e.Message + e.StackTrace; } return(responseInfo); }