Exemple #1
0
    private void oTrans_customerAdapter_BeforeAdapterMethod(object sender, BeforeAdapterMethodArgs args)
    {
        // ** Argument Properties and Uses **
        // ** args.MethodName **
        // ** Add Event Handler Code **

        // ** Use MessageBox to find adapter method name
        // EpiMessageBox.Show(args.MethodName);
        string parentcustnum = "";

        switch (args.MethodName)
        {
        case "Update":
            activeDistributor = ((EpiCheckBox)csm.GetNativeControlReference("4ff5eda0-9888-4703-a1b1-5185e494758e"));
            metroArea         = ((EpiCombo)csm.GetNativeControlReference("c0355971-9f0a-4126-905a-7d5eca9fb7c5"));
            primaryLineVE     = ((EpiCombo)csm.GetNativeControlReference("bc535f05-1878-40e0-8c80-ddd3a6d70a0f"));
            if (activeDistributor.Checked)
            {
                if (metroArea.Text.Length == 0 || primaryLineVE.Text.Length == 0)
                {
                    throw new UIException("Metro Area and Primary Line Van Equip must be filled for an Active distributor.");
                }
            }

            category  = ((EpiCombo)csm.GetNativeControlReference("f76dd0e7-ba1f-4fff-aaec-9cc5e3f15156"));
            fleetSize = ((EpiCombo)csm.GetNativeControlReference("8228301d-6ad4-4b54-8834-5a9a50535bf1"));
            if (category.Text == "Fleet" && fleetSize.Text.Length == 0)
            {
                throw new UIException("Fleet size must be filled for Category: Fleet");
            }


            if (custDataView != null && custDataView.HasRow)
            {
                if (custDataView.dataView[custDataView.Row]["ParentCustID_c"].ToString() == "")
                {
                    custDataView.dataView[custDataView.Row]["ParentCustNum_c"] = 0;
                }
                else
                {
                    parentcustnum = GetParentCustNumByCustNum(custDataView.dataView[custDataView.Row]["ParentCustID_c"].ToString());

                    if (parentcustnum.Length == 0)
                    {
                        throw new UIException("Parent Customer ID  doesn't exists.");
                    }
                    else
                    {
                        custDataView.dataView[custDataView.Row]["ParentCustNum_c"] = parentcustnum;
                    }
                }
            }
            break;
        }
    }
    public void DestroyCustomCode()
    {
        // ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
        // Begin Wizard Added Object Disposal

        this.oTrans_adapter.BeforeAdapterMethod -= new BeforeAdapterMethod(this.oTrans_adapter_BeforeAdapterMethod);
        this.oTrans_adapter = null;
        this.edvCRMCall.EpiViewNotification -= new EpiViewNotification(this.edvCRMCall_EpiViewNotification);
        this.edvCRMCall = null;

        callType    = null;
        inquiryType = null;
        points      = null;
        // End Wizard Added Object Disposal

        // Begin Custom Code Disposal

        // End Custom Code Disposal
    }
    public void InitializeCustomCode()
    {
        // ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
        // Begin Wizard Added Variable Initialization

        this.oTrans_adapter = ((EpiBaseAdapter)(this.csm.TransAdaptersHT["oTrans_adapter"]));
        this.oTrans_adapter.BeforeAdapterMethod += new BeforeAdapterMethod(this.oTrans_adapter_BeforeAdapterMethod);
        this.edvCRMCall = ((EpiDataView)(this.oTrans.EpiDataViews["CRMCall"]));
        this.edvCRMCall.EpiViewNotification += new EpiViewNotification(this.edvCRMCall_EpiViewNotification);

        callType    = ((EpiCombo)csm.GetNativeControlReference("aa40b07c-65e2-4cec-bc2a-1fc794aee8cb"));
        inquiryType = ((EpiCombo)csm.GetNativeControlReference("25e32f3c-cd04-4c18-8674-3b58b309078f"));
        points      = ((EpiCombo)csm.GetNativeControlReference("f16c1292-c473-4962-b4ae-940542c38ea0"));
        // End Wizard Added Variable Initialization

        // Begin Wizard Added Custom Method Calls

        // End Wizard Added Custom Method Calls
    }