Esempio n. 1
0
 private void metroGrid1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 0)
     {
         int            Id             = (int)metroGrid1.Rows[e.RowIndex].Cells["Id"].Value;
         UpdateDocument updateDocument = new UpdateDocument(Id);
         updateDocument.Show();
     }
     else if (e.ColumnIndex == 1)
     {
         int Id     = (int)metroGrid1.Rows[e.RowIndex].Cells["Id"].Value;
         var result = MetroFramework.MetroMessageBox.Show(this, "آیا مطمئن هستید این آیتم حذف شود؟", "اخطار", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
         if (result == DialogResult.Yes)
         {
             _repository.Delete(Id);
             DocumentViewForm documentViewForm = (DocumentViewForm)Application.OpenForms["DocumentViewForm"];
             documentViewForm.LoadGrid();
         }
         else
         {
             DocumentViewForm documentViewForm = (DocumentViewForm)Application.OpenForms["DocumentViewForm"];
             documentViewForm.LoadGrid();
         }
     }
 }
Esempio n. 2
0
        private void UpdateDocument_FormClosed(object sender, FormClosedEventArgs e)
        {
            DocumentViewForm documentViewForm = (DocumentViewForm)Application.OpenForms["DocumentViewForm"];

            documentViewForm.LoadGrid();
        }