Exemplo n.º 1
0
        private void search_but_Click(object sender, EventArgs e)
        {
            bool   filtr = true;
            string sql   = "select * from \"Price\"";

            if (org_combox.SelectedValue.ToString() != "-1")
            {
                if (filtr)
                {
                    sql  += " where";
                    filtr = false;
                }
                else
                {
                    sql += " and";
                }
                sql += " \"PK_Org\" = " + org_combox.SelectedValue.ToString();
            }

            if (tovar_combobox.SelectedValue.ToString() != "-1")
            {
                if (filtr)
                {
                    sql  += " where";
                    filtr = false;
                }
                else
                {
                    sql += " and";
                }
                sql += " \"PK_Product\" = " + tovar_combobox.SelectedValue.ToString();
            }

            if (pricefrom_textbox.Text != "")
            {
                if (filtr)
                {
                    sql  += " where";
                    filtr = false;
                }
                else
                {
                    sql += " and";
                }
                sql += " \"price_for_one\" > " + pricefrom_textbox.Text;
            }

            if (priceto_textbox.Text != "")
            {
                if (filtr)
                {
                    sql  += " where";
                    filtr = false;
                }
                else
                {
                    sql += " and";
                }
                sql += " \"price_for_one\" < " + priceto_textbox.Text;
            }

            Search_c_table_form form = new Search_c_table_form(price.Search(sql));

            form.ShowDialog();
        }