private void CreateCustomerPaymentMethodDetailRecord(CustomerPaymentMethod customerPM, CCSynchronizeCard syncCard) { PXResultset <PaymentMethodDetail> details = GetPaymentMethodDetailParams(customerPM.PaymentMethodID); PXCache customerPaymentMethodDetailCache = Caches[typeof(CustomerPaymentMethodDetail)]; CustomerPaymentMethodDetail customerPaymentDetails; foreach (PaymentMethodDetail detail in details) { customerPaymentDetails = customerPaymentMethodDetailCache.CreateInstance() as CustomerPaymentMethodDetail; customerPaymentDetails.DetailID = detail.DetailID; customerPaymentDetails.PMInstanceID = customerPM.PMInstanceID; customerPaymentDetails.PaymentMethodID = customerPM.PaymentMethodID; if (customerPaymentDetails.DetailID == CreditCardAttributes.CardNumber) { Match match = new Regex("[\\d]+").Match(syncCard.CardNumber); if (match.Success) { string cardNum = match.Value.PadLeft(8, 'X'); customerPaymentDetails.Value = cardNum; } } if (customerPaymentDetails.DetailID == CreditCardAttributes.CCPID) { customerPaymentDetails.Value = syncCard.PaymentCCPID; } customerPaymentMethodDetailCache.Insert(customerPaymentDetails); customerPaymentMethodDetailCache.Persist(PXDBOperation.Insert); } }
private void ProcessTaxRecord(TaxHistory record, TaxReportLine taxLine, decimal?roundedTaxAmount) { PXCache taxHistoryCache = graph.Caches[typeof(TaxHistory)]; decimal?filedAmount = record.ReportFiledAmt; int lineNbr = record.LineNbr.Value; int branchID = record.BranchID.Value; if (filedAmount != roundedTaxAmount) { TaxHistory taxHistory = CreateDeltaHistory(record, roundedTaxAmount); taxHistoryCache.Insert(taxHistory); } if (!linesWithRelatedAggregatesTable.ContainsKey(lineNbr)) { return; } List <int> relatedAggregateLineNumbers = linesWithRelatedAggregatesTable[lineNbr]; foreach (int aggrLineNumber in relatedAggregateLineNumbers) { decimal amount = (roundedTaxAmount ?? 0m) * (taxLine.LineMult ?? 0m); AddTaxAmountToAggregateLine(branchID, aggrLineNumber, amount); } }
private void CreateActivity() { PXCache cache = _graph.Caches[typeof(CRActivity)]; _activity = (CRActivity)cache.CreateCopy(cache.Insert()); _activity.ClassID = CRActivityClass.Email; _activity.Type = null; _activity.Subject = _email.Message.Subject.With(_ => _.ToString()) ?? " "; string clearedSubject; DecodeTicket(_activity.Subject, out clearedSubject); _activity.Subject = clearedSubject; _activity.StartDate = _email.Message.Date == DateTime.MinValue ? PXTimeZoneInfo.Now : PXTimeZoneInfo.ConvertTimeFromUtc(_email.Message.Date.ToUniversalTime(), LocaleInfo.GetTimeZone()); _activity = (CRActivity)cache.CreateCopy(cache.Update(_activity)); _graph.EnsureCachePersistence(_activity.GetType()); var cached = _graph.Caches[_activity.GetType()].Locate(_activity); _graph.Persist(); _graph.SelectTimeStamp(); _activity = (CRActivity)cache.CreateCopy(cached); }
public static void Update(PXGraph graph, int?vendorID, int?vendorLocationID, string curyID, int?inventoryID, int?subItemID, string uom, decimal curyCost) { if (curyCost <= 0 || string.IsNullOrEmpty(uom) || vendorID == null || vendorLocationID == null) { return; } PXCache cache = graph.Caches[typeof(POVendorInventoryPriceUpdate)]; foreach (PXResult <InventoryItem, Vendor, Company> r in PXSelectJoin <InventoryItem, LeftJoin <Vendor, On <Vendor.bAccountID, Equal <Required <Vendor.bAccountID> > >, CrossJoin <Company> >, Where <InventoryItem.inventoryID, Equal <Required <InventoryItem.inventoryID> > > > . Select(graph, vendorID, inventoryID)) { InventoryItem item = r; Vendor vendor = r; Company company = r; if (item.InventoryID == null || vendor.BAccountID == null || (item.StkItem == true && subItemID == null)) { continue; } INSetup setup = new PXSetup <INSetup>(graph).Current; int?savedSubItemID = item.StkItem == true ? subItemID : null; POVendorInventory existVendorPrice = PXSelectReadonly <POVendorInventory, Where <POVendorInventory.inventoryID, Equal <Required <POVendorInventory.inventoryID> >, And <POVendorInventory.subItemID, Equal <Required <POVendorInventory.subItemID> >, And <POVendorInventory.purchaseUnit, Equal <Required <POVendorInventory.purchaseUnit> >, And <POVendorInventory.vendorID, Equal <Required <POVendorInventory.vendorID> >, And <POVendorInventory.vendorLocationID, Equal <Required <POVendorInventory.vendorLocationID> > > > > > > > .SelectWindowed(graph, 0, 1, item.InventoryID, savedSubItemID, uom, vendorID, vendorLocationID); string priceCuryID = (existVendorPrice != null ? existVendorPrice.CuryID : vendor.CuryID) ?? company.BaseCuryID; POVendorInventoryPriceUpdate vendorPrice = (POVendorInventoryPriceUpdate)cache.CreateInstance(); vendorPrice.InventoryID = inventoryID; vendorPrice.SubItemID = savedSubItemID; vendorPrice.VendorID = vendorID; vendorPrice.VendorLocationID = vendorLocationID; vendorPrice.PurchaseUnit = uom; vendorPrice = (POVendorInventoryPriceUpdate)cache.Insert(vendorPrice); if (item.StkItem != true) { vendorPrice.SubItemID = savedSubItemID; } vendorPrice.CuryID = priceCuryID; cache.Normalize(); vendorPrice.Active = true; Decimal cost = ConventCury(graph, vendor.CuryRateTypeID, curyID, curyCost, priceCuryID); vendorPrice.LastPrice = ConvertUOM(graph, item, uom, cost, item.PurchaseUnit); } }
/// <summary> /// Links the Smartsheet user information to the Acumatica's Employee /// </summary> /// <param name="projectEntryGraph">Project graph</param> /// <param name="smartsheetClient">Smartsheet SDK Client</param> public void CreateEmployeesAcuUserSS(ProjectEntry projectEntryGraph, SmartsheetClient smartsheetClient) { User userRow = new User(); AccessUsers accessUsersGraph = PXGraph.CreateInstance <AccessUsers>(); AccessUsersSSIExt graphExtended = accessUsersGraph.GetExtension <AccessUsersSSIExt>(); try { EmployeeMaint employeeMaintGraph = PXGraph.CreateInstance <EmployeeMaint>(); foreach (EPEmployeeContract filter in projectEntryGraph.EmployeeContract.Select()) { EPEmployee ePEmployeeRecord = employeeMaintGraph.Employee.Current = employeeMaintGraph.Employee.Search <EPEmployee.bAccountID>(filter.EmployeeID); if (ePEmployeeRecord == null) { return; } EPEmployeeSSExt ePEmployeeExtRecord = PXCache <EPEmployee> .GetExtension <EPEmployeeSSExt>(ePEmployeeRecord); if (String.IsNullOrEmpty(Convert.ToString(ePEmployeeExtRecord.UsrSSUserid))) { userRow = graphExtended.CreateSmartsheetUser(filter.EmployeeID, smartsheetClient); if (userRow != null) { PXCache <EPUsersListSS> usersListCache = employeeMaintGraph.Caches <EPUsersListSS>(); EPUsersListSS epUsersListSSRow = UserSSList.Select().Where(x => ((EPUsersListSS)x).Ssuserid == userRow.Id).FirstOrDefault(); if (epUsersListSSRow == null) { EPUsersListSS usersListSSRow = (EPUsersListSS)usersListCache.Insert(new EPUsersListSS { Ssuserid = userRow.Id, FirstName = userRow.FirstName, LastName = userRow.LastName, Email = userRow.Email, BAccountID = filter.EmployeeID }); } else { epUsersListSSRow.BAccountID = filter.EmployeeID; epUsersListSSRow.FirstName = userRow.FirstName; epUsersListSSRow.LastName = userRow.LastName; epUsersListSSRow.Email = userRow.Email; usersListCache.Update(epUsersListSSRow); } employeeMaintGraph.Persist(); PXDatabase.Update <EPEmployee>(new PXDataFieldRestrict <EPEmployee.bAccountID>(filter.EmployeeID), new PXDataFieldAssign <EPEmployeeSSExt.usrSSUserID>(userRow.Id)); } } } } catch (Exception ex) { throw new PXException(ex.Message); } }
public static IEnumerable <object> InsertAll(this PXCache cache, IEnumerable <object> items) { items = items.ToList(); foreach (var item in items) { cache.Insert(item); } return(items); }
private Type GetPrimaryGraphType(Type type) { EntityHelper helper = new EntityHelper(this); PXCache cache = this.Caches[type]; object row = cache.Current ?? cache.Insert(cache.CreateInstance()); cache.IsDirty = false; return(helper.GetPrimaryGraphType(type, row, false)); }
public static object StrictInsert(this PXCache cache, object item) { object res = cache.Insert(item); if (cache.GetStatus(res) != PXEntryStatus.Inserted || !cache.Inserted.Cast <object>().Contains(res)) { throw new Exception(string.Format("Cant insert item {0} in cache", item.GetType())); } return(res); }
private EPActivity InsertActivity(PXCache cache) { CRHelper.AssertNull(cache, "cache"); CRHelper.AssertInheritance(typeof(EPActivity), cache.GetItemType(), "cache.GetItemType()"); EPActivity activity = (EPActivity)cache.Insert(); activity.RefNoteID = NoteID; return(activity); }
public static void UpdateFSSODetFromOpportunity(PXCache soDetCache, FSSODet fsSODetRow, CROpportunityProducts crOpportunityProductRow, FSxCROpportunityProducts fsxCROpportunityProductsRow, string lineType) { if (crOpportunityProductRow == null || fsxCROpportunityProductsRow == null) { return; } fsSODetRow.SourceNoteID = crOpportunityProductRow.NoteID; soDetCache.Current = fsSODetRow = (FSSODet)soDetCache.Insert(fsSODetRow); fsSODetRow.LineType = lineType; fsSODetRow.InventoryID = crOpportunityProductRow.InventoryID; fsSODetRow.IsBillable = crOpportunityProductRow.IsFree == false; soDetCache.Current = fsSODetRow = (FSSODet)soDetCache.Update(fsSODetRow); fsSODetRow = (FSSODet)soDetCache.CreateCopy(fsSODetRow); fsSODetRow.BillingRule = fsxCROpportunityProductsRow.BillingRule; fsSODetRow.TranDesc = crOpportunityProductRow.Descr; if (crOpportunityProductRow.SiteID != null) { fsSODetRow.SiteID = crOpportunityProductRow.SiteID; } fsSODetRow.EstimatedDuration = fsxCROpportunityProductsRow.EstimatedDuration; fsSODetRow.EstimatedQty = crOpportunityProductRow.Qty; fsSODetRow.CuryUnitPrice = crOpportunityProductRow.CuryUnitPrice; fsSODetRow.ManualPrice = crOpportunityProductRow.ManualPrice; fsSODetRow.ProjectID = crOpportunityProductRow.ProjectID; fsSODetRow.ProjectTaskID = crOpportunityProductRow.TaskID; fsSODetRow.CostCodeID = crOpportunityProductRow.CostCodeID; fsSODetRow.CuryUnitCost = crOpportunityProductRow.CuryUnitCost; fsSODetRow.ManualCost = crOpportunityProductRow.POCreate; fsSODetRow.EnablePO = crOpportunityProductRow.POCreate; fsSODetRow.POVendorID = crOpportunityProductRow.VendorID; fsSODetRow.POVendorLocationID = fsxCROpportunityProductsRow.VendorLocationID; fsSODetRow.TaxCategoryID = crOpportunityProductRow.TaxCategoryID; fsSODetRow.DiscPct = crOpportunityProductRow.DiscPct; fsSODetRow.CuryDiscAmt = crOpportunityProductRow.CuryDiscAmt; fsSODetRow.CuryBillableExtPrice = crOpportunityProductRow.CuryExtPrice; soDetCache.Current = soDetCache.Update(fsSODetRow); }
protected void FillPropertyValue(PXGraph graph, string viewName) { PXCache cache = Caches[typeof(FieldValue)]; cache.Clear(); foreach (FieldValue field in ProcessingProperties) { cache.Insert(field); } cache.IsDirty = false; }
protected T InsertWith <T>(PXGraph graph, T row, PXRowInserted handler) where T : class, IBqlTable, new() { graph.RowInserted.AddHandler <T>(handler); try { return(PXCache <T> .Insert(graph, row)); } finally { graph.RowInserted.RemoveHandler <T>(handler); } }
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); } }
private void UpdateCacheRecord(PXCache sender, CSAttributeGroup cSAttributeGroup, PXDBOperation operation) { if (operation == PXDBOperation.Insert) { sender.Insert(cSAttributeGroup); } else if (operation == PXDBOperation.Update) { sender.Update(cSAttributeGroup); } else if (operation == PXDBOperation.Delete) { sender.Delete(cSAttributeGroup); } }
public static void Update(PXGraph graph, int?vendorID, int?vendorLocationID, string curyID, int?inventoryID, int?subItemID, string uom, decimal curyCost) { if (curyCost <= 0 || string.IsNullOrEmpty(uom) || vendorID == null || vendorLocationID == null) { return; } PXCache cache = graph.Caches[typeof(POVendorInventoryPriceUpdate)]; foreach (PXResult <InventoryItem, Vendor, Company> r in PXSelectJoin <InventoryItem, LeftJoinSingleTable <Vendor, On <Vendor.bAccountID, Equal <Required <Vendor.bAccountID> > >, CrossJoin <Company> >, Where <InventoryItem.inventoryID, Equal <Required <InventoryItem.inventoryID> > > > . Select(graph, vendorID, inventoryID)) { InventoryItem item = r; Vendor vendor = r; Company company = r; if (item.InventoryID == null || vendor.BAccountID == null || (item.StkItem == true && subItemID == null)) { continue; } INSetup setup = PXSetupOptional <INSetup> .Select(graph); int?savedSubItemID = item.StkItem == true ? subItemID : null; POVendorInventoryPriceUpdate vendorPrice = (POVendorInventoryPriceUpdate)cache.CreateInstance(); vendorPrice.InventoryID = inventoryID; vendorPrice.SubItemID = savedSubItemID; vendorPrice.VendorID = vendorID; vendorPrice.VendorLocationID = vendorLocationID; vendorPrice.PurchaseUnit = uom; vendorPrice = (POVendorInventoryPriceUpdate)cache.Insert(vendorPrice); if (item.StkItem != true) { vendorPrice.SubItemID = savedSubItemID; } vendorPrice.CuryID = curyID; cache.Normalize(); vendorPrice.Active = true; vendorPrice.LastPrice = curyCost; } }
public static void CreateContractPostRegister(PXGraph graph, FSContractPostDoc fsContractPostDocRow) { PXCache <FSContractPostRegister> cacheFSPostRegister = new PXCache <FSContractPostRegister>(graph); FSContractPostRegister fsPostRegisterRow = new FSContractPostRegister(); fsPostRegisterRow.ServiceContractID = fsContractPostDocRow.ServiceContractID; fsPostRegisterRow.ContractPeriodID = fsContractPostDocRow.ContractPeriodID; fsPostRegisterRow.ContractPostBatchID = fsContractPostDocRow.ContractPostBatchID; fsPostRegisterRow.PostedTO = fsContractPostDocRow.PostedTO; fsPostRegisterRow.PostDocType = fsContractPostDocRow.PostDocType; fsPostRegisterRow.PostRefNbr = fsContractPostDocRow.PostRefNbr; cacheFSPostRegister.Insert(fsPostRegisterRow); cacheFSPostRegister.Persist(PXDBOperation.Insert); }
public static string GetDefaultLotSerClass(PXGraph graph) { INLotSerClass lotSerClass = PXSelect <INLotSerClass, Where <INLotSerClass.lotSerTrack, Equal <INLotSerTrack.notNumbered> > > .Select(graph); if (lotSerClass == null) { PXCache cache = graph.Caches <INLotSerClass>(); INLotSerClass lotser = (INLotSerClass)cache.CreateInstance(); lotser.LotSerClassID = DfltLotSerialClass; lotser.LotSerTrack = INLotSerTrack.NotNumbered; cache.Insert(lotser); return(lotser.LotSerClassID); } else { return(lotSerClass.LotSerClassID); } }
protected virtual IEnumerable setup() { PXCache cache = Setup.Cache; PXResultset <WZSetup> ret = PXSelect <WZSetup> .SelectSingleBound(this, null); if (ret.Count == 0) { WZSetup setup = (WZSetup)cache.Insert(new WZSetup()); cache.IsDirty = false; ret.Add(new PXResult <WZSetup>(setup)); } else if (cache.Current == null) { cache.SetStatus((WZSetup)ret, PXEntryStatus.Notchanged); } return(ret); }
public static void SegregateRegister(PXGraph graph, int BranchID, string Origin, string PeriodID, DateTime?DocDate, string descr, DocumentList <FARegister> created) { PXCache doccache = graph.Caches[typeof(FARegister)]; PXCache trancache = graph.Caches[typeof(FATran)]; if (trancache.IsInsertedUpdatedDeleted) { graph.Actions.PressSave(); if (doccache.Current != null && created.Find(doccache.Current) == null) { created.Add((FARegister)doccache.Current); } graph.Clear(); } FARegister register = created.Find <FARegister.branchID, FARegister.origin, FARegister.finPeriodID>(BranchID, Origin, PeriodID) ?? new FARegister(); if (register.RefNbr != null) { FARegister newreg = PXSelect <FARegister, Where <FARegister.refNbr, Equal <Current <FARegister.refNbr> > > > .SelectSingleBound(graph, new object[] { register }); if (newreg.DocDesc != descr) { newreg.DocDesc = string.Empty; doccache.Update(newreg); } doccache.Current = newreg; } else { graph.Clear(); register = new FARegister { Hold = false, BranchID = BranchID, Origin = Origin, FinPeriodID = PeriodID, DocDate = DocDate, DocDesc = descr }; doccache.Insert(register); } }
protected virtual void OnNewCombination() { string[] attributeIdentifiers = _templateAttributes.Keys.ToArray(); if (attributeIdentifiers == null) { throw new PXArgumentException(nameof(attributeIdentifiers)); } if (_attributeValues == null) { throw new PXArgumentException(nameof(_attributeValues)); } if (_attributeValues.Length != attributeIdentifiers.Length) { throw new PXArgumentException($"{nameof(_attributeValues)}.{nameof(_attributeValues.Length)}"); } PXCache itemCache = _graph.Caches <INAttributeDescriptionItem>(); var description = new List <string>(); for (int attributeIndex = 0; attributeIndex < attributeIdentifiers.Length; attributeIndex++) { var newItem = (INAttributeDescriptionItem)itemCache.CreateInstance(); newItem.TemplateID = _template.InventoryID; newItem.GroupID = _numberOfCombination; newItem.AttributeID = attributeIdentifiers[attributeIndex]; newItem.ValueID = _attributeValues[attributeIndex]; newItem = (INAttributeDescriptionItem)itemCache.Insert(newItem); string valueDescription = CRAttribute.Attributes[newItem.AttributeID].Values .Where(v => v.ValueID == newItem.ValueID).FirstOrDefault()?.Description; description.Add(valueDescription); } PXCache groupCache = _graph.Caches <INAttributeDescriptionGroup>(); var newGroup = (INAttributeDescriptionGroup)groupCache.CreateInstance(); newGroup.TemplateID = _template.InventoryID; newGroup.GroupID = _numberOfCombination; newGroup.Description = string.Join(Separator, description); newGroup = (INAttributeDescriptionGroup)groupCache.Insert(newGroup); }
private void LoadTransactions(IList <DetailsValue> details) { foreach (var d in details) { var transactionFields = d?.Fields; if (transactionFields == null) { continue; } var transactionRow = _transactionCache.Insert(); SetFieldExtValue <int?, int?>(transactionFields.LineNbr, _transactionCache, transactionRow, nameof(APTran.LineNbr)); SetFieldExtValue <string, string>(transactionFields.VendorItemID, _transactionCache, transactionRow, nameof(APTran.InventoryID)); SetFieldExtValue <string, string>(transactionFields.Description, _transactionCache, transactionRow, nameof(APTran.TranDesc)); SetFieldExtValue <string, string>(transactionFields.UOM, _transactionCache, transactionRow, nameof(APTran.UOM)); SetFieldExtValue <decimal?, decimal?>(transactionFields.Qty, _transactionCache, transactionRow, nameof(APTran.Qty)); SetFieldExtValue <decimal?, decimal?>(transactionFields.UnitPrice, _transactionCache, transactionRow, nameof(APTran.CuryUnitCost)); } }
protected virtual void UpdateUnassigned(PXCache cache, SOPickerListEntry assigned, decimal?deltaQty) { SOPickerListEntry unassigned = deltaQty > 0 && GetLotSerClass(cache.Graph, assigned.InventoryID).LotSerTrack == INLotSerTrack.SerialNumbered ? null : SelectFrom <SOPickerListEntry> . Where < isUnassigned.IsEqual <True> . And <worksheetNbr.IsEqual <worksheetNbr.FromCurrent> > . And <pickerNbr.IsEqual <pickerNbr.FromCurrent> > . And <inventoryID.IsEqual <inventoryID.FromCurrent> > . And <subItemID.IsEqual <subItemID.FromCurrent> > . And <locationID.IsEqual <locationID.FromCurrent> > . And <orderLineUOM.IsEqual <orderLineUOM.FromCurrent> > > . View.SelectSingleBound(cache.Graph, new[] { assigned }).TopFirst; if (unassigned == null) { unassigned = PXCache <SOPickerListEntry> .CreateCopy(assigned); unassigned.EntryNbr = null; unassigned.LotSerialNbr = ""; unassigned.ExpireDate = null; unassigned.Qty = 0; unassigned.BaseQty = 0; unassigned.PickedQty = 0; unassigned.BasePickedQty = 0; unassigned.IsUnassigned = true; unassigned = (SOPickerListEntry)cache.Insert(unassigned); } unassigned.Qty += deltaQty; if (unassigned.Qty == 0) { unassigned = (SOPickerListEntry)cache.Delete(unassigned); } else { unassigned = (SOPickerListEntry)cache.Update(unassigned); } }
public virtual void loadTemplateSS() { PMSetup pmSetupRow = this.Base.Setup.Current; Dictionary <string, string> templateSS = GetTemplateSS(); PXCache <PMTemplateListSS> pmtemplateListCache = this.Base.Caches <PMTemplateListSS>(); foreach (PMTemplateListSS item in TemplateSetup.Select()) { pmtemplateListCache.Delete(item); } foreach (var templateRow in templateSS) { PMTemplateListSS ci = (PMTemplateListSS)pmtemplateListCache.Insert(new PMTemplateListSS { TemplateSS = templateRow.Key.ToString(), TemplateName = templateRow.Value.ToString(), TemplateDefault = false }); } }
private void CreateCustomerProcessingCenterRecord(CustomerPaymentMethod customerPM, CCSynchronizeCard syncCard) { PXCache customerProcessingCenterCache = Caches[typeof(CustomerProcessingCenterID)]; customerProcessingCenterCache.ClearQueryCacheObsolete(); PXSelectBase <CustomerProcessingCenterID> checkRecordExist = new PXSelectReadonly <CustomerProcessingCenterID, Where <CustomerProcessingCenterID.cCProcessingCenterID, Equal <Required <CreditCardsFilter.processingCenterId> >, And <CustomerProcessingCenterID.bAccountID, Equal <Required <CustomerProcessingCenterID.bAccountID> >, And <CustomerProcessingCenterID.customerCCPID, Equal <Required <CustomerProcessingCenterID.customerCCPID> > > > > >(this); CustomerProcessingCenterID cProcessingCenter = checkRecordExist.SelectSingle(syncCard.CCProcessingCenterID, syncCard.BAccountID, syncCard.CustomerCCPID); if (cProcessingCenter == null) { cProcessingCenter = customerProcessingCenterCache.CreateInstance() as CustomerProcessingCenterID; cProcessingCenter.BAccountID = syncCard.BAccountID; cProcessingCenter.CCProcessingCenterID = syncCard.CCProcessingCenterID; cProcessingCenter.CustomerCCPID = syncCard.CustomerCCPID; customerProcessingCenterCache.Insert(cProcessingCenter); customerProcessingCenterCache.Persist(PXDBOperation.Insert); } }
public static void ReverseGLVoucher(PXGraph graph, PXAction actionSave, Action baseReverse, PXCache voucherBatchView) { GLWorkBook wb = PXSelect <GLWorkBook, Where <GLWorkBook.workBookID, Equal <Required <GLVoucherBatch.workBookID> > > > .Select(graph, graph.GetContextValue <GLVoucherBatch.workBookID>()); if (wb?.ReversingWorkBookID == null) { throw new PXException(Messages.ReversingWorkbookIDisnotDefined); } GLWorkBook reversingWB = PXSelect <GLWorkBook, Where <GLWorkBook.workBookID, Equal <Required <GLVoucherBatch.workBookID> >, And <GLWorkBook.status, Equal <WorkBookStatus.active> > > > .Select(graph, wb.ReversingWorkBookID); if (reversingWB == null) { throw new PXException(Messages.ReversingWorkbookIDisnotFound); } GLVoucherBatch vb = PXSelect <GLVoucherBatch, Where <GLVoucherBatch.workBookID, Equal <Required <GLWorkBook.workBookID> >, And <GLVoucherBatch.released, Equal <False> > >, OrderBy <Asc <GLVoucherBatch.voucherBatchNbr> > > .Select(graph, reversingWB.WorkBookID); if (vb == null) { var batch = new GLVoucherBatch { WorkBookID = reversingWB.WorkBookID, Descr = Messages.ReversingVoucherBatchDesc }; vb = (GLVoucherBatch)voucherBatchView.Insert(batch); voucherBatchView.Current = batch; actionSave.Press(); } graph.contextValues[typeof(GLVoucherBatch.workBookID).FullName] = reversingWB.WorkBookID; graph.contextValues[typeof(GLVoucherBatch.voucherBatchNbr).FullName] = vb.VoucherBatchNbr; baseReverse.Invoke(); throw new PXRedirectWithinContextException(graph, graph, Messages.VoucherEdit, typeof(GLVoucherBatch.workBookID), typeof(GLVoucherBatch.voucherBatchNbr)); }
/// <summary> /// Inserts the columns that the SmartSheet Template has in Acumatica /// </summary> /// <param name="mappingCache"> </param> public void InsertTemplate(PXCache <PMSSMapping> mappingCache) { Dictionary <string, string> columnSheetSS = GetColumnSheet(); this.Base.Caches <PMSSMapping>().Clear(); int cont = 0; foreach (var sheetRow in columnSheetSS) { if (mappingCache.GetValue <PMSSMapping.cellSSID>(sheetRow.Value.ToString()) == null) { PMSSMapping mappingRow = (PMSSMapping)mappingCache.Insert(new PMSSMapping { CellSSID = cont++, NameSS = sheetRow.Key, NameAcu = null, CellFormat = sheetRow.Value }); } } }
protected void CreateCustomerProcessingCenterRecord(V2.TranProfile input) { PXCache customerProcessingCenterCache = Base.Caches[typeof(CustomerProcessingCenterID)]; customerProcessingCenterCache.ClearQueryCacheObsolete(); PXSelectBase <CustomerProcessingCenterID> checkRecordExist = new PXSelectReadonly <CustomerProcessingCenterID, Where <CustomerProcessingCenterID.cCProcessingCenterID, Equal <Required <CustomerProcessingCenterID.cCProcessingCenterID> >, And <CustomerProcessingCenterID.bAccountID, Equal <Required <CustomerProcessingCenterID.bAccountID> >, And <CustomerProcessingCenterID.customerCCPID, Equal <Required <CustomerProcessingCenterID.customerCCPID> > > > > >(Base); CustomerProcessingCenterID cProcessingCenter = checkRecordExist.SelectSingle(SelectedProcessingCenter, SelectedBAccount, input.CustomerProfileId); if (cProcessingCenter == null) { cProcessingCenter = customerProcessingCenterCache.CreateInstance() as CustomerProcessingCenterID; cProcessingCenter.BAccountID = SelectedBAccount; cProcessingCenter.CCProcessingCenterID = SelectedProcessingCenter; cProcessingCenter.CustomerCCPID = input.CustomerProfileId; customerProcessingCenterCache.Insert(cProcessingCenter); customerProcessingCenterCache.Persist(PXDBOperation.Insert); } }
private void UpdateZones(PXCache sender, TaxReportLine oldRow, TaxReportLine newRow) { if (oldRow != null && (newRow == null || newRow.TempLine == false)) { if (!string.IsNullOrEmpty(newRow?.Descr)) { int fid = newRow.Descr.IndexOf(TAG_TAXZONE, StringComparison.OrdinalIgnoreCase); if (fid >= 0) { newRow.Descr = newRow.Descr.Remove(fid, TAG_TAXZONE.Length).TrimEnd(' '); } } DeleteChildTaxLinesForMainTaxLine(oldRow); } if (newRow?.TempLine == true && newRow.TempLine != oldRow?.TempLine) { newRow.TaxZoneID = null; if (string.IsNullOrEmpty(newRow.Descr) || newRow.Descr.IndexOf(TAG_TAXZONE, StringComparison.OrdinalIgnoreCase) < 0) { newRow.Descr += ' ' + TAG_TAXZONE; } foreach (TaxZone zone in PXSelect <TaxZone> .Select(this)) { TaxReportLine child = CreateChildLine(newRow, zone); sender.Insert(child); } } if (newRow?.TempLine == true && oldRow?.TempLine == true) { UpdateTaxLineOnFieldUpdatedWhenDetailByTaxZoneNotChanged(sender, oldRow, newRow); } }
public void CreateCustomerPaymentMethodRecord(CCSynchronizeCard item) { PXCache customerPaymentMethodCache = Caches[typeof(CustomerPaymentMethod)]; CustomerPaymentMethod customerPM = customerPaymentMethodCache.CreateInstance() as CustomerPaymentMethod; customerPM.BAccountID = item.BAccountID; customerPM.CustomerCCPID = item.CustomerCCPID; customerPM.Descr = item.CardNumber; customerPM.PaymentMethodID = item.PaymentMethodID; customerPM.CashAccountID = item.CashAccountID; customerPM.CCProcessingCenterID = item.CCProcessingCenterID; if (item.ExpirationDate != null) { customerPaymentMethodCache.SetValueExt <CustomerPaymentMethod.expirationDate>(customerPM, item.ExpirationDate); } customerPaymentMethodCache.Insert(customerPM); customerPaymentMethodCache.Persist(PXDBOperation.Insert); customerPM = customerPaymentMethodCache.Current as CustomerPaymentMethod; CreateCustomerPaymentMethodDetailRecord(customerPM, item); CreateCustomerProcessingCenterRecord(customerPM, item); }
private static CurrencyInfo GetCurrencyInfo(PXGraph graph, string curyRateTypeID, string curyID) { if (curyID == null) { curyID = new PXSetup <Company>(graph).Current.BaseCuryID; } if (curyRateTypeID == null) { curyRateTypeID = new CMSetupSelect(graph).Current.APRateTypeDflt; } CurrencyInfo info = new CurrencyInfo(); info.ModuleCode = BatchModule.AP; info.CuryID = curyID; info.CuryRateTypeID = curyRateTypeID; info.CuryInfoID = null; PXCache cache = graph.Caches[typeof(CurrencyInfo)]; info = (CurrencyInfo)cache.Insert(info); cache.Delete(info); return(info); }