private void OpenDetailPage(string ID) { string IDType = new string(ID.Take(ID.IndexOf('_')).ToArray()); switch (IDType) { case "Prop": { PropertyDetails form = new PropertyDetails(Property.PropertyList.Find(i => i.PropertyID == ID), this); form.Show(); break; } case "Ten": { TenantDetails form = new TenantDetails(Tenant.TenantList.Find(t => t.TenantID == ID), this); form.Show(); break; } case "Occ": case "Mnt": case "Inc": case "Pay": { ViewOccurenceDataForm form = new ViewOccurenceDataForm(Occurence.GetOccurenceByID(ID)); form.Show(); break; } } }
private void btn_Edit_Click(object sender, EventArgs e) { if (((Button)sender).Name == btn_EditProperty.Name) { try { ViewPropertyDataForm form = new ViewPropertyDataForm(Property.GetPropertyByID(dgv_Properties.SelectedRows[0].Cells[0].Value.ToString())); form.Show(); } catch (ArgumentOutOfRangeException) { } } if (((Button)sender).Name == btn_EditTenant.Name) { try { ViewTenantDataForm form = new ViewTenantDataForm(Tenant.GetTenantByID(dgv_Tenant.SelectedRows[0].Cells[0].Value.ToString())); form.Show(); } catch (ArgumentOutOfRangeException) { } } if (((Button)sender).Name == btn_EditMaintenance.Name) { try { ViewOccurenceDataForm form = new ViewOccurenceDataForm(Occurence.GetOccurenceByID(dgv_Maintenance.SelectedRows[0].Cells[0].Value.ToString())); form.Show(); } catch (ArgumentOutOfRangeException) { } } if (((Button)sender).Name == btn_EditFinance.Name) { try { ViewOccurenceDataForm form = new ViewOccurenceDataForm(Occurence.GetOccurenceByID(dgv_Finance.SelectedRows[0].Cells[0].Value.ToString())); form.Show(); } catch (ArgumentOutOfRangeException) { } } }
private void btn_Edit_Click(object sender, EventArgs e) { if (((Button)sender).Name == btn_MaintenanceEdit.Name) { try { ViewOccurenceDataForm form = new ViewOccurenceDataForm(Occurence.GetOccurenceByID(dgv_Maintenance.SelectedRows[0].Cells[0].Value.ToString())); if (form.ShowDialog() == DialogResult.Cancel) { LoadMaintenanceDGV(); } } catch (ArgumentOutOfRangeException) { } } if (((Button)sender).Name == btn_FinancesEdit.Name) { try { ViewOccurenceDataForm form = new ViewOccurenceDataForm(Occurence.GetOccurenceByID(dgv_Finances.SelectedRows[0].Cells[0].Value.ToString())); if (form.ShowDialog() == DialogResult.Cancel) { LoadFinanceDGV(); } } catch (ArgumentOutOfRangeException) { } } if (((Button)sender).Name == btn_InformationEdit.Name) { try { ViewPropertyDataForm form = new ViewPropertyDataForm(Property.GetPropertyByID(SelectedProperty.PropertyID)); if (form.ShowDialog() == DialogResult.Cancel) { LoadInformationDGV(); } } catch (ArgumentOutOfRangeException) { } } }
private void dgv_MouseDoubleClick(object sender, MouseEventArgs e) { var hti = ((DataGridView)sender).HitTest(e.X, e.Y); if (hti.RowIndex >= 0 && hti.ColumnIndex >= 0) { if (sender is DataGridView) { DataGridView source = (DataGridView)sender; string ID = source.SelectedRows[0].Cells[0].Value.ToString(); string IDType = new string(ID.Take(ID.IndexOf('_')).ToArray()); switch (IDType) { case "Prop": { break; } case "Ten": { break; } case "Occ": { break; } case "Mnt": { ViewOccurenceDataForm form = new ViewOccurenceDataForm(MaintenanceItem.GetOccurenceByID(ID)); if (form.ShowDialog() == DialogResult.OK) { LoadMaintenanceDGV(); } break; } case "Inc": { ViewOccurenceDataForm form = new ViewOccurenceDataForm(Incident.GetOccurenceByID(ID)); if (form.ShowDialog() == DialogResult.OK) { LoadFinanceDGV(); } break; } case "Pay": { ViewOccurenceDataForm form = new ViewOccurenceDataForm(Incident.GetOccurenceByID(ID)); if (form.ShowDialog() == DialogResult.OK) { LoadFinanceDGV(); } break; } case "Note": { ViewNoteDataForm form = new ViewNoteDataForm(SelectedTenant.Notes.Find(i => i.NoteID == ID), dgv_Notes); if (form.ShowDialog() == DialogResult.OK) { LoadNoteDGV(); } break; } } } } }
private void btn_Edit_Click(object sender, EventArgs e) { if (((Button)sender).Name == btn_MaintenanceEdit.Name) { try { ViewOccurenceDataForm form = new ViewOccurenceDataForm(Occurence.GetOccurenceByID(dgv_Maintenance.SelectedRows[0].Cells[0].Value.ToString())); if (form.ShowDialog() == DialogResult.Cancel) { LoadMaintenanceDGV(); } } catch (ArgumentOutOfRangeException) { } } if (((Button)sender).Name == btn_FinancesEdit.Name) { try { ViewOccurenceDataForm form = new ViewOccurenceDataForm(Occurence.GetOccurenceByID(dgv_Finances.SelectedRows[0].Cells[0].Value.ToString())); if (form.ShowDialog() == DialogResult.Cancel) { LoadFinanceDGV(); } } catch (ArgumentOutOfRangeException) { } } if (((Button)sender).Name == btn_InformationEdit.Name) { try { ViewTenantDataForm form = new ViewTenantDataForm(Tenant.GetTenantByID(SelectedTenant.TenantID)); if(form.ShowDialog() == DialogResult.Cancel) { } } catch (ArgumentOutOfRangeException) { } } }