public override void RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { object key; if (IsTopLevel && (key = sender.GetValue(e.Row, FieldName)) != null) { PXCache cache = sender.Graph.Caches[typeof(CurrencyInfo)]; CurrencyInfo info = (CurrencyInfo)cache.Locate(new CurrencyInfo { CuryInfoID = Convert.ToInt64(key) }); PXEntryStatus status = PXEntryStatus.Notchanged; if (info != null && ((status = cache.GetStatus(info)) == PXEntryStatus.Inserted)) { cache.PersistInserted(info); } else if (status == PXEntryStatus.Updated) { cache.PersistUpdated(info); } else if (status == PXEntryStatus.Deleted) { cache.PersistDeleted(info); } } base.RowPersisting(sender, e); }
protected virtual void ARInvoice_RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { sender.Persist(e.Row, PXDBOperation.Normal); sender.PersistInserted(e.Row); sender.PersistUpdated(e.Row); sender.PersistDeleted(e.Row); }
private void AddCustomerProcessingCenterIfNeeded(CustomerProcessingCenterID newCustomerProcessingCenterID) { CustomerProcessingCenterID customerProcessingCenter = PXSelect<CustomerProcessingCenterID, Where<CustomerProcessingCenterID.cCProcessingCenterID, Equal<Required<CustomerProcessingCenterID.cCProcessingCenterID>>, And<CustomerProcessingCenterID.bAccountID, Equal<Required<CustomerProcessingCenterID.bAccountID>>, And<CustomerProcessingCenterID.customerCCPID, Equal<Required<CustomerProcessingCenterID.customerCCPID>>>>>> .Select(this, newCustomerProcessingCenterID.CCProcessingCenterID, newCustomerProcessingCenterID.BAccountID, newCustomerProcessingCenterID.CustomerCCPID); if (customerProcessingCenter == null) { PXCache cache = Caches[typeof(CustomerProcessingCenterID)]; newCustomerProcessingCenterID = cache.Insert(newCustomerProcessingCenterID) as CustomerProcessingCenterID; cache.PersistInserted(newCustomerProcessingCenterID); } }
public virtual IEnumerable GenerateProjection(PXAdapter adapter) { if (RouteAppointmentForecastingFilter.Current != null && RouteAppointmentForecastingFilter.Current.DateBegin != null && RouteAppointmentForecastingFilter.Current.DateEnd != null && RouteAppointmentForecastingFilter.Current.DateBegin < RouteAppointmentForecastingFilter.Current.DateEnd) { DateTime beginFromFilter = RouteAppointmentForecastingFilter.Current.DateBegin.Value; DateTime endToFilter = RouteAppointmentForecastingFilter.Current.DateEnd.Value; string recordType = ID.RecordType_ServiceContract.ROUTE_SERVICE_CONTRACT; int?serviceID = RouteAppointmentForecastingFilter.Current.ServiceID; int?customerID = RouteAppointmentForecastingFilter.Current.CustomerID; int?customerLocationID = RouteAppointmentForecastingFilter.Current.CustomerLocationID; int?routeID = RouteAppointmentForecastingFilter.Current.RouteID; PXLongOperation.StartOperation( this, delegate { using (PXTransactionScope ts = new PXTransactionScope()) { if (beginFromFilter != null && endToFilter != null) { DateHandler requestDate = new DateHandler(endToFilter); var period = new Period((DateTime)beginFromFilter, (DateTime)endToFilter); List <Scheduler.Schedule> scheduleListToProcess = new List <Scheduler.Schedule>(); var generator = new TimeSlotGenerator(); var fsRouteContractScheduleRecords = PXSelectJoinGroupBy <FSRouteContractSchedule, InnerJoin <FSServiceContract, On <FSServiceContract.serviceContractID, Equal <FSRouteContractSchedule.entityID> >, InnerJoin <FSScheduleRoute, On <FSScheduleRoute.scheduleID, Equal <FSRouteContractSchedule.scheduleID> >, InnerJoin <FSScheduleDet, On <FSScheduleDet.scheduleID, Equal <FSRouteContractSchedule.scheduleID> > > > >, Where < FSRouteContractSchedule.entityType, Equal <FSSchedule.entityType.Contract>, And <FSServiceContract.recordType, Equal <FSServiceContract.recordType.RouteServiceContract>, And <FSRouteContractSchedule.active, Equal <True>, And <FSServiceContract.status, Equal <FSServiceContract.status.Active>, And <FSRouteContractSchedule.startDate, LessEqual <Required <FSRouteContractSchedule.startDate> >, And2 < Where < Required <FSScheduleDet.inventoryID>, IsNull, Or <FSScheduleDet.inventoryID, Equal <Required <FSScheduleDet.inventoryID> > > >, And2 < Where < Required <FSRouteContractSchedule.customerID>, IsNull, Or <FSRouteContractSchedule.customerID, Equal <Required <FSRouteContractSchedule.customerID> > > >, And2 < Where < Required <FSRouteContractSchedule.customerLocationID>, IsNull, Or <FSRouteContractSchedule.customerLocationID, Equal <Required <FSRouteContractSchedule.customerLocationID> > > >, And2 < Where < Required <FSScheduleRoute.dfltRouteID>, IsNull, Or <FSScheduleRoute.dfltRouteID, Equal <Required <FSScheduleRoute.dfltRouteID> > > >, And < Where <FSRouteContractSchedule.endDate, IsNull, Or <FSRouteContractSchedule.endDate, GreaterEqual <Required <FSRouteContractSchedule.startDate> > > > > > > > > > > > > >, Aggregate < GroupBy <FSRouteContractSchedule.scheduleID> > > .Select(this, beginFromFilter, serviceID, serviceID, customerID, customerID, customerLocationID, customerLocationID, routeID, routeID, endToFilter); foreach (FSRouteContractSchedule fsRouteContractScheduleRecord in fsRouteContractScheduleRecords) { List <Scheduler.Schedule> mapScheduleResults = MapFSScheduleToSchedule.convertFSScheduleToSchedule(RouteAppointmentForecastingFilter.Cache, fsRouteContractScheduleRecord, endToFilter, recordType); foreach (Scheduler.Schedule mapSchedule in mapScheduleResults) { scheduleListToProcess.Add(mapSchedule); } } if (recordType == ID.RecordType_ServiceContract.ROUTE_SERVICE_CONTRACT) { foreach (Scheduler.Schedule schedule in scheduleListToProcess) { schedule.Priority = (int?)RouteScheduleProcess.SetSchedulePriority(schedule, this); schedule.RouteInfoList = RouteScheduleProcess.getRouteListFromSchedule(schedule, this); } } List <TimeSlot> timeSlots = generator.GenerateCalendar(period, scheduleListToProcess); var fsRouteAppointmentForecastingRecords = PXSelect <FSRouteAppointmentForecasting, Where < FSRouteAppointmentForecasting.startDate, GreaterEqual <Required <FSRouteAppointmentForecasting.startDate> >, And < FSRouteAppointmentForecasting.startDate, LessEqual <Required <FSRouteAppointmentForecasting.startDate> > > > > .Select(this, beginFromFilter, endToFilter); PXCache <FSRouteAppointmentForecasting> cacheRouteForecasting = new PXCache <FSRouteAppointmentForecasting>(this); foreach (FSRouteAppointmentForecasting fsRouteAppointmentDetailProjectionRecord in fsRouteAppointmentForecastingRecords) { cacheRouteForecasting.PersistDeleted(fsRouteAppointmentDetailProjectionRecord); } foreach (TimeSlot timeSlot in timeSlots) { requestDate.setDate(timeSlot.DateTimeBegin); FSSchedule fsScheduleRow = ScheduleSelected.Select(timeSlot.ScheduleID); FSScheduleRoute fsScheduleRouteRow = ScheduleRouteSelected.Select(fsScheduleRow.ScheduleID); FSServiceContract fsServiceContractRow = ServiceContractSelected.Select(fsScheduleRow.EntityID); FSRouteAppointmentForecasting fsRouteAppointmentForecastingRow = new FSRouteAppointmentForecasting(); fsRouteAppointmentForecastingRow.RouteID = fsScheduleRouteRow.DfltRouteID; fsRouteAppointmentForecastingRow.StartDate = requestDate.StartOfDay(); fsRouteAppointmentForecastingRow.ScheduleID = fsScheduleRow.ScheduleID; fsRouteAppointmentForecastingRow.ServiceContractID = fsServiceContractRow.ServiceContractID; fsRouteAppointmentForecastingRow.CustomerLocationID = fsServiceContractRow.CustomerLocationID; fsRouteAppointmentForecastingRow.CustomerID = fsServiceContractRow.CustomerID; fsRouteAppointmentForecastingRow.SequenceOrder = int.Parse(fsScheduleRouteRow.GlobalSequence); cacheRouteForecasting.PersistInserted(fsRouteAppointmentForecastingRow); } } ts.Complete(); } }); } return(adapter.Get()); }
protected void ViewCount() { if (pageid != null) { Guid currentwikipage = new Guid(pageid); PXGraph article = PXGraph.CreateInstance(typeof(KBArticleMaint)); PXCache responsesummary = article.Caches[typeof(KBResponseSummary)]; PXCache responses = article.Caches[typeof(KBResponse)]; PXResult <WikiPage, WikiPageLanguage, WikiRevision> result = (PXResult <WikiPage, WikiPageLanguage, WikiRevision>) PXSelectJoin <WikiPage, InnerJoin <WikiPageLanguage, On <WikiPageLanguage.pageID, Equal <WikiPage.pageID> >, InnerJoin <WikiRevision, On <WikiRevision.pageID, Equal <WikiPage.pageID> > > >, Where <WikiPage.pageID, Equal <Required <WikiPage.pageID> > > > .SelectWindowed(new PXGraph(), 0, 1, currentwikipage); Guid userId = PXAccess.GetUserID(); PXResult <KBResponseSummary> resultsummary = (PXResult <KBResponseSummary>) PXSelect <KBResponseSummary, Where <KBResponseSummary.pageID, Equal <Required <KBResponseSummary.pageID> > > > .SelectWindowed(article, 0, 1, currentwikipage); PXResult <KBResponse> resnonse = (PXResult <KBResponse>) PXSelect <KBResponse, Where <KBResponse.userID, Equal <Required <KBResponse.userID> >, And <KBResponse.pageID, Equal <Required <KBResponse.pageID> > > > > .SelectWindowed(article, 0, 1, userId, currentwikipage); if (result != null) { WikiPage wp = result[typeof(WikiPage)] as WikiPage; WikiPageLanguage wpl = result[typeof(WikiPageLanguage)] as WikiPageLanguage; KBResponseSummary kbrs = responsesummary.CreateInstance() as KBResponseSummary; KBResponse newresnonse = responses.CreateInstance() as KBResponse; if (resultsummary != null) { kbrs = resultsummary[typeof(KBResponseSummary)] as KBResponseSummary; } if (resnonse != null) { newresnonse = resnonse[typeof(KBResponse)] as KBResponse; } if (wp != null && wpl != null) { if (kbrs == null || kbrs.PageID == null) { kbrs.PageID = currentwikipage; kbrs.Views = 1; kbrs.Markcount = 0; kbrs.Marksummary = 0; kbrs.CreatedByID = wp.CreatedByID; kbrs.CreatedByScreenID = "WP00000"; kbrs.CreatedDateTime = wp.CreatedDateTime; kbrs.LastModifiedByID = wp.LastModifiedByID; kbrs.LastModifiedByScreenID = "WP00000"; kbrs.LastModifiedDateTime = wp.LastModifiedDateTime; kbrs.tstamp = wp.tstamp; responsesummary.Insert(kbrs); responsesummary.PersistInserted(kbrs); responsesummary.Clear(); } else { kbrs.Views++; responsesummary.Update(kbrs); responsesummary.PersistUpdated(kbrs); responsesummary.Clear(); } if (newresnonse == null || newresnonse.PageID == null) { newresnonse.PageID = currentwikipage; newresnonse.RevisionID = 1; newresnonse.OldMark = 0; newresnonse.NewMark = 0; newresnonse.Date = PXTimeZoneInfo.Now; newresnonse.UserID = userId; newresnonse.Summary = ""; newresnonse.CreatedByID = wp.CreatedByID; newresnonse.CreatedByScreenID = "WP00000"; newresnonse.CreatedDateTime = wp.CreatedDateTime; newresnonse.LastModifiedByID = wp.LastModifiedByID; newresnonse.LastModifiedByScreenID = "WP00000"; newresnonse.LastModifiedDateTime = wp.LastModifiedDateTime; newresnonse.tstamp = wp.tstamp; responses.Insert(newresnonse); responses.PersistInserted(newresnonse); responses.Clear(); } } } } }
protected void Rate_PageRate(object sender, EventArgs e) { Filltables(); Guid currentwikipage = new Guid(pageid); PXGraph article = PXGraph.CreateInstance(typeof(KBArticleMaint)); PXCache response = article.Caches[typeof(KBResponse)]; PXCache responsesummary = article.Caches[typeof(KBResponseSummary)]; PXResult <WikiPage, WikiPageLanguage, WikiRevision> result = (PXResult <WikiPage, WikiPageLanguage, WikiRevision>) PXSelectJoin <WikiPage, InnerJoin <WikiPageLanguage, On <WikiPageLanguage.pageID, Equal <WikiPage.pageID> >, InnerJoin <WikiRevision, On <WikiRevision.pageID, Equal <WikiPage.pageID> > > >, Where <WikiPage.pageID, Equal <Required <WikiPage.pageID> > >, OrderBy <Desc <WikiRevision.pageRevisionID> > > .SelectWindowed(new PXGraph(), 0, 1, currentwikipage); Guid userId = PXAccess.GetUserID(); PXResult <KBResponseSummary> resultsummary = (PXResult <KBResponseSummary>) PXSelect <KBResponseSummary, Where <KBResponseSummary.pageID, Equal <Required <KBResponseSummary.pageID> > > > .SelectWindowed(article, 0, 1, currentwikipage); PXResult <KBResponse> resnonse = (PXResult <KBResponse>) PXSelect <KBResponse, Where <KBResponse.userID, Equal <Required <KBResponse.userID> >, And <KBResponse.pageID, Equal <Required <KBResponse.pageID> > > > > .SelectWindowed(article, 0, 1, userId, currentwikipage); if (result != null) { WikiPage wp = result[typeof(WikiPage)] as WikiPage; WikiPageLanguage wpl = result[typeof(WikiPageLanguage)] as WikiPageLanguage; KBResponseSummary kbrs = responsesummary.CreateInstance() as KBResponseSummary; KBResponse newresnonse = response.CreateInstance() as KBResponse; if (resultsummary != null) { kbrs = resultsummary[typeof(KBResponseSummary)] as KBResponseSummary; } if (resnonse != null) { newresnonse = resnonse[typeof(KBResponse)] as KBResponse; if (wp != null && wpl != null && newresnonse.NewMark != null) { if (newresnonse.OldMark != 0) { kbrs.Marksummary = kbrs.Marksummary - newresnonse.OldMark; kbrs.Marksummary = kbrs.Marksummary + newresnonse.NewMark; } else { kbrs.Markcount = kbrs.Markcount + 1; kbrs.Marksummary = kbrs.Marksummary + newresnonse.NewMark; } int AvRate = (int)((int)kbrs.Marksummary / (int)kbrs.Markcount); Int32 Marksummary = (int)kbrs.Marksummary; Int32 Markcount = (int)kbrs.Markcount; double dAvRate = (double)Marksummary / (double)Markcount; kbrs.AvRate = dAvRate; responsesummary.Update(kbrs); responsesummary.PersistUpdated(kbrs); responsesummary.Clear(); newresnonse.PageID = currentwikipage; newresnonse.RevisionID = 1; newresnonse.OldMark = newresnonse.NewMark; newresnonse.Date = PXTimeZoneInfo.Now; newresnonse.Summary = ""; newresnonse.CreatedByID = wp.CreatedByID; newresnonse.CreatedByScreenID = "WP00000"; newresnonse.CreatedDateTime = wp.CreatedDateTime; newresnonse.LastModifiedByID = wp.LastModifiedByID; newresnonse.LastModifiedByScreenID = "WP00000"; newresnonse.LastModifiedDateTime = wp.LastModifiedDateTime; response.Update(newresnonse); response.PersistUpdated(newresnonse); response.Clear(); } } else { if (wp != null && wpl != null && newresnonse.NewMark != null) { newresnonse.PageID = currentwikipage; newresnonse.RevisionID = 1; newresnonse.OldMark = newresnonse.NewMark; newresnonse.Date = PXTimeZoneInfo.Now; newresnonse.UserID = userId; newresnonse.Summary = ""; newresnonse.CreatedByID = wp.CreatedByID; newresnonse.CreatedByScreenID = "WP00000"; newresnonse.CreatedDateTime = wp.CreatedDateTime; newresnonse.LastModifiedByID = wp.LastModifiedByID; newresnonse.LastModifiedByScreenID = "WP00000"; newresnonse.LastModifiedDateTime = wp.LastModifiedDateTime; if (kbrs == null || kbrs.PageID == null) { kbrs.PageID = currentwikipage; kbrs.CreatedByID = wp.CreatedByID; kbrs.CreatedByScreenID = "WP00000"; kbrs.CreatedDateTime = wp.CreatedDateTime; kbrs.LastModifiedByID = wp.LastModifiedByID; kbrs.LastModifiedByScreenID = "WP00000"; kbrs.LastModifiedDateTime = wp.LastModifiedDateTime; kbrs.Markcount = 1; kbrs.Marksummary = newresnonse.NewMark; int AvRate = (int)((int)kbrs.Marksummary / (int)kbrs.Markcount); Int32 Marksummary = (int)kbrs.Marksummary; Int32 Markcount = (int)kbrs.Markcount; double dAvRate = (double)Marksummary / (double)Markcount; kbrs.AvRate = dAvRate; responsesummary.Insert(kbrs); responsesummary.PersistInserted(kbrs); responsesummary.Clear(); } else { kbrs.Markcount = kbrs.Markcount + 1; kbrs.Marksummary = kbrs.Marksummary + newresnonse.NewMark; responsesummary.Update(kbrs); responsesummary.PersistUpdated(kbrs); responsesummary.Clear(); } response.Insert(newresnonse); response.PersistInserted(newresnonse); response.Clear(); } } string path = PXUrl.SiteUrlWithPath(); path += path.EndsWith("/") ? "" : "/"; var url = string.Format("{0}Wiki/{1}?pageid={2}", path, this.ResolveClientUrl("~/Wiki/ShowWiki.aspx"), pageid); url = url + "&rateid=" + Rate.Value; throw new Exception("Redirect0:" + url); } }
public void ConvertCustomerPaymentMethod(CustomerPaymentMethod cpm, CCProcessingCenter newCCPC) { CCProcessingCenterPmntMethod newProcessingCenterPM = PXSelect <CCProcessingCenterPmntMethod, Where <CCProcessingCenterPmntMethod.paymentMethodID, Equal <Required <CCProcessingCenterPmntMethod.paymentMethodID> >, And <CCProcessingCenterPmntMethod.processingCenterID, Equal <Required <CCProcessingCenterPmntMethod.processingCenterID> > > > > .Select(this, cpm.PaymentMethodID, newCCPC.ProcessingCenterID); if (newProcessingCenterPM == null) { newProcessingCenterPM = (CCProcessingCenterPmntMethod)ProcessingCenterPM.Cache.CreateInstance(); newProcessingCenterPM.PaymentMethodID = cpm.PaymentMethodID; newProcessingCenterPM.ProcessingCenterID = newCCPC.ProcessingCenterID; ProcessingCenterPM.Insert(newProcessingCenterPM); } CustomerPaymentMethod currCPM = (CustomerPaymentMethod)CustomerPM.Cache.CreateCopy(cpm); var oldCCProcessingCenterID = currCPM.CCProcessingCenterID; currCPM.CCProcessingCenterID = newCCPC.ProcessingCenterID; CustomerPM.Cache.SetDefaultExt <CustomerPaymentMethod.customerCCPID>(currCPM); currCPM.Selected = true; currCPM = CustomerPM.Update(currCPM); CustomerPM.Current = currCPM; PXResultset <PaymentMethodDetail> oldDetails = PMDetails.Select(currCPM.PaymentMethodID); foreach (PaymentMethodDetail oldDetail in oldDetails) { PaymentMethodDetail newDetail = (PaymentMethodDetail)PMDetails.Cache.CreateCopy(oldDetail); newDetail.ValidRegexp = null; PMDetails.Update(newDetail); } PaymentMethod CurrPM = PM.Select(); PaymentMethodDetail CCPID = FindCCPID(CurrPM); if (CCPID == null) { using (PXTransactionScope ts = new PXTransactionScope()) { PaymentMethodDetail res; CCPID = (PaymentMethodDetail)PMDetails.Cache.CreateInstance(); CCPID.PaymentMethodID = currCPM.PaymentMethodID; CCPID.UseFor = PaymentMethodDetailUsage.UseForARCards; CCPID.DetailID = "CCPID"; CCPID.Descr = Messages.PaymentProfileID; CCPID.IsCCProcessingID = true; CCPID.IsRequired = true; res = PMDetails.Insert(CCPID); if (res == null) { throw new PXException(Messages.CouldNotInsertPMDetail); } else { PMDetails.Cache.Persist(PXDBOperation.Insert); } ts.Complete(); } } CCProcessingCenter procCenter = PXSelect <CCProcessingCenter, Where <CCProcessingCenter.processingCenterID, Equal <Required <CCProcessingCenter.processingCenterID> > > > .Select(this, oldCCProcessingCenterID); bool doesOldProcCenterSupportTokenizing = CCProcessingFeatureHelper.IsFeatureSupported(procCenter, CCProcessingFeature.ProfileManagement); bool doesNewProcCenterSupportTokenizing = CCProcessingFeatureHelper.IsFeatureSupported(newCCPC, CCProcessingFeature.ProfileManagement); if (!doesOldProcCenterSupportTokenizing && doesNewProcCenterSupportTokenizing) { CustomerPaymentMethodDetail newCCPIDPM = PXSelect <CustomerPaymentMethodDetail, Where <CustomerPaymentMethodDetail.pMInstanceID, Equal <Required <CustomerPaymentMethodDetail.pMInstanceID> >, And <CustomerPaymentMethodDetail.paymentMethodID, Equal <Required <CustomerPaymentMethodDetail.paymentMethodID> >, And <CustomerPaymentMethodDetail.detailID, Equal <Required <CustomerPaymentMethodDetail.detailID> > > > > > .Select(this, currCPM.PMInstanceID, currCPM.PaymentMethodID, CCPID.DetailID); if (newCCPIDPM != null) { newCCPIDPM.Value = null; CustomerPMDetails.Update(newCCPIDPM); } else { newCCPIDPM = new CustomerPaymentMethodDetail { PMInstanceID = currCPM.PMInstanceID, PaymentMethodID = currCPM.PaymentMethodID, DetailID = CCPID.DetailID }; CustomerPMDetails.Insert(newCCPIDPM); } var graph = PXGraph.CreateInstance <CCCustomerInformationManagerGraph>(); graph.GetOrCreatePaymentProfile(this, CustomerPM, CustomerPMDetails); } if (doesNewProcCenterSupportTokenizing) { if (currCPM.CustomerCCPID == null) { currCPM.CustomerCCPID = cpm.CustomerCCPID; } CustomerProcessingCenterID newCustomerProcessingCenterID = new CustomerProcessingCenterID { CCProcessingCenterID = newCCPC.ProcessingCenterID, BAccountID = cpm.BAccountID, CustomerCCPID = currCPM.CustomerCCPID }; PXCache cache = Caches[typeof(CustomerProcessingCenterID)]; newCustomerProcessingCenterID = cache.Insert(newCustomerProcessingCenterID) as CustomerProcessingCenterID; cache.PersistInserted(newCustomerProcessingCenterID); } currCPM = CustomerPM.Update(currCPM); this.Save.Press(); }
public virtual void RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { object key = sender.GetValue(e.Row, _FieldOrdinal); PXCache cache = sender.Graph.Caches[typeof(CATran)]; CATran info = null; if (key != null) { //do not read cached record in release processes if ((info = PXSelectReadonly <CATran, Where <CATran.tranID, Equal <Required <CATran.tranID> > > > .Select(sender.Graph, key)) != null) { CATran cached = (CATran)cache.Locate(info); if (cached != null) { if ((cached.OrigModule != null && info.OrigModule != null && cached.OrigModule != info.OrigModule) || (cached.OrigRefNbr != null && info.OrigRefNbr != null && cached.OrigRefNbr != info.OrigRefNbr) || (cached.OrigTranType != null && info.OrigTranType != null && cached.OrigTranType != info.OrigTranType)) { // TO Be removed after solving CATran issue (check JIRA item AC-57875 for details) throw new PXException(Messages.CouldNotInsertCATran); } if (cache.GetStatus(cached) == PXEntryStatus.Notchanged) { PXCache <CATran> .RestoreCopy(cached, info); } info = cached; } else { cache.SetStatus(info, PXEntryStatus.Notchanged); } } if ((long)key < 0L && info == null) { info = new CATran(); info.TranID = (long)key; info = (CATran)cache.Locate(info); } if (info == null) { key = null; sender.SetValue(e.Row, _FieldOrdinal, null); } } if ((e.Operation & PXDBOperation.Command) == PXDBOperation.Delete) { if (info != null) { cache.Delete(info); cache.PersistDeleted(info); } } else if (info == null) { if (!this.NeedPreventCashTransactionCreation(sender, e.Row)) { info = DefaultValues(sender, new CATran(), e.Row); if (info != null) { info = (CATran)cache.Insert(info); if (!(info.TranID < 0L)) { throw new PXException(Messages.CouldNotInsertCATran); } // TO Be removed after solving CATran issue (check JIRA item AC-57875 for details) sender.SetValue(e.Row, _FieldOrdinal, info.TranID); _KeyToAbort = info.TranID; cache.PersistInserted(info); long id = info.TranID ?? 0; if (id == 0 || id < 0) { throw new PXException(Messages.CATranNotSaved, sender.GetItemType().Name); } sender.SetValue(e.Row, _FieldOrdinal, id); info.TranID = id; cache.Normalize(); } } } else if (info.TranID < 0L) { info = DefaultValues(sender, PXCache <CATran> .CreateCopy(info), e.Row); if (info != null) { info = (CATran)cache.Update(info); sender.SetValue(e.Row, _FieldOrdinal, info.TranID); _KeyToAbort = info.TranID; cache.PersistInserted(info); long id = info.TranID ?? 0; if (id == 0 || id < 0) { throw new PXException(Messages.CATranNotSaved, sender.GetItemType().Name); } sender.SetValue(e.Row, _FieldOrdinal, id); info.TranID = id; cache.Normalize(); } } else { CATran copy = PXCache <CATran> .CreateCopy(info); copy = DefaultValues(sender, copy, e.Row); if (copy != null) { if ((copy.OrigModule != null && info.OrigModule != null && copy.OrigModule != info.OrigModule) || (copy.OrigRefNbr != null && info.OrigRefNbr != null && copy.OrigRefNbr != info.OrigRefNbr) || (copy.OrigTranType != null && info.OrigTranType != null && copy.OrigTranType != info.OrigTranType)) { // TO Be removed after solving CATran issue (check JIRA item AC-57875 for details) throw new PXException(Messages.CouldNotInsertCATran); } info = (CATran)cache.Update(copy); //to avoid another process updated DefaultValues will return null for Released docs, except for GLTran cache.PersistUpdated(info); } //JournalEntry is usually persisted prior to ReleaseGraph to obtain BatchNbr reference, read info should contain set Released flag else if (info.Released == false) { key = null; sender.SetValue(e.Row, _FieldOrdinal, null); cache.Delete(info); } } foreach (CATran toDelete in cache.Deleted) { cache.PersistDeleted(toDelete); } }
protected virtual void ARInvoice_RowInserted(PXCache sender, PXRowInsertedEventArgs e) { sender.PersistInserted(e.Row); }