示例#1
0
        public string ModifyUserOrganization(string pRequest)
        {
            var rd     = new APIResponse <ModifyUserOrganizationRD>();
            var rdData = new ModifyUserOrganizationRD();

            var rp = pRequest.DeserializeJSONTo <APIRequest <ModifyUserOrganizationRP> >();

            if (rp.Parameters == null)
            {
                throw new ArgumentException();
            }

            if (rp.Parameters != null)
            {
                rp.Parameters.Validate();
            }

            var loggingSessionInfo = new LoggingSessionManager().CurrentSession;

            try
            {
                UserDeptJobMappingBLL    mappingBll = new UserDeptJobMappingBLL(loggingSessionInfo);
                UserDeptJobMappingEntity entity     = mappingBll.GetByUserID(rp.Parameters.UserID);
                if (entity != null)
                {
                    entity.UnitID        = rp.Parameters.UnitID;
                    entity.JobFunctionID = rp.Parameters.JobFunctionID;
                    if (!string.IsNullOrEmpty(rp.Parameters.UserLevel))
                    {
                        entity.UserLevel = rp.Parameters.UserLevel;
                    }
                    entity.LineManagerID = rp.Parameters.LineManagerID;
                    mappingBll.Update(entity);
                    rdData.IsSuccess = true;
                    rd.ResultCode    = 0;
                }
                else
                {
                    rdData.IsSuccess = false;
                    rd.ResultCode    = 101;
                    rd.Message       = "对象不存在";
                }
            }
            catch (Exception ex)
            {
                rd.ResultCode = 103;
                rd.Message    = ex.Message;
            }
            rd.Data = rdData;
            return(rd.ToJSON());
        }
        public string ModifyUserPersonalInfo(string pRequest)
        {
            var rd     = new APIResponse <ModifyUserPersonalInfoRD>();
            var rdData = new ModifyUserPersonalInfoRD();
            var rp     = pRequest.DeserializeJSONTo <APIRequest <ModifyUserPersonalInfoRP> >();

            if (rp.Parameters == null)
            {
                throw new ArgumentException();
            }

            if (rp.Parameters != null)
            {
                rp.Parameters.Validate();
            }

            var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID);

            try
            {
                T_UserBLL    bll    = new T_UserBLL(loggingSessionInfo);
                T_UserEntity entity = bll.GetUserEntityByID(rp.Parameters.UserID);
                if (entity != null)
                {
                    entity.user_code      = rp.Parameters.UserCode;
                    entity.user_name      = rp.Parameters.UserName;
                    entity.user_gender    = rp.Parameters.UserGender;
                    entity.user_email     = rp.Parameters.UserEmail;
                    entity.user_telephone = rp.Parameters.UserTelephone;
                    entity.user_status    = rp.Parameters.UserStatus;

                    if (!string.IsNullOrEmpty(rp.Parameters.UserNameEn))
                    {
                        entity.user_name_en = rp.Parameters.UserNameEn;
                    }
                    if (!string.IsNullOrEmpty(rp.Parameters.UserBirthday))
                    {
                        entity.user_birthday = rp.Parameters.UserBirthday;
                    }
                    if (!string.IsNullOrEmpty(rp.Parameters.UserPassword))
                    {
                        entity.user_password = rp.Parameters.UserPassword;
                    }
                    if (!string.IsNullOrEmpty(rp.Parameters.UserCellphone))
                    {
                        entity.user_cellphone = rp.Parameters.UserCellphone;
                    }
                    if (!string.IsNullOrEmpty(rp.Parameters.FailDate))
                    {
                        entity.fail_date = rp.Parameters.FailDate;
                    }

                    bll.Update(entity);

                    //更新LineManagerID
                    UserDeptJobMappingBLL    mappingBll    = new UserDeptJobMappingBLL(loggingSessionInfo);
                    UserDeptJobMappingEntity mappingEntity = mappingBll.GetByUserID(entity.user_id);
                    if (mappingEntity != null)
                    {
                        mappingEntity.LineManagerID = rp.Parameters.LineManagerID;
                        mappingBll.Update(mappingEntity);
                    }
                    rdData.IsSuccess = true;
                    rd.ResultCode    = 0;
                }
                else
                {
                    rdData.IsSuccess = false;
                    rd.ResultCode    = 101;
                    rd.Message       = "用户不存在";
                }
            }
            catch (Exception ex)
            {
                rd.ResultCode = 103;
                rd.Message    = ex.Message;
            }
            rd.Data = rdData;
            return(rd.ToJSON());
        }