Ejemplo n.º 1
0
 private void btn_Update_Click(object sender, EventArgs e)
 {
     cinema_Model = new Cinema_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)
         {
             CinemaCRUD = new Cinema_CRUD_Service();
             if (CinemaCRUD.Update(cinema_Model))
             {
                 MessageBox.Show("Data UPDATED !!");
                 this.Close();
             }
             else
             {
                 MessageBox.Show("Data FAILED UPDATED !!");
                 this.Close();
             }
         }
         else
         {
         }
         ((FrmEditCinema)f).displaydatagrid();
     }
 }
Ejemplo n.º 2
0
 private void btn_Save_Click(object sender, EventArgs e)
 {
     try
     {
         if (PerformValidation(groupBox1))
         {
             ATB();
             CinemaCRUD = new Cinema_CRUD_Service();
             if (CinemaCRUD.Insert(cinema_Model))
             {
                 MessageBox.Show("Data Saved");
                 displaydatagrid();
             }
             else
             {
                 MessageBox.Show("ERROR,Data Failed To Saved");
                 displaydatagrid();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("ERROR!!! : " + ex.Message.ToString());
     }
 }
Ejemplo n.º 3
0
 private void dt_user_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     Cinema_Id = dg_main.SelectedRows[0].Cells["Cinema_Id"].Value.ToString();
     if (dg_main.Columns[e.ColumnIndex] == btnDelete)
     {
         bool DialogDel = MessageBox.Show("Are you sure to delete this Data", "DELETE", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes;
         if (DialogDel)
         {
             CinemaCRUD = new Cinema_CRUD_Service();
             if (CinemaCRUD.GetDeleteByID(Cinema_Id))
             {
                 MessageBox.Show("Data DELETED !!");
             }
             else
             {
                 MessageBox.Show("Data FAILED TO DELETE !!");
             }
             displaydatagrid();
         }
     }
     else if (dg_main.Columns[e.ColumnIndex] == btnEdit)
     {
         ATB();
         FrmUpdateCinema frmUpdateCinema = new FrmUpdateCinema();
         frmUpdateCinema.ShowDialog();
     }
 }
Ejemplo n.º 4
0
 public void displaydatagrid()
 {
     try
     {
         CinemaCRUD                 = new Cinema_CRUD_Service();
         dt                         = CinemaCRUD.get_AllCinemas(dt);
         dg_main.DataSource         = null;
         dg_main.DataSource         = dt;
         dg_main.AllowUserToAddRows = false;
         dg_main.ReadOnly           = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("ERROR!!! : " + ex.Message.ToString());
     }
 }