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; }
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(); } }
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; }
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); }
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); } } }
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; }