Example #1
0
        private void button6_Click(object sender, EventArgs e)
        {
            int    f_n, f_s, f_d;
            filter f = new filter();

            f.ShowDialog();

            f_n = Data.f_n;
            f_s = Data.f_s;
            f_d = Data.f_d;

            if (f_n == 1 || f_s == 1 || f_d == 1)
            {
                string request = "";

                OracleCommand cmd = con.CreateCommand();
                if (f_d == 1)
                {
                    request = $" AND DOCU_ISSU_DD  >= {Data.st_date_orig}  AND DOCU_ISSU_DD <= {Data.end_date_orig} ";
                }
                if (f_s == 1)
                {
                    request = request + $" AND C.CRP_CD = {Data.number_ser} ";
                }
                if (f_n == 1)
                {
                    request = request + $" AND C.CRP_NM = '{Data.name_cl}' ";
                }


                cmd.CommandText = "SELECT DISTINCT c.*, Y.DOCU_PRICE, Y.GET_DD FROM (SELECT B.DOCU_NO, B.DOCU_SRES, B.DOCU_ISSU_DD, B.DOCU_STAT_CD, A.CRP_CD, A.CRP_NM, A.DIST_ID_2, A.crp_issu_dd FROM TBCB_CRP_INFO A INNER JOIN TBCB_CRP_DOCU_INFO B ON A.CRP_CD = B.CRP_CD) c , NEW_TBCB y where c.docu_no = y.docu_no AND C.CRP_CD = Y.CRP_CD  and rownum <=100" + request + "order by CASE When '" + f_d + "' = 1 THEN C.DOCU_ISSU_DD END ASC ";

                bool find_val = false;

                cmd.CommandType = CommandType.Text;
                OracleDataReader dr   = cmd.ExecuteReader();
                List <string[]>  data = new List <string[]>();
                while (dr.Read())
                {
                    find_val = true;
                    fill_data(data, dr);
                }
                if (find_val)
                {
                    MessageBox.Show("Найдено!");
                }
                else
                {
                    MessageBox.Show("Не найдено по данному запросу!");
                }
                print_data(data);
            }

            Data.f_n = 0;
            Data.f_s = 0;
            Data.f_d = 0;
        }
Example #2
0
        private void button6_Click(object sender, EventArgs e)
        {
            int    f_c, f_s, f_d;
            filter f = new filter();

            f.ShowDialog();

            f_c = Data.f_c;
            f_s = Data.f_s;
            f_d = Data.f_d;

            if (f_c == 1 || f_s == 1 || f_d == 1)
            {
                string        st_date = "-1", end_date = "-1";
                OracleCommand cmd = con.CreateCommand();
                if (f_d == 1)
                {
                    st_date  = Data.st_data_orig;
                    end_date = Data.end_data_orig;

                    cmd.Parameters.Add("ST_DATE", OracleDbType.Varchar2, 8).Value  = st_date;
                    cmd.Parameters.Add("END_DATE", OracleDbType.Varchar2, 8).Value = end_date;
                }
                //////////////////////         cmd.CommandText = "SELECT B.DOCU_NO, B.DOCU_SRES, B.DOCU_ISSU_DD, B.DOCU_STAT_CD, A.CRP_CD, A.CRP_NM, DIST_ID_2 FROM TBCB_CRP_INFO A INNER JOIN TBCB_CRP_DOCU_INFO B ON A.CRP_CD = B.CRP_CD where rownum <= 50 AND DOCU_ISSU_DD  > :ST_DATE  AND DOCU_ISSU_DD < :END_DATE"; ;
                //cmd.CommandText = "SELECT DISTINCT c.*, Y.DOCU_PRICE, Y.GET_DD FROM (SELECT B.DOCU_NO, B.DOCU_SRES, B.DOCU_ISSU_DD, B.DOCU_STAT_CD, A.CRP_CD, A.CRP_NM, A.DIST_ID_2, B.CRTE_DT FROM TBCB_CRP_INFO A INNER JOIN TBCB_CRP_DOCU_INFO B ON A.CRP_CD = B.CRP_CD) c , NEW_TBCB y where c.docu_no = y.docu_no and rownum <=100 AND DOCU_ISSU_DD  >= :ST_DATE  AND DOCU_ISSU_DD <= :END_DATE order by C.DOCU_ISSU_DD";

                cmd.CommandText = "SELECT DISTINCT c.*, Y.DOCU_PRICE, Y.GET_DD FROM (SELECT B.DOCU_NO, B.DOCU_SRES, B.DOCU_ISSU_DD, B.DOCU_STAT_CD, A.CRP_CD, A.CRP_NM, A.DIST_ID_2, A.crp_issu_dd FROM TBCB_CRP_INFO A INNER JOIN TBCB_CRP_DOCU_INFO B ON A.CRP_CD = B.CRP_CD) c , NEW_TBCB y where c.docu_no = y.docu_no AND C.CRP_CD = Y.CRP_CD  and rownum <=100 AND ( (DOCU_ISSU_DD  >= :ST_DATE AND DOCU_ISSU_DD <= :END_DATE) ) order by CASE When '" + f_d + "' = 1 THEN C.DOCU_ISSU_DD END ASC ";


                bool find_val = false;

                cmd.CommandType = CommandType.Text;
                OracleDataReader dr   = cmd.ExecuteReader();
                List <string[]>  data = new List <string[]>();
                while (dr.Read())
                {
                    find_val = true;
                    fill_data(data, dr);
                }
                if (find_val)
                {
                    MessageBox.Show("Найдено!");
                }
                else
                {
                    MessageBox.Show("Не найдено по данному запросу!");
                }
                print_data(data);
            }

            Data.f_c = 0;
            Data.f_s = 0;
            Data.f_d = 0;
        }
