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

                    int    nID     = Convert.ToInt32(oCategoryD["ID"]);
                    Godown oGodown = db.Godowns.FirstOrDefault(p => p.GodownID == nID);


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

                    fGodown frm = new fGodown();
                    frm.ItemChanged = RefreshList;
                    frm.ShowDlg(oGodown, false);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #2
0
 private void btnNew_Click(object sender, EventArgs e)
 {
     try
     {
         fGodown frm = new fGodown();
         frm.ItemChanged = RefreshList;
         frm.ShowDlg(new Godown(), true);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }