Ejemplo n.º 1
0
        private void BtnSearchTransactionType_Click(object sender, EventArgs e)
        {
            FrmTransactionType SearchTransactionType = new FrmTransactionType(true);
            var    TransTypeRes = SearchTransactionType.ShowDialog();
            string TransTypeVal = "";

            if (TransTypeRes == DialogResult.OK)
            {
                TransTypeVal = SearchTransactionType.ReturnValue1;
            }
            CmbType.Text = TransTypeVal;
            CmbType.Select(CmbType.Text.Length, 0);
        }
Ejemplo n.º 2
0
        private void CmbType_TextChanged(object sender, EventArgs e)
        {
            int NumberOfChar = CmbType.Text.Length - CmbType.SelectedText.Length;

            if (SearchKeyHit == true && FromTextChange == false)
            {
                CmbType.Items.Clear();
                string Desc = "", Category = "", Hier = "";
                string EnteredText = CmbType.Text.Substring(0, CmbType.Text.Length - CmbType.SelectedText.Length).Replace("::", ":");
                string QueryRes    = "";
                int    LoopCounter = 0;
                if (EnteredText.Split(':').Count() == 3)
                {
                    Desc     = EnteredText.Split(':')[0];
                    Category = EnteredText.Split(':')[1];
                    Hier     = EnteredText.Split(':')[2];
                    QueryRes = CommFunc.Fetch_DB_MultiValue("Description,Category,Hierarchy", "TransactionTypeDim", "Description like '"
                                                            + Desc + "%' and Category like '" + Category + "%' and Hierarchy like '" + Hier + "%'");
                    while (LoopCounter < QueryRes.Split('|').Count())
                    {
                        CmbType.Items.Add(QueryRes.Split('|')[LoopCounter]);
                        LoopCounter++;
                    }
                    FromTextChange = true;
                    if (QueryRes != "")
                    {
                        CmbType.SelectedIndex = 0;
                    }
                    CmbType.Select(NumberOfChar, CmbType.Text.Length - NumberOfChar);
                }
                if (EnteredText.Split(':').Count() == 2)
                {
                    Desc     = EnteredText.Split(':')[0];
                    Category = EnteredText.Split(':')[1];
                    QueryRes = CommFunc.Fetch_DB_MultiValue("Description,Category,Hierarchy", "TransactionTypeDim", "Description like '"
                                                            + Desc + "%' and Category like '" + Category + "%'");
                    while (LoopCounter < QueryRes.Split('|').Count())
                    {
                        CmbType.Items.Add(QueryRes.Split('|')[LoopCounter]);
                        LoopCounter++;
                    }
                    FromTextChange = true;
                    if (QueryRes != "")
                    {
                        CmbType.SelectedIndex = 0;
                    }
                    CmbType.Select(NumberOfChar, CmbType.Text.Length - NumberOfChar);
                }
                if (EnteredText.Split(':').Count() == 1)
                {
                    Desc     = EnteredText;
                    QueryRes = CommFunc.Fetch_DB_MultiValue("Description,Category,Hierarchy", "TransactionTypeDim", "Description like '"
                                                            + Desc + "%'");
                    while (LoopCounter < QueryRes.Split('|').Count())
                    {
                        CmbType.Items.Add(QueryRes.Split('|')[LoopCounter]);
                        LoopCounter++;
                    }
                    FromTextChange = true;
                    if (QueryRes != "")
                    {
                        CmbType.SelectedIndex = 0;
                    }
                    CmbType.Select(NumberOfChar, CmbType.Text.Length - NumberOfChar);
                }
                else
                {
                    FromTextChange = false;
                }
            }
        }