public ResponseBo <List <PersonAccountListBo> > GetList(PersonAccountGetListCriteriaBo criteriaBo)
        {
            ResponseBo <List <PersonAccountListBo> > responseBo = new ResponseBo <List <PersonAccountListBo> >();

            try
            {
                using (SqlConnection conn = DbAccess.Connection.GetConn())
                {
                    var p = new DynamicParameters();
                    p.Add("@Message", dbType: DbType.String, direction: ParameterDirection.Output, size: 255);
                    p.Add("@IsSuccess", dbType: DbType.Boolean, direction: ParameterDirection.Output);

                    p.Add("@OwnerPersonId", criteriaBo.OwnerPersonId, DbType.Int64, ParameterDirection.Input);

                    p.Add("@AccountTypeIdList", criteriaBo.AccountTypeIdList.ToStrSeparated(), DbType.String, ParameterDirection.Input, 50);
                    p.Add("@StatId", criteriaBo.StatId, DbType.Int32, ParameterDirection.Input);
                    p.Add("@CurrencyId", criteriaBo.CurrencyId, DbType.Int32, ParameterDirection.Input);

                    p.Add("@OperatorRealId", criteriaBo.Session.RealPerson.Id, DbType.Int64, ParameterDirection.Input);
                    p.Add("@LanguageId", criteriaBo.Session.RealPerson.LanguageId, DbType.Int32, ParameterDirection.Input);

                    responseBo.Bo        = conn.Query <PersonAccountListBo>("spPersonAccountList", p, commandType: CommandType.StoredProcedure).ToList();
                    responseBo.Message   = p.Get <string>("@Message");
                    responseBo.IsSuccess = p.Get <bool>("@IsSuccess");
                }
            }
            catch (Exception ex)
            {
                responseBo = base.SaveExLog(ex, this.GetType(), MethodBase.GetCurrentMethod().Name, criteriaBo).ToResponse <List <PersonAccountListBo> >();
            }

            return(responseBo);
        }
Example #2
0
        public ResponseDto <List <PersonAccountListDto> > GetList(PersonAccountGetListCriteriaDto criteriaDto)
        {
            PersonAccountGetListCriteriaBo criteriaBo = new PersonAccountGetListCriteriaBo()
            {
                OwnerPersonId = criteriaDto.OwnerPersonId,

                AccountTypeIdList = criteriaDto.AccountTypeIdList,
                CurrencyId        = criteriaDto.CurrencyId,
                StatId            = criteriaDto.StatId,

                Session = Session
            };

            ResponseBo <List <PersonAccountListBo> > responseBo = personAccountBusiness.GetList(criteriaBo);

            ResponseDto <List <PersonAccountListDto> > responseDto = responseBo.ToResponseDto <List <PersonAccountListDto>, List <PersonAccountListBo> >();

            if (responseBo.IsSuccess && responseBo.Bo != null)
            {
                responseDto.Dto = new List <PersonAccountListDto>();
                foreach (PersonAccountListBo itemBo in responseBo.Bo)
                {
                    responseDto.Dto.Add(new PersonAccountListDto()
                    {
                        Id            = itemBo.Id,
                        Name          = itemBo.Name,
                        AccountTypeId = itemBo.AccountTypeId,
                        CurrencyId    = itemBo.CurrencyId,
                        StatId        = itemBo.StatId,
                        Balance       = itemBo.Balance,

                        IsFastRetail = itemBo.IsFastRetail
                    });
                }
            }

            return(responseDto);
        }