Grid Property Changed

@josecgomez
How would I refresh that DataView I just created?

You shouldn’t have to, it subscribes to the top grid and when you change the top grid it automatically re-runs the query. However if you want to force it to refresh (IE you add more data somewhere else) you can do this

//Add this using at the top of your class
using System.Reflection;

//On "Refresh" or button click
MethodInfo mi = bdvLeaveUsage.GetType().GetMethod("invokeExecute", BindingFlags.Instance | BindingFlags.NonPublic);
mi.Invoke(bdvLeaveUsage, new object[]{ true });
5 Likes

Okay I have a very weird issue going on. I made a BAQ Data View from all the code we talked about. That is working fine. I bound a text field to one of the columns in the Data View. I have an if statement that performs if this or that. However, the if statement only works if I have a message box in there. If I comment out the Message Box it quits working. What in the world is going on?

	{
	GS_UD09_Movement_DataView = new BAQDataView("GS_UD09_Movement_DataView");
	oTrans.Add("GS_UD09_Movement_DataView", GS_UD09_Movement_DataView);
	var OrderNum = "V_GS_Order_Detail_All_1View.OrderDtl_OrderNum";
	var OrderLine = "V_GS_Order_Detail_All_1View.OrderDtl_OrderLine";
	oTrans.PublishColumnChange(OrderNum, Guid.NewGuid().ToString());
	oTrans.PublishColumnChange(OrderLine, Guid.NewGuid().ToString());
	var OrderNumPub = oTrans.GetPublisher(OrderNum);
	var OrderLinePub = oTrans.GetPublisher(OrderLine);
	GS_UD09_Movement_DataView.SubscribeToPublisher(OrderNumPub.PublishName, "UD091_Number01");
	GS_UD09_Movement_DataView.SubscribeToPublisher(OrderLinePub.PublishName, "UD091_Number02");
	}	

// This is the if then statement that only works if I leave the Message Box active

	{
				MessageBox.Show(tbMovementToDept.Text);
				if (tbMovementToDept.Text == "99")
				{
					//MessageBox.Show("Dept. 99" + " Move " + tbMovementToDept.Text);
					btnShipstore.Visible = true;
					btnCreateNon_Conformance.Visible = true;	
				}
			else
				{
					//MessageBox.Show("Not Dept. 99" + tbMovementToDept.Text);
					btnShipstore.Visible = false;
					btnCreateNon_Conformance.Visible = false;
				}
			}```

//I call Dept99(); here:
```//Order - On Leave Refreshes the View and Grids
	private void numOrderDtl_OrderNum_Leave(object sender, System.EventArgs args)
		{
		if (numOrderDtl_OrderNum.Value.ToString() == ("0"))
			{
		MessageBox.Show("Please enter more job information to search.");
			}
			else
			{
			txtOrderHed_PONum.Text = string.Empty;
			epiNumericOrderNumRef.Value = numOrderDtl_OrderNum.Value;
			numOrderDtl_OrderLine.Value = (1);
			epiNumericEditorOrderLineNo.Value = numOrderDtl_OrderLine.Value;
			DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
			dqa.BOConnect();
			QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("GS_Order_Detail_Params");
			qeds.ExecutionParameter.Clear();
			qeds.ExecutionParameter.AddExecutionParameterRow("OrderNum", epiNumericOrderNumRef.Value.ToString() , "nvarchar", false, Guid.NewGuid(), "A");
			qeds.ExecutionParameter.AddExecutionParameterRow("OrderLine", epiNumericEditorOrderLineNo.Value.ToString() , "nvarchar", false, Guid.NewGuid(), "A");
			dqa.ExecuteByID("GS_Order_Detail_Params", qeds);
			grid_OrderDetails.DataSource = dqa.QueryResults.Tables["Results"];
			edvV_GS_Order_Detail_All_1View.ResetDataView(dqa.QueryResults.Tables["Results"].DefaultView);
    		edvV_GS_Order_Detail_All_1View.Notify(new EpiNotifyArgs(oTrans, 0, EpiTransaction.NotifyType.Initialize));
			changeordernumber();	
			MainController.AppControlPanel.HandleToolClick("RefreshTool", new Infragistics.Win.UltraWinToolbars.ToolClickEventArgs(MainController.MainToolManager.Tools["RefreshTool"], null));		
			Dept99();		
			}
		}

I’m confused if you are using the BAQDataView why are you executing a BAQ manually?

When does that if statement get called?

What do you mean executing the BAQ manually? The if statement gets called at the end of the change order number. Those are other Dynamic BAQ’s I haven’t converted yet.

Can you paste the whole function? Where the IF statement is

Yes, I will just paste the entire code:

//Custom code for MainController
//Created: 9/15/2018 11:34:11 AM
//**************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Ice.BO;
using Ice.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
using Infragistics.Win.UltraWinGrid;
using Ice.Lib.Broadcast;
using System.Reflection;

public class Script
{
	// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
	// Begin Wizard Added Module Level Variables **
	// End Wizard Added Module Level Variables **
	// Add Custom Module Level Variables Here **
private string custid;
private int ordernum;
private int orderline;
private int qty;
private int grdiquoteqty;
private int numcolors; 
private string quotepartnum;
private string partnum;
private int quotenum;
private int newquoteqty;
private string newquotepartnum;
private int newnumcolors;
private int newqtybreaks;
private string newcustid;
private int neworderqty;
private string neworderpartnum;
private int ordernumcolors;
private int neworderqtybreaks;
private string ordercustid;
private int newordernum;
private int neworderline;
private EpiTextBox txtOrderDtl_PartNum;
private EpiTextBox txtCustomer_CustID3; 
private EpiNumericEditor numOrderDtl_OrderLine;
private EpiTextBox txtOrderHed_PONum;
private EpiTextBox txtOrderDtl_GS_ImprintCopy_c;
private EpiPanel V_GS_Order_Detail_All_1ViewDetailPanel1;
private EpiNumericEditor numQuoteDtl_QuoteNum;
private EpiNumericEditor numOrderDtl_OrderNum;
private EpiTextBox txtCustomer_CustID;
private EpiTextBox txtCustomer_CustID2;
private EpiTextBox txtOrderDtl_GS_BasicImg_c;
private EpiNumericEditor numOrderDtl_OrderQty;
private EpiNumericEditor numOrderDtl_GS_NbrOfColors_c;
private EpiNumericEditor numInvcHead_OrderNum;
private EpiNumericEditor numInvcHead_InvoiceNum;
	private EpiTextBox txtOrderDtl_LineStatus;
	private EpiTextBox txtCalculated_OrderHeld;
	private EpiTextBox txtCalculated_OrderVoided;
	private EpiTextBox txtCalculated_LineVoided;
private EpiDataView edvV_GS_CustomerSearch_1View;
private DataView V_GS_Order_Detail_All_1View_DataView;
private EpiDataView edvV_GS_Order_Detail_All_1View;
private EpiDataView edvV_GS_Quotes_1View;
private EpiDataView edvV_GS_Invoices_1View;
private EpiNumericEditor numCustomer_CustNum;
private System.Windows.Forms.WebBrowser wbSite2; //Attachments List View Preview in Order Attachments Tab
private System.Windows.Forms.WebBrowser wbSite3;
private System.Windows.Forms.WebBrowser wbSite4;
private System.Windows.Forms.WebBrowser wbSite6;
private System.Windows.Forms.WebBrowser wbSite; //Attachment View in Order
private EpiNumericEditor numOrderDtl_TotalReleases;
private EpiNumericEditor numOrderDtl_RMANum;
	private BAQDataView GS_UD09_Movement_DataView;
	private BAQDataView GS_Order_Workflow_DataView;
	private BAQDataView GS_Misc_Charges_DataView;
	//private EpiTextBox tbMovementToDept;
public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		
		// Begin Wizard Added Variable Initialization
		
		MainController.KeyPreview = true;
		
		// End Wizard Added Variable Initialization
		
		// Begin Wizard Added Custom Method Calls
		SetExtendedProperties();		
		
		this.V_GS_Order_Detail_All_1View_Row.EpiRowChanged += new EpiRowChanged(this.V_GS_Order_Detail_All_1View_AfterRowChange);
		this.V_GS_CustomerSearch_1View_Row.EpiRowChanged += new EpiRowChanged(this.V_GS_CustomerSearch_1View_AfterRowChange);
		this.edvV_GS_Order_Detail_All_1View = ((EpiDataView)(this.oTrans.EpiDataViews["V_GS_Order_Detail_All_1View"]));
		this.edvV_GS_Order_Detail_All_1View.EpiViewNotification += new EpiViewNotification(this.edvV_GS_Order_Detail_All_1View_EpiViewNotification);
		this.edvV_GS_Quotes_1View = ((EpiDataView)(this.oTrans.EpiDataViews["V_GS_Quotes_1View"]));
		this.edvV_GS_CustomerSearch_1View = ((EpiDataView)(this.oTrans.EpiDataViews["V_GS_CustomerSearch_1View"]));
		this.edvV_GS_CustomerSearch_1View.EpiViewNotification += new EpiViewNotification(this.edvV_GS_CustomerSearch_1View_EpiViewNotification);
		txtCalculated_OrderHeld = (EpiTextBox)csm.GetNativeControlReference("a59114e3-b6c2-402e-9451-87d04067070f");
		txtCalculated_OrderVoided = (EpiTextBox)csm.GetNativeControlReference("9e6f1e3e-1b35-4d7e-b085-6bab21dfe67c");
		txtCalculated_LineVoided = (EpiTextBox)csm.GetNativeControlReference("88d79693-f4bf-42c9-b60e-7b1bab751ae6");
		numOrderDtl_RMANum = (EpiNumericEditor)csm.GetNativeControlReference("95f23ddd-5ac7-4a12-852a-f0250b4fb69c");	
		txtOrderDtl_LineStatus = (EpiTextBox)csm.GetNativeControlReference("e2be8d80-360f-4d62-8ac2-da015c80df38");
		epiNumericEditorOrderLineNo = (EpiNumericEditor)csm.GetNativeControlReference("4b377693-8a86-4f9f-988b-d44862bcb3dd");
		numCustomer_CustNum = (EpiNumericEditor)csm.GetNativeControlReference("ad61efeb-c259-4700-bd9e-d4ac0be68efb");		
		numOrderDtl_OrderQty = (EpiNumericEditor)csm.GetNativeControlReference("912b6872-a423-4d21-bc7e-f223d262ca5d");
		numOrderDtl_GS_NbrOfColors_c = (EpiNumericEditor)csm.GetNativeControlReference("fb8c08ba-9289-4d12-92e1-ed82b9f19e6d");
		txtCustomer_CustID = (EpiTextBox)csm.GetNativeControlReference("b1f04d95-6ac9-45da-a929-e650058f13bc");
		txtCustomer_CustID2 = (EpiTextBox)csm.GetNativeControlReference("bd16b76f-fc71-4b78-bb6d-8ec7cedc1338");	
		numQuoteDtl_QuoteNum = (EpiNumericEditor)csm.GetNativeControlReference("cda1ff1f-11c3-4a3d-bd6e-5f684a9107b2");
		txtOrderDtl_GS_ImprintCopy_c = (EpiTextBox)csm.GetNativeControlReference("bf50390a-fe73-4caf-aeec-d23e401e6899");
		txtOrderHed_PONum = (EpiTextBox)csm.GetNativeControlReference("3e06f070-8be5-4c87-8cd9-413463a26382");
		numOrderDtl_OrderLine = (EpiNumericEditor)csm.GetNativeControlReference("74100544-e769-4d3a-b4b8-074eb4d4969e");
		numOrderDtl_OrderNum = (EpiNumericEditor)csm.GetNativeControlReference("fff3b987-034b-440f-a55c-7f8fd3c44853");
		txtOrderDtl_PartNum = (EpiTextBox)csm.GetNativeControlReference("e9a1f245-a0dc-497c-81b9-8b1b35adf74a");
		txtCustomer_CustID3 = (EpiTextBox)csm.GetNativeControlReference("f69b6575-a461-4c07-a660-bbabb7da63f5");
		numOrderDtl_TotalReleases = (EpiNumericEditor)csm.GetNativeControlReference("2a1053cd-593c-41d5-8c74-e0026524b06f");
		grid_QuoteLetterPrev = (EpiUltraGrid)csm.GetNativeControlReference("2c21a74b-e009-4d50-a7d7-9442c68eba4c");
		grid_Attachments = (EpiUltraGrid)csm.GetNativeControlReference("6be52172-491c-40d5-89c8-6733d44ae5e4");
		txtOrderDtl_GS_BasicImg_c = (EpiTextBox)csm.GetNativeControlReference("f93687e6-7b41-4e05-ac8a-ae386b32178f");
		tbMovementToDept = (EpiTextBox)csm.GetNativeControlReference("b2c3c916-7189-47c8-bed1-11c6bba9e433");
		this.btn_enFlow.Click += new System.EventHandler(this.btn_enFlow_Click);
		this.btn_SalesOrderSearch.Click += new System.EventHandler(this.btn_SalesOrderSearch_Click);
		this.btnQS_NewQuote.Click += new System.EventHandler(this.btnQS_NewQuote_Click);
		this.btnQS_CustID.Click += new System.EventHandler(this.btnQS_CustID_Click);
		this.btnQS_Part.Click += new System.EventHandler(this.btnQS_Part_Click);
		this.btn_QS_Num1.Click += new System.EventHandler(this.btn_QS_Num1_Click);
		this.btn_QS_editquo1.Click += new System.EventHandler(this.btn_QS_editquo1_Click);
		this.btnExpediting.Click += new System.EventHandler(this.btnExpediting_Click);
		this.btnOrderQuickNotes.Click += new System.EventHandler(this.btnOrderQuickNotes_Click);
		this.btnCreateNon_Conformance.Click += new System.EventHandler(this.btnCreateNon_Conformance_Click);
		this.epiTextQS_CustID.Leave += new System.EventHandler(this.epiTextQS_CustID_Leave);
		this.numOrderDtl_OrderNum.Leave += new System.EventHandler(this.numOrderDtl_OrderNum_Leave);
		this.txtOrderHed_PONum.Leave += new System.EventHandler(this.txtOrderHed_PONum_Leave);
		this.txtCustomer_CustID.Leave += new System.EventHandler(this.txtCustomer_CustID_Leave);
		this.numQuoteDtl_QuoteNum.Leave += new System.EventHandler(this.numQuoteDtl_QuoteNum_Leave);
		this.btn_Cust_CustID.Click += new System.EventHandler(this.btn_Cust_CustID_Click);
		this.btnQuoteClearForm.Click += new System.EventHandler(this.btnQuoteClearForm_Click);
		this.btnOrderView.Click += new System.EventHandler(this.btnOrderView_Click);
		this.btn_QuoteFromOrder.Click += new System.EventHandler(this.btn_QuoteFromOrder_Click);
		this.btnShipstore.Click += new System.EventHandler(this.btnShipstore_Click);
		this.btnChangeShipping.Click += new System.EventHandler(this.btnChangeShipping_Click);
		this.btnNewProspectEntry.Click += new System.EventHandler(this.btnNewProspectEntry_Click);
		this.btnQuickNoteLaunch.Click += new System.EventHandler(this.btnQuickNoteLaunch_Click);
		this.numOrderDtl_OrderLine.GotFocus += new System.EventHandler(this.numOrderDtl_OrderLine_GotFocus);
		this.txtOrderHed_PONum.GotFocus += new System.EventHandler(this.txtOrderHed_PONum_GotFocus);
		this.txtCustomer_CustID.GotFocus += new System.EventHandler(this.txtCustomer_CustID_GotFocus);
		this.gridPOResults.AfterRowActivate += new System.EventHandler(this.gridPOResults_AfterRowActivate);
		this.gridLinesCopyChanges.AfterRowActivate += new System.EventHandler(this.gridLinesCopyChanges_AfterRowActivate);
		this.grid_Attachments.AfterRowActivate += new System.EventHandler(this.grid_Attachments_AfterRowActivate);
		this.gridPOResults.AfterSelectChange += new Infragistics.Win.UltraWinGrid.AfterSelectChangeEventHandler(this.gridPOResults_AfterSelectChange);
		this.gridLinesCopyChanges.AfterSelectChange += new Infragistics.Win.UltraWinGrid.AfterSelectChangeEventHandler(this.gridLinesCopyChanges_AfterSelectChange);
		this.gridWorkflow.AfterSelectChange += new Infragistics.Win.UltraWinGrid.AfterSelectChangeEventHandler(this.gridWorkflow_AfterSelectChange);
		this.btnChecklist.Click += new System.EventHandler(this.btnChecklist_Click);
		this.baseToolbarsManager.ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler (this.baseToolbarsManager_ToolClick);
		gridPOResults.Visible = false;
		tbOrderOnHold.Visible = false;
		tbLineCancelled.Visible = false;
		tbOrderCancelled.Visible = false;
		gridCopyChanges.Visible = true;
		gridChecklist.Visible = false;
		gridLinesCopyChanges.Visible = true;
		btnOrderView.Visible = false;   ////Once Janice makes a call this can be made to true
		btn_SalesOrderSearch.Visible = true;
		btnCreateNon_Conformance.Visible = true;
		btnChecklist.Visible = true;
		numOrderDtl_OrderLine.Visible = true;
		numOrderDtl_TotalReleases.Visible = false;
		SetupBrowser_AttachmentListView(); //All Attachments Box
		SetupBrowser_Attachments(); //Attachments Box
		SetupBrowser_QuoteLetter(); //Quote Letter Box
		SetupBrowser_ChecklistQueue(); //Checklist Queue
		SetupBrowser_enFlowQueue(); //enFlow Queue
		LegacyIndicatorLabel.Visible = false;
		tbQuoteComment.Visible = false;
		tbQuoteLegacyRef2.Visible = false;
		tbChecklistStatus.Visible = false;
		epiGroupBoxAttachments.Visible = true;
		epiTextBoxNoChecklist.Visible = false;
		CreateMovementBAQView();
		CreateWorkflowBAQView();
		CreateMiscChargesBAQView();
		//End Wizard Added Custom Method Calls
	}

	public void DestroyCustomCode()
	{
		 // ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		 // Begin Wizard Added Object Disposal
	
		this.btnNewProspectEntry.Click -= new System.EventHandler(this.btnNewProspectEntry_Click);
		this.gridWorkflow.AfterSelectChange -= new Infragistics.Win.UltraWinGrid.AfterSelectChangeEventHandler(this.gridWorkflow_AfterSelectChange);
		 // End Wizard Added Object Disposal

		 // Begin Custom Code Disposal
		this.numOrderDtl_OrderNum.Leave += new System.EventHandler(this.numOrderDtl_OrderNum_Leave);
		this.V_GS_CustomerSearch_1View_Row.EpiRowChanged -= new EpiRowChanged(this.V_GS_CustomerSearch_1View_AfterRowChange);
		this.V_GS_Order_Detail_All_1View_Row.EpiRowChanged -= new EpiRowChanged(this.V_GS_Order_Detail_All_1View_AfterRowChange);
		this.btn_QuoteFromOrder.Click -= new System.EventHandler(this.btn_QuoteFromOrder_Click);
		this.edvV_GS_Order_Detail_All_1View.EpiViewNotification -= new EpiViewNotification(this.edvV_GS_Order_Detail_All_1View_EpiViewNotification);
		this.edvV_GS_Order_Detail_All_1View = null;
		this.btnQS_NewQuote.Click -= new System.EventHandler(this.btnQS_NewQuote_Click);
		this.btnQS_CustID.Click -= new System.EventHandler(this.btnQS_CustID_Click);
		this.btnQS_Part.Click -= new System.EventHandler(this.btnQS_Part_Click);
		this.btn_QS_Num1.Click -= new System.EventHandler(this.btn_QS_Num1_Click);
		this.btn_QS_editquo1.Click -= new System.EventHandler(this.btn_QS_editquo1_Click);
		this.btnChangeShipping.Click -= new System.EventHandler(this.btnChangeShipping_Click);
		this.btnExpediting.Click -= new System.EventHandler(this.btnExpediting_Click);
		this.btnOrderQuickNotes.Click -= new System.EventHandler(this.btnOrderQuickNotes_Click);
		this.epiTextQS_CustID.Leave -= new System.EventHandler(this.epiTextQS_CustID_Leave);
		this.txtCustomer_CustID.Leave -= new System.EventHandler(this.txtCustomer_CustID_Leave);
		this.txtOrderHed_PONum.Leave -= new System.EventHandler(this.txtOrderHed_PONum_Leave);
		this.btnCreateNon_Conformance.Click -= new System.EventHandler(this.btnCreateNon_Conformance_Click);
		this.gridWorkflow.AfterSelectChange -= new Infragistics.Win.UltraWinGrid.AfterSelectChangeEventHandler(this.gridWorkflow_AfterSelectChange);
		this.edvV_GS_Quotes_1View = null;
		this.btn_Cust_CustID.Click -= new System.EventHandler(this.btn_Cust_CustID_Click);
		this.btnQuoteClearForm.Click -= new System.EventHandler(this.btnQuoteClearForm_Click);
		this.edvV_GS_CustomerSearch_1View.EpiViewNotification -= new EpiViewNotification(this.edvV_GS_CustomerSearch_1View_EpiViewNotification);
		this.edvV_GS_CustomerSearch_1View = null;
		this.btnOrderView.Click -= new System.EventHandler(this.btnOrderView_Click);
		this.btnShipstore.Click -= new System.EventHandler(this.btnShipstore_Click);
		this.btnQuickNoteLaunch.Click -= new System.EventHandler(this.btnQuickNoteLaunch_Click);
		this.numOrderDtl_OrderLine.GotFocus -= new System.EventHandler(this.numOrderDtl_OrderLine_GotFocus);
		this.txtCustomer_CustID.GotFocus -= new System.EventHandler(this.txtCustomer_CustID_GotFocus);
		this.txtOrderHed_PONum.GotFocus -= new System.EventHandler(this.txtOrderHed_PONum_GotFocus);
		this.gridPOResults.AfterSelectChange -= new Infragistics.Win.UltraWinGrid.AfterSelectChangeEventHandler(this.gridPOResults_AfterSelectChange);
		this.gridLinesCopyChanges.AfterSelectChange -= new Infragistics.Win.UltraWinGrid.AfterSelectChangeEventHandler(this.gridLinesCopyChanges_AfterSelectChange);
		this.gridLinesCopyChanges.AfterRowActivate -= new System.EventHandler(this.gridLinesCopyChanges_AfterRowActivate);
		this.btn_enFlow.Click -= new System.EventHandler(this.btn_enFlow_Click);
		this.btnChecklist.Click -= new System.EventHandler(this.btnChecklist_Click);
		this.btnNewProspectEntry.Click -= new System.EventHandler(this.btnNewProspectEntry_Click);
		this.grid_Attachments.AfterRowActivate -= new System.EventHandler(this.grid_Attachments_AfterRowActivate);
		numOrderDtl_RMANum.Value = 0;
		epiNumericEditorOrderLineNo.Value = (0);
		numCustomer_CustNum.Value = (0);		
		numOrderDtl_OrderQty.Value = (0);
		numOrderDtl_GS_NbrOfColors_c.Value = (0);
		txtCustomer_CustID.Text = string.Empty;
		txtCustomer_CustID2.Text = string.Empty;
		numQuoteDtl_QuoteNum.Value = (0);
		txtOrderDtl_GS_ImprintCopy_c.Text = string.Empty;
		txtOrderHed_PONum.Text = string.Empty;
		numOrderDtl_OrderLine.Value = (0);
		numOrderDtl_OrderNum.Value = (0);
		txtOrderDtl_PartNum.Text = string.Empty;
		txtCustomer_CustID3.Text = string.Empty;
		numOrderDtl_TotalReleases.Value = (0);
		// End Custom Code Disposal
	
	}

