Match Current User to Order.EntryPerson

I created a some code to do an action when the user matches the entry person. Or it will at least tell you if they match. I might try to do this for User Group next.

I’m using this on order entry when an order is created or changed and the criteria is met. You can use whatever trigger you like.

Enjoy.

private void oTrans_ordAdapter_AfterAdapterMethod(object sender, AfterAdapterMethodArgs args)
{
	switch (args.MethodName)
	{
		case "Update":
		EpiDataView edv1 = (EpiDataView) this.oTrans.EpiDataViews["CallContextClientData"];
		EpiDataView edv2 = (EpiDataView)(oTrans.EpiDataViews["OrderHed"]);
		string entryID = edv1.dataView[0]["CurrentUserId"].ToString();
   	 string userID = edv2.dataView[0]["EntryPerson"].ToString();

		if ((userID == "manager") || (userID == "user2"))
		{
			if (userID == entryID)

			{
				MessageBox.Show("Users Match"); 
			}
		}
		break;
	}
3 Likes