Example #1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            try
            {
                using (DEWSRMEntities db = new DEWSRMEntities())
                {
                    int[]       selRows = ((GridView)grdSMSFormate.MainView).GetSelectedRows();
                    DataRowView oID     = (DataRowView)(((GridView)grdSMSFormate.MainView).GetRow(selRows[0]));

                    int        nID         = Convert.ToInt32(oID["ID"]);
                    SMSFormate oSMSFormate = db.SMSFormates.FirstOrDefault(p => p.SMSFormateID == nID);


                    if (oSMSFormate == null)
                    {
                        MessageBox.Show("select an item to edit", "Item not yet selected", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }

                    fSMSFormate frm = new fSMSFormate();
                    frm.ItemChanged = RefreshList;
                    frm.ShowDlg(oSMSFormate, false);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            fSMSFormate frm = new fSMSFormate();

            frm.ItemChanged = RefreshList;
            frm.ShowDlg(new SMSFormate(), true);
        }