Example #1
0
        public static void getCustomers()
        {
            var hp = new HomePage
            {
                dtpBeginDate = { Format = DateTimePickerFormat.Custom, CustomFormat = @"yyyy-MM-dd" },
                dtpEndDate   = { Format = DateTimePickerFormat.Custom, CustomFormat = @"yyyy-MM-dd" }
            };
            var cs = new Connstr();

            cs.Open("auctiondb");
            MySqlCommand cmd = new MySqlCommand("SELECT " + "Lname AS 'Last Name', " + "Fname AS 'First Name', " +
                                                "CONCAT(Fname, ' ', Lname) as 'First and Last Name', " +
                                                "Addr1 AS 'Address 1', " + "Addr2 AS 'Address 2', " + "city AS City, " +
                                                "state AS State, " + "zip AS Zip ," + "Rep_code AS 'Field Rep', " +
                                                "rep_code2 AS 'Field Rep 2', " + "createdate AS 'Date Added' " +
                                                "FROM auctiondb.customer c " +
                                                $"where createdate between '{hp.dtpBeginDate.Value}' and '{hp.dtpEndDate.Value}' " +
                                                "and addr1 != '' " + "and lname <> '%#%' " + "group by idnbr " +
                                                "order by Lname, fname, addr1;"
                                                );
            MySqlDataAdapter sqlDA = new MySqlDataAdapter(cmd.CommandText, cs.DB);
            var cusTable           = new DataTable();

            sqlDA.Fill(cusTable);
            hp.dgCustomers.DataSource = cusTable;
        }
Example #2
0
        public static void button1click()
        {
            HomePage hp = new HomePage();
            var      CS = new Connstr();

            CS.Open("auctiondb");

            if (hp.cbParams.Text == "ALL")
            {
                if (hp.cbHistory.Text == "No")
                {
                    mycommand = $"Select * from auctiondb.{hp.cbTable.Text};";
                    var sqlDataAdapter = new MySqlDataAdapter(mycommand, CS.DB);
                    var Reports        = new DataTable();
                    sqlDataAdapter.Fill(Reports);
                    hp.dgReport.DataSource = Reports;
                }
            }
        }
Example #3
0
        public static void CreateParams()
        {
            HomePage hp = new HomePage();

            if (hp.cbParams.Text == "SPECIFIC")
            {
                if (hp.lblColumns != null)
                {
                    hp.lblColumns.Visible = true;
                }
                hp.checkedlistbox.Visible = true;

                if (hp.cbHistory.Text == "No")
                {
                    mycommand =
                        $"Select column_name from information_schema.columns where table_name = N'{hp.cbTable.Text}';";
                    var CS = new Connstr();
                    CS.Open("auctiondb");
                    var             cmd = new MySqlCommand(mycommand, CS.DB);
                    MySqlDataReader dr;
                    dr = cmd.ExecuteReader();
                    if (dr.HasRows)
                    {
                        while (dr.Read())
                        {
                            hp.checkedlistbox.Items.Add(dr[0].ToString());
                        }
                    }
                    dr.Close();
                }
            }
            else if (hp.cbParams.Text == "ALL")
            {
                hp.lblColumns.Visible     = false;
                hp.checkedlistbox.Visible = false;
            }
        }