Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            EyouSoft.OpenRelation.Model.MUserInfo userInfo = new EyouSoft.OpenRelation.Model.MUserInfo()
            {
                Email             = "*****@*****.**",
                Fax               = "057188888888",
                Gender            = EyouSoft.OpenRelation.Model.Gender.L,
                Mobile            = "15868456678",
                MSN               = "*****@*****.**",
                Password          = "******",
                PlatformUserId    = string.Empty,
                PlatformCompanyId = string.Empty,
                QQ                = "1378024159",
                RealName          = "汪奇志",
                SystemType        = EyouSoft.OpenRelation.Model.SystemType.YYT,
                SystemUserId      = 40894,
                Telephone         = "057156884616",
                UserName          = "******",
                SystemCompanyId   = 1125,
                SystemCompanyType = EyouSoft.OpenRelation.Model.SystemCompanyType.ZX
            };

            EyouSoft.OpenRelation.Model.MRequestInfo requestInfo = new EyouSoft.OpenRelation.Model.MRequestInfo();
            requestInfo.AppKey            = EyouSoft.OpenRelation.Utils.GetAppKey();
            requestInfo.InstructionCode   = EyouSoft.OpenRelation.Utils.ConvertJSON <EyouSoft.OpenRelation.Model.MUserInfo>(userInfo);
            requestInfo.InstructionType   = EyouSoft.OpenRelation.Model.InstructionType.UpdateUser;
            requestInfo.RequestSystemType = EyouSoft.OpenRelation.Model.SystemType.YYT;
            requestInfo.RequestUriString  = EyouSoft.OpenRelation.Utils.GetMiddlewareURI();

            this.request.Value = EyouSoft.OpenRelation.Utils.ConvertJSON <EyouSoft.OpenRelation.Model.MRequestInfo>(requestInfo);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 删除用户信息
        /// </summary>
        /// <param name="requestInfo"></param>
        /// <returns></returns>
        private EyouSoft.OpenRelation.Model.MResponseInfo DeleteUserInfo(EyouSoft.OpenRelation.Model.MRequestInfo requestInfo)
        {
            EyouSoft.OpenRelation.Model.MResponseInfo responseInfo = new EyouSoft.OpenRelation.Model.MResponseInfo()
            {
                IsSuccess = true
            };

            var ibll = EyouSoft.BLL.OpenStructure.BUser.CreateInstance();

            EyouSoft.OpenRelation.Model.MUserInfo          middleInfo = EyouSoft.OpenRelation.Utils.InvertJSON <EyouSoft.OpenRelation.Model.MUserInfo>(requestInfo.InstructionCode);
            IList <EyouSoft.Model.OpenStructure.MUserInfo> items      = new List <EyouSoft.Model.OpenStructure.MUserInfo>();

            switch (requestInfo.RequestSystemType)
            {
            case EyouSoft.OpenRelation.Model.SystemType.Platform:
                items = ibll.GetMUserList(0, (int)requestInfo.RequestSystemType, middleInfo.PlatformUserId);
                break;

            case EyouSoft.OpenRelation.Model.SystemType.TYT:
                items = ibll.GetMUserList(middleInfo.SystemUserId, (int)requestInfo.RequestSystemType, null);
                break;

            case EyouSoft.OpenRelation.Model.SystemType.YYT:
                items = ibll.GetMUserList(middleInfo.SystemUserId, (int)requestInfo.RequestSystemType, null);
                break;
            }

            ibll = null;

            if (items == null || items.Count < 1)
            {
                responseInfo.IsSuccess = true;
                responseInfo.Desc      = "中间处理程序未找到用户对应关系,未处理任何数据!";
                return(responseInfo);
            }

            foreach (var item in items)
            {
                middleInfo.PlatformCompanyId = item.PlatformCompanyId;
                middleInfo.PlatformUserId    = item.PlatformUserId;
                middleInfo.SystemType        = (EyouSoft.OpenRelation.Model.SystemType)item.SystemType;
                middleInfo.SystemUserId      = item.SystemUserId;

                if (requestInfo.RequestSystemType == EyouSoft.OpenRelation.Model.SystemType.Platform)
                {
                    requestInfo.RequestUriString = EyouSoft.OpenRelation.Utils.GetURI(middleInfo.SystemType);
                }
                else
                {
                    requestInfo.RequestUriString = EyouSoft.OpenRelation.Utils.GetURI(EyouSoft.OpenRelation.Model.SystemType.Platform);
                }

                requestInfo.InstructionCode = EyouSoft.OpenRelation.Utils.ConvertJSON <EyouSoft.OpenRelation.Model.MUserInfo>(middleInfo);

                HandOut(requestInfo);
            }

            return(responseInfo);
        }
Ejemplo n.º 3
0
        /// <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);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 更新用户信息
        /// </summary>
        /// <param name="requestInfo"></param>
        /// <returns></returns>
        private EyouSoft.OpenRelation.Model.MResponseInfo UpdateUserInfo(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);
            }
            EyouSoft.IBLL.CompanyStructure.ICompanyUser UserBll   = EyouSoft.BLL.CompanyStructure.CompanyUser.CreateInstance();
            EyouSoft.Model.CompanyStructure.CompanyUser UserModel = UserBll.GetModel(MiddUser.PlatformUserId);
            if (UserModel == null || UserModel.ContactInfo == null)
            {
                responseInfo.IsSuccess = false;
                responseInfo.Desc      = "在平台中未找到对应的用户或者用户对应的联系人信息!";

                return(responseInfo);
            }

            //大平台邮箱不能为空 赋值空格
            if (string.IsNullOrEmpty(MiddUser.Email))
            {
                MiddUser.Email = " ";
            }

            UserModel.UserName = MiddUser.UserName.Trim();
            if (!string.IsNullOrEmpty(MiddUser.Password.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();

            try
            {
                responseInfo.IsSuccess = UserBll.UpdateChild(UserModel);
                responseInfo.Desc      = "修改用户信息操作已完成!";
            }
            catch (Exception e)
            {
                responseInfo.IsSuccess = false;
                responseInfo.Desc      = "修改用户操作执行异常!";
                responseInfo.ErrorCode = e.Message + e.StackTrace;
            }

            return(responseInfo);
        }
Ejemplo n.º 5
0
        /// <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);
        }