Exemple #1
0
        public IEnumerable <WayBillTemplateExt> GetWayBillTemplateList(IEnumerable <int> shippingMethodIds,
                                                                       string templateTypeId)
        {
            var ctx = this.UnitOfWork as LMS_DbContext;

            Check.Argument.IsNotNull(ctx, "数据库对象");
            Check.Argument.IsNullOrWhiteSpace(templateTypeId, "模板类型Id");
            Check.Argument.IsNotNull(shippingMethodIds, "运输方式列表为空");
            var methodIds = shippingMethodIds as int[] ?? shippingMethodIds.ToArray();
            int enable    = WayBillTemplateInfo.StatusToValue(WayBillTemplateInfo.StatusEnum.Enable);
            var list      =
                ctx.WayBillTemplates.Where(
                    w =>
                    methodIds.Contains(w.ShippingMethodId) && w.TemplateTypeId == templateTypeId &&
                    w.Status == enable)
                .Select(w => new WayBillTemplateExt
            {
                WayBillTemplateId   = w.WayBillTemplateId,
                TemplateName        = w.TemplateName,
                TemplateTypeId      = w.TemplateTypeId,
                ShippingMethodId    = w.ShippingMethodId,
                Status              = w.Status,
                TemplateContent     = w.TemplateContent,
                Remark              = w.Remark,
                RowNumber           = w.RowNumber,
                ColumnNumber        = w.ColumnNumber,
                TemplateHeadId      = w.TemplateHeadId,
                TemplateContentId   = w.TemplateContentId,
                LinkMode            = w.LinkMode,
                Countries           = w.Countries,
                CreatedOn           = w.CreatedOn,
                LastUpdatedOn       = w.LastUpdatedOn,
                TemplateBodyContent = (from wino in ctx.WayBillTemplateInfos
                                       where
                                       wino.TemplateModelId == w.TemplateContentId &&
                                       wino.Status == enable
                                       select wino.TemplateContent).FirstOrDefault(),
                TemplateHead = (from wino in ctx.WayBillTemplateInfos
                                where wino.TemplateModelId == w.TemplateHeadId && wino.Status == enable
                                select wino.TemplateContent).FirstOrDefault(),
            });

            return(list.ToList());
        }
        public List <WayBillTemplate> GetWayBillTemplateByNameAndShippingMethod(string templateName, int shippingMethodId)
        {
            int disable = WayBillTemplateInfo.StatusToValue(WayBillTemplateInfo.StatusEnum.Disable);

            return(_wayBillTemplateRepository.GetList(p => p.TemplateName == templateName && p.ShippingMethodId == shippingMethodId && p.Status != disable));
        }
        public List <WayBillTemplate> GetList()
        {
            int disable = WayBillTemplateInfo.StatusToValue(WayBillTemplateInfo.StatusEnum.Disable);

            return(_wayBillTemplateRepository.GetList(p => p.Status != disable));
        }