Esempio n. 1
0
        /// <summary>
        /// 从数据库中获取销售订单领域模型。
        /// </summary>
        /// <param name="salesOrderId"></param>
        /// <returns></returns>
        public SalesOrderDomainModel GetSalesorderDomainModelByIdFromDatabse(string salesOrderId)
        {
            SalesOrderDomainModel    model = null;
            SalesorderBasicInfoModel SalesorderBasicInfo = SalesorderBasicInfoService.Instance.Retrieve(salesOrderId);

            if (SalesorderBasicInfo == null)
            {
                return(null);
            }
            model                         = new SalesOrderDomainModel();
            model.BasicInfo               = SalesorderBasicInfo;
            model.ProductList             = new Dictionary <string, SalesorderProductInfoModel>();
            model.CommuniationPackageList = new Dictionary <string, SalesorderCommuniationpackageInfoModel>();
            model.ProcessLogs             = new Dictionary <string, SalesorderProcessLogModel>();


            ParameterCollection pc = new ParameterCollection();

            pc.Add("salesorder_id", SalesorderBasicInfo.SalesorderId);
            List <SalesorderProductInfoModel> list = SalesorderProductInfoService.Instance.RetrieveMultiple(pc, OrderByCollection.Create("created_on", "desc"));

            if (list != null)
            {
                foreach (SalesorderProductInfoModel item in list)
                {
                    model.ProductList[item.ProductName] = item;
                }
            }

            List <SalesorderCommuniationpackageInfoModel> CommuniationList = SalesorderCommuniationpackageInfoService.Instance.RetrieveMultiple(pc, OrderByCollection.Create("created_on", "desc"));

            if (CommuniationList != null)
            {
                foreach (SalesorderCommuniationpackageInfoModel CommuniationPackageList in CommuniationList)
                {
                    model.CommuniationPackageList[CommuniationPackageList.BindCommuniationpackageId] = CommuniationPackageList;
                }
            }

            List <SalesorderProcessLogModel> ProcessLogModel = SalesorderProcessLogService.Instance.RetrieveMultiple(pc, OrderByCollection.Create("created_on", "desc"));

            if (ProcessLogModel != null)
            {
                foreach (SalesorderProcessLogModel ProcessLogsList in ProcessLogModel)
                {
                    model.ProcessLogs[ProcessLogsList.SalesorderProcessId] = ProcessLogsList;
                }
            }


            return(model);
        }
Esempio n. 2
0
        /// <summary>
        /// 从缓存中获取销售订单领域模型。
        /// </summary>
        /// <param name="salesOrderId"></param>
        /// <param name="clear"></param>
        /// <returns></returns>
        public SalesOrderDomainModel GetSalesorderDomainModelById(string salesOrderId, bool clear)
        {
            if (string.IsNullOrEmpty(salesOrderId))
            {
                return(null);
            }

            string cacheKey             = CacheKey.SALESORDER_DOMAINMODEL.GetKeyDefine(salesOrderId);
            SalesOrderDomainModel model = CacheUtil.Get <SalesOrderDomainModel>(cacheKey);

            if (model == null || clear)
            {
                model = GetSalesorderDomainModelByIdFromDatabse(salesOrderId);

                if (model != null)
                {
                    CacheUtil.Set(cacheKey, model);
                }
            }

            return(model);
        }