示例#1
0
 public void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         FrmDetailBase detailForm = GetDetailForm();
         if (detailForm != null)
         {
             detailForm.IsAdding   = true;
             detailForm.ItemAdded += delegate(object obj, ItemAddedEventArgs args)
             {
                 Add_A_Row(args.AddedItem);
             };
             detailForm.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error");
     }
 }
示例#2
0
        public void GridView_DoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                object pre = this.GridView.GetItem(this.GridView.Rows[e.RowIndex]);
                if (pre != null)
                {
                    FrmDetailBase detailForm = GetDetailForm();
                    if (detailForm != null)
                    {
                        detailForm.IsAdding     = false;
                        detailForm.UpdatingItem = pre;

                        detailForm.ItemUpdated += delegate(object obj, ItemUpdatedEventArgs args)
                        {
                            Update_A_Row(args.UpdatedItem);
                        };
                        detailForm.ShowDialog();
                    }
                }
            }
        }
示例#3
0
        private void mnu_Property_Click(object sender, EventArgs e)
        {
            List <object> updateItems = this.GridView.GetSelectedItems();

            if (updateItems.Count > 0)
            {
                object pre = updateItems[0];
                if (pre != null)
                {
                    FrmDetailBase detailForm = GetDetailForm();
                    if (detailForm != null)
                    {
                        detailForm.IsAdding     = false;
                        detailForm.UpdatingItem = pre;
                        detailForm.ItemUpdated += delegate(object obj, ItemUpdatedEventArgs args)
                        {
                            Update_A_Row(args.UpdatedItem);
                        };
                        detailForm.ShowDialog();
                    }
                }
            }
        }