Ejemplo n.º 1
0
        protected void UpdateSonUser(List <EyouSoft.Model.SystemStructure.AreaBase> areaList)
        {
            if (!IsCompanyCheck)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "<script>alert('对不起,你尚未审核通过!');</script>");
                return;
            }
            sonUserModel.DepartId = Utils.GetFormValue(sus_selDepart.UniqueID);
            if (!string.IsNullOrEmpty(sonUserModel.DepartId))
            {
                var departModel =
                    EyouSoft.BLL.CompanyStructure.CompanyDepartment.CreateInstance().GetModel(sonUserModel.DepartId);
                sonUserModel.DepartName = departModel == null ? string.Empty : departModel.DepartName;
            }

            sonUserModel.RoleID = Utils.GetFormValue(sus_selRole.UniqueID);
            if (sus_txtNewPassword1.Value.Trim() != "")
            {
                EyouSoft.Model.CompanyStructure.PassWord pass = new EyouSoft.Model.CompanyStructure.PassWord();
                pass.NoEncryptPassword    = sus_txtNewPassword1.Value;
                sonUserModel.PassWordInfo = pass;
            }
            sonUserModel.ContactInfo.Fax         = Utils.InputText(sus_txtFax.Value, 50);
            sonUserModel.ContactInfo.Mobile      = Utils.InputText(sus_txtMobile.Value, 20);
            sonUserModel.ContactInfo.MSN         = Utils.InputText(sus_txtMSN.Value, 50);
            sonUserModel.ContactInfo.QQ          = Utils.InputText(sus_txtQQ.Value, 20);
            sonUserModel.ContactInfo.ContactName = Utils.InputText(sus_txtUserName.Value, 20);
            sonUserModel.ContactInfo.Tel         = Utils.InputText(sus_txtTel.Value, 20);
            sonUserModel.Area = areaList;
            if (sonUserBll.UpdateChild(sonUserModel))
            {
                ResponseMegSuccess();
            }
            else
            {
                ResponseMegError();
            }
        }
Ejemplo n.º 2
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);
        }