Esempio n. 1
0
    private void GetUD01Data(string key1, string key2, string key3, string key4, string key5)
    {
        if ((this._Key1UD01 != key1) || (this._Key2UD01 != key2) || (this._Key3UD01 != key3) || (this._Key4UD01 != key4) || (this._Key5UD01 != key5))
        {
            // Build where clause for search.
            string whereClause = "Key1 = \'" + key1 + "\' And Key2 = \'" + key2 + "\' And Key3 = \'" + key3 + "\' And Key4 = \'" + key4 + "\'";
            System.Collections.Hashtable whereClauses = new System.Collections.Hashtable(1);
            whereClauses.Add("UD01", whereClause);

            // Call the adapter search.
            SearchOptions searchOptions = SearchOptions.CreateRuntimeSearch(whereClauses, DataSetMode.RowsDataSet);
            this._ud01Adapter.InvokeSearch(searchOptions);

            if ((this._ud01Adapter.UD01Data.UD01.Rows.Count > 0))
            {
                this._edvUD01.Row = 0;
            }
            else
            {
                this._edvUD01.Row = -1;
            }

            // Notify that data was updated.
            this._edvUD01.Notify(new EpiNotifyArgs(this.oTrans, this._edvUD01.Row, this._edvUD01.Column));

            // Set key fields to their new values.
            this._Key1UD01 = key1;
            this._Key2UD01 = key2;
            this._Key3UD01 = key3;
            this._Key4UD01 = key4;
            this._Key5UD01 = key5;
        }
    }
        private void GetCustXPrtData(string part)
        {
            if (this._part != part)
            {
                // Build where clause for search.
                string whereClause = "PartNum = '" + part + "'";
                System.Collections.Hashtable whereClauses = new System.Collections.Hashtable(1);
                whereClauses.Add("CustXPrt", whereClause);

                // Call the adapter search.
                SearchOptions searchOptions = SearchOptions.CreateRuntimeSearch(whereClauses, DataSetMode.RowsDataSet);
                this.cxad.InvokeSearch(searchOptions);

                if ((this.cxad.CustomerPartXRefData.CustXPrt.Rows.Count > 0))
                {
                    this._edvCustXPrt.Row = 0;
                }
                else
                {
                    this._edvCustXPrt.Row = -1;
                }

                // Notify that data was updated.
                this._edvCustXPrt.Notify(new EpiNotifyArgs(this.oTrans, this._edvCustXPrt.Row, this._edvCustXPrt.Column));

                // Set key fields to their new values.
                this._part = part;
            }
        }
Esempio n. 3
0
    private void btnNextID_Click(object sender, System.EventArgs args)
    {
        // ** Place Event Handling Code Here **
        this.custAdapter = new CustomerAdapter(this.oTrans);
        this.custAdapter.BOConnect();
        this.custDataView = (EpiDataView)(this.oTrans.EpiDataViews["Customer"]);
        DataRow currentCustomer = this.custDataView.CurrentDataRow;

        // Add Prefix
        string custID = formatNewID(currentCustomer["Name"].ToString());

        // Set Suffix
        int custSuffix = 1;         // 001

        // Iterate until suffix exists with prefix
        do
        {
            string whereClause = "CustID = \'" + custID + custSuffix.ToString("D3") + "\'";
            System.Collections.Hashtable whereClauses = new System.Collections.Hashtable(1);
            whereClauses.Add("Customer", whereClause);

            SearchOptions searchOptions = SearchOptions.CreateRuntimeSearch(whereClauses, DataSetMode.RowsDataSet);
            this.custAdapter.InvokeSearch(searchOptions);

            if ((this.custAdapter.CustomerData.Customer.Rows.Count > 0))
            {
                custSuffix++;
            }
        } while(this.custAdapter.CustomerData.Customer.Rows.Count > 0);

        // Set new custID
        string newCustID = custID + custSuffix.ToString("D3");

        //MessageBox.Show("New CustID: " + newCustID);

        et_newCustID      = ((EpiTextBox)csm.GetNativeControlReference("eb06f6cc-8342-4610-8c12-bdfb93e78f8d"));
        et_newCustID.Text = newCustID;
    }
    private void btnCopyVehicles_Click(object sender, System.EventArgs args)
    {
        txtCopyPart = ((EpiTextBox)csm.GetNativeControlReference("d74c3905-a49e-42f4-a48d-e2a6a8b79379"));
        txtCopyRev  = ((EpiTextBox)csm.GetNativeControlReference("31cbeabb-4107-4626-ae5d-66897b75a8d8"));
        EpiDataView epiViewPartRev = ((EpiDataView)(this.oTrans.EpiDataViews["PartRev"]));
        DataRow     dataRowPartRev = epiViewPartRev.CurrentDataRow;
        string      partNum;
        string      revisionNum;

        if ((dataRowPartRev != null))
        {
            partNum     = dataRowPartRev["PartNum"].ToString();
            revisionNum = dataRowPartRev["RevisionNum"].ToString();


            if (txtCopyPart.Text == partNum && txtCopyRev.Text == revisionNum)
            {
                MessageBox.Show("Cannot copy from same Part Revision");
            }
            else if (txtCopyPart.Text == "" || txtCopyRev.Text == "")
            {
                MessageBox.Show("Choose a Part Revision");
            }
            else
            {
                DialogResult dialogResult = EpiMessageBox.Show("Are you sure you want to copy vehicles?", "Cancel", MessageBoxButtons.YesNo);
                if ((dialogResult == DialogResult.Yes))
                {
                    try {
                        // Set UD100Adapter

                        UD100Adapter ud100Adapter = new UD100Adapter(PartForm);
                        ud100Adapter.BOConnect();

                        Hashtable whereClauses = new Hashtable(1);
                        string    whereClause  = "ChildKey1 <> '' AND ChildKey2 <> ''";
                        whereClauses.Add("UD100A", whereClause);

                        SearchOptions searchOptions = SearchOptions.CreateRuntimeSearch(whereClauses, DataSetMode.RowsDataSet);
                        ud100Adapter.InvokeSearch(searchOptions);

                        // Delete all current PartRev's vehicles
                        DataRow[] deleteRows = ud100Adapter.UD100Data.UD100A.Select("ChildKey1 = \'" + partNum + "\' and ChildKey2 = \'" + revisionNum + "\'");
                        for (int i = 0; (i < deleteRows.Length); i++)
                        {
                            ud100Adapter.Delete(deleteRows[i]);
                        }

                        // Copy all selected PartRev's vehicles
                        DataRow[] copyRows = ud100Adapter.UD100Data.UD100A.Select("ChildKey1 = \'" + txtCopyPart.Text + "\' and ChildKey2 = \'" + txtCopyRev.Text + "\'");
                        for (int i = 0; (i < copyRows.Length); i++)
                        {
                            CreateChild(copyRows[i]["Brand_c"].ToString(), copyRows[i]["Model_c"].ToString(), copyRows[i]["Year_c"].ToString(), copyRows[i]["Length_c"].ToString(), copyRows[i]["Height_c"].ToString());
                        }
                        ud100Adapter.Update();
                        ud100Adapter.Dispose();
                        MessageBox.Show("Completed");
                    } catch (Exception e) {
                        MessageBox.Show(e.ToString());
                    }
                }
            }
        }
    }
