示例#1
0
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            int         pdId = Convert.ToInt32(DGVDev.CurrentRow.Cells[0].Value);
            EditDevForm ed   = new EditDevForm(pdId);

            if (ed.ShowDialog() == DialogResult.OK)
            {
                MetroFramework.MetroMessageBox.Show(this, "Update Successfully", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);

                DGVDev.Refresh();
            }
            DevForm_Load(sender, e);
        }
示例#2
0
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                AddDevForm addDev = new AddDevForm();
                if (addDev.ShowDialog() == DialogResult.OK)
                {
                    MetroFramework.MetroMessageBox.Show(this, "Save Successfully", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    DevForm_Load(sender, e);
                    DGVDev.Refresh();
                }

                DevForm_Load(sender, e);
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(this, "Error " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#3
0
 private void BtnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (MetroFramework.MetroMessageBox.Show(this, "Are you sure want to delete this record?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
         {
             int pdId = Convert.ToInt32(DGVDev.CurrentRow.Cells[0].Value);
             var dev  = db.Developments.Find(pdId);
             db.Developments.Remove(dev);
             db.SaveChanges();
             MetroFramework.MetroMessageBox.Show(this, "Deleted Successfully", "Info");
             DevelopmentForm_Load(sender, e);
             DGVDev.Refresh();
         }
     }
     catch (Exception ex)
     {
         MetroMessageBox.Show(this, "Error in your record " + ex.ToString(), "Info", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }