예제 #1
0
 private void btn_Add_Click(object sender, EventArgs e)
 {
     if (((Button)sender).Name == btn_MaintenanceAdd.Name)
     {
         if (SelectedTenant.IsCurrentTenant)
         {
             NewMaintenanceForm dialog = new NewMaintenanceForm(SelectedTenant.Residence, false);
             dialog.ShowDialog();
             if (dialog.DialogResult == DialogResult.OK)
             {
                 LoadMaintenanceDGV();
             }
         }
         else
         {
             MessageBox.Show("This tenant is not a current resident", "Notice", MessageBoxButtons.OK);
         }
     }
     if (((Button)sender).Name == btn_FinancesAdd.Name)
     {
         if (SelectedTenant.IsCurrentTenant)
         {
             SimplePrompt prompt = new SimplePrompt("Income or Expense?", "Finance", "Income", "Expense");
             prompt.ShowDialog();
             if (prompt.DialogResult == DialogResult.Yes)
             {
                 NewPaymentForm dialog = new NewPaymentForm(SelectedTenant.Residence);
                 dialog.ShowDialog();
                 if (dialog.DialogResult == DialogResult.OK)
                 {
                     LoadFinanceDGV();
                 }
             }
             else if (prompt.DialogResult == DialogResult.No)
             {
                 AddIncidentForm dialog = new AddIncidentForm(SelectedTenant.Residence);
                 dialog.ShowDialog();
                 if (dialog.DialogResult == DialogResult.OK)
                 {
                     LoadFinanceDGV();
                 }
             }
         }
         else
         {
             MessageBox.Show("This tenant is not a current resident", "Notice", MessageBoxButtons.OK);
         }
     }
     if (((Button)sender).Name == btn_NotesAdd.Name)
     {
         ViewNoteDataForm form = new ViewNoteDataForm(new Note(), dgv_Notes);
         if (form.ShowDialog() == DialogResult.OK)
         {
             SelectedTenant.Notes.Add(form.note);
             LoadNoteDGV();
         }
     }
 }
예제 #2
0
 private void btn_Add_Click(object sender, EventArgs e)
 {
     if (((Button)sender).Name == btn_MaintenanceAdd.Name)
     {
         NewMaintenanceForm dialog = new NewMaintenanceForm(SelectedProperty, false);
         dialog.ShowDialog();
         if (dialog.DialogResult == DialogResult.OK)
         {
             LoadMaintenanceDGV();
         }
     }
     if (((Button)sender).Name == btn_FinancesAdd.Name)
     {
         SimplePrompt prompt = new SimplePrompt("Income or Expense?", "Finance", "Income", "Expense");
         prompt.ShowDialog();
         if (prompt.DialogResult == DialogResult.Yes)
         {
             NewPaymentForm dialog = new NewPaymentForm(SelectedProperty);
             dialog.ShowDialog();
             if (dialog.DialogResult == DialogResult.OK)
             {
                 LoadFinanceDGV();
             }
         }
         else if (prompt.DialogResult == DialogResult.No)
         {
             AddIncidentForm dialog = new AddIncidentForm(SelectedProperty);
             dialog.ShowDialog();
             if (dialog.DialogResult == DialogResult.OK)
             {
                 LoadFinanceDGV();
             }
         }
     }
     if (((Button)sender).Name == btn_NotesAdd.Name)
     {
         ViewNoteDataForm form = new ViewNoteDataForm(new Note(), dgv_Notes);
         if (form.ShowDialog() == DialogResult.OK)
         {
             SelectedProperty.Notes.Add(form.note);
             LoadNoteDGV();
         }
     }
 }
