示例#1
0
 public void LoadForm()
 {
     theather_Model        = new Theather_Model();
     txt_Cinema.Text       = ((FrmEditTheather)f).txt_Cinema.Text;
     txt_Seats.Text        = ((FrmEditTheather)f).txt_Seats.Text;
     txt_TheatherName.Text = ((FrmEditTheather)f).txt_TheatherName.Text;
 }
示例#2
0
 private void btn_Update_Click(object sender, EventArgs e)
 {
     theather_Model = new Theather_Model();
     if (PerformValidation(groupBox1))
     {
         ATB();
         bool DialogDel = MessageBox.Show("Are you sure to EDIT this Data", "EDIT", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes;
         if (DialogDel)
         {
             theatherCRUD = new Theather_CRUDService();
             if (theatherCRUD.Update(theather_Model))
             {
                 MessageBox.Show("Data UPDATED !!");
                 this.Close();
             }
             else
             {
                 MessageBox.Show("Data FAILED UPDATED !!");
                 this.Close();
             }
         }
         else
         {
             MessageBox.Show("Wrong Password !!");
         }
         ((FrmEditTheather)f).displaydatagrid();
     }
 }
示例#3
0
 public void ATB()
 {
     theather_Model               = new Theather_Model();
     theather_Model.cinema        = txt_Cinema.Text;
     theather_Model.theather_name = txt_TheatherName.Text;
     theather_Model.seats         = txt_Seats.Text;
 }
示例#4
0
        public bool Update(Theather_Model theather_Model)
        {
            bool result = false;

            try
            {
                DBCon = new DBConnection();
                query = string.Format(@"UPDATE `theather`
                                        SET 
                                            `cinema` = '{0}',
                                            `theather_name` = '{1}',
                                            `seats` = '{2}'
                                        WHERE `theather_id` = '{3}';",
                                      theather_Model.cinema,
                                      theather_Model.theather_name,
                                      theather_Model.seats,
                                      theather_Model.theather_id);

                DBCon.ConnectionOpen();
                cmd    = new MySqlCommand(query, DBCon.Connection);
                result = cmd.ExecuteNonQuery() == 1;
                DBCon.ConnectionClose();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            return(result);
        }
示例#5
0
        public bool Insert(Theather_Model theather_Model)
        {
            bool result = false;

            query = "INSERT INTO `Theather`(`Cinema`,`theather_name`,`seats`)" +
                    "VALUES(@Cinema,@theather_name,@seats)";

            using (MySqlCommand cmd = new MySqlCommand(query, conn))
            {
                cmd.Parameters.Add("@Cinema", theather_Model.cinema);
                cmd.Parameters.Add("@theather_name", theather_Model.theather_name);
                cmd.Parameters.Add("@seats", theather_Model.seats);
                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                    conn.Close();
                    return(result = true);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                    return(result);
                }
            }
        }
示例#6
0
 public void ATB()
 {
     theather_Model               = new Theather_Model();
     theather_Model.cinema        = txt_Cinema.Text;
     theather_Model.theather_name = txt_TheatherName.Text;
     theather_Model.seats         = txt_Seats.Text;
     theather_Model.theather_id   = ((FrmEditTheather)f).theather_Id;
 }