//Customer Section Code Begins*********

//Order Focus on Sheet
	private void txtCustomer_CustID_GotFocus(object sender, System.EventArgs args)
	{
	txtCustomer_CustID.Focus();
	}

//Customer ID Search Button in Customer Section
	private void btn_Cust_CustID_Click(object sender, System.EventArgs args)
	{
		SearchOnCustomerAdapterShowDialog_1();
	}
	
//Customer - New Account Prospect Entry
private void btnNewProspectEntry_Click(object sender, System.EventArgs args)
	{
	LaunchFormOptions lfo = new LaunchFormOptions();
	lfo.IsModal = false;
	lfo.SuppressFormSearch = true;
	System.Collections.Generic.Dictionary<string, string> mylist = new System.Collections.Generic.Dictionary<string, string>();
	lfo.ContextValue = mylist;
	ProcessCaller.LaunchForm(oTrans, "CRM001", lfo); 
	}

//Customer ID Search Method in Customer Section
	private void SearchOnCustomerAdapterShowDialog_1()
	{
		 //Wizard Generated Search Method
		 //You will need to call this method from another method in custom code
		 //For example, [Form]_Load or [Button]_Click

		bool recSelected;
		string whereClause = string.Empty;
		System.Data.DataSet dsCustomerAdapter = Ice.UI.FormFunctions.SearchFunctions.listLookup(this.oTrans, "CustomerAdapter", out recSelected, true, whereClause);
		if (recSelected)
		{
			System.Data.DataRow adapterRow = dsCustomerAdapter.Tables[0].Rows[0];
			txtCustomer_CustID.Text = adapterRow["CustID"].ToString();
			epiTextCustNumRef.Text = adapterRow["CustID"].ToString();
				{
				if (txtCustomer_CustID.Text.Length >= 3)
				{
					changecustomernumber();
				}
					else
					{
					}
				}
		}
	}

//Customer - Refreshes Customer View and Populates Grids
	private void changecustomernumber()
	{
	epiTextCustNumRef.Text = txtCustomer_CustID.Text;
	//Customer Detail Grid That is Hidden From View
	DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
	dqa.BOConnect();
	QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("GS_Customer_Search_Param");
	qeds.ExecutionParameter.Clear();
	qeds.ExecutionParameter.AddExecutionParameterRow("CustID", epiTextCustNumRef.Text , "nvarchar", false, Guid.NewGuid(), "A");
	dqa.ExecuteByID("GS_Customer_Search_Param", qeds);
	grid_Cust_Search_Parms.DataSource = dqa.QueryResults.Tables["Results"];
	edvV_GS_CustomerSearch_1View.ResetDataView(dqa.QueryResults.Tables["Results"].DefaultView);
    edvV_GS_CustomerSearch_1View.Notify(new EpiNotifyArgs(oTrans, 0, EpiTransaction.NotifyType.Initialize));
	//Customer Attributes Grid
	DynamicQueryAdapter dqa1 = new DynamicQueryAdapter(oTrans);
	dqa1.BOConnect();
	QueryExecutionDataSet qeds1 = dqa1.GetQueryExecutionParametersByID("GS_Customer_Attributes");
	qeds1.ExecutionParameter.Clear();
	qeds1.ExecutionParameter.AddExecutionParameterRow("CustID", epiTextCustNumRef.Text , "nvarchar", false, Guid.NewGuid(), "B");
	dqa1.ExecuteByID("GS_Customer_Attributes", qeds1);
	epiUltraGridC3.DataSource = dqa1.QueryResults.Tables["Results"];
	//Customer Contacts Grid
	DynamicQueryAdapter dqa2 = new DynamicQueryAdapter(oTrans);
	dqa2.BOConnect();
	QueryExecutionDataSet qeds2 = dqa2.GetQueryExecutionParametersByID("GS_Customer_Contacts");
	qeds2.ExecutionParameter.Clear();
	qeds2.ExecutionParameter.AddExecutionParameterRow("CustID", epiTextCustNumRef.Text , "nvarchar", false, Guid.NewGuid(), "C");
	dqa2.ExecuteByID("GS_Customer_Contacts", qeds2);
	epiUltraGridC2.DataSource = dqa2.QueryResults.Tables["Results"];
	//Customer Notes
	DynamicQueryAdapter dqa3 = new DynamicQueryAdapter(oTrans);
	dqa3.BOConnect();
	QueryExecutionDataSet qeds3 = dqa3.GetQueryExecutionParametersByID("GS_Customer_Note");
	qeds3.ExecutionParameter.Clear();
	qeds3.ExecutionParameter.AddExecutionParameterRow("CustNum", epiTextCustNumRef.Text , "nvarchar", false, Guid.NewGuid(), "D");
	dqa3.ExecuteByID("GS_Customer_Note", qeds3);
	gridCustomerNotes.DataSource = dqa3.QueryResults.Tables["Results"];
	MainController.AppControlPanel.HandleToolClick("RefreshTool", new Infragistics.Win.UltraWinToolbars.ToolClickEventArgs(MainController.MainToolManager.Tools["RefreshTool"], null));	
}

//Customer - On Leave Refreshes the View and Grids
	private void txtCustomer_CustID_Leave(object sender, System.EventArgs args)
		{
		if (txtCustomer_CustID.Text.Length >= 3)
		{
			changecustomernumber();
		}
			else
			{
			}
		}

//Customer - Quick Note Launch Button - Popup Window
	private void btnQuickNoteLaunch_Click(object sender, System.EventArgs args)
	{
		System.Diagnostics.Process.Start("http://envisionpp/erpdashboard/quickNoteStart.asp?custnum=" + numCustomer_CustNum.Value.ToString());
	}
	
//Customer - Detail View After Row Change
	private void V_GS_CustomerSearch_1View_AfterRowChange(EpiRowChangedArgs args)
	{
		// ** Argument Properties and Uses **
		// args.CurrentView.dataView[args.CurrentRow]["FieldName"]
		// args.LastRow, args.CurrentRow, args.CurrentView
		// Add Event Handler Code
	}

//Customer - Epi Customer Detail View
	private void edvV_GS_CustomerSearch_1View_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
	{
		// ** Argument Properties and Uses **
		// view.dataView[args.Row]["FieldName"]
		// args.Row, args.Column, args.Sender, args.NotifyType
		// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
		if ((args.NotifyType == EpiTransaction.NotifyType.AddRow))
		{
			if ((args.Row > -1))
			{
			}
		}
	}

//**********************Order Section Code Begins*********
	
//Order - Button Search for Sales Order Number in Orders Section
	private void btn_SalesOrderSearch_Click(object sender, System.EventArgs args)
	{
		SearchOnSalesOrderAdapterShowDialog();
	}

//Order - Method for Sales Order Search in Orders Section
	private void SearchOnSalesOrderAdapterShowDialog() 
	{
		 //Wizard Generated Search Method
		 //You will need to call this method from another method in custom code
		 //For example, [Form]_Load or [Button]_Click
		bool recSelected;
		string whereClause = string.Empty;
		System.Data.DataSet dsSalesOrderAdapter = Ice.UI.FormFunctions.SearchFunctions.listLookup(this.oTrans, "SalesOrderAdapter", out recSelected, true, whereClause);
		if (recSelected)
		{
			System.Data.DataRow adapterRow = dsSalesOrderAdapter.Tables[0].Rows[0];
			numOrderDtl_OrderNum.Value = adapterRow["OrderNum"].ToString();
			epiNumericOrderNumRef.Value = adapterRow["OrderNum"].ToString();
			epiTextBoxPORefNum.Text = adapterRow["PONum"].ToString();
			txtOrderHed_PONum.Text = string.Empty;
			epiNumericOrderNumRef.Value = numOrderDtl_OrderNum.Value;
			numOrderDtl_OrderLine.Value = (1);
			epiNumericEditorOrderLineNo.Value = numOrderDtl_OrderLine.Value;
			DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
			dqa.BOConnect();
			QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("GS_Order_Detail_Params");
			qeds.ExecutionParameter.Clear();
			qeds.ExecutionParameter.AddExecutionParameterRow("OrderNum", epiNumericOrderNumRef.Value.ToString() , "nvarchar", false, Guid.NewGuid(), "A");
			qeds.ExecutionParameter.AddExecutionParameterRow("OrderLine", epiNumericEditorOrderLineNo.Value.ToString() , "nvarchar", false, Guid.NewGuid(), "A");
			dqa.ExecuteByID("GS_Order_Detail_Params", qeds);
			grid_OrderDetails.DataSource = dqa.QueryResults.Tables["Results"];
			edvV_GS_Order_Detail_All_1View.ResetDataView(dqa.QueryResults.Tables["Results"].DefaultView);
    		edvV_GS_Order_Detail_All_1View.Notify(new EpiNotifyArgs(oTrans, 0, EpiTransaction.NotifyType.Initialize));
			changeordernumber();			
		}
	}

//Order - On Leave Refreshes the View and Grids
	private void numOrderDtl_OrderNum_Leave(object sender, System.EventArgs args)
		{
		if (numOrderDtl_OrderNum.Value.ToString() == ("0"))
			{
		MessageBox.Show("Please enter more job information to search.");
			}
			else
			{
			txtOrderHed_PONum.Text = string.Empty;
			epiNumericOrderNumRef.Value = numOrderDtl_OrderNum.Value;
			numOrderDtl_OrderLine.Value = (1);
			epiNumericEditorOrderLineNo.Value = numOrderDtl_OrderLine.Value;
			DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
			dqa.BOConnect();
			QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("GS_Order_Detail_Params");
			qeds.ExecutionParameter.Clear();
			qeds.ExecutionParameter.AddExecutionParameterRow("OrderNum", epiNumericOrderNumRef.Value.ToString() , "nvarchar", false, Guid.NewGuid(), "A");
			qeds.ExecutionParameter.AddExecutionParameterRow("OrderLine", epiNumericEditorOrderLineNo.Value.ToString() , "nvarchar", false, Guid.NewGuid(), "A");
			dqa.ExecuteByID("GS_Order_Detail_Params", qeds);
			grid_OrderDetails.DataSource = dqa.QueryResults.Tables["Results"];
			edvV_GS_Order_Detail_All_1View.ResetDataView(dqa.QueryResults.Tables["Results"].DefaultView);
    		edvV_GS_Order_Detail_All_1View.Notify(new EpiNotifyArgs(oTrans, 0, EpiTransaction.NotifyType.Initialize));
			changeordernumber();	
			MainController.AppControlPanel.HandleToolClick("RefreshTool", new Infragistics.Win.UltraWinToolbars.ToolClickEventArgs(MainController.MainToolManager.Tools["RefreshTool"], null));		
			Dept99();		
			}
		}
	
//Order - Lines and Copy Grid Refreshes Boxes 		//Populate Boxes with Active Line Selection from Grid
	private void gridLinesCopyChanges_AfterRowActivate(object sender, System.EventArgs args)
	{
		UltraGridRow activeRow = gridLinesCopyChanges.ActiveRow;
		numOrderDtl_OrderLine.Value = activeRow.Cells["OrderDtl_OrderLine"].Value.ToString();
		epiNumericEditorOrderLineNo.Value = activeRow.Cells["OrderDtl_OrderLine"].Value.ToString();
		}

//Order - Lines and Copy Grid Refreshes List and Results
	private void gridLinesCopyChanges_AfterSelectChange(object sender, Infragistics.Win.UltraWinGrid.AfterSelectChangeEventArgs args)
	{
		OrderLinesSecondRefresh();
	}

//Order - Lines and Copy 2nd Refresh
	private void OrderLinesSecondRefresh()
	{
		epiNumericEditorOrderLineNo.Value = numOrderDtl_OrderLine.Value;
		DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
		dqa.BOConnect();
		QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("GS_Order_Detail_Params");
		qeds.ExecutionParameter.Clear();
		qeds.ExecutionParameter.AddExecutionParameterRow("OrderNum", epiNumericOrderNumRef.Value.ToString() , "nvarchar", false, Guid.NewGuid(), "A");
		qeds.ExecutionParameter.AddExecutionParameterRow("OrderLine", epiNumericEditorOrderLineNo.Value.ToString() , "nvarchar", false, Guid.NewGuid(), "A");
		dqa.ExecuteByID("GS_Order_Detail_Params", qeds);
		grid_OrderDetails.DataSource = dqa.QueryResults.Tables["Results"];
		edvV_GS_Order_Detail_All_1View.ResetDataView(dqa.QueryResults.Tables["Results"].DefaultView);
    	edvV_GS_Order_Detail_All_1View.Notify(new EpiNotifyArgs(oTrans, 0, EpiTransaction.NotifyType.Initialize));
		changeordernumber();
	}

//Order - PONum Leave
	private void txtOrderHed_PONum_Leave(object sender, System.EventArgs args)
	{
		if (txtOrderHed_PONum.Text.Length >= 3)
		{
		//Order Populate Boxes
		numOrderDtl_OrderNum.Value = (0);
		numOrderDtl_OrderLine.Value = (0);
		numOrderDtl_TotalReleases.Value = (0);
		epiTextBoxPORefNum.Text = txtOrderHed_PONum.Text;
		//Order Details Grid with PO 
		DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
		dqa.BOConnect();
		QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("GS_Order_Detail_ParamsPO");
		qeds.ExecutionParameter.Clear();
		qeds.ExecutionParameter.AddExecutionParameterRow("POParam", txtOrderHed_PONum.Text, "nvarchar", false, Guid.NewGuid(), "A");
		dqa.ExecuteByID("GS_Order_Detail_ParamsPO", qeds);
		gridPOResults.DataSource = dqa.QueryResults.Tables["Results"];
			{
				if (dqa.QueryResults.Tables["Results"].Rows.Count <= 1)
				{
					gridPOResults.Visible = false;
					}
				else
				{
					MessageBox.Show("Select the PO you are searching for.");
					gridPOResults.Visible = true;
					gridPOResults.BringToFront();
					gridPOResults.Focus();
					}
			}
			edvV_GS_Order_Detail_All_1View.ResetDataView(dqa.QueryResults.Tables["Results"].DefaultView);
    		edvV_GS_Order_Detail_All_1View.Notify(new EpiNotifyArgs(oTrans, 0, EpiTransaction.NotifyType.Initialize));
			changeordernumber(); 
		}
		else
		{
		}
	}
		
//Order - PO Grid Refreshes Boxes  //Populate Boxes with Active PO Selection from Grid
	private void gridPOResults_AfterRowActivate(object sender, System.EventArgs args)
	{		
		UltraGridRow activeRow = gridPOResults.ActiveRow;
		epiTextBoxPORefNum.Text = activeRow.Cells["OrderHed_PONum"].Value.ToString();
		epiNumericOrderNumRef.Value = activeRow.Cells["OrderDtl_OrderNum"].Value.ToString();
		epiNumericEditorOrderLineNo.Value = activeRow.Cells["OrderDtl_OrderLine"].Value.ToString();
		txtOrderHed_PONum.Text = epiTextBoxPORefNum.Text;
		numOrderDtl_OrderNum.Value = activeRow.Cells["OrderDtl_OrderNum"].Value.ToString();
		numOrderDtl_OrderLine.Value = activeRow.Cells["OrderDtl_OrderLine"].Value.ToString();
		numOrderDtl_TotalReleases.Value = activeRow.Cells["OrderDtl_TotalReleases"].Value.ToString();
	}

//Order - PO Grid Refreshes List and Results
	private void gridPOResults_AfterSelectChange(object sender, Infragistics.Win.UltraWinGrid.AfterSelectChangeEventArgs args)
	{
		POSecondRefresh();
	}

//Order - PO Grid 2nd Refresh
	private void POSecondRefresh()
	{
		epiTextBoxPORefNum.Text = txtOrderHed_PONum.Text;
		DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
		dqa.BOConnect();
		QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("GS_Order_Detail_ParamsPO");
		qeds.ExecutionParameter.Clear();
		qeds.ExecutionParameter.AddExecutionParameterRow("POParam", txtOrderHed_PONum.Text, "nvarchar", false, Guid.NewGuid(), "A");
		dqa.ExecuteByID("GS_Order_Detail_ParamsPO", qeds);
		gridPOResults.DataSource = dqa.QueryResults.Tables["Results"];
		edvV_GS_Order_Detail_All_1View.ResetDataView(dqa.QueryResults.Tables["Results"].DefaultView);
    	edvV_GS_Order_Detail_All_1View.Notify(new EpiNotifyArgs(oTrans, 0, EpiTransaction.NotifyType.Initialize));
		gridPOResults.Visible = false;
		changeordernumber();
}

