Example #1
0
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            try
            {
                var data = ((BindingSource)dvEvents.DataSource).List;

                EventDto record = null;

                int id = int.Parse(dvEvents.Rows[selectedRowIndex].Cells[0].Value.ToString());
                foreach (EventDto ct in data)
                {
                    if (ct.Id == id)
                    {
                        record = ct;
                        break;
                    }
                }

                AddNewEvent addNewEvent = new AddNewEvent(db, this, record);
                addNewEvent.Show();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                MessageBox.Show("Failed to upsert events");
            }
        }
Example #2
0
 private void BtnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         AddNewEvent addNewEvent = new AddNewEvent(db, this, null);
         addNewEvent.Show();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
         MessageBox.Show("Failed to upsert events");
     }
 }