Beispiel #1
0
        /// <summary>
        /// 培训机构管理员登录
        /// </summary>
        public ServiceInvokeDTO<AgencyAdminDTO> AdminLogin(string userName, string password)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO<AgencyAdminDTO> result = null;
            try
            {
                AgencyAdmin dbAdmin = agencyAdminDAL.GetByAccount(userName);
                if (dbAdmin != null)
                {
                    // 校验机构状态
                    Agency agency = agencyDAL.GetByID(dbAdmin.AgencyID);
                    if (agency != null && agency.State == AgencyState.Normal)
                    {
                        string saltPassword = SecurityUtil.MD5(password + Constant.ADMIN_SALT_KEY);
                        if (saltPassword.Equals(dbAdmin.Password))
                        {
                            // 拼装DTO
                            AgencyConfig config = agencyConfigDAL.GetByAgencyID(dbAdmin.AgencyID);
                            int creatorID = agencyCreatorDAL.GetCreatorIDByAgencyID(dbAdmin.AgencyID);
                            AgencyDTO agencyDto = new AgencyDTO(agency, config, creatorID);

                            AgencyAdminDTO adminDTO = new AgencyAdminDTO(dbAdmin, agencyDto);
                            result = new ServiceInvokeDTO<AgencyAdminDTO>(InvokeCode.SYS_INVOKE_SUCCESS, adminDTO);
                        }
                        else
                        {
                            result = new ServiceInvokeDTO<AgencyAdminDTO>(InvokeCode.ACCOUNT_AGENCY_ADMIN_LOGIN_ERROR);
                        }
                    }
                    else
                    {
                        result = new ServiceInvokeDTO<AgencyAdminDTO>(InvokeCode.ACCOUNT_AGENCY_STATE_ERROR);
                    }
                }
                else
                {
                    result = new ServiceInvokeDTO<AgencyAdminDTO>(InvokeCode.ACCOUNT_AGENCY_ADMIN_LOGIN_ERROR);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Beispiel #2
0
        /// <summary>
        /// 获取培训机构详情
        /// </summary>
        public ServiceInvokeDTO<AgencyDTO> GetAgencyDetail(int agencyID)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO<AgencyDTO> result = null;
            try
            {
                Agency agency = agencyDAL.GetByID(agencyID);
                if (agency != null)
                {
                    // 拼装DTO
                    AgencyConfig config = agencyConfigDAL.GetByAgencyID(agencyID);
                    int creatorID = agencyCreatorDAL.GetCreatorIDByAgencyID(agencyID);
                    AgencyDTO agencyDTO = new AgencyDTO(agency, config, creatorID);

                    result = new ServiceInvokeDTO<AgencyDTO>(InvokeCode.SYS_INVOKE_SUCCESS, agencyDTO);
                }
                else
                {
                    result = new ServiceInvokeDTO<AgencyDTO>(InvokeCode.SYS_OBJECT_NOT_EXIST_ERROR);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Beispiel #3
0
 public AgencyAdminDTO(AgencyAdmin admin, AgencyDTO agency)
     : this(admin)
 {
     this.Agency = agency;
 }