Esempio n. 5
0
    private void CheckData(int CheckLevel)
    {
        //Last, current, next CheckColumn   CheckRightGroup   check is True or false
        string  LastLevel, CurLevel, CurUserLevel, NextLevel, GroupName, isCheck = "=1", isUnCheck = "=0";
        int     TotalCheckRows = 0;     //All Quoted Rows
        Boolean ck             = false; //defalt check status to set

        if (CheckLevel == 1)
        {
            LastLevel    = "1";
            CurLevel     = "Checked1_c";
            CurUserLevel = "Checked1By_c";
            NextLevel    = "Checked2_c";
            GroupName    = "Quote";
        }
        else if (CheckLevel == 2)
        {
            LastLevel    = "Checked1_c";
            CurLevel     = "Checked2_c";
            CurUserLevel = "Checked2By_c";
            NextLevel    = "Checked3_c";
            GroupName    = "QA";
        }
        else
        {
            LastLevel    = "Checked2_c";
            CurLevel     = "Checked3_c";
            CurUserLevel = "Checked3By_c";
            NextLevel    = "0";
            GroupName    = "Admin";
        }

        try
        {
            EpiDataView edvUser = (EpiDataView)oTrans.EpiDataViews["CallContextClientData"];
            string      UserId  = edvUser.dataView[edvUser.Row]["CurrentUserId"].ToString();

            if (!HaveRight(UserId, GroupName))
            {
                ExceptionBox.Show(new System.Exception("no right to check!"));
                return;
            }

            //get the view data
            EpiDataView edv = (EpiDataView)(oTrans.EpiDataViews["V_QuoteUpdateInfoCGVer1_1View3"]);
            if (edv.dataView.Count > 0)
            {
                // Get the Quoted data from QuoteHed
                QuoteAdapter qa = new QuoteAdapter(this.oTrans);
                qa.BOConnect();

                string whereClause = " Quoted = 1 ";
                System.Collections.Hashtable whereClauses = new System.Collections.Hashtable(1);
                whereClauses.Add("QuoteHed", whereClause);

                SearchOptions searchOptions = SearchOptions.CreateRuntimeSearch(whereClauses, DataSetMode.RowsDataSet);
                qa.InvokeSearch(searchOptions);
                TotalCheckRows = qa.QuoteData.Tables["QuoteHed"].Rows.Count;

                //check or uncheck [checked rows = max rows ,then uncheck.   checked rows != max rows, then check]
                DataRow[] RowsCur = qa.QuoteData.QuoteHed.Select(CurLevel + isCheck);
                if (RowsCur.Length != TotalCheckRows)
                {
                    ck = true;
                }

                //check cur row, last level must be checked.
                //uncheck cur row, the next level must be unchecked
                DataRow[] RowsPrevious = ck ? qa.QuoteData.QuoteHed.Select(LastLevel + isCheck) : qa.QuoteData.QuoteHed.Select(NextLevel + isUnCheck);
                if (RowsPrevious.Length == TotalCheckRows)
                {
                    //check the data in SQL
                    for (int i = 0; i < qa.QuoteData.Tables["QuoteHed"].Rows.Count; i++)
                    {
                        qa.QuoteData.Tables["QuoteHed"].Rows[i][CurLevel]     = ck;
                        qa.QuoteData.Tables["QuoteHed"].Rows[i][CurUserLevel] = UserId;
                    }
                    qa.Update();
                    qa.Dispose();

                    // Check the data on the interface
                    for (int i = 0; i < edv.dataView.Count; i++)
                    {
                        edv.dataView[i]["QuoteHed_" + CurLevel] = ck;
                    }

                    edv.Notify(new EpiNotifyArgs(this.oTrans, edv.Row, edv.Column));
                }
                else
                {
                    ExceptionBox.Show(new System.Exception(ck ? "check the last level please!" : "uncheck the next level please!"));
                }
            }
            else
            {
                ExceptionBox.Show(new System.Exception("no row can be checked or unchecked!"));
            }
        }
        catch (System.Exception ex)
        {
            ExceptionBox.Show(ex);
        }
    }