コード例 #1
0
        protected override void OnFlowEnd(T_EXE_PublishApply entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing)
        {
            var publishInfo = this.GetEntityByID <S_EP_PublishInfo>(entity.ID);
            var majors      = EnumBaseHelper.GetEnumDef("Project.Major").EnumItem.ToList();

            if (publishInfo == null)
            {
                publishInfo = new S_EP_PublishInfo();
                this.BusinessEntities.Set <S_EP_PublishInfo>().Add(publishInfo);
            }
            this.UpdateEntity <S_EP_PublishInfo>(publishInfo, entity.ToDic());
            publishInfo.ID            = entity.ID;
            publishInfo.SubmitTime    = DateTime.Now;
            publishInfo.BelongYear    = ((DateTime)publishInfo.SubmitTime).Year;
            publishInfo.BelongMonth   = ((DateTime)publishInfo.SubmitTime).Month;
            publishInfo.BelongQuarter = ((publishInfo.BelongMonth - 1) / 3) + 1;
            var major = majors.FirstOrDefault(a => a.Code == publishInfo.MajorCode);

            if (major != null)
            {
                publishInfo.MajorName = major.Name;
            }
            foreach (var item in entity.T_EXE_PublishApply_PriceDetail)
            {
                var price = this.GetEntityByID <S_EP_PublishInfo_PriceDetail>(item.ID);
                if (price == null)
                {
                    price = new S_EP_PublishInfo_PriceDetail();
                    this.BusinessEntities.Set <S_EP_PublishInfo_PriceDetail>().Add(price);
                }
                this.UpdateEntity <S_EP_PublishInfo_PriceDetail>(price, item.ToDic());
                price.ID = item.ID;
                price.S_EP_PublishInfoID = publishInfo.ID;
            }
            foreach (var item in entity.T_EXE_PublishApply_Products)
            {
                var product = this.GetEntityByID <S_EP_PublishInfo_Products>(item.ID);
                if (product == null)
                {
                    product = new S_EP_PublishInfo_Products();
                    this.BusinessEntities.Set <S_EP_PublishInfo_Products>().Add(product);
                }
                this.UpdateEntity <S_EP_PublishInfo_Products>(product, item.ToDic());
                product.ID = item.ID;
                product.S_EP_PublishInfoID = publishInfo.ID;
            }
            entity.SetProductPrintState(PrintState.Printed.ToString());
            this.BusinessEntities.SaveChanges();
        }
コード例 #2
0
        protected override void OnFlowEnd(T_EXE_PublishApply entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing)
        {
            var publishInfo = this.GetEntityByID <S_EP_PublishInfo>(entity.ID);

            if (publishInfo == null)
            {
                publishInfo = new S_EP_PublishInfo();
                this.BusinessEntities.Set <S_EP_PublishInfo>().Add(publishInfo);
            }
            this.UpdateEntity <S_EP_PublishInfo>(publishInfo, entity.ToDic());
            publishInfo.ID            = entity.ID;
            publishInfo.SubmitTime    = DateTime.Now;
            publishInfo.BelongYear    = ((DateTime)publishInfo.SubmitTime).Year;
            publishInfo.BelongMonth   = ((DateTime)publishInfo.SubmitTime).Month;
            publishInfo.BelongQuarter = ((publishInfo.BelongMonth - 1) / 3) + 1;
            foreach (var item in entity.T_EXE_PublishApply_PriceDetail)
            {
                var price = this.GetEntityByID <S_EP_PublishInfo_PriceDetail>(item.ID);
                if (price == null)
                {
                    price = new S_EP_PublishInfo_PriceDetail();
                    this.BusinessEntities.Set <S_EP_PublishInfo_PriceDetail>().Add(price);
                }
                this.UpdateEntity <S_EP_PublishInfo_PriceDetail>(price, item.ToDic());
                price.ID = item.ID;
                price.S_EP_PublishInfoID = publishInfo.ID;
            }
            foreach (var item in entity.T_EXE_PublishApply_Products)
            {
                var product = this.GetEntityByID <S_EP_PublishInfo_Products>(item.ID);
                if (product == null)
                {
                    product = new S_EP_PublishInfo_Products();
                    this.BusinessEntities.Set <S_EP_PublishInfo_Products>().Add(product);
                }
                this.UpdateEntity <S_EP_PublishInfo_Products>(product, item.ToDic());
                product.ID = item.ID;
                product.S_EP_PublishInfoID = publishInfo.ID;
            }

            entity.SetProductPrintState(PrintState.Printed.ToString());
            entity.SetProductSignUser();
            this.BusinessEntities.SaveChanges();
        }