//Order - Refreshes Order View and Populates Grids //Populate Order Number and PO Number Boxes
	private void changeordernumber()
	{
	epiNumericOrderNumRef.Value = numOrderDtl_OrderNum.Value;   
	epiNumericEditorOrderLineNo.Value = numOrderDtl_OrderLine.Value;
	epiTextBoxPORefNum.Text = txtOrderHed_PONum.Text;
	//Order Lines
	DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
	dqa.BOConnect();
	QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("GS_Orders_Lines");
	qeds.ExecutionParameter.Clear();
	qeds.ExecutionParameter.AddExecutionParameterRow("OrderNum", epiNumericOrderNumRef.Value.ToString() , "nvarchar", false, Guid.NewGuid(), "A");
	dqa.ExecuteByID("GS_Orders_Lines", qeds);
	gridLinesCopyChanges.DataSource = dqa.QueryResults.Tables["Results"];
	foreach (System.Data.DataRow r in dqa.QueryResults.Tables["Results"].Rows)
			{
			epiTextBoxCustomerName.Text = r["Customer_Name"].ToString();
			}
	//Order Notes and Call Log and Workflow Log
	DynamicQueryAdapter dqa10 = new DynamicQueryAdapter(oTrans);
	dqa10.BOConnect();
	QueryExecutionDataSet qeds10 = dqa10.GetQueryExecutionParametersByID("GS_Order_CallWorkflowNotes");
	qeds10.ExecutionParameter.Clear();
	qeds10.ExecutionParameter.AddExecutionParameterRow("Ordernum", epiNumericOrderNumRef.Value.ToString() , "nvarchar", false, Guid.NewGuid(), "V");
	//qeds10.ExecutionParameter.AddExecutionParameterRow("OrderLine", epiNumericEditorOrderLineNo.Value.ToString() , "nvarchar", false, Guid.NewGuid(), "C");
	dqa10.ExecuteByID("GS_Order_CallWorkflowNotes", qeds10);
	gridOrderNotes.DataSource = dqa10.QueryResults.Tables["Results"];
	//Order Checklist
	DynamicQueryAdapter dqa2 = new DynamicQueryAdapter(oTrans);
	dqa2.BOConnect();
	QueryExecutionDataSet qeds2 = dqa2.GetQueryExecutionParametersByID("GS_Order_Checklists");
	qeds2.ExecutionParameter.Clear();
	qeds2.ExecutionParameter.AddExecutionParameterRow("OrderNum", epiNumericOrderNumRef.Value.ToString() , "nvarchar", false, Guid.NewGuid(), "C");
	qeds2.ExecutionParameter.AddExecutionParameterRow("OrderLine", epiNumericEditorOrderLineNo.Value.ToString() , "nvarchar", false, Guid.NewGuid(), "C");
	dqa2.ExecuteByID("GS_Order_Checklists", qeds2);
	gridChecklist.DataSource = dqa2.QueryResults.Tables["Results"];
		{
			if (dqa2.QueryResults.Tables["Results"].Rows.Count > 0)
			{
			btnChecklist.Visible = true;
			epiTextBoxNoChecklist.Visible = false;
			gridChecklist.Visible = true;
			tbChecklistStatus.Visible = true;
			foreach (System.Data.DataRow w in dqa2.QueryResults.Tables["Results"].Rows)
				{
				tbChecklistStatus.Text = w["WorkFlowStatus_WFStatusName"].ToString();
				}
			}			
			else
			{
				tbChecklistStatus.Visible = false;
				btnChecklist.Visible = false;
				epiTextBoxNoChecklist.Visible = true;
				gridChecklist.Visible = false;
			}
		}
//Order Attachments
	DynamicQueryAdapter dqa7 = new DynamicQueryAdapter(oTrans);
	dqa7.BOConnect();
	QueryExecutionDataSet qeds7 = dqa7.GetQueryExecutionParametersByID("GS_Attachments");
	qeds7.ExecutionParameter.Clear();
	qeds7.ExecutionParameter.AddExecutionParameterRow("OrderNum", epiNumericOrderNumRef.Value.ToString() , "nvarchar", false, Guid.NewGuid(), "F");
	dqa7.ExecuteByID("GS_Attachments", qeds7);
	grid_Attachments.DataSource = dqa7.QueryResults.Tables["Results"];
	{
	string urltodisplay = "";
	foreach (System.Data.DataRow u in dqa7.QueryResults.Tables["Results"].Rows)
	{if (u["XFileRef_XFileDesc"].ToString() == ("Line 01"))    //Change once Attachments gets updated by Nick Knipp
		{urltodisplay = u["XFileRef_XFileName"].ToString(); }
		else
		{}
	if (urltodisplay != "")
		{epiTextBoxLineArt.Text = urltodisplay;}
	else
		{epiTextBoxLineArt.Text = string.Empty;}
	}
	}
//Order Attachments Grid
		if (dqa7.QueryResults.Tables["Results"].Rows.Count >= 1)
		{	
		}
		else
		{
		epiTextBoxLineArt.Text = string.Empty;
		epiTextBoxOrderNoAttach.Text = string.Empty;
		}
	wbSite.Navigate (epiTextBoxLineArt.Text); //Attachment View
//Order Releases	
	DynamicQueryAdapter dqa8 = new DynamicQueryAdapter(oTrans);
	dqa8.BOConnect();
	QueryExecutionDataSet qeds8 = dqa8.GetQueryExecutionParametersByID("GS_Orders_Releases");
	qeds8.ExecutionParameter.Clear();
	qeds8.ExecutionParameter.AddExecutionParameterRow("OrderNum", epiNumericOrderNumRef.Value.ToString() , "nvarchar", false, Guid.NewGuid(), "G");
	qeds8.ExecutionParameter.AddExecutionParameterRow("OrderLine", epiNumericEditorOrderLineNo.Value.ToString() , "nvarchar", false, Guid.NewGuid(), "G");
	dqa8.ExecuteByID("GS_Orders_Releases", qeds8);
	gridCopyChanges.DataSource = dqa8.QueryResults.Tables["Results"];
	wbSite2.Navigate (epiTextBoxOrderNoAttach.Text);  //SetupBrowser_Attachments Grid View  
	refreshBasicImage(); 
		{if (txtCalculated_OrderVoided.Text == ("True"))
			{
			MessageBox.Show("Order has been Cancelled");
			tbOrderCancelled.Visible = true;
			}
			else
			{
			//MessageBox.Show("Not Voided");
			tbOrderCancelled.Visible = false;
			}
		}
				{if (txtCalculated_LineVoided.Text == ("True"))
			{
			MessageBox.Show("Line has been Cancelled");
			tbLineCancelled.Visible = true;
			}
			else
			{
			//MessageBox.Show("Not Voided");
			tbLineCancelled.Visible = false;
			}
		}
				{
					if (txtCalculated_OrderHeld.Text == ("True"))
					{
						MessageBox.Show("Order is on HOLD");
						tbOrderOnHold.Visible = true;
					}
					else
					{//MessageBox.Show("Order Not Held");
						tbOrderOnHold.Visible = false;}}
					CreateRowRuleGS_Order_WorkflowWorkFlowStatus_WFStatusNameContains_New();;
			this.numOrderDtl_OrderLine.GotFocus += new System.EventHandler(this.numOrderDtl_OrderLine_GotFocus);
			MainController.AppControlPanel.HandleToolClick("RefreshTool", new Infragistics.Win.UltraWinToolbars.ToolClickEventArgs(MainController.MainToolManager.Tools["RefreshTool"], null));	
		}
	
	private void Dept99()
	{
				MessageBox.Show(tbMovementToDept.Text);
				if (tbMovementToDept.Text == "99")
				{
					//MessageBox.Show("Dept. 99" + " Move " + tbMovementToDept.Text);
					btnShipstore.Visible = true;
					btnCreateNon_Conformance.Visible = true;	
				}
			else
				{
					//MessageBox.Show("Not Dept. 99" + tbMovementToDept.Text);
					btnShipstore.Visible = false;
					btnCreateNon_Conformance.Visible = false;
				}
			}


//Order - Workflow Refresh After Selection
	private void gridWorkflow_AfterSelectChange(object sender, Infragistics.Win.UltraWinGrid.AfterSelectChangeEventArgs args)
	{
		UltraGridRow activeRow = gridWorkflow.ActiveRow;
		dbWorkflowFollowupDate.Text = activeRow.Cells["WorkFlow_FollowupDate"].Value.ToString();
		dbWorkflowCreateDate.Text = activeRow.Cells["Workflow_CreateDate"].Value.ToString();
		tbWorkflowType.Text = activeRow.Cells["WorkflowType_WFTypeName"].Value.ToString();
		tbWorkflowQueue.Text = activeRow.Cells["WorkflowQueue_WFQueueName"].Value.ToString();
		tbWorkflowStatus.Text = activeRow.Cells["WorkflowStatus_WFStatusName"].Value.ToString();
		nbWorkflowClosed.Value = activeRow.Cells["Workflow_Closed"].Value.ToString();
			}
	
//Order - Size Dimension
private void refreshBasicImage()
	{
		
		string fname1 = txtOrderDtl_GS_BasicImg_c.Text;
		if (fname1 == "") 
			{
				//MessageBox.Show("Blank Art");
			//pbSizeLayout.Image=System.Drawing.Image.FromFile(@"\\Intranet\Art\blank.png");
			}
			else 
			{
				//MessageBox.Show("Art Layout");
			//pbSizeLayout.Image=System.Drawing.Image.FromFile(@"\\Intranet\Art\"+fname1);   //Turning this off in Playpen - because it is erroring out. 
			}
	}

//Order - Attachments
	private void SetupBrowser_Attachments()
	{
		wbSite = new System.Windows.Forms.WebBrowser();
		wbSite.Dock = System.Windows.Forms.DockStyle.Fill;
		wbSite.Location = new System.Drawing.Point(0,0);
		wbSite.MinimumSize = new System.Drawing.Size(20,20);
		wbSite.Name = "Attachments";
		wbSite.Size = new System.Drawing.Size(560,323);
		wbSite.TabIndex = 0;
		epiGroupBoxAttachments.Controls.Add(wbSite);
	}  

//Order - Checklist Queue
	 private void SetupBrowser_ChecklistQueue()
	{
		wbSite3 = new System.Windows.Forms.WebBrowser();
		wbSite3.Dock = System.Windows.Forms.DockStyle.Fill;
		wbSite3.Location = new System.Drawing.Point(0,0);
		wbSite3.MinimumSize = new System.Drawing.Size(20,20);
		wbSite3.Name = "Checklist Queue";
		wbSite3.Size = new System.Drawing.Size(560,323);
		wbSite3.TabIndex = 0;
		epiGroupBoxChecklistQueue.Controls.Add(wbSite3);
		wbSite3.Navigate ("http://envisionpp/workflowqueues/checklistview.asp");
	}  

//Order - enFlow Queue
	 private void SetupBrowser_enFlowQueue()
	{
		wbSite6 = new System.Windows.Forms.WebBrowser();
		wbSite6.Dock = System.Windows.Forms.DockStyle.Fill;
		wbSite6.Location = new System.Drawing.Point(0,0);
		wbSite6.MinimumSize = new System.Drawing.Size(20,20);
		wbSite6.Name = "enFlow Queue";
		wbSite6.Size = new System.Drawing.Size(560,323);
		wbSite6.TabIndex = 0;
		epiGroupBoxEnflow.Controls.Add(wbSite6);
		wbSite6.Navigate ("http://envisionpp/workflow/enflowview.asp");
	}  

//Order Focus on Sheet
	private void numOrderDtl_OrderLine_GotFocus(object sender, System.EventArgs args)
	{
	this.numOrderDtl_OrderLine.GotFocus += new System.EventHandler(this.numOrderDtl_OrderLine_GotFocus);
	}

//Order Focus on Sheet
	private void txtOrderHed_PONum_GotFocus(object sender, System.EventArgs args)
	{
	this.txtOrderHed_PONum.GotFocus += new System.EventHandler(this.txtOrderHed_PONum_GotFocus);
	}

//Order - Quote From ORDER in Orders Section
	private void btn_QuoteFromOrder_Click(object sender, System.EventArgs args)
	{	
	LaunchFormOptions lfo = new LaunchFormOptions();
	lfo.IsModal = false;
	lfo.SuppressFormSearch = true;
	System.Collections.Generic.Dictionary<string, string> mylist = new System.Collections.Generic.Dictionary<string, string>();
	mylist.Add("entitynum", "0"); 
	neworderpartnum = txtOrderDtl_PartNum.Text;
	mylist.Add("partnum", neworderpartnum.ToString()); 
	neworderqty = Convert.ToInt32(numOrderDtl_OrderQty.Value);
	mylist.Add("quantity", neworderqty.ToString()); 
	ordercustid = txtCustomer_CustID2.Text;
	mylist.Add("custid", ordercustid); 
	mylist.Add("quantitybreaks", "3");
	ordernumcolors = Convert.ToInt32(numOrderDtl_GS_NbrOfColors_c.Value);
	mylist.Add("numofcolors", ordernumcolors.ToString()); 
	newordernum = Convert.ToInt32(epiNumericEditorC1OrderNum.Text);
	mylist.Add("prevorder", newordernum.ToString());
	neworderline = Convert.ToInt32(epiNumericEditorC2OrderLine.Text);
	mylist.Add("prevorderline", neworderline.ToString());
	mylist.Add("actiontype", "NewQuote"); 
	string valuein = "Quote";
	lfo.ValueIn = valuein;
	lfo.ContextValue = mylist;
	ProcessCaller.LaunchForm(oTrans, "GSCONFIG", lfo); 
	}

