private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { var senderGrid = (DataGridView)sender; if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn) { if (senderGrid.CurrentCell.OwningColumn.Name.ToString().Equals("HostEditButton")) { addConferenceDetailModel.ConferenceId = (int)dataGridView2.Rows[e.RowIndex].Cells["HostConferenceId"].Value; addConferenceDetailModel.ConferenceName = (string)dataGridView2.Rows[e.RowIndex].Cells["HostConferenceName"].Value; addConferenceDetailModel.ConferenceTypeName = (string)dataGridView2.Rows[e.RowIndex].Cells["HostType"].Value; addConferenceDetailModel.ConferenceCategoryName = (string)dataGridView2.Rows[e.RowIndex].Cells["HostCategory"].Value; addConferenceDetailModel.Location = (string)dataGridView2.Rows[e.RowIndex].Cells["HostAddress"].Value; addConferenceDetailModel.Speaker = (string)dataGridView2.Rows[e.RowIndex].Cells["HostMainSpeaker"].Value; addConferenceDetailModel.StartDate = (DateTime)dataGridView2.Rows[e.RowIndex].Cells["HostStartDate"].Value; addConferenceDetailModel.EndDate = (DateTime)dataGridView2.Rows[e.RowIndex].Cells["HostEndDate"].Value; AddEvent form3 = new AddEvent(0, f, addConferenceDetailModel, _GetSpeakerDetail, _ConferenceTypeRepository, _ConferenceRepository, _DictionaryCityRepository, _DictionaryCountryRepository, _DictionaryCountyRepository, _DictionaryConferenceCategoryRepository, _Locationrepository); this.Enabled = false; form3.Tag = this; form3.Show(this); } } } catch (Exception ex) { SetBalloonTip("Something is wrong", "Please press again!"); notifyIcon1.Visible = true; notifyIcon1.ShowBalloonTip(3000); } }
public void AddEventNotEdit() { AddEvent form3 = new AddEvent(1, f, addConferenceDetailModel, _GetSpeakerDetail, _ConferenceTypeRepository, _ConferenceRepository, _DictionaryCityRepository, _DictionaryCountryRepository, _DictionaryCountyRepository, _DictionaryConferenceCategoryRepository, _Locationrepository); this.Enabled = false; form3.Tag = this; form3.Show(this); }
public NewEditForm(AddEvent f, AddEventDetailModel EventDetail, IConferenceRepository ConferenceRepository, string dictionary, bool EditSave) { InitializeComponent(); _ConferenceRepository = ConferenceRepository; DetailEvent = EventDetail; form4 = f; form4.Enabled = false; EditOrSave = EditSave; dictionar = dictionary; if (dictionary.ToString() == "Speaker") { label1.Text = "Email"; label3.Visible = true; textBox3.Visible = true; } if (dictionary.ToString() == "DictionaryCategory") { label1.Visible = false; textBox1.Visible = false; } if (dictionary.ToString() == "DictionaryType") { label1.Visible = false; textBox1.Visible = false; checkBox1.Visible = true; } if (EditOrSave) { if (dictionary.ToString() == "Speaker") { textBox1.Text = DetailEvent.SpeakerEmail; textBox2.Text = EventDetail.SpeakerName; textBox3.Text = DetailEvent.SpeakerNationality; } if (dictionary.ToString() == "DictionaryCategory") { textBox2.Text = EventDetail.DictionaryConferenceCategoryName; } if (dictionary.ToString() == "DictionaryType") { textBox2.Text = EventDetail.ConferenceTypeName; checkBox1.Checked = EventDetail.isRemote; } if (dictionary.ToString() == "DictionaryCity") { textBox1.Text = EventDetail.DictionaryCityCode; textBox2.Text = EventDetail.DictionaryCityName; } if (dictionary.ToString() == "DictionaryCountry") { textBox1.Text = EventDetail.DictionaryCountryCode; textBox2.Text = EventDetail.DictionaryCountryName; } if (dictionary.ToString() == "DictionaryCounty") { textBox1.Text = EventDetail.DictionaryCountyCode; textBox2.Text = EventDetail.DictionaryCountyName; } } }
public AddEvent(int editnew, MainForm form, AddConferenceDetailModel addConferenceDetailModel, IGetSpeakerDetail GetSpeakerDetail, IConferenceTypeRepository ConferenceTypeRepository, IConferenceRepository ConferenceRepository, IDictionaryCityRepository dictionaryCityRepository, IDictionaryCountryRepository DictionaryCountryRepository, IDictionaryCountyRepository DictionaryCountyRepository, IDictionaryConferenceCategoryRepository DictionaryConferenceCategoryRepository, ILocationRepository locationRepository) { InitializeComponent(); tabType.Hide(); EditNew = editnew; AddConferenceDetailModel = new AddConferenceDetailModel(); AddConferenceDetailModel = addConferenceDetailModel; eventDetails = new AddEventDetailModel(); var_email = AddConferenceDetailModel.HostEmail; formMain = form; f = this; // Current form to use in New/Edit Form _DictionaryCountyRepository = DictionaryCountyRepository; _GetSpeakerDetail = GetSpeakerDetail; _DictionaryCountryRepository = DictionaryCountryRepository; _ConferenceRepository = ConferenceRepository; _DictionaryConferenceCategoryRepository = DictionaryConferenceCategoryRepository; _LocationRepository = locationRepository; List <SpeakerDetailModel> speakers = GetSpeakers().Result; List <DictionaryCountryModel> countries = GetDictionaryCountry().Result; countys = GetDictionaryCounty().Result; List <DictionaryConferenceCategoryModel> categories = GetDictionaryCategory().Result; _ConferenceTypeRepository = ConferenceTypeRepository; x = GetConferenceType().Result; if (countries == null) { return; } else { populateCountry(countries); } if (categories == null) { return; } else { populateCategory(categories); } if (speakers == null) { return; } if (countys == null) { return; } populateSpeakers(speakers); _DictionaryCityRepository = dictionaryCityRepository; cityList = GetCity().Result; if (cityList == null || cityList.Count() == 0) { return; } if (x == null || x.Count() == 0) { return; } listView1_populate(); eventDetails.HostEmail = var_email; eventDetails.StartDate = AddStartDate.Value; eventDetails.EndDate = AddEndDate.Value; if (editnew == 0) { eventDetails.DictionaryCityName = addConferenceDetailModel.Location; eventDetails.ConferenceId = addConferenceDetailModel.ConferenceId; DictionaryCityModel city = GetCity(eventDetails.ConferenceId).Result; eventDetails.DictionaryCityId = city.DictionaryCityId; eventDetails.DictionaryCityName = city.Name; eventDetails.DictionaryCityCode = city.Code; eventDetails.DictionaryCountyId = city.DictionaryCountyId; DictionaryCountyModel county = GetCounty(eventDetails.DictionaryCountyId).Result; eventDetails.DictionaryCountyName = county.DictionaryCountyName; eventDetails.DictionaryCountyCode = county.Code; eventDetails.DictionaryCountryId = county.DictionaryCountryId; DictionaryCountryModel country = GetCountry(eventDetails.DictionaryCountryId).Result; eventDetails.DictionaryCountryName = country.DictionaryCountryName; eventDetails.DictionaryCountryCode = country.Code; eventDetails.ConferenceName = addConferenceDetailModel.ConferenceName; eventDetails.ConferenceTypeName = addConferenceDetailModel.ConferenceTypeName; eventDetails.EndDate = addConferenceDetailModel.EndDate; eventDetails.StartDate = addConferenceDetailModel.StartDate; eventDetails.SpeakerName = addConferenceDetailModel.Speaker; eventDetails.DictionaryConferenceCategoryName = addConferenceDetailModel.ConferenceCategoryName; DictionaryConferenceCategoryModel category = GetCategory(eventDetails.ConferenceId).Result; eventDetails.DictionaryConferenceCategoryId = category.DictionaryConferenceCategoryId; eventDetails.LocationName = addConferenceDetailModel.Location; AddConferenceName.Text = eventDetails.ConferenceName; AddAddress.Text = eventDetails.LocationName; AddStartDate.Value = eventDetails.StartDate; AddEndDate.Value = eventDetails.EndDate; ToSelectItem(); } }