예제 #3
0
 private void btn_Add_Click(object sender, EventArgs e)
 {
     if (((Button)sender).Name == btn_AddProperty.Name)
     {
         bool loop;
         do
         {
             loop = false;
             NewPropertyForm dialog = new NewPropertyForm();
             dialog.ShowDialog();
             if (dialog.DialogResult == DialogResult.Retry)
             {
                 loop = true;
             }
             LoadPropertyPage();
         } while (loop);
     }
     if (((Button)sender).Name == btn_AddTenant.Name)
     {
         bool loop;
         do
         {
             loop = false;
             NewTenantForm dialog = new NewTenantForm();
             dialog.ShowDialog();
             if (dialog.DialogResult == DialogResult.Retry)
             {
                 loop = true;
             }
             LoadTenantPage();
         } while (loop);
     }
     if (((Button)sender).Name == btn_AddMaintenance.Name)
     {
         PropertySelector ps = new PropertySelector();
         if (ps.ShowDialog() == DialogResult.OK)
         {
             NewMaintenanceForm dialog = new NewMaintenanceForm(ps.selection, false);
             dialog.ShowDialog();
             if (dialog.DialogResult == DialogResult.OK)
             {
                 LoadMaintenancePage();
             }
         }
     }
     if (((Button)sender).Name == btn_AddFinance.Name)
     {
         try
         {
             PropertySelector ps = new PropertySelector();
             if (ps.ShowDialog() == DialogResult.OK)
             {
                 SimplePrompt prompt = new SimplePrompt("Income or Expense?", "Finance", "Income", "Expense");
                 prompt.ShowDialog();
                 if (prompt.DialogResult == DialogResult.Yes)
                 {
                     NewPaymentForm dialog = new NewPaymentForm(ps.selection);
                     dialog.ShowDialog();
                     if (dialog.DialogResult == DialogResult.OK)
                     {
                         LoadFinancePage();
                     }
                 }
                 else if (prompt.DialogResult == DialogResult.No)
                 {
                     AddIncidentForm dialog = new AddIncidentForm(ps.selection);
                     dialog.ShowDialog();
                     if (dialog.DialogResult == DialogResult.OK)
                     {
                         LoadFinancePage();
                     }
                 }
             }
         }
         catch (ArgumentOutOfRangeException) { }
     }
 }
예제 #4
0
 private void btn_Add_Click(object sender, EventArgs e)
 {
     if (((Button)sender).Name == btn_MaintenanceAdd.Name)
     {
         if (SelectedTenant.IsCurrentTenant)
         {
             NewMaintenanceForm dialog = new NewMaintenanceForm(SelectedTenant.Residence, false);
             dialog.ShowDialog();
             if (dialog.DialogResult == DialogResult.OK)
             { LoadMaintenanceDGV(); }
         }
         else
         { MessageBox.Show("This tenant is not a current resident", "Notice", MessageBoxButtons.OK); }
     }
     if (((Button)sender).Name == btn_FinancesAdd.Name)
     {
         if (SelectedTenant.IsCurrentTenant)
         {
             SimplePrompt prompt = new SimplePrompt("Income or Expense?", "Finance", "Income", "Expense");
             prompt.ShowDialog();
             if (prompt.DialogResult == DialogResult.Yes)
             {
                 NewPaymentForm dialog = new NewPaymentForm(SelectedTenant.Residence);
                 dialog.ShowDialog();
                 if (dialog.DialogResult == DialogResult.OK)
                 { LoadFinanceDGV(); }
             }
             else if (prompt.DialogResult == DialogResult.No)
             {
                 AddIncidentForm dialog = new AddIncidentForm(SelectedTenant.Residence);
                 dialog.ShowDialog();
                 if (dialog.DialogResult == DialogResult.OK)
                 { LoadFinanceDGV(); }
             }
         }
         else
         { MessageBox.Show("This tenant is not a current resident", "Notice", MessageBoxButtons.OK); }
     }
     if (((Button)sender).Name == btn_NotesAdd.Name)
     {
         ViewNoteDataForm form = new ViewNoteDataForm(new Note(), dgv_Notes);
         if (form.ShowDialog() == DialogResult.OK)
         {
             SelectedTenant.Notes.Add(form.note);
             LoadNoteDGV();
         }
     }
 }