//Order - Create Non-Conformance *************************************************************************FIX
	private void btnCreateNon_Conformance_Click(object sender, System.EventArgs args)
	{
	LaunchFormOptions lfo = new LaunchFormOptions();
	lfo.IsModal = false;
	lfo.SuppressFormSearch = true;
	System.Collections.Generic.Dictionary<string, string> mylist = new System.Collections.Generic.Dictionary<string, string>();
	mylist.Add("OpenRMA", "true");
	mylist.Add("CustNum", "24989");
	mylist.Add("RMANum", "0");
	mylist.Add("OrderNum", "1411");
	mylist.Add("OrderLine", "1");
	mylist.Add("OrderRel", "1");
	mylist.Add("actiontype", "NewRMA"); 
	//string valuein = "GetNewRMAHead";	
	//string.Vlfo.ValueIn = valuein;
	//lfo.ContextValue = mylist;
	//LaunchFormOptions lfo = new LaunchFormOptions();
	lfo.ValueIn = mylist;
	ProcessCaller.LaunchForm(oTrans, "CRGO5000", lfo); 
	}
	
//Order - View Order in Configurator - Button hidden - Janice hasn't made Call for this yet. 
	private void btnOrderView_Click(object sender, System.EventArgs args)
	{
	LaunchFormOptions lfo = new LaunchFormOptions();
	string valuein = "Order";
	newordernum = Convert.ToInt32(epiNumericEditorC1OrderNum.Text);
	string contextvaluein = newordernum.ToString();
	lfo.ValueIn = valuein;
	lfo.ContextValue = contextvaluein;
	ProcessCaller.LaunchForm(oTrans, "GSCONFIG", lfo); 
	}     

//Launch Epicor URL - Any Area
	private void LaunchURL(string url, string title = "", int padding = 65)
	{
	Ice.Lib.Customization.CustomWebBrowserDialog uiWebBrowser = new Ice.Lib.Customization.CustomWebBrowserDialog();
	Ice.Lib.Framework.EpiBaseForm f = (Ice.Lib.Framework.EpiBaseForm)csm.PersonalizeCustomizeManager.TopControl.FindForm();
   uiWebBrowser.Width = f.Width - padding;
   uiWebBrowser.Height = f.Height - padding;
   uiWebBrowser.Text = title;
   uiWebBrowser.HomeURL = url;
   uiWebBrowser.StartPosition = FormStartPosition.CenterScreen; // If you don't center you can use .Top and .Left
   uiWebBrowser.Show();
   uiWebBrowser.OnRefresh(); // Loads URL
}

//Order - Attachments in Grid
	private void SetupBrowser_AttachmentListView()
	{
		wbSite2 = new System.Windows.Forms.WebBrowser();
		wbSite2.Dock = System.Windows.Forms.DockStyle.Fill;
		wbSite2.Location = new System.Drawing.Point(0,0);
		wbSite2.MinimumSize = new System.Drawing.Size(20,20);
		wbSite2.Name = "Attachment List View";
		wbSite2.Size = new System.Drawing.Size(560,323);
		wbSite2.TabIndex = 0;
		epiGroupBoxAttachmentsGridView.Controls.Add(wbSite2);
	}  

//Order - Shipstore Button URL Launch
private void btnShipstore_Click(object sender, System.EventArgs args)
	{
		System.Diagnostics.Process.Start("http://shipstore.gill-line.com/Prod/");
	}
   
//Order - enFlow Button URL Launch
private void btn_enFlow_Click(object sender, System.EventArgs args)
	{
		System.Diagnostics.Process.Start("http://envisionpp/workflow/enflowview.asp?ordernum=" + numOrderDtl_OrderNum.Value.ToString() + "&nohead=Y");
	}

//Order - Order Change Shipping Button URL Launch
private void btnChangeShipping_Click(object sender, System.EventArgs args)
	{
		System.Diagnostics.Process.Start("http://envisionpp/workflow/workflow.asp?wftypeid=18&nohead=Y&ischild=Y&ordernum=" + numOrderDtl_OrderNum.Value.ToString());
	}

//Order - Quick Notes
private void btnOrderQuickNotes_Click(object sender, System.EventArgs args)
	{
		System.Diagnostics.Process.Start("http://envisionpp/erpdashboard/quickNoteStart.asp?order=" + numOrderDtl_OrderNum.Value.ToString() + "&line=" + numOrderDtl_OrderLine.Value.ToString());
	}

//Order - Expediting Button URL Launch
	private void btnExpediting_Click(object sender, System.EventArgs args)
	{
		System.Diagnostics.Process.Start("http://envisionpp/workflow/workflow.asp?wftypeid=6&nohead=Y&ischild=Y&ordernum=" + numOrderDtl_OrderNum.Value.ToString() + "&orderline=" + numOrderDtl_OrderLine.Value.ToString());
	}

//Order - Checklist
	private void btnChecklist_Click(object sender, System.EventArgs args)
	{
		System.Diagnostics.Process.Start("http://envisionpp/workflow/workflow.asp?nohead=y&wftypeid=2&ordernum=" + numOrderDtl_OrderNum.Value.ToString() + "&orderline=" + numOrderDtl_OrderLine.Value.ToString());
	}

//Order - Attachments Grid Displays File
	private void grid_Attachments_AfterRowActivate(object sender, System.EventArgs args)
	{	
		UltraGridRow activeRow = grid_Attachments.ActiveRow;    
		epiTextBoxOrderNoAttach.Text = activeRow.Cells["XFileRef_XFileName"].Value.ToString();
		
			if (epiTextBoxOrderNoAttach.Text.StartsWith("http://viewit"))
			{
				wbSite2.Navigate ("http://viewit");
				MessageBox.Show("View It File - This will refresh");
				wbSite2.Refresh();
				wbSite2.Navigate (epiTextBoxOrderNoAttach.Text);
			}
			else
			{
				wbSite2.Navigate (epiTextBoxOrderNoAttach.Text);
			}
	}
		
//Order - Detail View After Row Change
	private void V_GS_Order_Detail_All_1View_AfterRowChange(EpiRowChangedArgs args)
	{
		// ** Argument Properties and Uses **
		// args.CurrentView.dataView[args.CurrentRow]["FieldName"]
		// args.LastRow, args.CurrentRow, args.CurrentView
		// Add Event Handler Code
	}

//Order - Epi Order Detail View
	private void edvV_GS_Order_Detail_All_1View_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
	{
		// ** Argument Properties and Uses **
		// view.dataView[args.Row]["FieldName"]
		// args.Row, args.Column, args.Sender, args.NotifyType
		// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
		if ((args.NotifyType == EpiTransaction.NotifyType.AddRow))
		{
			if ((args.Row > -1))
			{

			}
		}
	}
	
	//Order - Movement Data View
private void CreateMovementBAQView() 
	{
	GS_UD09_Movement_DataView = new BAQDataView("GS_UD09_Movement_DataView");
	oTrans.Add("GS_UD09_Movement_DataView", GS_UD09_Movement_DataView);
	var OrderNum = "V_GS_Order_Detail_All_1View.OrderDtl_OrderNum";
	var OrderLine = "V_GS_Order_Detail_All_1View.OrderDtl_OrderLine";
	oTrans.PublishColumnChange(OrderNum, Guid.NewGuid().ToString());
	oTrans.PublishColumnChange(OrderLine, Guid.NewGuid().ToString());
	var OrderNumPub = oTrans.GetPublisher(OrderNum);
	var OrderLinePub = oTrans.GetPublisher(OrderLine);
	GS_UD09_Movement_DataView.SubscribeToPublisher(OrderNumPub.PublishName, "UD091_Number01");
	GS_UD09_Movement_DataView.SubscribeToPublisher(OrderLinePub.PublishName, "UD091_Number02");
	}	
//Order - Workflow Data View
	private void CreateWorkflowBAQView() 
	{
	GS_Order_Workflow_DataView = new BAQDataView("GS_Order_Workflow");  //GS_Order_Workflow
	oTrans.Add("GS_Order_Workflow", GS_Order_Workflow_DataView);
	var OrderNum = "V_GS_Order_Detail_All_1View.OrderDtl_OrderNum";
	//var OrderLine = "V_GS_Order_Detail_All_1View.OrderDtl_OrderLine";  //Don't need this for the Workflow
	oTrans.PublishColumnChange(OrderNum, Guid.NewGuid().ToString());
	//oTrans.PublishColumnChange(OrderLine, Guid.NewGuid().ToString());
	var OrderNumPub = oTrans.GetPublisher(OrderNum);
	//var OrderLinePub = oTrans.GetPublisher(OrderLine);
	GS_Order_Workflow_DataView.SubscribeToPublisher(OrderNumPub.PublishName, "WorkFlow_OrderNum");
	//GS_Order_Workflow_DataView.SubscribeToPublisher(OrderLinePub.PublishName, "Workflow_OrderLine");
}

//Order - Misc Charges Data View
private void CreateMiscChargesBAQView()
		{
	GS_Misc_Charges_DataView = new BAQDataView("GS_Misc_Charges");  //GS Order Misc. Charges Grid  
	oTrans.Add("GS_Misc_Charges", GS_Misc_Charges_DataView);
	var OrderNum = "V_GS_Order_Detail_All_1View.OrderDtl_OrderNum";
	var OrderLine = "V_GS_Order_Detail_All_1View.OrderDtl_OrderLine";
	oTrans.PublishColumnChange(OrderNum, Guid.NewGuid().ToString());
	oTrans.PublishColumnChange(OrderLine, Guid.NewGuid().ToString());
	var OrderNumPub = oTrans.GetPublisher(OrderNum);
	var OrderLinePub = oTrans.GetPublisher(OrderLine);
	GS_Misc_Charges_DataView.SubscribeToPublisher(OrderNumPub.PublishName, "OrderMsc_OrderNum");
	GS_Misc_Charges_DataView.SubscribeToPublisher(OrderLinePub.PublishName, "OrderMsc_OrderLine");
}


//**********************QUOTE Section Code Begins **********
	
//Quote - Customer ID Search in the Create New Quote Section
	private void btnQS_CustID_Click(object sender, System.EventArgs args)
	{
		SearchOnCustomerAdapterShowDialog_2();
	}

//Quote - Customer ID Search Method in the Create New Quote Section
	private void SearchOnCustomerAdapterShowDialog_2()
	{
		 //Wizard Generated Search Method
		 //You will need to call this method from another method in custom code
		 //For example, [Form]_Load or [Button]_Click

		bool recSelected;
		string whereClause = string.Empty;
		System.Data.DataSet dsCustomerAdapter = Ice.UI.FormFunctions.SearchFunctions.listLookup(this.oTrans, "CustomerAdapter", out recSelected, true, whereClause);
		if (recSelected)
		{
			System.Data.DataRow adapterRow = dsCustomerAdapter.Tables[0].Rows[0];
			// Map Search Fields to Application Fields
		{
			epiTextQS_CustID.Text = adapterRow["CustID"].ToString();
			DynamicQueryAdapter dqa10 = new DynamicQueryAdapter(oTrans);
		dqa10.BOConnect();
		QueryExecutionDataSet qeds10 = dqa10.GetQueryExecutionParametersByID("GS_Quote_Memos");
		qeds10.ExecutionParameter.Clear();
		qeds10.ExecutionParameter.AddExecutionParameterRow("CustID", epiTextQS_CustID.Text , "nvarchar", false, Guid.NewGuid(), "A");
		dqa10.ExecuteByID("GS_Quote_Memos", qeds10);
		epiUltraGridC4.DataSource = dqa10.QueryResults.Tables["Results"];
		}
	}
}

