private void button2_Click(object sender, EventArgs e)
        {
            #region all statements of add informations



            if (txtname.Text != string.Empty)
            {
                #region paramter

                con.Open();
                string name = txtname.Text;
                Halls  c1   = new Halls();
                c1.Name = txtname.Text;

                #endregion

                c1.add1(c1);
                con.Close();
            }

            else
            {
                MessageBox.Show("Please make sure that you have entered all the information");
            }


            #endregion
        }
        private void button3_Click(object sender, EventArgs e)
        {
            con.Open();
            Halls  c1   = new Halls();
            string name = combhall.Text;

            c1.delete1(name);
            con.Close();
        }
Exemple #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            con.Open();

            #region paramter

            Halls  c1   = new Halls();
            string name = combhall.Text;

            #endregion
            dgv_search_cust.DataSource = c1.search1(name);
            con.Close();
        }
        public displayhall()
        {
            InitializeComponent();
            con.Open();

            #region paramter

            Halls c1 = new Halls();

            #endregion

            dgv_display_cust.DataSource = c1.display1();

            con.Close();
        }
        public void edit1(Halls c1, string n)
        {
            try
            {
                #region Paramters

                SqlCommand cmd;

                #endregion

                con.Open();
                cmd = new SqlCommand("update Halls set Halls_Name='" + c1.Name + "'where Halls_Name='" + n + "'", con);
                cmd.ExecuteNonQuery();
                MessageBox.Show("Your Update was sucsessful");
                con.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Please check Name ");
            }
        }
        public void add1(Halls c2)
        {
            try
            {
                #region Paramters

                SqlCommand cmd;

                #endregion

                con.Open();
                cmd = new SqlCommand("insert into Halls (Halls_Name) values ('" + c2.Name + "') ", con);
                cmd.ExecuteNonQuery();
                MessageBox.Show("Your Registeration was sucsessful");
                con.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Please check Name ");
            }
        }