Ejemplo n.º 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());
        }
Ejemplo n.º 3
0
        public string GetPersonDetailInfo(string pRequest)
        {
            var rd     = new APIResponse <GetPersonDetailInfoRD>();
            var rdData = new GetPersonDetailInfoRD();

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

            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);
                PersonDetailInfo detail = null;
                if (entity != null)
                {
                    //用户信息
                    detail = new PersonDetailInfo
                    {
                        UserID        = entity.user_id,
                        UserCode      = entity.user_code,
                        UserName      = entity.user_name,
                        UserGender    = entity.user_gender,
                        UserBirthday  = entity.user_birthday,
                        UserEmail     = entity.user_email,
                        UserCellphone = entity.user_telephone,
                        UserTelephone = entity.user_telephone
                    };
                    //获取UnitID,UnitName
                    UserDeptJobMappingBLL    mappingBll    = new UserDeptJobMappingBLL(loggingSessionInfo);
                    UserDeptJobMappingEntity mappingEntity = mappingBll.GetByUserID(entity.user_id);
                    if (mappingEntity != null)
                    {
                        detail.UnitID = mappingEntity.UnitID;
                        TUnitBLL    unitBll    = new TUnitBLL(loggingSessionInfo);
                        TUnitEntity unitEntity = unitBll.GetByID(mappingEntity.UnitID);
                        if (unitEntity != null)
                        {
                            detail.UnitName = unitEntity.UnitName;
                        }
                    }
                    //获取是否有建群权限
                    detail.IsIMGroupCreator = bll.IsHasPower(entity.user_id, UserRightCode.USER_CREATE_GROUP_RIGHT_CODE);
                }
                rdData.DetailInfo = detail;
                rd.ResultCode     = 0;
            }
            catch (Exception ex)
            {
                rd.ResultCode = 103;
                rd.Message    = ex.Message;
            }
            rd.Data = rdData;
            return(rd.ToJSON());
        }