コード例 #1
0
		public SOPackageEngine(PXGraph graph)
		{
			if (graph == null)
				throw new ArgumentNullException("graph");

			this.graph = graph;
		}
コード例 #2
0
		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;
		}
コード例 #3
0
		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;
		}
コード例 #4
0
			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;
			}
コード例 #5
0
		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);
		}
コード例 #6
0
		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;
		}
コード例 #7
0
		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;
		}
コード例 #8
0
		public override void ViewCreated(PXGraph graph, string viewName)
		{
			base.ViewCreated(graph, viewName);

			CheckPropertiesViewName();
			CheckPropertyMarkAttribute();

			InitializePropertyValueView(graph);

			AttachEventHandlers(graph);
		}
コード例 #9
0
		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));
		}
コード例 #10
0
		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;
		}
コード例 #11
0
		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);
			}
		}
コード例 #12
0
ファイル: RateEngine.cs プロジェクト: PavelMPD/SimpleProjects
		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;
		}
コード例 #13
0
		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;
		}
コード例 #14
0
		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;
		}
コード例 #15
0
ファイル: Error.aspx.cs プロジェクト: PavelMPD/SimpleProjects
    //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;				
		}
    }
コード例 #16
0
	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;
	}
コード例 #17
0
	private void FormatSearchCaption()
	{
		PXGraph graph = new PXGraph();
		this.CreateWikiMenu(graph, SearchCaption);
		this.CreateCategoryMenu(graph, SearchCaptionCategory);
		this.CreateProductMenu(graph, SearchCaptionProduct);
		this.CreateOrderMenu(graph, OrderCaption);		
	}
コード例 #18
0
		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));
			}
		}
コード例 #19
0
		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());
		}
コード例 #20
0
ファイル: ARAccess.cs プロジェクト: PavelMPD/SimpleProjects
		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;
				}
			}
		}
コード例 #21
0
	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;
		}
	}
コード例 #22
0
		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;
		}
コード例 #23
0
		private object FindSource(PXGraph graph, long noteId)
		{
			return new EntityHelper(graph).GetEntityRow(noteId);
		}
コード例 #24
0
		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());
		}
コード例 #25
0
		private EPActivity GetRoutingMessage(PXGraph graph, EPActivity message)
		{
			return (EPActivity)PXSelect<EPActivity,
									Where<EPActivity.parentTaskID, Equal<Required<EPActivity.parentTaskID>>>>.
									SelectWindowed(graph, 0, 1, message.TaskID);
		}
コード例 #26
0
	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;
	}
コード例 #27
0
		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;
		}
コード例 #28
0
ファイル: GLUtility.cs プロジェクト: PavelMPD/SimpleProjects
		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;
		}
コード例 #29
0
	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;
	}
コード例 #30
0
		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);
		}