public void uploadPanel_Upload(PX.Web.UI.UserControls.PXUploadFilePanel.PXFileUploadedEventArgs args) { PXAdapter adapter = new PXAdapter(this.ds.DataGraph.Views[ds.PrimaryView]); adapter.Parameters = new object[] { args.BinData, args.FileName }; IEnumerator iterator = ds.DataGraph.Actions["ImportToDITA"].Press(adapter).GetEnumerator(); while(iterator.MoveNext()) { } }
public override IEnumerable ValidateAddresses(PXAdapter adapter) { Location main = this.Location.Current; if (main != null) { bool needSave = false; Save.Press(); Address address = this.Address.Current; if (address != null && address.IsValidated == false) { if (CS.PXAddressValidator.Validate<Address>(this, address, true)) needSave = true; } Address remitAddress = this.RemitAddress.Current; if (remitAddress != null && remitAddress.IsValidated == false && (remitAddress.AddressID != address.AddressID)) { if (CS.PXAddressValidator.Validate<Address>(this, remitAddress, true)) needSave = true; } if (needSave == true) this.Save.Press(); } return adapter.Get(); }
/// <summary> /// The data source toolbar callback event handler. /// </summary> void toolBar_CallBack(object sender, PXCallBackEventArgs e) { var grid = sp1.FindControl("grid") as PXGrid; if (e.Command.Name == "Save") { PX.SM.FavoritesMaintenance fv = ds.DataGraph as PX.SM.FavoritesMaintenance; PXAdapter adapter = new PXAdapter(fv.Views[ds.PrimaryView]); adapter.SortColumns = null; adapter.Descendings = null; adapter.Searches = null; adapter.Filters = null; adapter.StartRow = 0; adapter.MaximumRows = grid.PageSize; adapter.TotalRequired = true; foreach (object r in fv.SaveFavorites.Press(adapter)) { break; } PXSiteMap.FavoritesProvider.Clear(); e.Result = PXSiteMap.FavoritesProvider.FavoritesExists() ? "1" : "0"; PXContext.Session.FavoritesExists["FavoritesExists"] = null; } }
/// <summary> /// The grid and tree toolbar callback event handler. /// </summary> protected void tbCommand_CallBack(object sender, PX.Web.UI.PXCallBackEventArgs e) { var tree = sp1.FindControl("tree") as PXTreeView; var grid = sp1.FindControl("grid") as PXGrid; PX.SM.FavoritesMaintenance fv = ds.DataGraph as PX.SM.FavoritesMaintenance; Guid selectedNode; if (PX.Common.GUID.TryParse(tree.SelectedValue, out selectedNode)) { PXAdapter adapter = new PXAdapter(fv.Views[ds.PrimaryView]); adapter.SortColumns = null; adapter.Descendings = null; adapter.Parameters = new object[] { selectedNode, grid.DataValues["NodeID"] }; adapter.Searches = null; adapter.Filters = null; adapter.StartRow = 0; adapter.MaximumRows = grid.PageSize; adapter.TotalRequired = true; switch (e.Command.Name) { case "left": foreach (object r in fv.RowLeft.Press(adapter)) { break; } break; case "right": foreach (object r in fv.RowRight.Press(adapter)) { break; } break; case "up": foreach (object r in fv.RowUp.Press(adapter)) { break; } break; case "down": foreach (object r in fv.RowDown.Press(adapter)) { break; } break; } e.Result = "1"; } }
public virtual IEnumerable NewVendor(PXAdapter adapter) { VendorMaint graph = PXGraph.CreateInstance <VendorMaint>(); throw new PXRedirectRequiredException(graph, Messages.NewVendor); }
public virtual IEnumerable viewTask(PXAdapter adapter) { editDetail(); return(adapter.Get()); }
protected virtual IEnumerable ChangeID(PXAdapter adapter) { return((new ChangeCostCode(this, "changeID")).Press(adapter)); }
public virtual IEnumerable markAsUnread(PXAdapter adapter) { PXLongOperation.StartOperation(this, () => MarkAs(adapter, EPViewStatusAttribute.NOTVIEWED, SelectedList())); return(adapter.Get()); }
protected virtual IEnumerable Post(PXAdapter adapter) { List<ARRegister> list = new List<ARRegister>(); foreach (ARInvoice order in adapter.Get<ARInvoice>()) { list.Add(order); } Save.Press(); PXLongOperation.StartOperation(this, delegate() { SOInvoiceEntry ie = PXGraph.CreateInstance<SOInvoiceEntry>(); INIssueEntry ingraph = PXGraph.CreateInstance<INIssueEntry>(); ingraph.FieldVerifying.AddHandler<INTran.inventoryID>((PXCache sender, PXFieldVerifyingEventArgs e) => { e.Cancel = true; }); ingraph.FieldVerifying.AddHandler<INTran.projectID>((PXCache sender, PXFieldVerifyingEventArgs e) => { e.Cancel = true; }); ingraph.FieldVerifying.AddHandler<INTran.taskID>((PXCache sender, PXFieldVerifyingEventArgs e) => { e.Cancel = true; }); DocumentList<INRegister> inlist = new DocumentList<INRegister>(ingraph); bool failed = false; foreach (ARInvoice ardoc in list) { try { ie.PostInvoice(ingraph, ardoc, inlist); if (adapter.MassProcess) { PXProcessing<ARInvoice>.SetInfo(list.IndexOf(ardoc), ActionsMessages.RecordProcessed); } } catch (Exception ex) { if (!adapter.MassProcess) { throw; } PXProcessing<ARInvoice>.SetError(list.IndexOf(ardoc), ex); failed = true; } } if (ie.sosetup.Current.AutoReleaseIN == true && inlist.Count > 0 && inlist[0].Hold == false) { INDocumentRelease.ReleaseDoc(inlist, false); } if (failed) { throw new PXOperationCompletedException(ErrorMessages.SeveralItemsFailed); } }); return adapter.Get(); }
public virtual IEnumerable viewSchedule(PXAdapter adapter) => ViewScheduleAction(adapter);
public virtual IEnumerable showAssets(PXAdapter adapter) { string minPeriod = null, maxPeriod = null; foreach (FinPeriod period in adapter.Get()) { if (period.Selected == true) { if(string.IsNullOrEmpty(minPeriod) || string.Compare(period.FinPeriodID, minPeriod) < 0) { minPeriod = period.FinPeriodID; } if (string.IsNullOrEmpty(maxPeriod) || string.Compare(period.FinPeriodID, maxPeriod) > 0) { maxPeriod = period.FinPeriodID; } } } Dictionary<string, string> d = new Dictionary<string, string>(); d["PeriodFrom"] = minPeriod.Substring(4, 2) + minPeriod.Substring(0, 4); d["PeriodTo"] = maxPeriod.Substring(4, 2) + maxPeriod.Substring(0, 4); const string ReportID = "FA652000"; throw new PXReportRequiredException(d, ReportID, PXBaseRedirectException.WindowMode.New, "Active Fixed Assets"); }
public IEnumerable splits(PXAdapter adapter) { return(Splits.Cache.Inserted); }
public virtual IEnumerable CreditCCPayment(PXAdapter adapter) { foreach (ARInvoice doc in adapter.Get<ARInvoice>()) { SOInvoice ext = (SOInvoice)SODocument.View.SelectSingleBound(new object[] { doc }); string PCRefTranNbr = ext.RefTranExtNbr; if (String.IsNullOrEmpty(ext.RefTranExtNbr)) { this.SODocument.Cache.RaiseExceptionHandling<SOOrder.refTranExtNbr>(ext, ext.RefTranExtNbr, new PXSetPropertyException(AR.Messages.ERR_PCTransactionNumberOfTheOriginalPaymentIsRequired)); } else { CCPaymentEntry.CreditCCPayment<SOInvoice>(ext, PCRefTranNbr, ccProcTran, null, UpdateSOInvoiceState); } } return adapter.Get(); }
private void MoveRow(PX.SM.WikiPageMapMaintenance graph, bool moveDown) { var tree = sp1.FindControl("tree") as PXTreeView; var grid = sp1.FindControl("grid") as PXGrid; PXAdapter adapter = new PXAdapter(graph.Views[ds.PrimaryView]); adapter.SortColumns = null; adapter.Descendings = null; adapter.Parameters = new object[] { tree.SelectedValue, grid.DataValues["PageID"] }; adapter.Searches = null; adapter.Filters = null; adapter.StartRow = 0; adapter.MaximumRows = grid.PageSize; adapter.TotalRequired = true; foreach (PX.SM.WikiPage map in graph.Children.Select(PX.Common.GUID.CreateGuid(tree.SelectedValue))) { if (map.PageID.Value == PX.Common.GUID.CreateGuid((string)grid.DataValues["PageID"])) { graph.Children.Current = map; break; } } if (moveDown) foreach (PX.SM.WikiPage item in graph.RowDown.Press(adapter)) { break; } else foreach (PX.SM.WikiPage item in graph.RowUp.Press(adapter)) { break; } graph.Children.Cache.IsDirty = false; }
public virtual IEnumerable VoidCCPayment(PXAdapter adapter) { List<ARRegister> list = new List<ARRegister>(); foreach (ARInvoice item in adapter.Get<ARInvoice>()) { list.Add(item); SOInvoice ext = (SOInvoice)SODocument.View.SelectSingleBound(new object[] { item }); CCPaymentEntry.VoidCCPayment<SOInvoice>(ext, ccProcTran, null, UpdateSOInvoiceState); } return list; }
public virtual IEnumerable CaptureCCPayment(PXAdapter adapter) { List<ARRegister> list = new List<ARRegister>(); foreach (ARInvoice item in adapter.Get<ARInvoice>()) { list.Add(item); SOInvoice ext = (SOInvoice) SODocument.View.SelectSingleBound(new object[] { item }); CCPaymentEntry.ReleaseDelegate releaseDelegate = null; CCPaymentEntry.UpdateDocStateDelegate docStateDelegate = UpdateSOInvoiceState; CCPaymentEntry.CaptureCCPayment<SOInvoice>(ext, this.ccProcTran, releaseDelegate, docStateDelegate); } return list; }
protected override IEnumerable Report(PXAdapter adapter, [PXString(8, InputMask = "CC.CC.CC.CC")] string reportID ) { if (!String.IsNullOrEmpty(reportID)) { Save.Press(); int i = 0; Dictionary<string, string> parameters = new Dictionary<string, string>(); string actualRecoprtID = null; foreach (ARInvoice doc in adapter.Get<ARInvoice>()) { parameters["ARInvoice.DocType" + i.ToString()] = doc.DocType; parameters["ARInvoice.RefNbr" + i.ToString()] = doc.RefNbr; actualRecoprtID = new NotificationUtility(this).SearchReport(ARNotificationSource.Customer, customer.Current, reportID, doc.BranchID); i++; } if (i > 0) { throw new PXReportRequiredException(parameters, actualRecoprtID, "Report " + actualRecoprtID); } } return adapter.Get(); }
public virtual IEnumerable amts(PXAdapter adapter) { AccBalanceByAssetFilter filter = Filter.Current; if (filter == null) { yield break; } PXSelectBase <FATran> select = new PXSelectJoin <FATran, InnerJoin <FixedAsset, On <FixedAsset.assetID, Equal <FATran.assetID>, And <FixedAsset.recordType, Equal <FARecordType.assetType> > >, InnerJoin <FADetails, On <FADetails.assetID, Equal <FixedAsset.assetID> >, InnerJoin <FALocationHistoryCurrent, On <FALocationHistoryCurrent.assetID, Equal <FixedAsset.assetID> >, InnerJoin <FALocationHistory, On <FALocationHistory.assetID, Equal <FixedAsset.assetID>, And <FALocationHistory.periodID, Equal <FALocationHistoryCurrent.lastPeriodID>, And <FALocationHistory.revisionID, Equal <FALocationHistoryCurrent.lastRevisionID> > > > > > > >, Where <FATran.released, Equal <True>, And <FATran.finPeriodID, LessEqual <Current <AccBalanceByAssetFilter.periodID> >, And <FATran.bookID, Equal <Current <AccBalanceByAssetFilter.bookID> >, And2 <Where <FALocationHistory.fAAccountID, Equal <Current <AccBalanceByAssetFilter.accountID> >, And <FALocationHistory.fASubID, Equal <Current <AccBalanceByAssetFilter.subID> >, Or <FALocationHistory.accumulatedDepreciationAccountID, Equal <Current <AccBalanceByAssetFilter.accountID> >, And <FALocationHistory.accumulatedDepreciationSubID, Equal <Current <AccBalanceByAssetFilter.subID> > > > > >, And <Where <FATran.debitAccountID, Equal <Current <AccBalanceByAssetFilter.accountID> >, And <FATran.debitSubID, Equal <Current <AccBalanceByAssetFilter.subID> >, Or <FATran.creditAccountID, Equal <Current <AccBalanceByAssetFilter.accountID> >, And <FATran.creditSubID, Equal <Current <AccBalanceByAssetFilter.subID> > > > > > > > > > > >(this); if (filter.BranchID != null) { select.WhereAnd <Where <FALocationHistory.locationID, Equal <Current <AccBalanceByAssetFilter.branchID> > > >(); } Dictionary <int?, Amounts> dict = new Dictionary <int?, Amounts>(); foreach (PXResult <FATran, FixedAsset, FADetails, FALocationHistoryCurrent, FALocationHistory> res in select.Select()) { FATran tran = (FATran)res; FixedAsset asset = (FixedAsset)res; FADetails details = (FADetails)res; FALocationHistory location = (FALocationHistory)res; Amounts record = null; if (!dict.TryGetValue(asset.AssetID, out record)) { record = new Amounts { AssetID = asset.AssetID, Description = asset.Description, Status = details.Status, ClassID = asset.ClassID, DepreciateFromDate = details.DepreciateFromDate, BranchID = location.BranchID, Department = location.Department, ItdAmt = decimal.Zero, YtdAmt = decimal.Zero, PtdAmt = decimal.Zero }; } decimal tranAmt = tran.TranAmt ?? decimal.Zero; decimal amount = tran.DebitAccountID == tran.CreditAccountID && tran.DebitSubID == tran.CreditSubID ? decimal.Zero : tran.DebitAccountID == filter.AccountID && tran.DebitSubID == filter.SubID ? tranAmt : -tranAmt; record.ItdAmt += amount; record.YtdAmt += (FinPeriodIDAttribute.FinPeriodEqual(filter.PeriodID, tran.FinPeriodID, FinPeriodIDAttribute.FinPeriodComparison.Year) ? amount : decimal.Zero); record.PtdAmt += (filter.PeriodID == tran.FinPeriodID ? amount : decimal.Zero); dict[asset.AssetID] = record; } foreach (Amounts amt in dict.Values) { if (amt.ItdAmt != decimal.Zero || amt.YtdAmt != decimal.Zero || amt.PtdAmt != decimal.Zero) { yield return(amt); } } }
protected virtual IEnumerable Flow(PXAdapter adapter) { Save.Press(); return adapter.Get(); }
public virtual IEnumerable showUnpostedDocuments(PXAdapter adapter) { ShowOpenShipments(SelectedItems); return(adapter.Get()); }
public virtual IEnumerable FixSchedulesWithoutNextExecutionDate(PXAdapter adapter) { SharedFunctions.UpdateSchedulesWithoutNextExecution(this, this.Filter.Cache); return(adapter.Get()); }
public IEnumerable GenerateWeeksOK(PXAdapter adapter) { DateTime current; int Year; int weekNumber; GetNextUsingWeek(out current, out weekNumber, out Year); DateTime?LastUsingWeek = GetLasttUsingWeek(); object fromDate = GenerateWeeksDialog.Current.FromDate; object tillDate = GenerateWeeksDialog.Current.TillDate; bool isFeryfing = GenerateWeeksDialog.Cache.RaiseFieldVerifying <EPGenerateWeeksDialog.fromDate>(GenerateWeeksDialog.Current, ref fromDate); isFeryfing = isFeryfing && GenerateWeeksDialog.Cache.RaiseFieldVerifying <EPGenerateWeeksDialog.tillDate>(GenerateWeeksDialog.Current, ref tillDate); if (GenerateWeeksDialog.VerifyRequired() && isFeryfing) { DateTime?oldCurrent = null; //Use to check Infinite Loop DateTime CalendarEndOfWeek; while (current <= GenerateWeeksDialog.Current.TillDate.Value) { int CalendarWeekNumber = PX.Data.Maintenance.PXDateTimeInfo.GetWeekNumber(current); int EndOfWeekYear = current.Year; if (CalendarWeekNumber == 1 && current.Month == 12) //End Of Week in next Year { EndOfWeekYear++; } if (CalendarWeekNumber > 31 && current.Month == 1) //Begin Of Week in previos Year { EndOfWeekYear--; } CalendarEndOfWeek = PX.Data.Maintenance.PXDateTimeInfo.GetWeekStart(EndOfWeekYear, CalendarWeekNumber).AddDays(6d); if (LastUsingWeek == null || LastUsingWeek < current) { if (GenerateWeeksDialog.Current.CutOffDayOne == EPGenerateWeeksDialog.CutOffDayListAttribute.FixedDayOfMonth) { if (current.Day <= GenerateWeeksDialog.Current.DayOne && GenerateWeeksDialog.Current.DayOne < CalendarEndOfWeek.Day) { CalendarEndOfWeek = new DateTime(current.Year, current.Month, GenerateWeeksDialog.Current.DayOne.Value); } } else if (GenerateWeeksDialog.Current.CutOffDayOne == EPGenerateWeeksDialog.CutOffDayListAttribute.EndOfMonth) { if (current.Year == CalendarEndOfWeek.Year) { if (current.Month < CalendarEndOfWeek.Month) { CalendarEndOfWeek = new DateTime(current.Year, current.Month, DateTime.DaysInMonth(current.Year, current.Month)); } } else if (current.Year < CalendarEndOfWeek.Year) { CalendarEndOfWeek = new DateTime(current.Year, current.Month, DateTime.DaysInMonth(current.Year, current.Month)); } } if (GenerateWeeksDialog.Current.CutOffDayTwo == EPGenerateWeeksDialog.CutOffDayListAttribute.FixedDayOfMonth) { if (current.Day <= GenerateWeeksDialog.Current.DayTwo && GenerateWeeksDialog.Current.DayTwo < CalendarEndOfWeek.Day) { CalendarEndOfWeek = new DateTime(current.Year, current.Month, GenerateWeeksDialog.Current.DayTwo.Value); } } else if (GenerateWeeksDialog.Current.CutOffDayTwo == EPGenerateWeeksDialog.CutOffDayListAttribute.EndOfMonth) { if (current.Month != CalendarEndOfWeek.Month) { CalendarEndOfWeek = new DateTime(current.Year, current.Month, DateTime.DaysInMonth(current.Year, current.Month)); } } } if (CalendarWeekNumber == 1 && current.Year < CalendarEndOfWeek.Year) { weekNumber = 1; Year++; } EPCustomWeek week = new EPCustomWeek { StartDate = GetBeginOfDate(current), EndDate = GetEndOfDate(CalendarEndOfWeek), IsActive = true, Year = Year, Number = weekNumber }; CustomWeek.Cache.Insert(week); if (weekNumber != 1 && current.Year < CalendarEndOfWeek.AddDays(1d).Year) { weekNumber = 1; Year++; } else { weekNumber++; } current = GetBeginOfDate(CalendarEndOfWeek.AddDays(1d)); if (oldCurrent == current) { throw new PXException("Infinite Loop. Incorrect week generation option."); } oldCurrent = current; } } return(adapter.Get()); }
public override IEnumerable Release(PXAdapter adapter) { List<ARRegister> list = new List<ARRegister>(); foreach (ARInvoice order in adapter.Get<ARInvoice>()) { list.Add(order); } if (!IsExternalTax) { Save.Press(); } else { try { skipAvalaraCallOnSave = true; Save.Press(); } finally { skipAvalaraCallOnSave = false; } } PXLongOperation.StartOperation(this, delegate() { List<ARRegister> listWithTax = new List<ARRegister>(); if (!IsExternalTax) { foreach (ARInvoice ardoc in list) { if (ardoc.IsTaxValid != true && AvalaraMaint.IsExternalTax(this, ardoc.TaxZoneID)) { ARInvoice doc = new ARInvoice(); doc.DocType = ardoc.DocType; doc.RefNbr = ardoc.RefNbr; doc.OrigModule = ardoc.OrigModule; doc.ApplyPaymentWhenTaxAvailable = ardoc.ApplyPaymentWhenTaxAvailable; listWithTax.Add(ARExternalTaxCalc.Process(doc)); } else { listWithTax.Add(ardoc); } } } else { listWithTax.AddRange(list); } SOInvoiceEntry ie = PXGraph.CreateInstance<SOInvoiceEntry>(); INIssueEntry ingraph = PXGraph.CreateInstance<INIssueEntry>(); SOOrderShipmentProcess docgraph = PXGraph.CreateInstance<SOOrderShipmentProcess>(); HashSet<object> processed = new HashSet<object>(); //Field Verification can fail if IN module is not "Visible";therfore suppress it: ingraph.FieldVerifying.AddHandler<INTran.projectID>((PXCache sender, PXFieldVerifyingEventArgs e) => { e.Cancel = true; }); ingraph.FieldVerifying.AddHandler<INTran.taskID>((PXCache sender, PXFieldVerifyingEventArgs e) => { e.Cancel = true; }); ARDocumentRelease.ReleaseDoc(listWithTax, adapter.MassProcess, null, delegate(ARRegister ardoc, bool isAborted) { List<object> items = new List<object>(); items.Add(ardoc); PXAutomation.RemovePersisted(ie, typeof(ARInvoice), items); docgraph.Clear(); foreach (PXResult<SOOrderShipment, SOOrder> ordershipment in docgraph.Items.View.SelectMultiBound(new object[] { ardoc })) { SOOrderShipment copy = PXCache<SOOrderShipment>.CreateCopy(ordershipment); SOOrder order = ordershipment; copy.InvoiceReleased = true; docgraph.Items.Update(copy); if (order.Completed == true && order.BilledCntr <= 1 && order.ShipmentCntr <= order.BilledCntr + order.ReleasedCntr) { foreach (SOAdjust adj in docgraph.Adjustments.Select(order.OrderType, order.OrderNbr)) { SOAdjust adjcopy = PXCache<SOAdjust>.CreateCopy(adj); adjcopy.CuryAdjdAmt = 0m; adjcopy.CuryAdjgAmt = 0m; adjcopy.AdjAmt = 0m; docgraph.Adjustments.Update(adjcopy); } } processed.Add(ardoc); } docgraph.Actions.PressSave(); }); PXAutomation.StorePersisted(ie, typeof(ARInvoice), new List<object>(processed)); PXAutomation.CompleteAction(docgraph); }); return list; }
public virtual IEnumerable AppClosingMenuActions(PXAdapter adapter) { return(adapter.Get()); }
private IEnumerable CaptureThroughForm(PXAdapter adapter) { List <TPrimary> list = new List <TPrimary>(); foreach (TPrimary doc in adapter.Get <TPrimary>()) { CheckDocumentUpdatedInDb(doc); ICCPayment pDoc = GetPaymentDoc(doc); if (pDoc.CuryDocBal <= 0) { throw new PXException(AR.Messages.ERR_CCAmountMustBePositive); } if (pDoc.Released == false) { Base.Actions.PressSave(); BeforeCapturePayment(doc); } CheckPaymentTransaction(doc); list.Add(doc); if (EnableMobileMode) { if (FindPreAuthorizing()) { continue; } Dictionary <string, string> appendParams = new Dictionary <string, string>(); appendParams.Add("NoteId", DocNoteId.ToString()); appendParams.Add("DocType", pDoc.DocType); appendParams.Add("TranType", V2.CCTranType.AuthorizeAndCapture.ToString()); appendParams.Add("CompanyName", Base.Accessinfo.CompanyName); string redirectUrl = V2.CCServiceEndpointHelper.GetUrl(V2.CCServiceAction.GetAcceptPaymentForm, appendParams); if (redirectUrl == null) { throw new PXException(AR.Messages.ERR_CCProcessingCouldNotGenerateRedirectUrl); } if (pDoc.PMInstanceID == PaymentTranExtConstants.NewPaymentProfile && !TranHeldForReview()) { SetSyncLock(doc); PXTrace.WriteInformation($"Redirect to endpoint. Url: {redirectUrl}"); throw new PXRedirectToUrlException(redirectUrl, PXBaseRedirectException.WindowMode.New, true, "Redirect:" + redirectUrl); } RemoveSyncLock(doc); } else { PXPaymentRedirectException redirectEx = null; try { GetPaymentProcessing().ShowAcceptPaymentForm(V2.CCTranType.AuthorizeAndCapture, pDoc, SelectedProcessingCenter, SelectedBAccount); } catch (PXPaymentRedirectException ex) { redirectEx = ex; } PXLongOperation.StartOperation(Base, () => { CheckPaymentTransaction(doc); if (pDoc.PMInstanceID == PaymentTranExtConstants.NewPaymentProfile && !TranHeldForReview() && !FindPreAuthorizing() && redirectEx != null) { SetSyncLock(doc); throw redirectEx; } RemoveSyncLock(doc); }); } } return(list); }
protected static void Approve(List <EPOwned> items) { EntityHelper helper = new EntityHelper(new PXGraph()); var graphs = new Dictionary <Type, PXGraph>(); bool errorOccured = false; foreach (EPOwned item in items) { try { PXProcessing <EPApproval> .SetCurrentItem(item); if (item.RefNoteID == null) { throw new PXException(Messages.ApprovalRefNoteIDNull); } object row = helper.GetEntityRow(item.RefNoteID.Value, true); if (row == null) { throw new PXException(Messages.ApprovalRecordNotFound); } Type cahceType = row.GetType(); Type graphType = helper.GetPrimaryGraphType(row, false); PXGraph graph; if (!graphs.TryGetValue(graphType, out graph)) { graphs.Add(graphType, graph = PXGraph.CreateInstance(graphType)); } graph.Clear(); graph.Caches[cahceType].Current = row; graph.Caches[cahceType].SetStatus(row, PXEntryStatus.Notchanged); PXAutomation.GetView(graph); string approved = typeof(EPExpenseClaim.approved).Name; if (graph.AutomationView != null) { PXAutomation.GetStep(graph, new object[] { graph.Views[graph.AutomationView].Cache.Current }, BqlCommand.CreateInstance( typeof(Select <>), graph.Views[graph.AutomationView].Cache.GetItemType()) ); } if (graph.Actions.Contains("Approve")) { graph.Actions["Approve"].Press(); } else if (graph.AutomationView != null) { PXView view = graph.Views[graph.AutomationView]; BqlCommand select = view.BqlSelect; PXAdapter adapter = new PXAdapter(new DummyView(graph, select, new List <object> { row })); adapter.Menu = "Approve"; if (graph.Actions.Contains("Action")) { if (!CheckRights(graphType, cahceType)) { throw new PXException(Messages.DontHaveAppoveRights); } foreach (var i in graph.Actions["Action"].Press(adapter)) { ; } } else { throw new PXException("Automation for screen/graph {0} exists but is not configured properly. Failed to find action - 'Action'", graph); } //PXAutomation.ApplyAction(graph, graph.Actions["Action"], "Approve", row, out rollback); } else if (graph.Caches[cahceType].Fields.Contains(approved)) { object upd = graph.Caches[cahceType].CreateCopy(row); graph.Caches[cahceType].SetValue(upd, approved, true); graph.Caches[cahceType].Update(upd); } graph.Persist(); PXProcessing <EPApproval> .SetInfo(ActionsMessages.RecordProcessed); } catch (Exception ex) { errorOccured = true; PXProcessing <EPApproval> .SetError(ex); } } if (errorOccured) { throw new PXOperationCompletedWithErrorException(ErrorMessages.SeveralItemsFailed); } }
public virtual IEnumerable syncUsers(PXAdapter adapter) { return(Base.SyncUsers.Press(adapter)); }
public virtual IEnumerable Clone(PXAdapter adapter) { if (this.Filter.Current.ScheduledEndTime == null) { Filter.Cache.RaiseExceptionHandling <FSCloneAppointmentFilter.scheduledEndTime>( Filter.Current, null, new PXSetPropertyException( PXMessages.LocalizeFormat( TX.Error.FIELD_MAY_NOT_BE_EMPTY, PXUIFieldAttribute.GetDisplayName <FSCloneAppointmentFilter.scheduledEndTime>(Filter.Cache)), PXErrorLevel.Error)); return(adapter.Get()); } if (this.Filter.Current.CloningType == ID.CloningType_CloneAppointment.MULTIPLE) { if (this.Filter.Current.ScheduledFromDate == null) { Filter.Cache.RaiseExceptionHandling <FSCloneAppointmentFilter.scheduledFromDate>( Filter.Current, null, new PXSetPropertyException( PXMessages.LocalizeFormat( TX.Error.FIELD_MAY_NOT_BE_EMPTY, PXUIFieldAttribute.GetDisplayName <FSCloneAppointmentFilter.scheduledFromDate>(Filter.Cache)), PXErrorLevel.Error)); return(adapter.Get()); } if (this.Filter.Current.ScheduledToDate == null) { Filter.Cache.RaiseExceptionHandling <FSCloneAppointmentFilter.scheduledToDate>( Filter.Current, null, new PXSetPropertyException( PXMessages.LocalizeFormat( TX.Error.FIELD_MAY_NOT_BE_EMPTY, PXUIFieldAttribute.GetDisplayName <FSCloneAppointmentFilter.scheduledToDate>(Filter.Cache)), PXErrorLevel.Error)); return(adapter.Get()); } } FSServiceOrder fsServiceOrderRow = PXSelectJoin <FSServiceOrder, InnerJoin < FSAppointment, On <FSAppointment.sOID, Equal <FSServiceOrder.sOID> > >, Where < FSAppointment.appointmentID, Equal <Required <FSAppointment.appointmentID> > > > .Select(this, this.Filter.Current.AppointmentID); if (fsServiceOrderRow != null && fsServiceOrderRow.Status == ID.Status_ServiceOrder.COMPLETED) { throw new PXException(TX.Error.CANNOT_CLONE_APPOINMENT_SERVICE_ORDER_COMPLETED); } CloneAppointmentProcess graphCloneAppointmentProcess = PXGraph.CreateInstance <CloneAppointmentProcess>(); graphCloneAppointmentProcess.Filter.Current.SrvOrdType = this.Filter.Current.SrvOrdType; graphCloneAppointmentProcess.Filter.Current.RefNbr = this.Filter.Current.RefNbr; graphCloneAppointmentProcess.Filter.Current.KeepTimeDuration = this.Filter.Current.KeepTimeDuration; graphCloneAppointmentProcess.Filter.Current.ScheduledDate = this.Filter.Current.ScheduledDate; graphCloneAppointmentProcess.Filter.Current.ScheduledStartTime = this.Filter.Current.ScheduledStartTime; graphCloneAppointmentProcess.Filter.Current.ScheduledEndTime = this.Filter.Current.ScheduledEndTime; graphCloneAppointmentProcess.Filter.Current.ScheduledFromDate = this.Filter.Current.ScheduledFromDate; graphCloneAppointmentProcess.Filter.Current.ScheduledToDate = this.Filter.Current.ScheduledToDate; graphCloneAppointmentProcess.Filter.Current.ActiveOnMonday = this.Filter.Current.ActiveOnMonday; graphCloneAppointmentProcess.Filter.Current.ActiveOnThursday = this.Filter.Current.ActiveOnThursday; graphCloneAppointmentProcess.Filter.Current.ActiveOnWednesday = this.Filter.Current.ActiveOnWednesday; graphCloneAppointmentProcess.Filter.Current.ActiveOnTuesday = this.Filter.Current.ActiveOnTuesday; graphCloneAppointmentProcess.Filter.Current.ActiveOnFriday = this.Filter.Current.ActiveOnFriday; graphCloneAppointmentProcess.Filter.Current.ActiveOnSaturday = this.Filter.Current.ActiveOnSaturday; graphCloneAppointmentProcess.Filter.Current.ActiveOnSunday = this.Filter.Current.ActiveOnSunday; graphCloneAppointmentProcess.AppointmentSelected.Current = this.AppointmentSelected.Current; PXLongOperation.StartOperation( this, delegate { using (PXTransactionScope ts = new PXTransactionScope()) { if (this.Filter.Current.CloningType == ID.CloningType_CloneAppointment.SINGLE) { AppointmentEntry graphOriginalAppointment = PXGraph.CreateInstance <AppointmentEntry>(); graphOriginalAppointment.AppointmentSelected.Current = graphOriginalAppointment.AppointmentRecords.Search <FSAppointment.appointmentID> (AppointmentSelected.Current.AppointmentID, AppointmentSelected.Current.SrvOrdType); graphCloneAppointmentProcess.CloneAppointment(graphOriginalAppointment, PXGraph.CreateInstance <AppointmentEntry>()); } if (this.Filter.Current.CloningType == ID.CloningType_CloneAppointment.MULTIPLE) { graphCloneAppointmentProcess.CloneMultipleAppointments(graphCloneAppointmentProcess); } ts.Complete(); } }); return(adapter.Get()); }
public virtual IEnumerable syncUsers(PXAdapter adapter) { Console.WriteLine("Sync users"); return(adapter.Get()); }
public virtual IEnumerable showCustomer(PXAdapter adapter) { PXRedirectHelper.TryRedirect(customer.Cache, CUSTOMER, Messages.Customer, PXRedirectHelper.WindowMode.NewWindow); return(adapter.Get()); }
protected IEnumerable next(PXAdapter adapter) { Filter.Current.Year = Filter.Current.Year.Return(_ => (int)_ + 1, DateTime.Today.Year); return(adapter.Get()); }
public IEnumerable release(PXAdapter adapter) { return(adapter.Get()); }
public virtual IEnumerable resubmit(PXAdapter adapter) { PXLongOperation.StartOperation(this, delegate() { ResubmitMessages(SelectedList().RowCast <CRSMEmail>().ToList()); }); return(adapter.Get()); }
public virtual IEnumerable doubleClick(PXAdapter adapter) { return(viewTask(adapter)); }
[PXProcessButton(ShortcutCtrl = true, ShortcutChar = (char)65, Tooltip = GL.Messages.SaveAndAddToolTip)] //Ctrl-A public virtual IEnumerable saveAndAdd(PXAdapter adapter) { Base.Save.Press(); return(Base.Insert.Press(adapter)); }
public IEnumerable Refresh(PXAdapter adapter) { this.Filter.Current.FilterDetails = null; return(adapter.Get()); }
public IEnumerable syncMyUsers(PXAdapter adapter) { SyncUsers(); return(adapter.Get()); }
public virtual IEnumerable restore(PXAdapter adapter) { PXLongOperation.StartOperation(this, () => RestoreMessages(SelectedList().RowCast <CRSMEmail>())); return(adapter.Get()); }
internal IEnumerable cut(PXAdapter adapter) => PerformCut(adapter);
public virtual IEnumerable CreateCommitment(PXAdapter adapter) { ExternalCommitmentEntry graph = PXGraph.CreateInstance <ExternalCommitmentEntry>(); throw new PXPopupRedirectException(graph, Messages.CommitmentEntry + " - " + Messages.CreateCommitment, true); }
internal IEnumerable paste(PXAdapter adapter) => PerformPaste(adapter);
public virtual IEnumerable ViewRemitOnMap(PXAdapter adapter) { BAccountUtility.ViewOnMap(this.RemitAddress.Current); return adapter.Get(); }
public virtual IEnumerable AddShipment(PXAdapter adapter) { bool RequireControlTotal = ARSetup.Current.RequireControlTotal == true; foreach (SOOrderShipment shipment in shipmentlist.Cache.Updated) { if (shipment.Selected == true) { foreach (PXResult<SOOrderShipment, SOOrder, CurrencyInfo, SOAddress, SOContact, SOOrderType, SOOrderTypeOperation> order in PXSelectJoin<SOOrderShipment, InnerJoin<SOOrder, On<SOOrder.orderType, Equal<SOOrderShipment.orderType>, And<SOOrder.orderNbr, Equal<SOOrderShipment.orderNbr>>>, InnerJoin<CurrencyInfo, On<CurrencyInfo.curyInfoID, Equal<SOOrder.curyInfoID>>, InnerJoin<SOAddress, On<SOAddress.addressID, Equal<SOOrder.billAddressID>>, InnerJoin<SOContact, On<SOContact.contactID, Equal<SOOrder.billContactID>>, InnerJoin<SOOrderType, On<SOOrderType.orderType, Equal<SOOrder.orderType>>, InnerJoin<SOOrderTypeOperation, On<SOOrderTypeOperation.orderType, Equal<SOOrder.orderType>, And<SOOrderTypeOperation.operation, Equal<SOOrderShipment.operation>>>>>>>>>, Where<SOOrderShipment.shipmentNbr, Equal<Current<SOOrderShipment.shipmentNbr>>, And<SOOrderShipment.shipmentType, Equal<Current<SOOrderShipment.shipmentType>>, And<SOOrderShipment.orderType, Equal<Current<SOOrderShipment.orderType>>, And<SOOrderShipment.orderNbr, Equal<Current<SOOrderShipment.orderNbr>>>>>>>.SelectMultiBound(this, new object[] { shipment })) { ARSetup.Current.RequireControlTotal = false; this.InvoiceOrder((DateTime)this.Accessinfo.BusinessDate, order, customer.Current, null); ARSetup.Current.RequireControlTotal = RequireControlTotal; continue; } foreach (PXResult<SOOrderReceipt, SOOrder, CurrencyInfo, SOAddress, SOContact, SOOrderType, SOOrderTypeOperation, Customer> res in PXSelectJoin<SOOrderReceipt, InnerJoin<SOOrder, On<SOOrder.orderType, Equal<SOOrderReceipt.orderType>, And<SOOrder.orderNbr, Equal<SOOrderReceipt.orderNbr>>>, InnerJoin<CurrencyInfo, On<CurrencyInfo.curyInfoID, Equal<SOOrder.curyInfoID>>, InnerJoin<SOAddress, On<SOAddress.addressID, Equal<SOOrder.billAddressID>>, InnerJoin<SOContact, On<SOContact.contactID, Equal<SOOrder.billContactID>>, InnerJoin<SOOrderType, On<SOOrderType.orderType, Equal<SOOrder.orderType>>, InnerJoin<SOOrderTypeOperation, On<SOOrderTypeOperation.orderType, Equal<SOOrder.orderType>, And<SOOrderTypeOperation.operation, Equal<Current<SOOrderShipment.operation>>>>, InnerJoin<Customer, On<Customer.bAccountID, Equal<SOOrder.customerID>>>>>>>>>, Where<SOOrderReceipt.receiptNbr, Equal<Current<SOOrderShipment.shipmentNbr>>, And<SOShipmentType.dropShip, Equal<Current<SOOrderShipment.shipmentType>>, And<SOOrderReceipt.orderType, Equal<Current<SOOrderShipment.orderType>>, And<SOOrderReceipt.orderNbr, Equal<Current<SOOrderShipment.orderNbr>>>>>>>.SelectMultiBound(this, new object[] { shipment })) { SOOrderReceipt receipt = res; SOOrder order = res; PXResultset<SOShipLine, SOLine> details = new PXResultset<SOShipLine, SOLine>(); foreach (PXResult<POReceiptLine, SOLine> line in PXSelectJoin<POReceiptLine, InnerJoin<SOLine, On<SOLine.pOType, Equal<POReceiptLine.pOType>, And<SOLine.pONbr, Equal<POReceiptLine.pONbr>, And<SOLine.pOLineNbr, Equal<POReceiptLine.pOLineNbr>>>>>, Where2<Where<POReceiptLine.lineType, Equal<POLineType.goodsForDropShip>, Or<POReceiptLine.lineType, Equal<POLineType.nonStockForDropShip>>>, And<POReceiptLine.receiptNbr, Equal<Current<SOOrderReceipt.receiptNbr>>, And<SOLine.orderType, Equal<Current<SOOrderReceipt.orderType>>, And<SOLine.orderNbr, Equal<Current<SOOrderReceipt.orderNbr>>>>>>>.SelectMultiBound(this, new object[] { receipt })) { details.Add(new PXResult<SOShipLine, SOLine>((SOShipLine)line, line)); } shipmentlist.Cache.SetStatus(shipment, PXEntryStatus.Notchanged); shipmentlist.Cache.Remove(shipment); ARSetup.Current.RequireControlTotal = false; this.InvoiceOrder((DateTime)this.Accessinfo.BusinessDate, new PXResult<SOOrderShipment, SOOrder, CurrencyInfo, SOAddress, SOContact, SOOrderType, SOOrderTypeOperation>((PXResult<SOOrderReceipt, SOOrder>)res, order, (CurrencyInfo)res, (SOAddress)res, (SOContact)res, (SOOrderType)res, (SOOrderTypeOperation)res), details, (Customer)res, null); ARSetup.Current.RequireControlTotal = RequireControlTotal; } } else if (shipment.InvoiceNbr == null) { shipmentlist.Cache.SetStatus(shipment, PXEntryStatus.Notchanged); shipmentlist.Cache.Remove(shipment); } } shipmentlist.View.Clear(); //shipmentlist.Cache.Clear(); return adapter.Get(); }
private IEnumerable PerformPaste(PXAdapter adapter) { var buffer = CutBuffer.Cache.Cached.Cast <ItemBuffer>().ToArray(); if (buffer.Any() == false) { return(adapter.Get()); } int newItemClassID = (int)ItemClasses.Current.ItemClassID; object[] inventoryIDs = buffer.Select(b => b.InventoryID).Cast <object>().ToArray(); var inventories = PXSelectReadonly <InventoryItem, Where <InventoryItem.inventoryID, In <Required <InventoryItem.inventoryID> > > > .Select(this, new[] { inventoryIDs }).RowCast <InventoryItem>().ToArray(); var notMatchItems = inventories.Where(i => i.StkItem != ItemClasses.Current.StkItem).ToArray(); if (notMatchItems.Any()) { String segmentedItemClassID = ItemClasses.Current.SegmentedClassCD.FirstSegment(' '); if (notMatchItems.Length == 1) { throw new PXInvalidOperationException( Messages.ItemClassAndInventoryItemStkItemShouldBeSameSingleItem, notMatchItems[0].InventoryCD.TrimEnd(), segmentedItemClassID); } else { PXTrace.WriteInformation( notMatchItems.Aggregate( new StringBuilder().AppendLine(PXMessages.LocalizeFormatNoPrefix(Messages.CouldNotBeMovedToItemClassItemsList, segmentedItemClassID)), (sb, item) => sb.AppendLine(item.InventoryCD.TrimEnd()), sb => sb.ToString())); throw new PXInvalidOperationException( Messages.ItemClassAndInventoryItemStkItemShouldBeSameManyItems, segmentedItemClassID); } } bool needToDefault = Inventories.Ask(AR.Messages.Warning, Messages.ItemClassChangeWarning, MessageButtons.YesNo) == WebDialogResult.Yes; Lazy <InventoryItemMaint> stockItemMaint = new Lazy <InventoryItemMaint>(CreateInstance <InventoryItemMaint>); Lazy <NonStockItemMaint> nonStockItemMaint = new Lazy <NonStockItemMaint>(CreateInstance <NonStockItemMaint>); foreach (InventoryItem inventory in inventories) { if (needToDefault) { InventoryItemMaintBase inventoryItemMaint = inventory.StkItem == true ? (InventoryItemMaintBase)stockItemMaint.Value : nonStockItemMaint.Value; inventoryItemMaint.Item.Current = inventory; using (inventoryItemMaint.MakeRuleWeakeningScopeFor <InventoryItem.lotSerClassID>(RuleWeakenLevel.SuppressError)) using (inventoryItemMaint.MakeRuleWeakeningScopeFor <InventoryItem.baseUnit>(RuleWeakenLevel.SuppressError)) using (stockItemMaint.Value.MakeRuleWeakeningScopeFor <InventoryItem.decimalBaseUnit>(RuleWeakenLevel.SuppressError)) { var copy = (InventoryItem)inventoryItemMaint.Item.Cache.CreateCopy(inventory); copy.ItemClassID = newItemClassID; inventoryItemMaint.Item.Update(copy); } inventoryItemMaint.Actions.PressSave(); } else { inventory.ItemClassID = newItemClassID; Inventories.Cache.Update(inventory); } Inventories.SetValueExt <InventoryItem.selected>(Inventories.Locate(inventory), false); } CutBuffer.Cache.Clear(); if (needToDefault) { Actions.PressCancel(); } else { Actions.PressSave(); } return(adapter.Get()); }
protected virtual IEnumerable CreditHold(PXAdapter adapter) { return adapter.Get(); }
protected virtual IEnumerable Report(PXAdapter adapter) { return(adapter.Get()); }
public virtual IEnumerable AddShipmentCancel(PXAdapter adapter) { foreach (SOOrderShipment shipment in shipmentlist.Cache.Updated) { if (shipment.InvoiceNbr == null) { shipmentlist.Cache.SetStatus(shipment, PXEntryStatus.Notchanged); shipmentlist.Cache.Remove(shipment); } } shipmentlist.View.Clear(); //shipmentlist.Cache.Clear(); return adapter.Get(); }