Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            cs = new customer();
            dt = new DataTable();

            try
            {
                cs.PlateNo = textBox1.Text;
                dt         = cs.plate_query(cs.PlateNo);


                string subtype = dt.Rows[0]["sub_payment"].ToString();
                string tp;

                if (subtype == "guest")
                {
                    tp = "Guest";
                }


                else
                {
                    tp = "Subscriber";
                }
                if (tp == "Subscriber")
                {
                    textBox2.Text = dt.Rows[0]["name"].ToString();
                    textBox3.Text = dt.Rows[0]["car_brand"].ToString();
                    textBox4.Text = dt.Rows[0]["car_model"].ToString();
                    textBox5.Text = dt.Rows[0]["TCKN"].ToString();
                    textBox6.Text = tp;
                }
                else
                {
                    textBox2.Text = dt.Rows[0]["name"].ToString();
                    textBox3.Text = "-";
                    textBox4.Text = "-";
                    textBox5.Text = "-";
                    textBox6.Text = tp;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("No such plate in park! " + ex.Message);
            }
        }