//Quote - Part Search in Create New Quote Section
	private void btnQS_Part_Click(object sender, System.EventArgs args)
	{
		SearchOnPartAdapterShowDialog_1();
	}
	
//Quote - Part Search Method in Create New Quote Section	
	private void SearchOnPartAdapterShowDialog_1()
	{
		 //Wizard Generated Search Method
		 //You will need to call this method from another method in custom code
		 //For example, [Form]_Load or [Button]_Click

		bool recSelected;
		string whereClause = string.Empty;
		System.Data.DataSet dsPartAdapter = Ice.UI.FormFunctions.SearchFunctions.listLookup(this.oTrans, "PartAdapter", out recSelected, true, whereClause);
		if (recSelected)
		{
			System.Data.DataRow adapterRow = dsPartAdapter.Tables[0].Rows[0];

			 //Map Search Fields to Application Fields
			{
			epiTextQS_PartNum.Text = adapterRow["PartNum"].ToString();
			}
	}
}

//Quote - New Quote - Launches Quote Configurator and Passes Information in the Create New Quote Section
	private void btnQS_NewQuote_Click(object sender, System.EventArgs args)
	{
	LaunchFormOptions lfo = new LaunchFormOptions();
	System.Collections.Generic.Dictionary<string, string> mylist = new System.Collections.Generic.Dictionary<string, string>();
	newcustid = epiTextQS_CustID.Text;
	mylist.Add("custid", newcustid.ToString()); 
	newquoteqty = Convert.ToInt32(epiNumericQS_Qty.Text);
	mylist.Add("quantity", newquoteqty.ToString());
	newquotepartnum = epiTextQS_PartNum.Text;
	mylist.Add("partnum", newquotepartnum); 
	newnumcolors = Convert.ToInt32(epiNumericQS_NumColors.Text);
	mylist.Add("numofcolors", newnumcolors.ToString()); 
	newqtybreaks = Convert.ToInt32(epiNumericQtyBreaks.Text);
	mylist.Add("quantitybreaks", newqtybreaks.ToString());
	mylist.Add("actiontype", "NewQuote"); 
	mylist.Add("entitynum", "0");
	string valuein = "Quote";
	lfo.ValueIn = valuein;
	lfo.ContextValue = mylist;
	ProcessCaller.LaunchForm(oTrans, "GSCONFIG", lfo); 
	}

//Quote Search in Quote Tracker Section
	private void btn_QS_Num1_Click(object sender, System.EventArgs args)
	{
		SearchOnQuoteAdapterShowDialog_1();
	}

//Quote Search in Quote Tracker Section
	private void SearchOnQuoteAdapterShowDialog_1()
	{
		 //Wizard Generated Search Method
		 //You will need to call this method from another method in custom code
		 //For example, [Form]_Load or [Button]_Click

		bool recSelected;
		string whereClause = string.Empty;
		System.Data.DataSet dsQuoteAdapter = Ice.UI.FormFunctions.SearchFunctions.listLookup(this.oTrans, "QuoteAdapter", out recSelected, true, whereClause);
		if (recSelected)
		{
			System.Data.DataRow adapterRow = dsQuoteAdapter.Tables[0].Rows[0];
			// Map Search Fields to Application Fields
				QuoteRefNum.Value = adapterRow["QuoteNum"].ToString();
				numQuoteDtl_QuoteNum.Value = adapterRow["QuoteNum"].ToString();
				changequotenumber();
		}
}
		
//Quote - Edit Quote in Quote Tracker Section
	private void btn_QS_editquo1_Click(object sender, System.EventArgs args)
	{
	LaunchFormOptions lfo = new LaunchFormOptions();
	string valuein = "Quote";
	quotenum = Convert.ToInt32(QuoteRefNum.Text);
	string contextvaluein = quotenum.ToString();
	lfo.ValueIn = valuein;
	lfo.ContextValue = contextvaluein;
	ProcessCaller.LaunchForm(oTrans, "GSCONFIG", lfo); 
	}

//Quote - On Quote Customer ID Leave of Field execute Dynamic Query to Populate Quote Memos by Customer
	private void epiTextQS_CustID_Leave(object sender, System.EventArgs args)
	{
		DynamicQueryAdapter dqa10 = new DynamicQueryAdapter(oTrans);
		dqa10.BOConnect();
		QueryExecutionDataSet qeds10 = dqa10.GetQueryExecutionParametersByID("GS_Quote_Memos");
		qeds10.ExecutionParameter.Clear();
		qeds10.ExecutionParameter.AddExecutionParameterRow("CustID", epiTextQS_CustID.Text , "nvarchar", false, Guid.NewGuid(), "A");
		dqa10.ExecuteByID("GS_Quote_Memos", qeds10);
		epiUltraGridC4.DataSource = dqa10.QueryResults.Tables["Results"];
	}

//Quote - Refreshes Quote View
	private void changequotenumber()
    {
		QuoteRefNum.Value = numQuoteDtl_QuoteNum.Value;
		
        DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
        dqa.BOConnect();
        QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("GS_Quotes_Param");
        qeds.ExecutionParameter.Clear();
        qeds.ExecutionParameter.AddExecutionParameterRow("QuoteNum", QuoteRefNum.Value.ToString(), "nvarchar", false, Guid.NewGuid(), "B");
        dqa.ExecuteByID("GS_Quotes_Param", qeds);
        gridQuoteDtl.DataSource = dqa.QueryResults.Tables["Results"];
        edvV_GS_Quotes_1View.ResetDataView(dqa.QueryResults.Tables["Results"].DefaultView); 
        edvV_GS_Quotes_1View.Notify(new EpiNotifyArgs(oTrans, 0, EpiTransaction.NotifyType.Initialize));
		DynamicQueryAdapter dqa1 = new DynamicQueryAdapter(oTrans);
        dqa1.BOConnect();
        QueryExecutionDataSet qeds1 = dqa1.GetQueryExecutionParametersByID("GS_Quote_LetterUD15");
        qeds1.ExecutionParameter.Clear();
        qeds1.ExecutionParameter.AddExecutionParameterRow("QuoteNum", QuoteRefNum.Value.ToString(), "nvarchar", false, Guid.NewGuid(), "C");
        dqa1.ExecuteByID("GS_Quote_LetterUD15", qeds1);
        grid_QuoteLetterPrev.DataSource = dqa1.QueryResults.Tables["Results"];
		foreach (System.Data.DataRow r in dqa1.QueryResults.Tables["Results"].Rows)
		{
		epiTextBoxQuoteLetterHTML.Text = r["UD15_GS_BodyEmail_c"].ToString();
		epiTextBoxQuoteLetterTo.Text = r["UD15_GS_ToEmail_c"].ToString();
		epiDateTimeEditorQuoteLetterSentDate.Text = r["UD15_GS_SentTime_c"].ToString();
		txtQuoteSentDate.Text = epiDateTimeEditorQuoteLetterSentDate.Text;
		}
		wbSite4.DocumentText = epiTextBoxQuoteLetterHTML.Text.ToString();
		{
			if (tbLegacyRef.Text == "LEGACYXX")
			{
				LegacyIndicatorLabel.Visible = true;
				tbQuoteComment.Visible = true;
				tbQuoteLegacyRef2.Visible = true;
			}
			else
			{
				LegacyIndicatorLabel.Visible = false;
				tbQuoteComment.Visible = false;
				tbQuoteLegacyRef2.Visible = false;
			}				
		MainController.AppControlPanel.HandleToolClick("RefreshTool", new Infragistics.Win.UltraWinToolbars.ToolClickEventArgs(MainController.MainToolManager.Tools["RefreshTool"], null));	
  	}
	}

//Quote - Quote Letter Preview
 public void SetupBrowser_QuoteLetter()
	{
		wbSite4 = new System.Windows.Forms.WebBrowser();
		wbSite4.Dock = System.Windows.Forms.DockStyle.Fill;
		wbSite4.Location = new System.Drawing.Point(0,0);
		wbSite4.MinimumSize = new System.Drawing.Size(20,20);
		wbSite4.Name = "Quote Letter Preview";
		wbSite4.Size = new System.Drawing.Size(560,323);
		wbSite4.TabIndex = 0;
		epiGroupBoxQuoteLetterPrev.Controls.Add(wbSite4);
}      

//Quote - Calls the View Update on Leave
	private void numQuoteDtl_QuoteNum_Leave(object sender, System.EventArgs args)
    {
		changequotenumber();
	 }

//Quote - Button to Clear New Quote Fields 
	private void btnQuoteClearForm_Click(object sender, System.EventArgs args)
	{
	epiTextQS_CustID.Text = string.Empty;
	DynamicQueryAdapter dqa10 = new DynamicQueryAdapter(oTrans);
	dqa10.BOConnect();
	QueryExecutionDataSet qeds10 = dqa10.GetQueryExecutionParametersByID("GS_Quote_Memos");
	qeds10.ExecutionParameter.Clear();
	qeds10.ExecutionParameter.AddExecutionParameterRow("CustID", epiTextQS_CustID.Text , "nvarchar", false, Guid.NewGuid(), "A");
	dqa10.ExecuteByID("GS_Quote_Memos", qeds10);
	epiUltraGridC4.DataSource = dqa10.QueryResults.Tables["Results"];
	epiTextQS_PartNum.Text = string.Empty;
	epiNumericQS_Qty.Value = "0";
	epiNumericQS_NumColors.Value = "0";
	epiNumericQtyBreaks.Value = "0";
	MainController.AppControlPanel.HandleToolClick("RefreshTool", new Infragistics.Win.UltraWinToolbars.ToolClickEventArgs(MainController.MainToolManager.Tools["RefreshTool"], null));	
	}


//Quote - Epi Quote Detail View
	private void edvV_GS_Quotes_1View_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
	{
		// ** Argument Properties and Uses **
		// view.dataView[args.Row]["FieldName"]
		// args.Row, args.Column, args.Sender, args.NotifyType
		// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
		if ((args.NotifyType == EpiTransaction.NotifyType.AddRow))
		{
			if ((args.Row > -1))
			{
				//MessageBox.Show ("edv quote view");
			}
		}
	}


//Quote - Detail View AFter Row Change
	private void V_GS_Quotes_1View_AfterRowChange(EpiRowChangedArgs args)
	{
		// ** Argument Properties and Uses **
		// args.CurrentView.dataView[args.CurrentRow]["FieldName"]
		// args.LastRow, args.CurrentRow, args.CurrentView
		// Add Event Handler Code
	}