예제 #5
0
 private void btn_Add_Click(object sender, EventArgs e)
 {
     if (((Button)sender).Name == btn_AddProperty.Name)
     {
         bool loop;
         do
         {
             loop = false;
             NewPropertyForm dialog = new NewPropertyForm();
             dialog.ShowDialog();
             if (dialog.DialogResult == DialogResult.Retry)
             { loop = true; }
             LoadPropertyPage();
         } while (loop);
     }
     if (((Button)sender).Name == btn_AddTenant.Name)
     {
         bool loop;
         do
         {
             loop = false;
             NewTenantForm dialog = new NewTenantForm();
             dialog.ShowDialog();
             if (dialog.DialogResult == DialogResult.Retry)
             { loop = true; }
             LoadTenantPage();
         } while (loop);
     }
     if (((Button)sender).Name == btn_AddMaintenance.Name)
     {
         PropertySelector ps = new PropertySelector();
         if (ps.ShowDialog() == DialogResult.OK)
         {
             NewMaintenanceForm dialog = new NewMaintenanceForm(ps.selection, false);
             dialog.ShowDialog();
             if (dialog.DialogResult == DialogResult.OK)
             { LoadMaintenancePage(); }
         }
     }
     if (((Button)sender).Name == btn_AddFinance.Name)
     {
         try
         {
             PropertySelector ps = new PropertySelector();
             if (ps.ShowDialog() == DialogResult.OK)
             {
                 SimplePrompt prompt = new SimplePrompt("Income or Expense?", "Finance", "Income", "Expense");
                 prompt.ShowDialog();
                 if (prompt.DialogResult == DialogResult.Yes)
                 {
                     NewPaymentForm dialog = new NewPaymentForm(ps.selection);
                     dialog.ShowDialog();
                     if (dialog.DialogResult == DialogResult.OK)
                     { LoadFinancePage(); }
                 }
                 else if (prompt.DialogResult == DialogResult.No)
                 {
                     AddIncidentForm dialog = new AddIncidentForm(ps.selection);
                     dialog.ShowDialog();
                     if (dialog.DialogResult == DialogResult.OK)
                     { LoadFinancePage(); }
                 }
             }
         }
         catch (ArgumentOutOfRangeException) { }
     }
 }
 private void btn_Add_Click(object sender, EventArgs e)
 {
     if(((Button)sender).Name == btn_MaintenanceAdd.Name)
     {
         NewMaintenanceForm dialog = new NewMaintenanceForm(SelectedProperty, false);
         dialog.ShowDialog();
         if (dialog.DialogResult == DialogResult.OK)
         { LoadMaintenanceDGV(); }
     }
     if (((Button)sender).Name == btn_FinancesAdd.Name)
     {
         SimplePrompt prompt = new SimplePrompt("Income or Expense?", "Finance", "Income", "Expense");
         prompt.ShowDialog();
         if (prompt.DialogResult == DialogResult.Yes)
         {
             NewPaymentForm dialog = new NewPaymentForm(SelectedProperty);
             dialog.ShowDialog();
             if(dialog.DialogResult== DialogResult.OK)
             { LoadFinanceDGV(); }
         }
         else if (prompt.DialogResult == DialogResult.No)
         {
             AddIncidentForm dialog = new AddIncidentForm(SelectedProperty);
             dialog.ShowDialog();
             if (dialog.DialogResult == DialogResult.OK)
             { LoadFinanceDGV(); }
         }
     }
     if (((Button)sender).Name == btn_NotesAdd.Name)
     {
         ViewNoteDataForm form = new ViewNoteDataForm(new Note(), dgv_Notes);
         if (form.ShowDialog() == DialogResult.OK)
         {
             SelectedProperty.Notes.Add(form.note);
             LoadNoteDGV();
         }
     }
 }