/// <summary> /// Create new rosie event and navigate onto the screen to perform /// the next step in event organization /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnNext_Click(object sender, EventArgs e) { if (radNew.Checked) { if (validateAddEventFrm()) { RosieEvent ev = new RosieEvent(); ev.EventDate = dtpFormDate.Value; ev.LocationId = (cmbLocations.SelectedItem as EventLocation).Id; ev.Name = txtEventName.Text; ev.Type = ((KeyValuePair <string, EventType>)cmbTypes.SelectedItem).Value; //SqlTransaction transaction = RosieEntity.Connector.Connection.BeginTransaction(); ev.Create(); RosieEvent createdEvent = RosieEvent.Retrieve(ev.EventDate, ev.LocationId); goToNextStepForEvent(createdEvent); } } else { if (dgEvents.SelectedRows.Count > 0) { goToNextStepForEvent(dgEvents.SelectedRows[0].DataBoundItem as RosieEvent); } } }
private void cmbEventName_SelectedIndexChanged(object sender, EventArgs e) { if (cmbEventName.SelectedItem != null) { DBConnector conn = new DBConnector(Classes.DBMethod.GetConnectionString()); RosieEntity.Connector = conn; RosieEvent rosieEvent = RosieEvent.Retrieve(long.Parse(DBMethod.GetSelectedItemID(cmbEventName))); EventLocation locEvent = EventLocation.Retrieve(rosieEvent.LocationId); lblEventLocation.Text += locEvent.Address.ToString(); } }