protected virtual void ResetFilterDates(InventoryTranByAcctEnqFilter aRow) { FinPeriod period = PXSelectReadonly <FinPeriod, Where <FinPeriod.finPeriodID, Equal <Required <FinPeriod.finPeriodID> > > > .Select(this, aRow.FinPeriodID); if (period != null) { aRow.PeriodStartDate = period.StartDate; aRow.PeriodEndDate = period.EndDate; aRow.EndDate = null; aRow.StartDate = null; } }
public FinPeriod FindLastPeriod(int?organizationID, bool clearQueryCache = false) { PXSelectBase <FinPeriod> select = new PXSelectReadonly <FinPeriod, Where <FinPeriod.organizationID, Equal <Required <FinPeriod.organizationID> > >, OrderBy <Desc <FinPeriod.finPeriodID> > >(Graph); if (clearQueryCache) { select.View.Clear(); } return(select.View.SelectSingle(organizationID) as FinPeriod); }
protected virtual OrganizationFinYear GenerateNextOrganizationFinYear(OrganizationFinYear year) { string generatedYearNumber = $"{int.Parse(year.Year) + 1:0000}"; MasterFinYear masterFinYear; while ((masterFinYear = FinPeriodRepository.FindMasterFinYearByID(generatedYearNumber, clearQueryCache: true)) == null) { MasterCalendarGraph.Clear(); MasterCalendarGraph.GenerateCalendar( FinPeriod.organizationID.MasterValue, int.Parse(FinPeriodRepository.FindLastYear(FinPeriod.organizationID.MasterValue, clearQueryCache: true).Year), int.Parse(generatedYearNumber)); } short generatedFinPeriodsCount = (short)masterFinYear.FinPeriods; if (YearSetup.Current.HasAdjustmentPeriod == true) { generatedFinPeriodsCount--; } OrganizationFinPeriod lastNonAdjustmentOrgFinPeriod = this.FinPeriodRepository.FindLastNonAdjustmentOrganizationFinPeriodOfYear(year.OrganizationID, year.Year, clearQueryCache: true); int generatedMasterYearNumber = int.Parse(lastNonAdjustmentOrgFinPeriod.FinYear); List <MasterFinPeriod> masterFinPeriods; PXSelectBase <MasterFinPeriod> select = new PXSelectReadonly < MasterFinPeriod, Where <MasterFinPeriod.finPeriodID, Greater <Required <MasterFinPeriod.finPeriodID> >, And <MasterFinPeriod.startDate, NotEqual <MasterFinPeriod.endDate> > >, OrderBy < Asc <MasterFinPeriod.finPeriodID> > >(this); select.View.Clear(); while ((masterFinPeriods = select .SelectWindowed(0, generatedFinPeriodsCount, lastNonAdjustmentOrgFinPeriod.MasterFinPeriodID) .RowCast <MasterFinPeriod>() .ToList()).Count < generatedFinPeriodsCount) { generatedMasterYearNumber++; MasterCalendarGraph.Clear(); MasterCalendarGraph.GenerateCalendar( FinPeriod.organizationID.MasterValue, int.Parse(FinPeriodRepository.FindLastYear(FinPeriod.organizationID.MasterValue, clearQueryCache: true).Year), generatedMasterYearNumber); select.View.Clear(); } MasterFinPeriod startMasterFinPeriod = masterFinPeriods.First(); return(GenerateSingleOrganizationFinYear((int)year.OrganizationID, masterFinYear, startMasterFinPeriod)); }
//Función que crea la esturcuta de una tabla (Columnas) public static DataTable CreateTableStructure(GIDesign genericInq) { //Crea la instancia al graph de las consultas genericas PXGenericInqGrph graphGetColumns = PXGenericInqGrph.CreateInstance(genericInq.DesignID.Value); //Inicializa el listado de columnas List <string> listColumns = new List <string>(); //Recorre, acomoda y agrega las columnas a la lista en orden foreach (GIResult resultMap in PXSelectReadonly <GIResult, Where <GIResult.designID, Equal <Required <GIResult.designID> > >, OrderBy <Asc <GIResult.lineNbr> > > .Select(graphGetColumns, new object[] { genericInq.DesignID.Value })) { // Solo agregamos si no está vacío if (!string.IsNullOrWhiteSpace(resultMap?.Caption)) { listColumns.Add(resultMap.Caption.ToString()); } } //Crea una nueva Tabla DataTable. System.Data.DataTable table = new DataTable("Result"); // Define las filas y columnas DataColumn column; // Crea la primera columna (autonumerable) column = new DataColumn(); column.DataType = System.Type.GetType("System.Int32"); column.ColumnName = "_id"; column.AutoIncrement = true; // Agrega la columna a la tabla table.Columns.Add(column); //Genera las columnas de acuerdo a la consulta genérica foreach (var itemColumn in listColumns) { // Crea la segunda columna column = new DataColumn(); column.DataType = System.Type.GetType("System.String"); column.ColumnName = itemColumn; column.AutoIncrement = false; // Agrega la columna a la tabla table.Columns.Add(column); } // Vuelve la columna "_id" PrimaryKey DataColumn[] PrimaryKeyColumns = new DataColumn[1]; PrimaryKeyColumns[0] = table.Columns["_id"]; table.PrimaryKey = PrimaryKeyColumns; //Regresa el esquema base de la tabla (columnas) return(table); }
protected virtual bool HasTransactions(PaymentTypeInstance aRow) { PXEntryStatus status = this.PaymentTypeInstance.Cache.GetStatus(aRow); if (status == PXEntryStatus.Inserted && status == PXEntryStatus.InsertedDeleted) { return(false); } PTInstTran tran = PXSelectReadonly <PTInstTran, Where <PTInstTran.pTInstanceID, Equal <Required <PTInstTran.pTInstanceID> > > > .SelectWindowed(this, 0, 1, aRow.PTInstanceID); return(tran != null); }
public virtual void GetGenerationRules(int? templateItemID, out List<INMatrixGenerationRule> idGenerationRules, out List<INMatrixGenerationRule> descrGenerationRules) { var generationRules = PXSelectReadonly<INMatrixGenerationRule, Where<INMatrixGenerationRule.templateID, Equal<Required<INMatrixGenerationRule.templateID>>>, OrderBy<Asc<INMatrixGenerationRule.sortOrder>>> .Select(_graph, templateItemID) .RowCast<INMatrixGenerationRule>() .ToList(); idGenerationRules = generationRules.Where(r => r.Type == INMatrixGenerationRule.type.ID).ToList(); descrGenerationRules = generationRules.Where(r => r.Type == INMatrixGenerationRule.type.Description).ToList(); }
public OrganizationFinYear FindOrganizationFinYearByID(int?organizationID, string year, bool clearQueryCache = false) { PXSelectBase <OrganizationFinYear> select = new PXSelectReadonly < OrganizationFinYear, Where <OrganizationFinYear.year, Equal <Required <OrganizationFinYear.year> >, And <OrganizationFinYear.organizationID, Equal <Required <OrganizationFinYear.organizationID> > > > >(Graph); if (clearQueryCache) { select.View.Clear(); } return(select.View.SelectSingle(year, organizationID) as OrganizationFinYear); }
public virtual IEnumerable reminderListCurrent([PXInt] int?taskID) { if (taskID == null) { if (ReminderList.Current == null) { yield break; } taskID = ReminderList.Current.TaskID; } yield return((EPActivity)PXSelectReadonly <EPActivity> .Search <EPActivity.taskID>(this, taskID)); }
public virtual INTran GetOriginalInTran(PXGraph graph, string receiptNbr, int?lineNbr) { if (receiptNbr == null || lineNbr == null) { return(null); } return (PXSelectReadonly <INTran, Where <INTran.docType, NotEqual <INDocType.adjustment>, And <INTran.docType, NotEqual <INDocType.transfer>, And <INTran.pOReceiptNbr, Equal <Required <INTran.pOReceiptNbr> >, And <INTran.pOReceiptLineNbr, Equal <Required <INTran.pOReceiptLineNbr> > > > > > > .SelectWindowed(graph, 0, 1, receiptNbr, lineNbr)); }
public OrganizationFinPeriod FindOrganizationFinPeriodByID(int?organizationID, string finPeriodID, bool clearQueryCache = false) { PXSelectBase <OrganizationFinPeriod> select = new PXSelectReadonly < OrganizationFinPeriod, Where <OrganizationFinPeriod.finPeriodID, Equal <Required <OrganizationFinPeriod.finPeriodID> >, And <OrganizationFinPeriod.organizationID, Equal <Required <OrganizationFinPeriod.organizationID> > > > >(Graph); if (clearQueryCache) { select.View.Clear(); } return(select.View.SelectSingle(finPeriodID, organizationID) as OrganizationFinPeriod); }
/// <summary> /// Calculates Sales Price. /// </summary> /// <param name="sender">Cache</param> /// <param name="inventoryID">Inventory</param> /// <param name="curyID">Currency</param> /// <param name="UOM">Unit of measure</param> /// <param name="date">Date</param> /// <returns>Sales Price.</returns> /// <remarks>AlwaysFromBaseCury flag in the SOSetup is considered when performing the calculation.</remarks> public static decimal?CalculateSalesPrice(PXCache sender, int inventoryID, string curyID, string UOM, DateTime date) { bool alwaysFromBase = false; SOSetup sosetup = PXSelectReadonly <SOSetup> .Select(sender.Graph); if (sosetup != null) { alwaysFromBase = sosetup.AlwaysFromBaseCury == true; } return(SOSalesPriceEntry.CalculateSalesPrice(sender, inventoryID, curyID, UOM, date, alwaysFromBase)); }
protected virtual bool ReloadHasChild() { var childSelect = new PXSelectReadonly <InventoryItem, Where <InventoryItem.templateItemID, Equal <Current <InventoryItem.inventoryID> > > >(this); childSelect.Cache.ClearQueryCache(); using (new PXFieldScope(childSelect.View, typeof(InventoryItem.inventoryID))) { InventoryItem child = childSelect.Select(); return(child != null); } }
public override CATran DefaultValues(PXCache sender, CATran catran_Row, object orig_Row) { CAAdj parentDoc = (CAAdj)orig_Row; if ((parentDoc.Released == true) && (catran_Row.TranID != null)) { return(null); } if (catran_Row.TranID == null || catran_Row.TranID < 0) { catran_Row.OrigModule = BatchModule.CA; catran_Row.OrigTranType = parentDoc.AdjTranType; if (parentDoc.TransferNbr == null) { catran_Row.OrigRefNbr = parentDoc.AdjRefNbr; } else { catran_Row.OrigRefNbr = parentDoc.TransferNbr; } } catran_Row.CashAccountID = parentDoc.CashAccountID; catran_Row.ExtRefNbr = parentDoc.ExtRefNbr; catran_Row.CuryID = parentDoc.CuryID; catran_Row.CuryInfoID = parentDoc.CuryInfoID; catran_Row.CuryTranAmt = parentDoc.CuryTranAmt * (parentDoc.DrCr == DrCr.Debit ? 1 : -1); catran_Row.TranAmt = parentDoc.TranAmt * (parentDoc.DrCr == DrCr.Debit ? 1 : -1); catran_Row.DrCr = parentDoc.DrCr; catran_Row.TranDate = parentDoc.TranDate; catran_Row.TranDesc = parentDoc.TranDesc; catran_Row.ReferenceID = null; catran_Row.Released = parentDoc.Released; catran_Row.Hold = parentDoc.Hold; catran_Row.FinPeriodID = parentDoc.FinPeriodID; catran_Row.TranPeriodID = parentDoc.TranPeriodID; catran_Row.Cleared = parentDoc.Cleared; catran_Row.ClearDate = parentDoc.ClearDate; PXSelectBase <CashAccount> selectStatement = new PXSelectReadonly <CashAccount, Where <CashAccount.cashAccountID, Equal <Required <CashAccount.cashAccountID> > > >(sender.Graph); CashAccount cashacc = (CashAccount)selectStatement.View.SelectSingle(catran_Row.CashAccountID); if (cashacc != null && cashacc.Reconcile == false && (catran_Row.Cleared != true || catran_Row.TranDate == null)) { catran_Row.Cleared = true; catran_Row.ClearDate = catran_Row.TranDate; } return(catran_Row); }
protected virtual void Segment_RowDeleting(PXCache cache, PXRowDeletingEventArgs e) { var row = (Segment)e.Row; var dimensionID = row.DimensionID; var segmentID = row.SegmentID; if (Header.Current.ParentDimensionID != null && row.Inherited == true) { throw new PXException(Messages.SegmentNotOverridden, segmentID); } if (PXSelectReadonly <Segment, Where <Segment.parentDimensionID, Equal <Current <Segment.dimensionID> >, And <Segment.segmentID, Equal <Current <Segment.segmentID> > > > > .SelectMultiBound(this, new object[] { row }).Count > 0) { throw new PXException(Messages.SegmentHasChilds, segmentID); } Segment lastSegmeent = PXSelect <Segment, Where <Segment.dimensionID, Equal <Current <Segment.dimensionID> > >, OrderBy <Desc <Segment.segmentID> > > .SelectSingleBound(this, new object[] { row }); if (lastSegmeent != null && lastSegmeent.SegmentID > segmentID) { throw new PXException(Messages.SegmentIsNotLast, segmentID); } if (((SegmentValue)PXSelect <SegmentValue, Where <SegmentValue.dimensionID, Equal <Optional <Segment.dimensionID> >, And <SegmentValue.segmentID, Equal <Optional <Segment.segmentID> > > > > . Select(this, dimensionID, segmentID)) != null) { if (row.ParentDimensionID == null) { throw new PXException(Messages.SegmentHasValues, segmentID); } var answer = Header.Ask(Messages.Warning, PXMessages.LocalizeFormatNoPrefixNLA(Messages.SegmentHasValuesQuestion, segmentID), MessageButtons.YesNoCancel, MessageIcon.Warning); switch (answer) { case WebDialogResult.Yes: break; case WebDialogResult.Cancel: e.Cancel = true; break; case WebDialogResult.No: default: throw new PXException(Messages.SegmentHasValues, segmentID); } } }
public override void Persist() { OrganizationLedgerLinkMaint linkMaint = GetExtension <OrganizationLedgerLinkMaint>(); foreach (Ledger ledger in LedgerRecords.Cache.Deleted) { CanBeLedgerDeleted(ledger); } foreach (Ledger ledger in LedgerRecords.Cache.Updated) { string origBalanceType = LedgerRecords.Cache.GetValueOriginal <Ledger.balanceType>(ledger) as string; if (origBalanceType != ledger.BalanceType) { GLTran existingReleasedTran = PXSelectReadonly <GLTran, Where <GLTran.ledgerID, Equal <Required <GLTran.ledgerID> >, And <GLTran.released, Equal <True> > > > .SelectSingleBound(this, null, ledger.LedgerID); if (existingReleasedTran != null) { throw new PXException(Messages.TheTypeOfTheLedgerCannotBeChangedBecauseAtLeastOneReleasedGLTransactionExists, ledger.LedgerCD); } if (ledger.BalanceType == LedgerBalanceType.Actual) { CanBeLedgerSetAsActual(ledger, linkMaint); } if (origBalanceType == LedgerBalanceType.Actual) { SetActualLedgerIDNullInRelatedCompanies(ledger, linkMaint); } } } Organization[] organizations = OrganizationView.Cache.Updated.Cast <Organization>() .Select(PXCache <Organization> .CreateCopy).ToArray(); using (var tranScope = new PXTransactionScope()) { base.Persist(); OrganizationView.Cache.Clear(); linkMaint.OnPersist(organizations); tranScope.Complete(); } }
public Branch GetBranchByID(int?branchID) { var branch = (Branch)PXSelectReadonly <Branch, Where <Branch.branchID, Equal <Required <Branch.branchID> > > > .Select(_graph, branchID); if (branch == null) { throw new PXException(PX.Objects.Common.Messages.EntityWithIDDoesNotExist, EntityHelper.GetFriendlyEntityName(typeof(Branch)), branchID); } return(branch); }
public static CATran DefaultValues(PXCache sender, CATran catran_Row, CADeposit parentDoc, string fieldName) { if ((parentDoc.Released == true) && (catran_Row.TranID != null) || IsCreationNeeded(parentDoc) == false) { return(null); } catran_Row.OrigModule = BatchModule.CA; catran_Row.OrigTranType = parentDoc.TranType; catran_Row.OrigRefNbr = parentDoc.RefNbr; catran_Row.CashAccountID = parentDoc.ExtraCashAccountID; catran_Row.ExtRefNbr = parentDoc.ExtRefNbr; catran_Row.CuryID = parentDoc.CuryID; catran_Row.CuryInfoID = parentDoc.CuryInfoID; catran_Row.DrCr = parentDoc.DrCr == CADrCr.CADebit ? CADrCr.CACredit : CADrCr.CADebit; catran_Row.CuryTranAmt = parentDoc.CuryExtraCashTotal * (catran_Row.DrCr == CADrCr.CADebit ? 1 : -1); catran_Row.TranAmt = parentDoc.ExtraCashTotal * (catran_Row.DrCr == CADrCr.CADebit ? 1 : -1); catran_Row.TranDate = parentDoc.TranDate; catran_Row.TranDesc = parentDoc.TranDesc; catran_Row.ReferenceID = null; catran_Row.Released = parentDoc.Released; catran_Row.Hold = parentDoc.Hold; catran_Row.FinPeriodID = parentDoc.FinPeriodID; catran_Row.TranPeriodID = parentDoc.TranPeriodID; catran_Row.Cleared = parentDoc.Cleared; catran_Row.ClearDate = parentDoc.ClearDate; if (parentDoc.DocType == CATranType.CAVoidDeposit) { CADeposit voidedDoc = PXSelectReadonly <CADeposit, Where <CADeposit.refNbr, Equal <Required <CADeposit.refNbr> >, And <CADeposit.tranType, Equal <Required <CADeposit.tranType> > > > > .Select(sender.Graph, parentDoc.RefNbr, CATranType.CADeposit); if (voidedDoc != null) { catran_Row.VoidedTranID = (long?)sender.GetValue(voidedDoc, fieldName); } } PXSelectBase <CashAccount> selectStatement = new PXSelectReadonly <CashAccount, Where <CashAccount.cashAccountID, Equal <Required <CashAccount.cashAccountID> > > >(sender.Graph); CashAccount cashacc = (CashAccount)selectStatement.View.SelectSingle(catran_Row.CashAccountID); if (cashacc != null && cashacc.Reconcile == false && (catran_Row.Cleared != true || catran_Row.TranDate == null)) { catran_Row.Cleared = true; catran_Row.ClearDate = catran_Row.TranDate; } return(catran_Row); }
public Contact GetContact(int?contactID) { var contact = (Contact)PXSelectReadonly <Contact, Where <Contact.contactID, Equal <Required <BAccount.defContactID> > > > .Select(_graph, contactID); if (contact == null) { throw new PXException(PX.Objects.Common.Messages.EntityWithIDDoesNotExist, EntityHelper.GetFriendlyEntityName(typeof(Contact)), contactID); } return(contact); }
public FinYear FindFirstYear(int?organizationID, bool clearQueryCache = false) { PXSelectBase <FinYear> select = new PXSelectReadonly < FinYear, Where <FinYear.organizationID, Equal <Required <FinYear.organizationID> > >, OrderBy < Asc <FinYear.year> > >(Graph); if (clearQueryCache) { select.View.Clear(); } return(select.View.SelectSingle(organizationID) as FinYear); }
public static void EnsureMigrationModeDisabled(PXGraph graph, APSetup setup = null) { setup = setup ?? PXSelectReadonly <APSetup> .Select(graph); if (setup?.MigrationMode != true) { return; } throw new PXSetupNotEnteredException( Messages.MigrationModeIsActivated, typeof(APSetup), Messages.APSetup); }
private void PopulateBucketList(object Row) { List <int> AllowedValues = new List <int>(); List <string> AllowedLabels = new List <string>(); List <int> DefaultAllowedValues = new List <int>(new int[] { 0 }); List <string> DefaultAllowedLabels = new List <string>(new string[] { "undefined" }); string BucketType = null; switch (((Tax)Row).TaxType) { case CSTaxType.VAT: BucketType = "%"; break; case CSTaxType.Sales: case CSTaxType.Use: case CSTaxType.Withholding: BucketType = CSTaxBucketType.Sales; break; } foreach (TaxBucket bucket in PXSelectReadonly <TaxBucket, Where <TaxBucket.vendorID, Equal <Required <TaxBucket.vendorID> >, And <TaxBucket.bucketType, Like <Required <TaxBucket.bucketType> > > > > .Select(this, ((Tax)Row).TaxVendorID, BucketType)) { AllowedValues.Add((int)bucket.BucketID); AllowedLabels.Add(bucket.Name); } if (((Tax)Row).TaxVendorID == null) { if (BucketType == "%") { AllowedValues.Add((int)-1); AllowedLabels.Add(Messages.DefaultInputGroup); } AllowedValues.Add((int)-2); AllowedLabels.Add(Messages.DefaultOutputGroup); } if (AllowedValues.Count > 0) { PXIntListAttribute.SetList <TaxRev.taxBucketID>(TaxRevisions.Cache, null, AllowedValues.ToArray(), AllowedLabels.ToArray()); } else { PXIntListAttribute.SetList <TaxRev.taxBucketID>(TaxRevisions.Cache, null, DefaultAllowedValues.ToArray(), DefaultAllowedLabels.ToArray()); } }
public bool IsAlreadyImported(int?aCashAccountID, string aExtTranID, out string aRefNbr) { aRefNbr = null; CABankTran detail = PXSelectReadonly <CABankTran, Where <CABankTran.tranType, Equal <Current <CABankTranHeader.tranType> >, And <CABankTran.cashAccountID, Equal <Required <CABankTran.cashAccountID> >, And <CABankTran.extTranID, Equal <Required <CABankTran.extTranID> > > > > > .Select(this, aCashAccountID, aExtTranID); if (detail != null) { aRefNbr = detail.TranID.ToString(); } return(detail != null); }
protected virtual void INKitSpecHdr_RowInserted(PXCache sender, PXRowInsertedEventArgs e) { INKitSpecHdr row = e.Row as INKitSpecHdr; if (row != null && row.IsNonStock == true) { INKitSpecHdr existing = PXSelectReadonly <INKitSpecHdr, Where <INKitSpecHdr.kitInventoryID, Equal <Current <INKitSpecHdr.kitInventoryID> > > > .Select(this); if (existing != null) { sender.RaiseExceptionHandling <INKitSpecHdr.revisionID>(e.Row, row.RevisionID, new PXSetPropertyException(Messages.SingleRevisionForNS)); } } }
public virtual IEnumerable reminderListCurrent([PXGuid] Guid?noteID) { if (noteID == null) { if (ReminderList.Current == null) { yield break; } noteID = ReminderList.Current.NoteID; } yield return((CRActivity)PXSelectReadonly <CRActivity> .Search <CRActivity.noteID>(this, noteID)); }
protected virtual void INBarCodeItem_ExpireDate_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e) { INPIDetail exists = PXSelectReadonly <INPIDetail, Where <INPIDetail.pIID, Equal <Current <INPIHeader.pIID> >, And <INPIDetail.inventoryID, Equal <Current <INBarCodeItem.inventoryID> >, And <INPIDetail.lotSerialNbr, Equal <Current <INBarCodeItem.lotSerialNbr> > > > > > .SelectWindowed(this, 0, 1); if (exists != null) { e.NewValue = exists.ExpireDate; e.Cancel = true; } }
private void BuildLists(PXGraph graph) { var boxes = PXSelectReadonly <AP1099Box> .Select(graph) .RowCast <AP1099Box>() .ToArray(); if (!boxes.Any()) { return; } _AllowedValues = boxes.Select(box => (int)box.BoxNbr).ToArray(); _AllowedLabels = boxes.Select(box => string.Concat(box.BoxNbr, "-", box.Descr)).ToArray(); }
private CurrencyRate getCuryRate(PXCache cache) { if (string.Equals(this.CuryID, this.BaseCuryID, StringComparison.OrdinalIgnoreCase)) { return(null); } return(PXSelectReadonly <CurrencyRate, Where <CurrencyRate.toCuryID, Equal <Required <CurrencyInfo.baseCuryID> >, And <CurrencyRate.fromCuryID, Equal <Required <CurrencyInfo.curyID> >, And <CurrencyRate.curyRateType, Equal <Required <CurrencyInfo.curyRateTypeID> >, And <CurrencyRate.curyEffDate, LessEqual <Required <CurrencyInfo.curyEffDate> > > > > >, OrderBy <Desc <CurrencyRate.curyEffDate> > > .SelectWindowed(cache.Graph, 0, 1, BaseCuryID, CuryID, CuryRateTypeID, CuryEffDate)); }
public override void Persist() { if (SiteMaster.Current != null) { object devConfirmPassword = SiteMaster.Current.DevConfirmPassword; SiteMaster.Cache.RaiseFieldVerifying <KCSiteMaster.devConfirmPassword>(SiteMaster.Current, ref devConfirmPassword); object ftpConfirmPassword = SiteMaster.Current.FTPConfirmPassword; SiteMaster.Cache.RaiseFieldVerifying <KCSiteMaster.fTPConfirmPassword>(SiteMaster.Current, ref ftpConfirmPassword); KCSiteMaster siteExists = PXSelectReadonly <KCSiteMaster, Where <KCSiteMaster.accountId, Equal <Required <KCSiteMaster.accountId> >, And <KCSiteMaster.siteMasterCD, NotEqual <Required <KCSiteMaster.siteMasterCD> > > > > .Select(this, SiteMaster.Current.AccountId, SiteMaster.Current.SiteMasterCD); if (siteExists != null) { string msg = KCMessages.AlreadyExistAccountId; SiteMaster.Cache.RaiseExceptionHandling <KCSiteMaster.accountId>(SiteMaster.Current, SiteMaster.Current.AccountId, new PXSetPropertyException <KCSiteMaster.accountId>(msg)); throw new PXSetPropertyException <KCSiteMaster.accountId>(msg); } } var isCATaxZoneExist = TaxZoneId.SelectSingle(KCConstants.Channel); var isCATaxExist = TaxId.SelectSingle(KCConstants.ChannelAdvisor); SalesTaxMaint stax = PXGraph.CreateInstance <SalesTaxMaint>(); TaxZoneMaint CAtaxzone = PXGraph.CreateInstance <TaxZoneMaint>(); Tax tax = stax.Tax.Insert(); TaxZone newTaxZone = CAtaxzone.TxZone.Insert(); TaxZoneDet taxZoneDet = CAtaxzone.TxZoneDet.Insert(); if (isCATaxExist == null) { stax.Tax.Cache.SetValue <Tax.taxID>(tax, KCConstants.ChannelAdvisor); stax.Tax.Cache.SetValue <Tax.descr>(tax, KCConstants.ChannelAdvisor); stax.Tax.Cache.SetValue <Tax.salesTaxAcctID>(tax, KCConstants.salesTaxAcctID); stax.Tax.Cache.SetValue <Tax.salesTaxSubID>(tax, KCConstants.salesTaxSubID); stax.Tax.Cache.SetValue <Tax.taxCalcType>(tax, KCConstants.taxCalcType); stax.Tax.Cache.SetValue <Tax.taxCalcLevel>(tax, KCConstants.taxCalcLevel); stax.Persist(); } if (isCATaxZoneExist == null) { CAtaxzone.TxZone.Cache.SetValue <TaxZone.taxZoneID>(newTaxZone, KCConstants.Channel); CAtaxzone.TxZone.Cache.SetValue <TaxZone.descr>(newTaxZone, KCConstants.Channel); CAtaxzone.TxZone.Cache.SetValue <TaxZone.dfltTaxCategoryID>(newTaxZone, KCConstants.Taxable); CAtaxzone.TxZoneDet.Cache.SetValue <TaxZoneDet.taxZoneID>(taxZoneDet, newTaxZone.TaxZoneID); CAtaxzone.TxZoneDet.Cache.SetValue <TaxZoneDet.taxID>(taxZoneDet, KCConstants.ChannelAdvisor); CAtaxzone.Persist(); } base.Persist(); }
protected virtual void _(Events.RowSelecting <FSAppointmentDet> e) { if (e.Row == null) { return; } var fsAppointmentDetURow = (FSAppointmentDet)e.Row; // FSAppointmentDet.BillingRule is an Unbound field so we need to calculate it if (fsAppointmentDetURow.IsService == true) { if (fsAppointmentDetURow.LineType == ID.LineType_ALL.NONSTOCKITEM) { fsAppointmentDetURow.BillingRule = ID.BillingRule.FLAT_RATE; } else if (fsAppointmentDetURow.SODetID > 0) { using (new PXConnectionScope()) { var fsSODetRow = PXSelectReadonly <FSSODet, Where < FSSODet.sODetID, Equal <Required <FSSODet.sODetID> > > > .Select(e.Cache.Graph, fsAppointmentDetURow.SODetID); fsAppointmentDetURow.BillingRule = ((FSSODet)fsSODetRow)?.BillingRule; } } } else if (fsAppointmentDetURow.IsInventoryItem == true || fsAppointmentDetURow.IsPickupDelivery == true) { fsAppointmentDetURow.BillingRule = ID.BillingRule.FLAT_RATE; } else { fsAppointmentDetURow.BillingRule = ID.BillingRule.NONE; } // IsFree is an Unbound field so we need to calculate it fsAppointmentDetURow.IsFree = ServiceOrderAppointmentHandlers.IsFree(fsAppointmentDetURow.BillingRule, fsAppointmentDetURow.ManualPrice, fsAppointmentDetURow.LineType); if (fsAppointmentDetURow.IsInventoryItem) { using (new PXConnectionScope()) { SharedFunctions.SetInventoryItemExtensionInfo(this, fsAppointmentDetURow.InventoryID, fsAppointmentDetURow); } } }
public static void LogImportCount(SOImportProcess.SOImportFilter currentimportcount, string integrationId, SOPartialMaint logGraph, int?processId, string screenAction, bool isNoOrdersPrepared) { SOOrderProcessLog processcount = null; switch (screenAction) { case SOConstants.importorders: processcount = new SOOrderProcessLog(); processcount.ProcessDate = PX.Common.PXTimeZoneInfo.Now; processcount.TotalRecordstoImport = isNoOrdersPrepared == true ? 0 : currentimportcount.TotalRecordsToImport; processcount.ImportedRecordsCount = currentimportcount.TotalImportedRecords; processcount.FailedRecordsCount = currentimportcount.TotalFailedRecords; processcount.IntegrationID = integrationId; processcount.Operation = SOConstants.btnPrepare; logGraph.OrderProcessLog.Insert(processcount); logGraph.Actions.PressSave(); logGraph.OrderProcessLog.Current.ParentProcessID = logGraph.OrderProcessLog.Current.ProcessID; logGraph.OrderProcessLog.Update(logGraph.OrderProcessLog.Current); logGraph.Actions.PressSave(); break; case SOConstants.scheduleimportorders: processcount = PXSelectReadonly <SOOrderProcessLog, Where <SOOrderProcessLog.processID, Equal <Required <SOOrderProcessLog.processID> > > > .Select(logGraph, Convert.ToInt32(processId)); if (processcount == null) { processcount = new SOOrderProcessLog(); processcount.ProcessDate = PX.Common.PXTimeZoneInfo.Now; processcount.Operation = SOConstants.btnPrepareAndImport; processcount.TotalRecordstoImport = isNoOrdersPrepared == true ? 0 : 1; processcount.ImportedRecordsCount = 0; processcount.FailedRecordsCount = 0; processcount.IntegrationID = integrationId; logGraph.OrderProcessLog.Insert(processcount); logGraph.Actions.PressSave(); logGraph.OrderProcessLog.Current.ParentProcessID = logGraph.OrderProcessLog.Current.ProcessID; logGraph.OrderProcessLog.Update(logGraph.OrderProcessLog.Current); logGraph.Actions.PressSave(); } else { processcount.ProcessDate = PX.Common.PXTimeZoneInfo.Now; processcount.TotalRecordstoImport = processcount.TotalRecordstoImport + 1; logGraph.OrderProcessLog.Update(processcount); logGraph.Actions.PressSave(); } break; } }