public SOPackageEngine(PXGraph graph) { if (graph == null) throw new ArgumentNullException("graph"); this.graph = graph; }
private string GetFormat(PXGraph graph, long? activityNoteID) { var format = activityNoteID. With(id => (EPActivity)PXSelect<EPActivity, Where<EPActivity.noteID, Equal<Required<EPActivity.noteID>>>>. Select(graph, id.Value)). With(n => n.ReportFormat); return string.IsNullOrEmpty(format) ? _DEFAULT_REPORTFORMAT : format; }
private Contact FindContact(PXGraph graph, string address) { PXSelect<Contact, Where<Contact.eMail, Equal<Required<Contact.eMail>>>>. Clear(graph); var contact = (Contact)PXSelect<Contact, Where<Contact.eMail, Equal<Required<Contact.eMail>>>>. SelectWindowed(graph, 0, 1, address); return contact; }
public IDictionary<string, byte[]> Process(PXGraph graph, string name, long? refNoteID, byte[] src) { if (src == null) return null; var report = ExtractReport(src); if (report == null) return null; var format = GetFormat(graph, refNoteID); return GenerateFile(report, name, format); }
private Package(PXGraph graph, EMailAccount account, EPActivity message) { if (graph == null) throw new ArgumentNullException("graph"); if (account == null) throw new ArgumentNullException("account"); if (message == null) throw new ArgumentNullException("message"); _graph = graph; _account = account; _message = message; }
public EmailProcessEventArgs(PXGraph graph, EMailAccount account, EPActivity message) { if (graph == null) throw new ArgumentNullException("graph"); if (account == null) throw new ArgumentNullException("account"); if (message == null) throw new ArgumentNullException("message"); _graph = graph; _account = account; _message = message; }
public EmployeeCostEngine(PXGraph graph) { if ( graph == null ) throw new ArgumentNullException(); this.graph = graph; EPSetup setup = PXSelect<EPSetup>.Select(graph); if (setup != null && !String.IsNullOrEmpty(setup.EmployeeRateUnit)) defaultUOM = setup.EmployeeRateUnit; }
public override void ViewCreated(PXGraph graph, string viewName) { base.ViewCreated(graph, viewName); CheckPropertiesViewName(); CheckPropertyMarkAttribute(); InitializePropertyValueView(graph); AttachEventHandlers(graph); }
private BAccount FindAccount(PXGraph graph, Contact contact) { if (contact == null || contact.BAccountID == null) return null; PXSelect<BAccount, Where<BAccount.bAccountID, Equal<Required<BAccount.bAccountID>>>>. Clear(graph); var account = (BAccount)PXSelect<BAccount, Where<BAccount.bAccountID, Equal<Required<BAccount.bAccountID>>>>. Select(graph, contact.BAccountID); return account; }
private void AddUpInformation(PXGraph graph, IList<string> briefInfo, object reference) { if (reference == null) return; var text = EntityHelper.GetEntityDescription(graph, reference).With(_ => _.Trim()); if (string.IsNullOrEmpty(text)) return; var header = EntityHelper.GetFriendlyEntityName(reference.GetType()); var format = string.IsNullOrEmpty(header) ? "{1}" : "{0}: {1}"; briefInfo.Add(string.Format(format, header, text)); }
public void SetField(PXGraph graph, object resultOldValuesRecord, Type changingField, object newValue) { //object oldValue = graph.Caches[changingField.DeclaringType].GetValue(resultOldValuesRecord, changingField.Name); //if (newValue != null && newValue.Equals(oldValue)) return; //if (newValue == null && oldValue == null) return; if (_fieldSetters.ContainsKey(changingField)) _fieldSetters[changingField].ForEach( pair => pair.Manager.SetRelation(graph, pair.Relation, resultOldValuesRecord, changingField, newValue)); else { graph.Caches[changingField.DeclaringType].SetValueExt(resultOldValuesRecord, changingField.Name, newValue); } }
public RateEngine(PXGraph graph, string rateTypeID, PMTran tran) { if (graph == null) throw new ArgumentNullException("graph"); if (string.IsNullOrEmpty(rateTypeID)) throw new ArgumentNullException("rateTypeID", "Argument is null or an empty string"); if (tran == null) throw new ArgumentNullException("tran"); this.graph = graph; this.rateTypeID = rateTypeID; this.tran = tran; }
public static EPActivity GetParentOriginalActivity(PXGraph graph, int taskId) { PXSelectReadonly<EPActivity, Where<EPActivity.taskID, Equal<Required<EPActivity.taskID>>>>. Clear(graph); var res = (EPActivity)PXSelectReadonly<EPActivity, Where<EPActivity.taskID, Equal<Required<EPActivity.taskID>>>>. Select(graph, taskId); while (res != null && res.ClassID == CRActivityClass.EmailRouting) { if (res.ParentTaskID == null) res = null; else res = (EPActivity)PXSelectReadonly<EPActivity, Where<EPActivity.taskID, Equal<Required<EPActivity.taskID>>>>. Select(graph, res.ParentTaskID); } return res; }
private Guid? GetKnownSender(PXGraph graph, EPActivity message) { var @from = Mailbox.Parse(message.MailFrom).With(_ => _.Address).With(_ => _.Trim()); PXSelectJoin<EPEmployee, InnerJoin<Contact, On<Contact.contactID, Equal<EPEmployee.defContactID>>, InnerJoin<Users, On<Users.pKID, Equal<EPEmployee.userID>>>>, Where<Contact.eMail, Equal<Required<Contact.eMail>>>>. Clear(graph); var employeeEmail = (EPEmployee)PXSelectJoin<EPEmployee, InnerJoin<Contact, On<Contact.contactID, Equal<EPEmployee.defContactID>>, InnerJoin<Users, On<Users.pKID, Equal<EPEmployee.userID>>>>, Where<Contact.eMail, Equal<Required<Contact.eMail>>>>. Select(graph, @from); if (employeeEmail != null) return employeeEmail.UserID; return null; }
//Gets url to navigate for entering required data private string GetNextUrl(ref PXSetupNotEnteredException exception) { Type graphType = null; PXGraph gettingCache = new PXGraph(); bool createInstanceError = true; //Get graph that user must use at first while (createInstanceError) { createInstanceError = false; PXPrimaryGraphBaseAttribute attr = PXPrimaryGraphAttribute.FindPrimaryGraph(gettingCache.Caches[exception.DAC], out graphType); if (graphType != null) { try { PXGraph tmpGraph = PXGraph.CreateInstance(graphType) as PXGraph; } catch (PXSetupNotEnteredException ctrException) { createInstanceError = true; exception = ctrException; } } } try { return graphType == null ? null : PXBaseDataSource.getMainForm(graphType); } //we cang get url if we don't have rights to the screen catch { return null; } }
private void CreateProductMenu(PXGraph graph, PXDropDown dd) { PXListItem liall = new PXListItem(PXMessages.LocalizeNoPrefix(PX.SM.Messages.SearchProduct)); dd.Items.Add(liall); foreach (PXResult result in PXSelect<SPWikiProduct>.Select(graph)) { SPWikiProduct wc = result[typeof(SPWikiProduct)] as SPWikiProduct; PXListItem li = new PXListItem(wc.Description, wc.ProductID); dd.Items.Add(li); } for (int i = 0; i < dd.Items.Count; i++) { if (ProductID == dd.Items[i].Value) { dd.SelectedIndex = i; } } string path = PXUrl.SiteUrlWithPath(); path += path.EndsWith("/") ? "" : "/"; var url = string.Format("{0}Search/{1}?query={2}&adv=1", path, this.ResolveClientUrl("~/Search/WikiSP.aspx"), txtSearch.Value); url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber + "&categoryID=" + CategoryID + "&productID=" + SearchCaptionProduct.Value + "&orderID=" + OrderID; }
private void FormatSearchCaption() { PXGraph graph = new PXGraph(); this.CreateWikiMenu(graph, SearchCaption); this.CreateCategoryMenu(graph, SearchCaptionCategory); this.CreateProductMenu(graph, SearchCaptionProduct); this.CreateOrderMenu(graph, OrderCaption); }
public PXPrimaryGraphCollection(PXGraph graph) { Graph = graph; }
public PXApprovalProcessing(PXGraph graph, Delegate handler) : base(graph, handler) { }
public static INReceiptStatus Find(PXGraph graph, int?inventoryID, int?costSubItemID, int?costSiteID, string lotSerialNbr, int?accountID, int?subID) => FindBy(graph, inventoryID, costSubItemID, costSiteID, lotSerialNbr, accountID, subID);
public ServiceSkills_View(PXGraph graph) : base(graph) { }
public static FinPeriod FindPrevPeriod(PXGraph graph, string fiscalPeriodId, bool aClosedOrActive ) { FinPeriod nextperiod = null; if (!string.IsNullOrEmpty(fiscalPeriodId)) { if (aClosedOrActive) { nextperiod = PXSelect<FinPeriod, Where2< Where<FinPeriod.closed, Equal<boolTrue>, Or<FinPeriod.active, Equal<boolTrue>>>, And<FinPeriod.finPeriodID, Less<Required<FinPeriod.finPeriodID>>>>, OrderBy<Desc<FinPeriod.finPeriodID>> >.SelectWindowed(graph, 0, 1, fiscalPeriodId); } else { nextperiod = PXSelect<FinPeriod, Where<FinPeriod.finPeriodID, Less<Required<FinPeriod.finPeriodID>>>, OrderBy<Desc<FinPeriod.finPeriodID>> >.SelectWindowed(graph, 0, 1, fiscalPeriodId); } } if (nextperiod == null) { nextperiod = FindLastPeriod(graph, true); } return nextperiod; }
public int?GetCalendarOrganizationID(PXGraph graph, PXCache attributeCache, object extRow) { return(GetKey(graph, attributeCache, extRow).OrganizationID); }
public ServiceEquipmentTypes_View(PXGraph graph, Delegate handler) : base(graph, handler) { }
public ServiceInventoryItems_View(PXGraph graph) : base(graph) { }
public ServiceEquipmentTypes_View(PXGraph graph) : base(graph) { }
public ServiceLicenseTypes_View(PXGraph graph) : base(graph) { }
public ServiceSkills_View(PXGraph graph, Delegate handler) : base(graph, handler) { }
public abstract void ProccessItem(PXGraph graph, TPrimary item);
public static DateTime?GetNextActivityStartDate <Activity>(PXGraph graph, PXResultset <Activity> res, PMTimeActivity row, int?fromWeekId, int?tillWeekId, PXCache tempDataCache, Type tempDataField) where Activity : PMTimeActivity, new() { DateTime?date; if (fromWeekId != null || tillWeekId != null) { date = PXWeekSelector2Attribute.GetWeekStartDate(graph, (int)(fromWeekId ?? tillWeekId)); } else { date = graph.Accessinfo.BusinessDate.GetValueOrDefault(DateTime.Now).Date; } EPEmployee employee = PXSelect <EPEmployee, Where <EPEmployee.userID, Equal <Required <EPEmployee.userID> > > > .Select(graph, row.OwnerID); EPEmployeeClass employeeClass = PXSelect <EPEmployeeClass, Where <EPEmployeeClass.vendorClassID, Equal <Required <EPEmployee.vendorClassID> > > > .Select(graph, employee != null?employee.VendorClassID : null); var calendarId = CRActivityMaint.GetCalendarID(graph, row); if (employeeClass != null && EPEmployeeClass.defaultDateInActivity.LastDay == employeeClass.DefaultDateInActivity) { DateTime?val = tempDataCache.GetValue(tempDataCache.Current, tempDataField.Name) as DateTime?; if (val != null) { int week = PXWeekSelector2Attribute.GetWeekID(graph, (DateTime)val); if ((fromWeekId == null || week >= fromWeekId) && (tillWeekId == null || tillWeekId >= week)) { date = val; } } } else { DateTime weekDate = (DateTime)date; DateTime?newDate = null; date = res != null && res.Count > 0 ? res.Max(_ => ((Activity)_).Date) : null ?? date; for (int curentWeek = PXWeekSelector2Attribute.GetWeekID(graph, weekDate); tillWeekId == null || curentWeek <= tillWeekId; curentWeek = PXWeekSelector2Attribute.GetWeekID(graph, weekDate)) { PXWeekSelector2Attribute.WeekInfo week1 = PXWeekSelector2Attribute.GetWeekInfo(graph, PXWeekSelector2Attribute.GetWeekID(graph, weekDate)); foreach (KeyValuePair <DayOfWeek, PXWeekSelector2Attribute.DayInfo> pair in week1.Days.OrderBy(_ => _.Value.Date)) { if (pair.Value.Date >= date && (CalendarHelper.IsWorkDay(graph, calendarId, (DateTime)pair.Value.Date) || string.IsNullOrEmpty(calendarId) && pair.Key != DayOfWeek.Saturday && pair.Key != DayOfWeek.Sunday)) { newDate = (DateTime)pair.Value.Date; break; } weekDate = weekDate.AddDays(1D); } if (newDate != null) { date = ((DateTime)newDate).Date; break; } } } if (!string.IsNullOrEmpty(calendarId) && date != null) { DateTime startDate; DateTime endDate; CalendarHelper.CalculateStartEndTime(graph, calendarId, (DateTime)date, out startDate, out endDate); date = startDate; } return(date); }
protected bool IsUsedAsReversingWorkbook(PXGraph graph, string workBookID) { return(PXSelectReadonly <GLWorkBook, Where <GLWorkBook.reversingWorkBookID, Equal <Required <GLWorkBook.workBookID> >, And <GLWorkBook.workBookID, NotEqual <Required <GLWorkBook.workBookID> > > > > .Select(graph, workBookID, workBookID).Any()); }
/// <summary> /// AttachDataAsFile /// </summary> ///<remarks>Invoke before persisting of DAC</remarks> public static void AttachDataAsFile(string fileName, string data, IDACWithNote dac, PXGraph graph) { var file = new FileInfo(Guid.NewGuid(), fileName, null, SerializationHelper.GetBytes(data)); var uploadFileMaintGraph = PXGraph.CreateInstance <UploadFileMaintenance>(); if (uploadFileMaintGraph.SaveFile(file) || file.UID == null) { var fileNote = new NoteDoc { NoteID = dac.NoteID, FileID = file.UID }; graph.Caches[typeof(NoteDoc)].Insert(fileNote); graph.Persist(typeof(NoteDoc), PXDBOperation.Insert); } }
public static TimeSpan CalculateOvertime(PXGraph graph, PMTimeActivity act, DateTime start, DateTime end) { var calendarId = GetCalendarID(graph, act); return(calendarId == null ? new TimeSpan() : CalendarHelper.CalculateOvertime(graph, start, end, calendarId)); }
private static void ProcessValidation(ValidationFilter filter, Contact record) { BusinessAccountMaint graph = PXGraph.CreateInstance <BusinessAccountMaint>(); PXView view = graph.BAccount.View; int startRow = 0, totalRows = 0; BAccount baccount = null; Contact contact = null; if (record.ContactType == ContactTypesAttribute.BAccountProperty && record.BAccountID != null) { List <object> list_baccount = view.Select(null, null, new object[] { record.BAccountID }, new string[] { typeof(BAccount.bAccountID).Name }, null, null, ref startRow, 1, ref totalRows); if (list_baccount != null && list_baccount.Count >= 1) { baccount = PXResult.Unwrap <BAccount>(list_baccount[0]); } } if (baccount == null || baccount.DefContactID != record.ContactID) { throw new PXException(Messages.ContactNotFound); } contact = graph.DefContact.Current = graph.DefContact.SelectWindowed(0, 1); contact.DuplicateFound = true; PXView viewDuplicates = graph.Duplicates.View; if (viewDuplicates == null) { throw new PXException(Messages.DuplicateViewNotFound); } viewDuplicates.Clear(); List <object> duplicates = viewDuplicates.SelectMulti(); contact = (Contact)graph.DefContact.Cache.CreateCopy(contact); contact.DuplicateStatus = DuplicateStatusAttribute.Validated; Decimal?score = 0; foreach (PXResult <CRDuplicateRecord, BAccount, Contact, CRLeadContactValidationProcess.Contact2> r in duplicates) { CRLeadContactValidationProcess.Contact2 duplicate = r; CRDuplicateRecord contactScore = r; int duplicateWeight = ContactMaint.GetContactWeight(duplicate); int currentWeight = ContactMaint.GetContactWeight(contact); if (duplicateWeight > currentWeight || (duplicateWeight == currentWeight && duplicate.ContactID < contact.ContactID)) { contact.DuplicateStatus = DuplicateStatusAttribute.PossibleDuplicated; if (contactScore.Score > score) { score = contactScore.Score; } } } graph.DefContact.Cache.Update(contact); graph.DefContact.Cache.RestoreCopy(record, contact); graph.Actions.PressSave(); }
protected static void Approve(List <EPOwned> items, bool approve) { 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)); } EPApproval approval = PXSelectReadonly <EPApproval, Where <EPApproval.approvalID, Equal <Current <EPOwned.approvalID> > > > .SelectSingleBound(graph, new object[] { item }); if (approval.Status == EPApprovalStatus.Pending) { 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()) ); } string actionName = approve ? nameof(Approve) : nameof(Reject); if (graph.Actions.Contains(actionName)) { graph.Actions[actionName].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 = actionName; 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(PXMessages.LocalizeFormatNoPrefixNLA(Messages.AutomationNotConfigured, 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); } }
internal DummyView(PXGraph graph, BqlCommand command, List <object> records) : base(graph, true, command) { _records = records; }
public PMCommitmentSelect(PXGraph graph) : base(graph) { }
private EPActivity GetRoutingMessage(PXGraph graph, EPActivity message) { return (EPActivity)PXSelect<EPActivity, Where<EPActivity.parentTaskID, Equal<Required<EPActivity.parentTaskID>>>>. SelectWindowed(graph, 0, 1, message.TaskID); }
private object FindSource(PXGraph graph, long noteId) { return new EntityHelper(graph).GetEntityRow(noteId); }
private void CreateGlobalSearchCaption(PXGraph graph, PXDropDown dd) { PXListItem liWikis = new PXListItem("Help"); dd.Items.Add(liWikis); PXListItem liEntities = new PXListItem("Entities"); dd.Items.Add(liEntities); PXListItem liFiles = new PXListItem("Files"); dd.Items.Add(liFiles); PXListItem liNotes = new PXListItem("Notes"); dd.Items.Add(liNotes); PXListItem liScreens = new PXListItem("Form Titles"); dd.Items.Add(liScreens); Int32 select; Int32.TryParse(Globalsearchcaption, out select); dd.SelectedIndex = select; string path = PXUrl.SiteUrlWithPath(); var url = ""; switch (dd.SelectedIndex) { case 0: path = PXUrl.SiteUrlWithPath(); path += path.EndsWith("/") ? "" : "/"; url = string.Format("{0}Search/{1}?query={2}&adv=1", path, this.ResolveClientUrl("~/Search/Wiki.aspx"), txtSearch.Value); url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber + "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderID + "&isWiki=1" + "&globalsearchcaption=" + dd.SelectedIndex.ToString(); break; case 1: path = PXUrl.SiteUrlWithPath(); path += path.EndsWith("/") ? "" : "/"; url = string.Format("{0}Search/{1}?query={2}&adv=1", path, this.ResolveClientUrl("~/Search/Entity.aspx"), txtSearch.Value); url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber + "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderID + "&isWiki=0" + "&globalsearchcaption=" + dd.SelectedIndex.ToString(); break; case 2: path = PXUrl.SiteUrlWithPath(); path += path.EndsWith("/") ? "" : "/"; url = string.Format("{0}Search/{1}?query={2}&adv=1", path, this.ResolveClientUrl("~/Search/File.aspx"), txtSearch.Value); url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber + "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderID + "&isWiki=0" + "&globalsearchcaption=" + dd.SelectedIndex.ToString(); break; case 3: path = PXUrl.SiteUrlWithPath(); path += path.EndsWith("/") ? "" : "/"; url = string.Format("{0}Search/{1}?query={2}&adv=1", path, this.ResolveClientUrl("~/Search/Note.aspx"), txtSearch.Value); url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber + "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderID + "&isWiki=0" + "&globalsearchcaption=" + dd.SelectedIndex.ToString(); break; case 4: path = PXUrl.SiteUrlWithPath(); path += path.EndsWith("/") ? "" : "/"; url = string.Format("{0}Search/{1}?query={2}&adv=1", path, this.ResolveClientUrl("~/Search/FormsTitle.aspx"), txtSearch.Value); url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber + "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderID + "&isWiki=0" + "&globalsearchcaption=" + dd.SelectedIndex.ToString(); break; } }
public ServiceInventoryItems_View(PXGraph graph, Delegate handler) : base(graph, handler) { }
public PXApprovalProcessing(PXGraph graph) : this(graph, null) { }
public static int? GetLaborClassID(PXGraph graph, string caseClassID, string earningTypeID) { CRCaseClassLaborMatrix matrix = PXSelect<CRCaseClassLaborMatrix , Where< CRCaseClassLaborMatrix.caseClassID, Equal<Required<CRCaseClass.caseClassID>> , And<CRCaseClassLaborMatrix.earningType, Equal<Required<CRCaseClassLaborMatrix.earningType>>> > >.Select(graph, new object[] { caseClassID, earningTypeID }); return matrix != null ? matrix.LabourItemID: null; }
public ServiceVehicleTypes_View(PXGraph graph) : base(graph) { }
private Mailbox FindOwnerAddress(PXGraph graph, long? noteId, Guid? mainOwner) { if (noteId == null) return null; var source = FindSource(graph, (long)noteId); if (source == null) return null; Contact owner; Users user; FindOwner(graph, source as IAssign, out owner, out user); if (user == null) return null; if (mainOwner == user.PKID) return null; return GenerateAddress(owner, user); }
public ServiceVehicleTypes_View(PXGraph graph, Delegate handler) : base(graph, handler) { }
private void SendCopyMessage(PXGraph graph, EMailAccount account, EPActivity message, string email) { var cache = graph.Caches[message.GetType()]; var copy = (EPActivity)cache.CreateCopy(message); copy.TaskID = null; copy.IsIncome = false; copy.ParentTaskID = message.TaskID; copy.MailTo = email; //TODO: need add address description copy.MailCc = null; copy.MailBcc = null; copy.MPStatus = MailStatusListAttribute.PreProcess; copy.ClassID = CRActivityClass.EmailRouting; new AddInfoEmailProcessor().Process(new EmailProcessEventArgs(graph, account, copy)); copy.RefNoteID = null; copy.ParentRefNoteID = null; copy.Pop3UID = null; copy.ImapUID = null; var imcUid = Guid.NewGuid(); copy.ImcUID = imcUid; copy.MessageId = this.GetType().Name + "_" + imcUid.ToString().Replace("-", string.Empty); copy.Owner = null; copy = (EPActivity)cache.CreateCopy(cache.Insert(copy)); //Update owner and reset owner if employee not found copy.Owner = message.Owner; try { cache.Update(copy); } catch (PXSetPropertyException) { copy.Owner = null; copy = (EPActivity)cache.CreateCopy(cache.Update(copy)); } var noteFiles = PXNoteAttribute.GetFileNotes(cache, message); if (noteFiles != null) PXNoteAttribute.SetFileNotes(cache, copy, noteFiles); graph.EnshureCachePersistance(copy.GetType()); }
public DatabaseCurrencyService(PXGraph graph) { Graph = graph; }
private void FindOwner(PXGraph graph, IAssign source, out Contact employee, out Users user) { employee = null; user = null; if (source == null || source.OwnerID == null) return; PXSelectJoin<Users, LeftJoin<EPEmployee, On<EPEmployee.userID, Equal<Users.pKID>>, LeftJoin<Contact, On<Contact.contactID, Equal<EPEmployee.defContactID>>>>, Where<Users.pKID, Equal<Required<Users.pKID>>>>. Clear(graph); var row = (PXResult<Users, EPEmployee, Contact>)PXSelectJoin<Users, LeftJoin<EPEmployee, On<EPEmployee.userID, Equal<Users.pKID>>, LeftJoin<Contact, On<Contact.contactID, Equal<EPEmployee.defContactID>>>>, Where<Users.pKID, Equal<Required<Users.pKID>>>>. Select(graph, source.OwnerID); employee = (Contact)row; user = (Users)row; }
/// <summary> Update Shipment Tracking Info For P3PL </summary> public virtual void UpdateTrackingInfo(LUMP3PLImportProc graph, List <LUMP3PLImportProcess> list) { PXLongOperation.StartOperation(this, delegate() { var logData = SelectFrom <LUMP3PLImportProcessLog> .View.Select(graph).RowCast <LUMP3PLImportProcessLog>(); foreach (var row in list) { try { var _soOrder = SelectFrom <SOOrder> .Where <SOOrder.orderNbr.IsEqual <P.AsString> > .View.Select(graph, row.WarehouseOrder).RowCast <SOOrder>()?.FirstOrDefault(); #region Check is already updated if (logData.Any(x => x.WarehouseOrder == row.WarehouseOrder && (x.IsProcess ?? false))) { continue; } #endregion #region Check SOOrder is Exists if (_soOrder == null) { throw new Exception("SOOrder is not exists"); } #endregion #region Check data if (string.IsNullOrEmpty(row.WarehouseOrder)) { throw new Exception("ERP Order Nbr can not be empty!"); } if (string.IsNullOrEmpty(row.Carrier) || row.Carrier == "null") { throw new Exception("Carrier can not be empty!"); } if (string.IsNullOrEmpty(row.TrackingNumber)) { throw new Exception("Tracking Nbr can not be empty!"); } #endregion if (_soOrder.OrderType == "FM") { var setup = graph.MiddlewareSetup.Select().RowCast <LUMMiddleWareSetup>().FirstOrDefault(); var shippingCarrier = row.Carrier; var _merchant = string.IsNullOrEmpty(PXAccess.GetCompanyName()?.Split(' ')[1]) ? "us" : PXAccess.GetCompanyName()?.Split(' ')[1].ToLower() == "uk" ? "gb" : PXAccess.GetCompanyName()?.Split(' ')[1].ToLower(); MiddleWare_Shipment metaData = new MiddleWare_Shipment() { merchant = _merchant, amazon_order_id = _soOrder.CustomerOrderNbr, shipment_date = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), shipping_method = "Standard", carrier = shippingCarrier, tracking_number = row.TrackingNumber }; // Update FBM var updateResult = MiddleWareHelper.CallMiddleWareToUpdateFBM(setup, metaData); // Check HttpStatusCode if (updateResult.StatusCode != System.Net.HttpStatusCode.OK) { throw new PXException($"Update MiddleWare FBM fail , Code = {updateResult.StatusCode}"); } // Check Response status var updateModel = JsonConvert.DeserializeObject <MiddleWare_Response>(updateResult.ContentResult); if (!updateModel.Status) { throw new PXException($"Update Middleware FBM fail, Msg = {updateModel.Message}"); } // update SOOrder_UsrSendToMiddleware var soorderGraph = PXGraph.CreateInstance <SOOrderEntry>(); _soOrder.GetExtension <SOOrderExt>().UsrSendToMiddleware = true; soorderGraph.Document.Update(_soOrder); soorderGraph.Save.Press(); InsertLogAndDeleteFile(graph, row, true, string.Empty); } else { var _soOrderShipment = SelectFrom <SOOrderShipment> .Where <SOOrderShipment.orderNbr.IsEqual <P.AsString> .And <SOOrderShipment.orderType.IsEqual <P.AsString> > > .View.Select(graph, _soOrder.OrderNbr, _soOrder.OrderType).RowCast <SOOrderShipment>()?.FirstOrDefault(); #region Check SOOrderShipment is Exists if (_soOrderShipment == null) { throw new Exception("SOOrder need to create Shipment first!"); } #endregion var _soShipment = SelectFrom <SOShipment> .Where <SOShipment.shipmentNbr.IsEqual <P.AsString> > .View.Select(graph, _soOrderShipment?.ShipmentNbr).RowCast <SOShipment>().FirstOrDefault(); #region Check SOShipment is Exists if (_soShipment == null) { throw new Exception("Shipment is not exists!"); } #endregion // Update Shipment var shipmentGraph = PXGraph.CreateInstance <SOShipmentEntry>(); _soShipment.GetExtension <SOShipmentExt>().UsrTrackingNbr = row.TrackingNumber; _soShipment.GetExtension <SOShipmentExt>().UsrCarrier = row.Carrier; shipmentGraph.Document.Update(_soShipment); shipmentGraph.Save.Press(); InsertLogAndDeleteFile(graph, row, true, string.Empty); } graph.Actions.PressSave(); } catch (Exception ex) { PXProcessing.SetError(ex.Message); InsertLogAndDeleteFile(graph, row, false, ex.Message); } } }); }
static public IEnumerable GroupDelegate(PXGraph graph, bool inclInserted) { PXResultset<PX.SM.Neighbour> set = PXSelectGroupBy<PX.SM.Neighbour, Where<PX.SM.Neighbour.leftEntityType, Equal<customerType>>, Aggregate<GroupBy<PX.SM.Neighbour.coverageMask, GroupBy<PX.SM.Neighbour.inverseMask, GroupBy<PX.SM.Neighbour.winCoverageMask, GroupBy<PX.SM.Neighbour.winInverseMask>>>>>>.Select(graph); foreach (PX.SM.RelationGroup group in PXSelect<PX.SM.RelationGroup>.Select(graph)) { if ((!string.IsNullOrEmpty(group.GroupName) || inclInserted) && (group.SpecificModule == null || group.SpecificModule == typeof(Customer).Namespace) || PX.SM.UserAccess.InNeighbours(set, group)) { yield return group; } } }
public static void RecalcAmountInClaimCury(PXCache receiptsCache, EPExpenseClaimDetails receipt) { if (receipt != null && receipt.TranAmt != null && receipt.TranAmtWithTaxes != null && receipt.RefNbr != null) { PXGraph graph = receiptsCache.Graph; PXCache taxTranCache = graph.Caches[typeof(EPTaxTran)]; CurrencyInfo expenseCuriInfo = PXSelect <CurrencyInfo, Where <CurrencyInfo.curyInfoID, Equal <Required <EPExpenseClaimDetails.curyInfoID> > > > .SelectSingleBound(graph, null, receipt.CuryInfoID); CurrencyInfo currencyinfo = PXSelect <CurrencyInfo, Where <CurrencyInfo.curyInfoID, Equal <Required <EPExpenseClaimDetails.curyInfoID> > > > .SelectSingleBound(graph, null, receipt.ClaimCuryInfoID); decimal curyClaim = 0m; decimal curyClaimWithTaxes = 0m; decimal curyClaimTax = 0m; decimal curyTaxRoundDiff = 0m; decimal curyVatExemptTotal = 0m; decimal curyVatTaxableTotal = 0m; if (IsSameCury(receipt.CuryInfoID, receipt.ClaimCuryInfoID, expenseCuriInfo, currencyinfo)) { curyClaim = receipt.CuryTranAmt ?? 0m; curyClaimWithTaxes = receipt.CuryTranAmtWithTaxes ?? 0m; curyClaimTax = receipt.CuryTaxTotal ?? 0m; curyTaxRoundDiff = receipt.CuryTaxRoundDiff ?? 0m; curyVatExemptTotal = receipt.CuryVatExemptTotal ?? 0m; curyVatTaxableTotal = receipt.CuryVatTaxableTotal ?? 0m; foreach (EPTaxTran copy in PXSelect <EPTaxTran, Where <EPTaxTran.claimDetailID, Equal <Required <EPExpenseClaimDetails.claimDetailID> > > > .Select(receiptsCache.Graph, receipt.ClaimDetailID)) { if (taxTranCache.GetStatus(copy) != PXEntryStatus.Inserted) { taxTranCache.SetStatus(copy, PXEntryStatus.Updated); } taxTranCache.SetValue <EPTaxTran.claimCuryExpenseAmt>(copy, copy.CuryExpenseAmt ?? 0m); taxTranCache.SetValue <EPTaxTran.claimCuryTaxableAmt>(copy, copy.CuryTaxableAmt ?? 0m); taxTranCache.SetValue <EPTaxTran.claimCuryTaxAmt>(copy, copy.CuryTaxAmt ?? 0m); } } else if (currencyinfo?.CuryRate != null) { PXCurrencyAttribute.CuryConvCury <EPExpenseClaimDetails.claimCuryInfoID>(receiptsCache, receipt, receipt.TranAmt ?? 0m, out curyClaim); PXCurrencyAttribute.CuryConvCury <EPExpenseClaimDetails.claimCuryInfoID>(receiptsCache, receipt, receipt.TranAmtWithTaxes ?? 0m, out curyClaimWithTaxes); PXCurrencyAttribute.CuryConvCury <EPExpenseClaimDetails.claimCuryInfoID>(receiptsCache, receipt, receipt.TaxTotal ?? 0m, out curyClaimTax); PXCurrencyAttribute.CuryConvCury <EPExpenseClaimDetails.claimCuryInfoID>(receiptsCache, receipt, receipt.TaxRoundDiff ?? 0m, out curyTaxRoundDiff); PXCurrencyAttribute.CuryConvCury <EPExpenseClaimDetails.claimCuryInfoID>(receiptsCache, receipt, receipt.VatExemptTotal ?? 0m, out curyVatExemptTotal); PXCurrencyAttribute.CuryConvCury <EPExpenseClaimDetails.claimCuryInfoID>(receiptsCache, receipt, receipt.VatTaxableTotal ?? 0m, out curyVatTaxableTotal); foreach (EPTaxTran copy in PXSelect <EPTaxTran, Where <EPTaxTran.claimDetailID, Equal <Required <EPExpenseClaimDetails.claimDetailID> > > > .Select(receiptsCache.Graph, receipt.ClaimDetailID)) { if (taxTranCache.GetStatus(copy) != PXEntryStatus.Inserted) { taxTranCache.SetStatus(copy, PXEntryStatus.Updated); } decimal newValue; PXCurrencyAttribute.CuryConvCury <EPExpenseClaimDetails.claimCuryInfoID>(receiptsCache, receipt, copy.ExpenseAmt ?? 0m, out newValue); taxTranCache.SetValue <EPTaxTran.claimCuryExpenseAmt>(copy, newValue); PXCurrencyAttribute.CuryConvCury <EPExpenseClaimDetails.claimCuryInfoID>(receiptsCache, receipt, copy.TaxableAmt ?? 0m, out newValue); taxTranCache.SetValue <EPTaxTran.claimCuryTaxableAmt>(copy, newValue); PXCurrencyAttribute.CuryConvCury <EPExpenseClaimDetails.claimCuryInfoID>(receiptsCache, receipt, copy.TaxAmt ?? 0m, out newValue); taxTranCache.SetValue <EPTaxTran.claimCuryTaxAmt>(copy, newValue); } } receipt.ClaimCuryTranAmt = curyClaim; receipt.ClaimCuryTranAmtWithTaxes = curyClaimWithTaxes; receipt.ClaimCuryTaxTotal = curyClaimTax; receipt.ClaimCuryTaxRoundDiff = curyTaxRoundDiff; receipt.ClaimCuryVatExemptTotal = curyVatExemptTotal; receipt.ClaimCuryVatTaxableTotal = curyVatTaxableTotal; } }
private void AttachEventHandlers(PXGraph graph) { graph.FieldSelecting.AddHandler(typeof (PropertyValue), typeof (PropertyValue.value).Name, FieldSelecting); graph.RowUpdating.AddHandler(typeof (PropertyValue), RowUpdating); graph.RowUpdated.AddHandler(typeof (PropertyValue), RowUpdated); //graph.RowUpdated.AddHandler(View.Cache.GetItemType(), (sender, e) => sender.Graph.Caches[typeof (PropertyValue)].Clear()); graph.RowUpdated.AddHandler(Operations.Cache.GetItemType(), (sender, e) => sender.Graph.Caches[typeof(PropertyValue)].Clear()); }
public static void Transfer(TransferFilter filter, List <FixedAsset> list) { TransferProcess graph = PXGraph.CreateInstance <TransferProcess>(); graph.DoTransfer(filter, list); }
private void InitializePropertyValueView(PXGraph graph) { //Init PXVirtual Static constructor typeof (PropertyValue).GetCustomAttributes(typeof (PXVirtualAttribute), false); var propertiesSelect = new PXSelectOrderBy<PropertyValue, OrderBy<Asc<PropertyValue.order>>>(graph, new PXSelectDelegate(() => graph.Caches[typeof(PropertyValue)].Cached.Cast<PropertyValue>().Where(item => item.Hidden != true))); graph.Views.Add(PropertiesViewName, propertiesSelect.View); if (View.Cache.Fields.Any(o=>o.EndsWith("_Attributes")) && !graph.Views.Caches.Contains(typeof(CS.CSAnswers))) { graph.Views.Caches.Add(typeof(CS.CSAnswers)); } }
public ActivateContractPeriodProcess() { ActivateContractPeriodProcess graphActivateContractPeriodProcess = null; ServiceContracts.SetProcessDelegate( delegate(FSServiceContract fsServiceContractRow) { if (graphActivateContractPeriodProcess == null) { graphActivateContractPeriodProcess = PXGraph.CreateInstance <ActivateContractPeriodProcess>(); graphActivateContractPeriodProcess.graphServiceContractEntry = PXGraph.CreateInstance <ServiceContractEntry>(); graphActivateContractPeriodProcess.graphServiceContractEntry.skipStatusSmartPanels = true; graphActivateContractPeriodProcess.graphRouteServiceContractEntry = PXGraph.CreateInstance <RouteServiceContractEntry>(); graphActivateContractPeriodProcess.graphRouteServiceContractEntry.skipStatusSmartPanels = true; } graphActivateContractPeriodProcess.ProcessContractPeriod(graphActivateContractPeriodProcess, fsServiceContractRow); }); }
private void CreateWikiMenu(PXGraph graph, PXDropDown dd) { PXListItem liall = new PXListItem("Entire Help"); dd.Items.Add(liall); foreach (PXResult result in PXSelect<WikiDescriptor>.Select(graph)) { WikiDescriptor wiki = result[typeof(WikiDescriptor)] as WikiDescriptor; if (wiki != null && wiki.PageID != null) { var node = PXSiteMap.Provider.FindSiteMapNodeFromKey((Guid)wiki.PageID); if (node != null) { string title = wiki.WikiTitle ?? node.Title; PXListItem li = new PXListItem(title, wiki.PageID.ToString()); dd.Items.Add(li); } } } for (int i = 0; i < dd.Items.Count; i++) { if (WikiID == dd.Items[i].Value) { dd.SelectedIndex = i; } } string path = PXUrl.SiteUrlWithPath(); path += path.EndsWith("/") ? "" : "/"; var url = string.Format("{0}Search/{1}?query={2}&adv=1", path, this.ResolveClientUrl("~/Search/WikiSP.aspx"), txtSearch.Value); url = url + "&wikiid=" + SearchCaption.Value + "&wikinumber=" + SearchCaption.SelectedIndex.ToString() + "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderID; }
public static string GetCustomerReportID(PXGraph graph, string reportID, DetailsResult statement) { return(GetCustomerReportID(graph, reportID, statement.CustomerId, statement.BranchID)); }
private void CreateOrderMenu(PXGraph graph, PXDropDown dd) { PXListItem li1 = new PXListItem("Order by Most Recent", "0"); dd.Items.Add(li1); PXListItem li2 = new PXListItem("Order by Views", "1"); dd.Items.Add(li2); PXListItem li3 = new PXListItem("Order by Rating", "2"); dd.Items.Add(li3); for (int i = 0; i < dd.Items.Count; i++) { if (OrderID == dd.Items[i].Value) { dd.SelectedIndex = i; } } string path = PXUrl.SiteUrlWithPath(); path += path.EndsWith("/") ? "" : "/"; var url = string.Format("{0}Search/{1}?query={2}&adv=1", path, this.ResolveClientUrl("~/Search/WikiSP.aspx"), txtSearch.Value); url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber + "&categoryID=" + CategoryID + "&productID=" +ProductID + "&orderID=" + OrderCaption.Value; }
public static NotificationSetupUserOverride Find(PXGraph graph, Guid?userID, Guid?setupID) => FindBy(graph, userID, setupID);