Ejemplo n.º 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();
         }
     }
 }
Ejemplo n.º 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();
         }
     }
 }
Ejemplo n.º 3
0
        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;
                            }
                    }
                }
            }
        }
Ejemplo n.º 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();
         }
     }
 }
 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();
         }
     }
 }
Ejemplo n.º 6
0
        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;
                    }
                    }
                }
            }
        }