Пример #1
0
        public void Copy(FLXProject project, FLXProjPurchDetails purchDetails)
        {
            using (PXTransactionScope transactionScope = new PXTransactionScope())
            {
                FLXProject copy1 = PXCache <FLXProject> .CreateCopy(project);

                copy1.OrigProjNbr = project.ProjectNbr;
                copy1.NoteID      = new Guid?();
                this.Document.Insert(copy1);
                string projectNbr = this.Document.Current.ProjectNbr;
                if (purchDetails != null)
                {
                    FLXProjPurchDetails copy2 = PXCache <FLXProjPurchDetails> .CreateCopy(purchDetails);

                    copy2.ProjectNbr = projectNbr;
                    copy2.NoteID     = new Guid?();
                    this.ProjPurchDtls.Insert(copy2);
                }
                foreach (FLXProjISOSched flxProjIsoSched1 in this.ProjISOSched.Cache.Inserted)
                {
                    FLXProjISOSched flxProjIsoSched2 = SelectFrom <FLXProjISOSched> .Where <FLXProjISOSched.projectNbr.IsEqual <P.AsString>
                                                                                            .And <FLXProjISOSched.scheduleCD.IsEqual <P.AsString> > > .View.SelectSingleBound((PXGraph)this, (object[])null, (object)copy1.OrigProjNbr, (object)flxProjIsoSched1.ScheduleCD);

                    flxProjIsoSched1.ScheduleDate = flxProjIsoSched2.ScheduleDate;
                    this.ProjISOSched.Update(flxProjIsoSched1);
                }
                transactionScope.Complete();
            }
            PXRedirectHelper.TryRedirect((PXGraph)this, PXRedirectHelper.WindowMode.Same);
        }
Пример #2
0
 protected virtual void _(Events.FieldUpdated <FLXProject.endCustomerID> e)
 {
     if (!(e.Row is FLXProject row) || this.ProjISOSched.Current != null)
     {
         return;
     }
     foreach (PXResult <CSAttributeDetail> pxResult in SelectFrom <CSAttributeDetail> .Where <CSAttributeDetail.disabled.IsEqual <False>
                                                                                              .And <CSAttributeDetail.attributeID.IsEqual <FLXProjectEntry.ISOSchedAtt> > > .View.ReadOnly.Select((PXGraph)this))
     {
         CSAttributeDetail csAttributeDetail = (CSAttributeDetail)pxResult;
         FLXProjISOSched   instance          = this.ProjISOSched.Cache.CreateInstance() as FLXProjISOSched;
         instance.ProjectNbr   = row.ProjectNbr;
         instance.ScheduleCD   = csAttributeDetail.ValueID;
         instance.ScheduleDate = this.Accessinfo.BusinessDate;
         instance.Descr        = csAttributeDetail.Description;
         this.ProjISOSched.Insert(instance);
     }
 }