Example #3
0
        private void button6_Click(object sender, EventArgs e)
        {
            filter f = new filter();

            f.ShowDialog();

            if (Data.f_n == true || Data.f_CRP == true || Data.f_d == true || Data.f_p == true || Data.f_i == true || Data.f_inn == true || Data.f_ser == true || Data.f_status == true)
            {
                string request = "";
                string name_cl = "";

                OracleCommand cmd = con.CreateCommand();
                if (Data.f_d == true)
                {
                    request = $" AND DOCU_ISSU_DD  >= '{Data.st_date_orig}'  AND DOCU_ISSU_DD <= '{Data.end_date_orig}' ";
                }
                if (Data.f_CRP == true)
                {
                    request = request + $" AND C.CRP_CD = {Data.number_ser} ";
                }
                if (Data.f_n == true)
                {
                    for (int i = 0; i < Data.name_cl.Length; i++)
                    {
                        if (Data.name_cl[i] == '%')
                        {
                            name_cl += '_';
                        }
                        else
                        {
                            name_cl += Data.name_cl[i];
                        }
                    }
                    request = request + $" AND C.CRP_NM LIKE '%{name_cl}%' ";
                }
                if (Data.f_p == true)
                {
                    request = request + $" AND y.DOCU_PRICE = '{Data.price}' AND y.CURRENCY = '{Data.val}'";
                }
                if (Data.f_i == true)
                {
                    request = request + $" AND y.ESTM_NM = '{Data.isch}'";
                }
                if (Data.f_inn == true)
                {
                    request = request + $" AND AND c.DIST_ID_2 = '{Data.INN}'";
                }
                if (Data.f_ser == true)
                {
                    request = request + $" AND c.DOCU_SRES = '{Data.ser}'";
                }
                if (Data.f_status == true)
                {
                    request = request + $" AND c.DOCU_STAT_CD = '{Data.status}'";
                }

                cmd.CommandText = "SELECT DISTINCT c.*, Y.DOCU_PRICE, Y.ESTM_NM, Y.FIO FROM(SELECT B.DOCU_NO, B.DOCU_SRES, B.DOCU_ISSU_DD, B.DOCU_STAT_CD, A.CRP_CD, A.CRP_NM, A.DIST_ID_2 FROM TBCB_CRP_INFO A INNER JOIN table_for_docu B ON A.CRP_CD = B.CRP_CD) c , NEW_TBCB y where c.docu_no = y.docu_no AND y.docu_sres = c.docu_sres AND C.CRP_CD = Y.CRP_CD  and rownum <=100" + request + "order by C.DOCU_ISSU_DD ";

                bool find_val = false;
                cmd.CommandType = CommandType.Text;
                OracleDataReader dr   = cmd.ExecuteReader();
                List <string[]>  data = new List <string[]>();
                while (dr.Read())
                {
                    find_val = true;
                    fill_data(data, dr);
                }
                if (find_val)
                {
                    MessageBox.Show("Найдено!");
                }
                else
                {
                    MessageBox.Show("Не найдено по данному запросу!");
                }
                print_data(data);
            }


            Data.f_n      = false;
            Data.f_CRP    = false;
            Data.f_d      = false;
            Data.f_p      = false;
            Data.f_i      = false;
            Data.f_inn    = false;
            Data.f_ser    = false;
            Data.f_status = false;
        }