protected virtual void RevalueFilter_TotalRevalued_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e) { if (e.Row != null) { decimal val = 0m; foreach (RevaluedGLHistory res in GLAccountList.Cache.Updated) { if ((bool)res.Selected) { decimal sign = AccountRules.IsDEALAccount(res.AccountType) ? 1.0m : -1.0m; val += sign * (decimal)res.FinPtdRevalued; } } if (val == 0) { TimeSpan timespan; Exception ex; if (PXLongOperation.GetStatus(UID, out timespan, out ex) == PXLongRunStatus.Completed) { Filter.Cache.RaiseExceptionHandling <RevalueFilter.totalRevalued>(e.Row, val, new PXSetPropertyException(Messages.NoRevaluationEntryWasMade, PXErrorLevel.Warning)); } } else { e.ReturnValue = val; e.Cancel = true; } } }
protected virtual IEnumerable careconrecords() { List <CAReconMessage> listMessages = PXLongOperation.GetCustomInfo(this.UID) as List <CAReconMessage>; CAEnqFilter filter = Filter.Current; foreach (CARecon recon in PXSelectJoin <CARecon, InnerJoin <CashAccount, On <CashAccount.cashAccountID, Equal <CARecon.cashAccountID> >, InnerJoin <Account, On <Account.accountID, Equal <CashAccount.accountID>, And <Match <Account, Current <AccessInfo.userName> > > >, InnerJoin <Sub, On <Sub.subID, Equal <CashAccount.subID>, And <Match <Sub, Current <AccessInfo.userName> > > > > > >, Where2 <Where <CARecon.cashAccountID, Equal <Required <CAEnqFilter.accountID> >, Or <Required <CAEnqFilter.accountID>, IsNull> >, And2 <Where <CARecon.reconDate, GreaterEqual <Required <CAEnqFilter.startDate> >, Or <Required <CAEnqFilter.startDate>, IsNull> >, And <Where <CARecon.reconDate, LessEqual <Required <CAEnqFilter.endDate> >, Or <Required <CAEnqFilter.endDate>, IsNull> > > > >, OrderBy <Asc <CARecon.reconDate, Asc <CARecon.reconNbr> > > > .Select(this, filter.AccountID, filter.AccountID, filter.StartDate, filter.StartDate, filter.EndDate, filter.EndDate)) { TimeSpan timespan; Exception ex; if ((PXLongOperation.GetStatus(UID, out timespan, out ex) == PXLongRunStatus.Aborted || PXLongOperation.GetStatus(UID, out timespan, out ex) == PXLongRunStatus.Completed) && listMessages != null && listMessages.Count > 0) { for (int i = 0; i < listMessages.Count; i++) { CAReconMessage message = (CAReconMessage)listMessages[i]; if (message.KeyCashAccount == recon.CashAccountID && message.KeyReconNbr == recon.ReconNbr) { CAReconRecords.Cache.RaiseExceptionHandling <CARecon.reconNbr>(recon, recon.ReconNbr, new PXSetPropertyException(message.Message, message.ErrorLevel)); } } } yield return(recon); } }
public EPApprovalProcess() { Records.SetProcessCaption(EP.Messages.Approve); Records.SetProcessAllCaption(EP.Messages.ApproveAll); Records.SetSelected <EPOwned.selected>(); Records.SetProcessDelegate(list => Approve(list, true)); Records.ConfirmationTitle = Messages.Approve; Records.ConfirmationMessage = Messages.ApproveAllConfirmation; this.Actions.Move(nameof(RejectAll), Records.ScheduleActionKey, true); this.Reject.StateSelectingEvents += new PXFieldSelecting(delegate(PXCache sender, PXFieldSelectingEventArgs e) { if (PXLongOperation.GetStatus(this.UID) != PXLongRunStatus.NotExists) { e.ReturnState = PXButtonState.CreateInstance(e.ReturnState, null, null, null, null, null, false, PXConfirmationType.Unspecified, null, null, null, null, null, null, null, null, null, null, null, typeof(EPApproval)); ((PXButtonState)e.ReturnState).Enabled = false; } }); this.RejectAll.StateSelectingEvents += new PXFieldSelecting(delegate(PXCache sender, PXFieldSelectingEventArgs e) { if (PXLongOperation.GetStatus(this.UID) != PXLongRunStatus.NotExists) { e.ReturnState = PXButtonState.CreateInstance(e.ReturnState, null, null, null, null, null, false, PXConfirmationType.Unspecified, null, null, null, null, null, null, null, null, null, null, null, typeof(EPApproval)); ((PXButtonState)e.ReturnState).Enabled = false; } }); }
public static void Process(EMailAccountSyncFilter filter, List <EMailSyncAccount> accounts, Object uid, string screenid) { //Check that process is singleton foreach (RowTaskInfo info in PXLongOperation.GetTaskList()) { if (Object.Equals(uid, info.NativeKey)) { continue; } PXLongRunStatus status = PXLongOperation.GetStatus(info.NativeKey); if (status != PXLongRunStatus.InProcess) { continue; } string company = PXLogin.ExtractCompany(info.User); string screen = (info.Screen ?? String.Empty).Replace(".", ""); if (screen == screenid && company == PXAccess.GetCompanyName()) { throw new PXException(ErrorMessages.PrevOperationNotCompleteYet); } } EmailsSyncMaint graph = CreateInstance <EmailsSyncMaint>(); using (new PXUTCTimeZoneScope()) { graph.ProcessInternal(new ProcessingContext(filter, accounts, graph.GetPolicies())); } }
protected virtual void SOCreateFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { SOCreateFilter filter = Filter.Current; FixedDemand.SetProcessDelegate(list => SOCreateProc(list, filter.PurchDate)); TimeSpan span; Exception message; PXLongRunStatus status = PXLongOperation.GetStatus(this.UID, out span, out message); PXUIFieldAttribute.SetVisible <SOLine.orderNbr>(Caches[typeof(SOLine)], null, (status == PXLongRunStatus.Completed || status == PXLongRunStatus.Aborted)); if (PXAccess.FeatureInstalled <FeaturesSet.warehouse>()) { INSite toxicsite = PXSelect <INSite, Where <INSite.siteID, Equal <Current <SOCreateFilter.siteID> >, And <INSite.active, Equal <True>, And <Where <INSite.addressID, IsNull, Or <INSite.contactID, IsNull> > > > > > .SelectSingleBound(this, new object[] { e.Row }); if (toxicsite != null) { throw new PXSetupNotEnteredException <INSite, INSite.siteCD>(Messages.WarehouseWithoutAddressAndContact, toxicsite.SiteCD, toxicsite.SiteCD); } } }
protected PXLongRunStatus GetLongOperationStatus() { TimeSpan timespan; Exception ex; return(PXLongOperation.GetStatus(this.UID, out timespan, out ex)); }
protected virtual void GLVoucher_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { GLVoucher row = (GLVoucher)e.Row; if (e.Row == null) { return; } Dictionary <string, Dictionary <Guid, CAMessage> > listMessages = PXLongOperation.GetCustomInfo(this.UID) as Dictionary <string, Dictionary <Guid, CAMessage> >; TimeSpan timespan; Exception ex; PXLongRunStatus status = PXLongOperation.GetStatus(this.UID, out timespan, out ex); if ((status == PXLongRunStatus.Aborted || status == PXLongRunStatus.Completed) && listMessages != null) { string key = row.VoucherBatchNbr; if (listMessages.ContainsKey(key)) { CAMessage message; if (listMessages[key].TryGetValue(row.RefNoteID ?? Guid.Empty, out message)) { sender.RaiseExceptionHandling <GLVoucher.refNbr>(row, row.RefNbr, new PXSetPropertyException <GLVoucher.refNbr>(message.Message, message.ErrorLevel)); } } } DisableOnProcessing(status); }
public virtual IEnumerable release(PXAdapter adapter) { PXCache cache = Caches[typeof(GLVoucherBatch)]; List <GLVoucherBatch> list = new List <GLVoucherBatch>(); foreach (GLVoucherBatch batch in VoucherBatches.Select()) { if (batch.Released != true && batch.Selected == true) { //cache.Update(batch); list.Add(batch); } } if (list.Count == 0) { throw new PXException(Messages.NoBatchesIsSelectedForRelease); } //Save.Press(); if (list.Count > 0) { PXLongOperation.ClearStatus(this.UID); PXLongOperation.StartOperation(this, delegate() { ReleaseBatch(list); }); TimeSpan timespan; Exception ex; PXLongRunStatus status = PXLongOperation.GetStatus(this.UID, out timespan, out ex); DisableOnProcessing(status); VoucherBatches.View.RequestRefresh(); } return(adapter.Get()); }
public virtual IEnumerable delete(PXAdapter adapter) { GLVoucherBatch batch = VoucherBatches.Current; if (batch == null) { throw new PXException(Messages.NoBatchesForDelete); } if (VoucherBatches.Ask(PXMessages.LocalizeFormatNoPrefixNLA(Messages.BatchDeleteConfirmation, batch.VoucherBatchNbr), MessageButtons.OKCancel) == WebDialogResult.OK) { if (batch.Released == true) { throw new PXException(Messages.BatchDeleteReleased); } List <GLVoucherBatch> fullList = new List <GLVoucherBatch>(); foreach (GLVoucherBatch voucherBatch in VoucherBatches.Select()) //create list to show all records during processing { fullList.Add(voucherBatch); } PXLongOperation.ClearStatus(this.UID); PXLongOperation.StartOperation(this, delegate() { DeleteBatch(batch, fullList.ToArray <object>()); }); TimeSpan timespan; Exception ex; PXLongRunStatus status = PXLongOperation.GetStatus(this.UID, out timespan, out ex); DisableOnProcessing(status); VoucherBatches.View.RequestRefresh(); } return(adapter.Get()); }
public virtual void SOShipmentFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { if (e.Row == null) { return; } SOShipmentFilter filter = e.Row as SOShipmentFilter; if (filter != null && !String.IsNullOrEmpty(filter.Action)) { Dictionary <string, object> parameters = Filter.Cache.ToDictionary(filter); Orders.SetProcessTarget(null, null, null, filter.Action, parameters); } int?action = GetActionIDByName(filter.Action); PXUIFieldAttribute.SetEnabled <SOShipmentFilter.invoiceDate>(sender, filter, action == SOShipmentEntryActionsAttribute.CreateInvoice || action == SOShipmentEntryActionsAttribute.CreateDropshipInvoice); PXUIFieldAttribute.SetEnabled <SOShipmentFilter.packagingType>(sender, filter, action != SOShipmentEntryActionsAttribute.CreateDropshipInvoice); PXUIFieldAttribute.SetEnabled <SOShipmentFilter.siteID>(sender, filter, action != SOShipmentEntryActionsAttribute.CreateDropshipInvoice); PXUIFieldAttribute.SetVisible <SOShipmentFilter.showPrinted>(sender, filter, action == SOShipmentEntryActionsAttribute.PrintLabels || action == SOShipmentEntryActionsAttribute.PrintPickList); PXUIFieldAttribute.SetDisplayName <SOShipment.shipmentNbr>(Orders.Cache, action == SOShipmentEntryActionsAttribute.CreateDropshipInvoice ? Messages.ReceiptNbr : Messages.ShipmentNbr); PXUIFieldAttribute.SetDisplayName <SOShipment.shipDate>(Orders.Cache, action == SOShipmentEntryActionsAttribute.CreateDropshipInvoice ? Messages.ReceiptDate : Messages.ShipmentDate); if (sosetup.Current.UseShipDateForInvoiceDate == true) { sender.RaiseExceptionHandling <SOShipmentFilter.invoiceDate>(filter, null, new PXSetPropertyException(Messages.UseInvoiceDateFromShipmentDateWarning, PXErrorLevel.Warning)); PXUIFieldAttribute.SetEnabled <SOShipmentFilter.invoiceDate>(sender, filter, false); } bool warnShipNotInvoiced = (action == SOShipmentEntryActionsAttribute.PostInvoiceToIN && (string)Orders.GetTargetFill(null, null, null, filter.Action, nameof(SOShipment.status)) != SOShipmentStatus.Completed && sosetup.Current.UseShippedNotInvoiced != true && sosetup.Current.UseShipDateForInvoiceDate != true); Exception warnShipNotInvoicedExc = warnShipNotInvoiced ? new PXSetPropertyException(Messages.ShipNotInvoicedWarning, PXErrorLevel.Warning) : null; sender.RaiseExceptionHandling <SOShipmentFilter.action>(filter, null, warnShipNotInvoicedExc); bool showPrintSettings = IsPrintingAllowed(filter); PXUIFieldAttribute.SetVisible <SOShipmentFilter.printWithDeviceHub>(sender, filter, showPrintSettings); PXUIFieldAttribute.SetVisible <SOShipmentFilter.definePrinterManually>(sender, filter, showPrintSettings); PXUIFieldAttribute.SetVisible <SOShipmentFilter.printerID>(sender, filter, showPrintSettings); PXUIFieldAttribute.SetVisible <SOShipmentFilter.numberOfCopies>(sender, filter, showPrintSettings); PXUIFieldAttribute.SetEnabled <SOShipmentFilter.definePrinterManually>(sender, filter, filter.PrintWithDeviceHub == true); PXUIFieldAttribute.SetEnabled <SOShipmentFilter.numberOfCopies>(sender, filter, filter.PrintWithDeviceHub == true); PXUIFieldAttribute.SetEnabled <SOShipmentFilter.printerID>(sender, filter, filter.PrintWithDeviceHub == true && filter.DefinePrinterManually == true); if (filter.PrintWithDeviceHub != true || filter.DefinePrinterManually != true) { filter.PrinterID = null; } bool showInvoiceSeparately = action.IsIn(SOShipmentEntryActionsAttribute.CreateInvoice, SOShipmentEntryActionsAttribute.CreateDropshipInvoice); PXUIFieldAttribute.SetEnabled <SOShipment.billSeparately>(Orders.Cache, null, showInvoiceSeparately && PXLongOperation.GetStatus(this.UID) == PXLongRunStatus.NotExists); PXUIFieldAttribute.SetVisible <SOShipment.billSeparately>(Orders.Cache, null, showInvoiceSeparately); }
protected virtual void SOCreateFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { SOCreateFilter filter = Filter.Current; FixedDemand.SetProcessDelegate(list => SOCreateProc(list, filter.PurchDate)); TimeSpan span; Exception message; PXLongRunStatus status = PXLongOperation.GetStatus(this.UID, out span, out message); PXUIFieldAttribute.SetVisible <SOLine.orderNbr>(Caches[typeof(SOLine)], null, (status == PXLongRunStatus.Completed || status == PXLongRunStatus.Aborted)); }
protected virtual void GLVoucherBatch_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { GLVoucherBatch row = (GLVoucherBatch)e.Row; if (e.Row == null) { return; } Dictionary <string, Dictionary <Guid, CAMessage> > listMessages = PXLongOperation.GetCustomInfo(this.UID) as Dictionary <string, Dictionary <Guid, CAMessage> >; TimeSpan timespan; Exception ex; PXLongRunStatus status = PXLongOperation.GetStatus(this.UID, out timespan, out ex); if ((status == PXLongRunStatus.Aborted || status == PXLongRunStatus.Completed) && listMessages != null) { string key = row.VoucherBatchNbr; if (listMessages.ContainsKey(key)) { VouchersInBatch.View.AllowSelect = true; CAMessage message; if (listMessages[key].TryGetValue(Guid.Empty, out message)) { sender.RaiseExceptionHandling <GLVoucherBatch.voucherBatchNbr>(row, row.VoucherBatchNbr, new PXSetPropertyException <GLVoucherBatch.voucherBatchNbr>(message.Message, message.ErrorLevel)); } else { sender.RaiseExceptionHandling <GLVoucherBatch.voucherBatchNbr>(row, row.VoucherBatchNbr, new PXSetPropertyException <GLVoucherBatch.voucherBatchNbr>("Processed", PXErrorLevel.RowInfo)); } } else { VouchersInBatch.View.AllowSelect = false; } } else { VouchersInBatch.View.AllowSelect = false; PXUIFieldAttribute.SetEnabled(sender, null, status == PXLongRunStatus.NotExists); } DisableOnProcessing(status); if (row != null) { PXUIFieldAttribute.SetEnabled(sender, row, false); PXUIFieldAttribute.SetEnabled <GLVoucherBatch.selected>(sender, row, row.Released == false); PXUIFieldAttribute.SetEnabled <GLVoucherBatch.descr>(sender, row, row.Released == false); } PXUIFieldAttribute.SetEnabled <GLVoucherBatch.released>(sender, null, false); PXUIFieldAttribute.SetEnabled <GLVoucherBatch.voucherBatchNbr>(sender, null, false); PXUIFieldAttribute.SetEnabled <GLVoucherBatch.docCount>(sender, null, false); }
protected void _(Events.RowSelected <POCreate.POCreateFilter> e) { POCreate.POCreateFilter filter = this.Base.Filter.Current; if (filter == null) { return; } this.Base.FixedDemand.SetProcessDelegate((PXProcessingBase <POFixedDemand> .ProcessListDelegate)(list => POCreate_Extension.CreateProc2(list, filter.PurchDate, filter.OrderNbr != null))); PXLongRunStatus status = PXLongOperation.GetStatus(this.Base.UID, out TimeSpan _, out Exception _); PXUIFieldAttribute.SetVisible <POLine.orderNbr>(this.Base.Caches[typeof(POLine)], (object)null, status == PXLongRunStatus.Completed || status == PXLongRunStatus.Aborted); PXUIFieldAttribute.SetVisible <POCreate.POCreateFilter.orderTotal>(e.Cache, (object)null, filter.VendorID.HasValue); }