//All - Clear View
	private void ClearScreen()
	{
		epiTextQS_CustID.Text = string.Empty;
		tbLegacyRef.Text = string.Empty;
		tbQuoteComment.Text = string.Empty;
		tbQuoteLegacyRef2.Text = string.Empty;
		LegacyIndicatorLabel.Visible = false;
		tbQuoteComment.Visible = false;
		tbQuoteLegacyRef2.Visible = false;
		DynamicQueryAdapter dqa10 = new DynamicQueryAdapter(oTrans);
		dqa10.BOConnect();
		QueryExecutionDataSet qeds10 = dqa10.GetQueryExecutionParametersByID("GS_Quote_Memos");
		qeds10.ExecutionParameter.Clear();
		qeds10.ExecutionParameter.AddExecutionParameterRow("CustID", epiTextQS_CustID.Text , "nvarchar", false, Guid.NewGuid(), "D");
		dqa10.ExecuteByID("GS_Quote_Memos", qeds10);
		epiUltraGridC4.DataSource = dqa10.QueryResults.Tables["Results"];
		epiTextBoxLineArt.Text = string.Empty;
		epiTextBoxOrderNoAttach.Text = string.Empty;
		epiTextBoxProofingURL.Text = string.Empty;
		txtCustomer_CustID.Text = string.Empty;
		epiTextCustNumRef.Text = string.Empty;
		numOrderDtl_OrderNum.Value = (0);
		numOrderDtl_OrderLine.Value = (0);
		numOrderDtl_TotalReleases.Value = (0);
		epiNumericOrderNumRef.Value = (0);
		epiNumericEditorOrderLineNo.Value = (0);
		epiNumericEditorLastLocation.Value = (0);	
		epiTextBoxPORefNum.Text = string.Empty;
		txtOrderHed_PONum.Text = string.Empty;
		epiTextBoxCustomerName.Text = string.Empty;
		epiTextCustNumRef.Text = string.Empty;
		txtQuoteSentDate.Text = string.Empty;
		epiTextBoxQuoteLetterTo.Text = string.Empty;
		QuoteRefNum.Value = (0);
		epiTextBoxQuoteLetterHTML.Text = string.Empty;	
		DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
		dqa.BOConnect();
		QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("GS_Order_Detail_Params");
		qeds.ExecutionParameter.Clear();
		qeds.ExecutionParameter.AddExecutionParameterRow("OrderNum", epiNumericOrderNumRef.Value.ToString() , "nvarchar", false, Guid.NewGuid(), "A");
		qeds.ExecutionParameter.AddExecutionParameterRow("OrderLine", epiNumericEditorOrderLineNo.Value.ToString() , "nvarchar", false, Guid.NewGuid(), "A");
		dqa.ExecuteByID("GS_Order_Detail_Params", qeds);
		grid_OrderDetails.DataSource = dqa.QueryResults.Tables["Results"];
		edvV_GS_Order_Detail_All_1View.ResetDataView(dqa.QueryResults.Tables["Results"].DefaultView);
    	edvV_GS_Order_Detail_All_1View.Notify(new EpiNotifyArgs(oTrans, 0, EpiTransaction.NotifyType.Initialize));
		changeordernumber();
		DynamicQueryAdapter dqa1 = new DynamicQueryAdapter(oTrans);
		dqa1.BOConnect();
		QueryExecutionDataSet qeds1 = dqa1.GetQueryExecutionParametersByID("GS_Customer_Search_Param");
		qeds1.ExecutionParameter.Clear();
		qeds1.ExecutionParameter.AddExecutionParameterRow("CustID", epiTextCustNumRef.Text , "nvarchar", false, Guid.NewGuid(), "B");
		dqa1.ExecuteByID("GS_Customer_Search_Param", qeds1);
		grid_Cust_Search_Parms.DataSource = dqa1.QueryResults.Tables["Results"];
		edvV_GS_CustomerSearch_1View.ResetDataView(dqa.QueryResults.Tables["Results"].DefaultView);
    	edvV_GS_CustomerSearch_1View.Notify(new EpiNotifyArgs(oTrans, 0, EpiTransaction.NotifyType.Initialize));
		changecustomernumber();
		DynamicQueryAdapter dqa2 = new DynamicQueryAdapter(oTrans);
        dqa2.BOConnect();
        QueryExecutionDataSet qeds2 = dqa2.GetQueryExecutionParametersByID("GS_Quotes_Param");
        qeds2.ExecutionParameter.Clear();
        qeds2.ExecutionParameter.AddExecutionParameterRow("QuoteNum", QuoteRefNum.Value.ToString(), "nvarchar", false, Guid.NewGuid(), "C");
        dqa2.ExecuteByID("GS_Quotes_Param", qeds2);
        gridQuoteDtl.DataSource = dqa2.QueryResults.Tables["Results"];
        edvV_GS_Quotes_1View.ResetDataView(dqa2.QueryResults.Tables["Results"].DefaultView); 
        edvV_GS_Quotes_1View.Notify(new EpiNotifyArgs(oTrans, 0, EpiTransaction.NotifyType.Initialize));
		changequotenumber();
		btnShipstore.Visible = true;
		btnChecklist.Visible = true;
		epiTextBoxNoChecklist.Visible = false;
		btnCreateNon_Conformance.Visible = true;
		txtCustomer_CustID.Focus();
	}

//All Clear Screen Tool 
	private void baseToolbarsManager_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs args)
	{
		switch (args.Tool.Key)
		{
			case "ClearTool":
			//MessageBox.Show("Clear Screen");
			ClearScreen();
			break;
			
		case "RefreshTool":
		MessageBox.Show("Refresh Tool");
		break;
	}
}



	private void SetExtendedProperties()
	{
		// Begin Wizard Added EpiDataView Initialization
		EpiDataView edvV_GS_Order_Detail_All_1View = ((EpiDataView)(this.oTrans.EpiDataViews["V_GS_Order_Detail_All_1View"]));
		// End Wizard Added EpiDataView Initialization

		// Begin Wizard Added Conditional Block
		if (edvV_GS_Order_Detail_All_1View.dataView.Table.Columns.Contains("OrderHed_ShipViaCode"))
		{
			// Begin Wizard Added ExtendedProperty Settings: edvV_GS_Order_Detail_All_1View-OrderHed_ShipViaCode
			edvV_GS_Order_Detail_All_1View.dataView.Table.Columns["OrderHed_ShipViaCode"].ExtendedProperties["ReadOnly"] = true;
			// End Wizard Added ExtendedProperty Settings: edvV_GS_Order_Detail_All_1View-OrderHed_ShipViaCode
		}
		// End Wizard Added Conditional Block
	}

	private void CreateRowRuleGS_Order_WorkflowWorkFlowStatus_WFStatusNameContains_New()
	{
		// Description: ColorWorkflows
		// **** begin autogenerated code ****
		RuleAction warningGS_Order_Workflow_RowAction = RuleAction.AddRowSettings(this.oTrans, "GS_Order_Workflow", true, SettingStyle.Warning);
		RuleAction[] ruleActions = new RuleAction[] {
				warningGS_Order_Workflow_RowAction};
		// Create RowRule and add to the EpiDataView.
		RowRule rrCreateRowRuleGS_Order_WorkflowWorkFlowStatus_WFStatusNameContains_New = new RowRule("GS_Order_Workflow.WorkFlowStatus_WFStatusName", RuleCondition.Contains, "New", ruleActions);
		((EpiDataView)(this.oTrans.EpiDataViews["GS_Order_Workflow"])).AddRowRule(rrCreateRowRuleGS_Order_WorkflowWorkFlowStatus_WFStatusNameContains_New);
		// **** end autogenerated code ****
	}

}

//From Jose Gomez for refreshing Data View
////Add this using at the top of your class
//using System.Reflection;
//
////On "Refresh" or button click
//MethodInfo mi = bdvLeaveUsage.GetType().GetMethod("invokeExecute", BindingFlags.Instance | BindingFlags.NonPublic);
//mi.Invoke(bdvLeaveUsage, new object[]{ true });```

wow that’s a lot of code LoL
ok so… how does tbMovementToDept.Text get its value? Is it bound to a data View?

Yes, don’t look to hard at the other code - I’m sure it could be more glamorous lol.
That field is bound to the BAQ Data View.

Right before the message box the field will be populated with “99”. So I know the Data View has refreshed.

Ok not sure why the If statement isn’t behaving , however with bound fields you should try to get away from addressing the controls directly (textbox, chekcbox etc) rather address the underlying data set.
My guess is that the MessageBox is helping with timing… You are requesting a refresh of the data (that takes some time) then immediately calling to get the value of the textbox. Without the messagebox there is no delay (at least not enough delay) for the data to make its way to the User Interface layer.
Try doing your If Statement on the DataView instead of the textBox

Like so

private void Dept99()
	{

				if (GS_UD09_Movement_DataView.Row>=0 && (string)GS_UD09_Movement_DataView.dataView[GS_UD09_Movement_DataView.Row]["TheNameOfYourMovemenToField"] == "99")
				{
					//MessageBox.Show("Dept. 99" + " Move " + tbMovementToDept.Text);
					btnShipstore.Visible = true;
					btnCreateNon_Conformance.Visible = true;	
				}
			else
				{
					//MessageBox.Show("Not Dept. 99" + tbMovementToDept.Text);
					btnShipstore.Visible = false;
					btnCreateNon_Conformance.Visible = false;
				}
}

Okay, I plugged this in and it still only works if I have the one MessageBox activated.

	{
				MessageBox.Show(tbMovementToDept.Text);
				if (GS_UD09_Movement_DataView.Row>=0 && (string)GS_UD09_Movement_DataView.dataView[GS_UD09_Movement_DataView.Row]["UD091_ShortChar04"] == "99")
				//if (tbMovementToDept.Text == "99")    //
				{
					btnShipstore.Visible = true;
					btnCreateNon_Conformance.Visible = true;	
				}
			else
				{
					btnShipstore.Visible = false;
					btnCreateNon_Conformance.Visible = false;
				}
			}```

If I comment the message box out it doesn't work.

So its a timing issue. Basically there is no data there that quickly… you’ll need to move this to another place… Perhaps on Notification event in GS_UD09_Movement_DataView would be a better place for it.
Or better yet it looks like you are just hiding / showing things… this is a great place to use some more of that EpiMagic and use the RowRules… RowRules let you do exactly this, hide, show disable controls based on the value of a data set.
EpiMagic == no code :slight_smile:

lol okay I will try that!

Perfect! That worked like EpiMagic. Thank you so much!

HOw do you do a Rule on a DataView if there isn’t a value in the field. For instance, if One of my DataViews isn’t populated then I want it to hide a box. I see row rules for contains, etc.

@josecgomez can the BAQView be used with a BAQ that have parameters? I did a customization in a UD form (UD10) which contains two date filters (they do not have any binding), if the filters do not have any date the grid should populate all the information from a BAQ when user clicks on retrieve button, if dates are entered in the fields then filter BAQ by these dates.

No