示例#1
0
        public ResponseBo <List <FicheListBo> > GetList(FicheGetListCriteriaBo criteriaBo)
        {
            ResponseBo <List <FicheListBo> > responseBo = new ResponseBo <List <FicheListBo> >();

            try
            {
                using (SqlConnection conn = DbAccess.Connection.GetConn())
                {
                    var p = new DynamicParameters();
                    base.AddStandartSpParams(ref p, criteriaBo);

                    p.Add("@ApprovalStatIdList", criteriaBo.ApprovalStatIdList.ToStrSeparated(), DbType.String, ParameterDirection.Input, 255);
                    p.Add("@FicheContentIdList", criteriaBo.FicheContentIdList.ToStrSeparated(), DbType.String, ParameterDirection.Input, 4000);

                    p.Add("@IssueDateStart", criteriaBo.IssueDateStart?.Date, DbType.Date, ParameterDirection.Input);
                    p.Add("@IssueDateEnd", criteriaBo.IssueDateEnd?.Date, DbType.Date, ParameterDirection.Input);

                    p.Add("@PrintedCode", criteriaBo.PrintedCode, DbType.String, ParameterDirection.Input, 50);

                    p.Add("@GrandTotalMin", criteriaBo.GrandTotalMin, DbType.Decimal, ParameterDirection.Input);
                    p.Add("@GrandTotalMax", criteriaBo.GrandTotalMax, DbType.Decimal, ParameterDirection.Input);

                    p.Add("@CurrencyId", criteriaBo.CurrencyId, DbType.Int32, ParameterDirection.Input);

                    p.Add("@PaymentStatId", criteriaBo.PaymentStatId, DbType.Int32, ParameterDirection.Input);

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

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

                    p.Add("@PageOffSet", criteriaBo.PageOffSet, DbType.Int32, ParameterDirection.Input);

                    p.Add("@OtherPersonsIdList", criteriaBo.OtherPersonsIdList.ToStrSeparated(), DbType.String, ParameterDirection.Input, 4000);

                    p.Add("@FicheTypeFakeIdList", criteriaBo.FicheTypeFakeIdList.ToStrSeparated(), DbType.String, ParameterDirection.Input, 255);

                    p.Add("@ExcludingFicheIdList", criteriaBo.ExcludingFicheIdList.ToStrSeparated(), DbType.String, ParameterDirection.Input, 4000);

                    responseBo.Bo        = conn.Query <FicheListBo>("spFicheList", 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 <FicheListBo> >();
            }

            return(responseBo);
        }
示例#2
0
        public ResponseDto <List <FicheListDto> > GetList(FicheGetListCriteriaDto criteriaDto)
        {
            FicheGetListCriteriaBo criteriaBo = new FicheGetListCriteriaBo()
            {
                OtherPersonsIdList  = criteriaDto.OtherPersonsIdList,
                FicheTypeFakeIdList = criteriaDto.FicheTypeFakeIdList,

                ApprovalStatIdList = criteriaDto.ApprovalStatIdList,
                FicheContentIdList = criteriaDto.FicheContentIdList,

                GrandTotalMin = criteriaDto.GrandTotalMin,
                GrandTotalMax = criteriaDto.GrandTotalMax,

                PrintedCode = criteriaDto.PrintedCode,

                IssueDateStart = criteriaDto.IssueDateStartNumber.ToDateTimeFromNumberNull(),
                IssueDateEnd   = criteriaDto.IssueDateEndNumber.ToDateTimeFromNumberNull(),

                CurrencyId = criteriaDto.CurrencyId,

                PaymentStatId = criteriaDto.PaymentStatId,

                FicheId = criteriaDto.FicheId,

                FicheIdRelated = criteriaDto.FicheIdRelated,

                DebtPersonId   = criteriaDto.DebtPersonId,
                CreditPersonId = criteriaDto.CreditPersonId,

                ExcludingFicheIdList = criteriaDto.ExcludingFicheIdList,

                PageOffSet = criteriaDto.PageOffSet,

                Session = Session
            };

            criteriaBo.PrintedCode = criteriaBo.PrintedCode.IsNull() ? null : criteriaBo.PrintedCode;
            if (criteriaBo.PrintedCode != null)
            {
                criteriaBo.PrintedCode = criteriaBo.PrintedCode.Trim();
            }

            ResponseBo <List <FicheListBo> > responseBo = ficheBusiness.GetList(criteriaBo);

            ResponseDto <List <FicheListDto> > responseDto = responseBo.ToResponseDto <List <FicheListDto>, List <FicheListBo> >();

            if (responseBo.IsSuccess && responseBo.Bo != null)
            {
                responseDto.Dto = new List <FicheListDto>();
                foreach (FicheListBo itemBo in responseBo.Bo)
                {
                    responseDto.Dto.Add(new FicheListDto()
                    {
                        Id = itemBo.Id,

                        DebtPersonId       = itemBo.DebtPersonId,
                        DebtPersonFullName = itemBo.DebtPersonFullName,
                        DebtPersonTypeId   = itemBo.DebtPersonTypeId,
                        DebtPersonIsAlone  = itemBo.DebtPersonIsAlone,

                        CreditPersonId       = itemBo.CreditPersonId,
                        CreditPersonFullName = itemBo.CreditPersonFullName,
                        CreditPersonTypeId   = itemBo.CreditPersonTypeId,
                        CreditPersonIsAlone  = itemBo.CreditPersonIsAlone,

                        FicheTypeId    = itemBo.FicheTypeId,
                        CurrencyId     = itemBo.CurrencyId,
                        ApprovalStatId = itemBo.ApprovalStatId,
                        IncludingVat   = itemBo.IncludingVat,

                        PaymentStatId = itemBo.PaymentStatId,
                        PaidTotal     = itemBo.PaidTotal,

                        FicheContentId      = itemBo.FicheContentId,
                        FicheContentGroupId = itemBo.FicheContentGroupId,

                        PrintedCode     = itemBo.PrintedCode,
                        IssueDateNumber = itemBo.IssueDate.ToNumberFromDateTime(),
                        DueDateNumber   = itemBo.DueDate.ToNumberFromDateTimeNull(),

                        GrandTotal       = itemBo.GrandTotal,
                        Total            = itemBo.Total,
                        RowDiscountTotal = itemBo.RowDiscountTotal,

                        UnderDiscountRate  = itemBo.UnderDiscountRate,
                        UnderDiscountTotal = itemBo.UnderDiscountTotal,

                        FicheTypeFakeId = itemBo.FicheTypeFakeId,

                        IsDebtor = itemBo.IsDebtor,

                        Notes = itemBo.Notes,

                        LastApprovalFicheHistoryParentPersonId = itemBo.LastApprovalFicheHistoryParentPersonId,
                        LastApprovalFicheHistoryChildPersonId  = itemBo.LastApprovalFicheHistoryChildPersonId,
                        LastApprovalStatId = itemBo.LastApprovalStatId
                    });
                }
            }

            return(responseDto);
        }