private void mnuPaymentArrangements_Click(object sender, EventArgs e)
        {
            /********************************************************************************
            *   Add
            ********************************************************************************/
            if (sender.Equals(mnuPaymentArrangementsAdd))
            {
                dgvPaymentArrangements.EndEdit();
                dgvPaymentArrangements.SuspendLayout();

                bindingPaymentArrangements.AddNew();
                dgvPaymentArrangements.CurrentCell          = dgvPaymentArrangements.CurrentRow.Cells[0];
                dgvPaymentArrangements.CurrentCell.Selected = true;

                dgvPaymentArrangements.ResumeLayout();
                dgvPaymentArrangements.BeginEdit(true);
            }

            /********************************************************************************
            *   Remove
            ********************************************************************************/
            else if (sender.Equals(mnuPaymentArrangementsRemove))
            {
                if (MessageBox.Show("Delete payment arrangement(s)?", "Confirm delete", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    this.SuspendLayout();
                    dgvPaymentArrangements.SuspendLayout();

                    List <PlanPaymentArrangement> lstPlanPmtArrangements = new List <PlanPaymentArrangement>();
                    foreach (DataGridViewRow dgr in dgvPaymentArrangements.SelectedRows)
                    {
                        lstPlanPmtArrangements.Add((PlanPaymentArrangement)dgr.DataBoundItem);
                    }

                    if (lstPlanPmtArrangements.Count > 0)
                    {
                        foreach (PlanPaymentArrangement planfee in lstPlanPmtArrangements)
                        {
                            try
                            {
                                bindingPaymentArrangements.Remove(planfee);
                            }
                            catch (MyException ex)
                            {
                                MyMessageBox.Show(this, "Plan Payment Arrangement", MyDisplayMessage.RemoveError, ex);
                            }
                        }
                    }

                    lstPlanPmtArrangements.Clear();
                    dgvPaymentArrangements.ClearSelection();

                    dgvPaymentArrangements.ResumeLayout();
                    this.ResumeLayout();
                }
            }

            /********************************************************************************
            *   Calculate End Date
            ********************************************************************************/
            else if (sender.Equals(mnuPaymentArrangementsCalcEndDate))
            {
                this.SuspendLayout();
                dgvPaymentArrangements.SuspendLayout();

                List <PlanPaymentArrangement> lstPlanPaymentArrangements = new List <PlanPaymentArrangement>();

                foreach (DataGridViewRow dgr in dgvPaymentArrangements.SelectedRows)
                {
                    lstPlanPaymentArrangements.Add((PlanPaymentArrangement)dgr.DataBoundItem);
                }

                if (lstPlanPaymentArrangements.Count > 0)
                {
                    foreach (PlanPaymentArrangement paymentarrangement in lstPlanPaymentArrangements)
                    {
                        DateTime StartDate;
                        DateTime EndDate = DateTime.Now;
                        double   dblPaymentAmount;

                        // is there a start date
                        if (!DateTime.TryParse(paymentarrangement.StartDate, out StartDate))
                        {
                            paymentarrangement.StartDate = DateTime.Now.ToShortDateString();
                        }

                        // is there a payment amount
                        if (!Double.TryParse(paymentarrangement.Amount.ToString(), out dblPaymentAmount))
                        {
                            paymentarrangement.Amount = 0;
                        }

                        // no payment amount = end date of infinity
                        if (dblPaymentAmount <= 0)
                        {
                            paymentarrangement.EndDate = DateTime.MaxValue.ToString();
                            break;
                        }

                        // no balance means defendant is done making payments
                        if (_dblRemainingBalance <= 0)
                        {
                            paymentarrangement.EndDate = DateTime.Now.ToShortDateString();
                            break;
                        }

                        int    intPaymentCount = (int)Math.Ceiling(_dblRemainingBalance / dblPaymentAmount);
                        string strPayPeriod    = Helper.GetPayPeriodName(paymentarrangement.PayPeriodTypeId);

                        switch (strPayPeriod.ToLower())
                        {
                        case "weekly":
                            EndDate = StartDate.AddDays((7 * intPaymentCount));
                            break;

                        case "monthly":
                            EndDate = StartDate.AddMonths(intPaymentCount);
                            break;

                        case "bi-weekly":
                            EndDate = StartDate.AddDays((14 * intPaymentCount));
                            break;

                        case "bi-monthly":
                            EndDate = StartDate.AddMonths((intPaymentCount / 2));
                            break;
                        }

                        ((PlanPaymentArrangement)bindingPaymentArrangements.Current).EndDate = EndDate.ToString("d");
                    }
                }

                dgvPaymentArrangements.ResumeLayout();
                this.ResumeLayout();

                dgvPaymentArrangements.ClearSelection();
                bindingPaymentArrangements.ResetBindings(false);
            }
        }
Ejemplo n.º 2
0
 private void btnDBSave_Click(object sender, EventArgs e)
 {
     LocalUser.DatabaseSettings.SaveSettings();
     MyMessageBox.Show(this, "Database Settings", MyDisplayMessage.SaveSuccess);
 }
Ejemplo n.º 3
0
 private void btnReportSave_Click(object sender, EventArgs e)
 {
     _user.SaveSettings();
     MyMessageBox.Show(this, "Report Settings", MyDisplayMessage.SaveSuccess);
 }
Ejemplo n.º 4
0
        private void mnuEmployer_Click(object sender, EventArgs e)
        {
            Employer employer = (Employer)bindingEmployers.Current;

            if (sender.Equals(mnuEmployerNew))
            {
                /********************************************************************************
                *   New
                ********************************************************************************/
                if (CanChangeCurrentEmployer())
                {
                    _GridViewState = GridViewState.Adding;
                    bindingEmployers.AddNew();
                    _GridViewState = GridViewState.None;

                    this.txtEmployerName.Focus();
                }
            }
            else if (sender.Equals(mnuEmployerRemove))
            {
                /********************************************************************************
                *   Remove
                ********************************************************************************/
                if (DialogResult.OK == MyMessageBox.Show(this, "Employer", MyDisplayMessage.RemoveConfirm))
                {
                    try
                    {
                        bindingEmployers.RemoveCurrent();
                        bindingEmployers.ResetBindings(false);
                        this.ucFilter.Focus();
                    }
                    catch (MyException ex)
                    {
                        MyMessageBox.Show(this, "Employer", MyDisplayMessage.RemoveError, ex);
                    }
                }
            }
            else if (sender.Equals(mnuEmployerRefresh))
            {
                /********************************************************************************
                *   Refresh
                ********************************************************************************/
                if (!employer.MyState.Equals(MyObjectState.Current))
                {
                    if (DialogResult.Cancel == MyMessageBox.Show(this, "Employer", MyDisplayMessage.RefreshConfirm))
                    {
                        return;
                    }
                }

                try
                {
                    employer.Refresh();
                    bindingEmployers.ResetBindings(false);
                    this.txtEmployerName.Focus();
                    this.txtEmployerName.Select(0, 0);
                }
                catch (MyException ex)
                {
                    MyMessageBox.Show(this, "Employer", MyDisplayMessage.RefreshError, ex);
                }
            }
            else if (sender.Equals(mnuEmployerSave))
            {
                /********************************************************************************
                *   Save
                ********************************************************************************/
                bindingEmployers.EndEdit();
                try
                {
                    employer.Save(true);
                    bindingEmployers.ResetBindings(false);
                    bindingEmployers.Sort = "";

                    if (dgvEmployers.SortOrder == SortOrder.Descending)
                    {
                        bindingEmployers.Sort = dgvEmployers.SortedColumn.DataPropertyName + " DESC";
                    }
                    else
                    {
                        bindingEmployers.Sort = dgvEmployers.SortedColumn.DataPropertyName + " ASC";
                    }

                    ResetDataGridViewEmployer(employer);
                }
                catch (MyException ex)
                {
                    MyMessageBox.Show(this, "Employer", MyDisplayMessage.SaveError, ex);
                }
            }
            else if (sender.Equals(mnuEmployerCancel))
            {
                /********************************************************************************
                *   Cancel
                ********************************************************************************/
                if (employer.MyState == MyObjectState.New)
                {
                    bindingEmployers.RemoveCurrent();
                    if (bindingEmployers.Count > 0)
                    {
                        bindingEmployers.Position = 0;
                        this.txtEmployerName.Focus();
                        this.txtEmployerName.Select(0, 0);
                    }
                    else
                    {
                        this.ucFilter.Focus();
                    }
                }
                else
                {
                    employer.Reset();
                    bindingEmployers.ResetCurrentItem();
                }
            }
        }
Ejemplo n.º 5
0
        private void mnuRestrictedCasePrefixes_Click(object sender, EventArgs e)
        {
            RestrictedCasePrefix restrictedcaseprefix = (RestrictedCasePrefix)bindingRestrictedCasePrefixes.Current;

            /********************************************************************************
            *   New
            ********************************************************************************/
            if (sender.Equals(mnuRestrictedCasePrefixesNew))
            {
                if (CanChangeCurrentRestrictedCasePrefix())
                {
                    _GridViewState = GridViewState.Adding;
                    bindingRestrictedCasePrefixes.AddNew();
                    _GridViewState = GridViewState.None;
                }
            }

            /********************************************************************************
            *   Remove
            ********************************************************************************/
            else if (sender.Equals(mnuRestrictedCasePrefixesRemove))
            {
                if (DialogResult.OK == MyMessageBox.Show(this, "Restricted Case Prefixes", MyDisplayMessage.RemoveConfirm))
                {
                    try
                    {
                        bindingRestrictedCasePrefixes.RemoveCurrent();
                        bindingRestrictedCasePrefixes.ResetBindings(false);
                    }
                    catch (MyException ex)
                    {
                        MyMessageBox.Show(this, "Restricted Case Prefixes", MyDisplayMessage.RemoveError, ex);
                    }
                }
            }

            /********************************************************************************
            *   Refresh
            ********************************************************************************/
            else if (sender.Equals(mnuRestrictedCasePrefixesRefresh))
            {
                if (!restrictedcaseprefix.MyState.Equals(MyObjectState.Current))
                {
                    if (DialogResult.Cancel == MyMessageBox.Show(this, "Restricted Case Prefixes", MyDisplayMessage.RefreshConfirm))
                    {
                        return;
                    }
                }

                try
                {
                    restrictedcaseprefix.Refresh();
                    bindingRestrictedCasePrefixes.ResetBindings(false);
                }
                catch (MyException ex)
                {
                    MyMessageBox.Show(this, "Restricted Case Prefixes", MyDisplayMessage.RefreshError, ex);
                }
            }

            /********************************************************************************
            *   Save
            ********************************************************************************/
            else if (sender.Equals(mnuRestrictedCasePrefixesSave))
            {
                dgvRestrictedCasePrefixes.EndEdit();
                bindingRestrictedCasePrefixes.EndEdit();
                try
                {
                    restrictedcaseprefix.Save(true);
                    bindingRestrictedCasePrefixes.ResetBindings(false);


                    bindingRestrictedCasePrefixes.Sort = "";
                    if (dgvRestrictedCasePrefixes.SortOrder == SortOrder.Descending)
                    {
                        bindingRestrictedCasePrefixes.Sort = dgvRestrictedCasePrefixes.SortedColumn.DataPropertyName + " DESC";
                    }
                    else
                    {
                        bindingRestrictedCasePrefixes.Sort = dgvRestrictedCasePrefixes.SortedColumn.DataPropertyName + " ASC";
                    }

                    ResetDataGridViewRestrictedCasePrefixes(restrictedcaseprefix);
                }
                catch (MyException ex)
                {
                    MyMessageBox.Show(this, "Restricted Case Prefixes", MyDisplayMessage.SaveError, ex);
                }
            }

            /********************************************************************************
            *   Cancel
            ********************************************************************************/
            else if (sender.Equals(mnuRestrictedCasePrefixesCancel))
            {
                if (restrictedcaseprefix.MyState == MyObjectState.New)
                {
                    bindingRestrictedCasePrefixes.RemoveCurrent();
                }
                else
                {
                    restrictedcaseprefix.Reset();
                    bindingRestrictedCasePrefixes.ResetCurrentItem();
                }
            }
        }
Ejemplo n.º 6
0
        private void mnuPlanCase_Click(object sender, EventArgs e)
        {
            /********************************************************************************
            *   Add
            ********************************************************************************/
            if (sender.Equals(mnuPlanCaseAdd))
            {
                dgvCases.EndEdit();

                this.SuspendLayout();
                dgvCases.SuspendLayout();

                bindingCases.AddNew();

                dgvCases.CurrentCell          = dgvCases.CurrentRow.Cells[0];
                dgvCases.CurrentCell.Selected = true;
                dgvCases.BeginEdit(true);

                dgvCases.ResumeLayout(false);
                this.ResumeLayout(false);
            }

            /********************************************************************************
            *   Remove
            ********************************************************************************/
            else if (sender.Equals(mnuPlanCaseRemove))
            {
                List <PlanCase> lstPlanCases = new List <PlanCase>();

                foreach (DataGridViewRow dgr in dgvCases.SelectedRows)
                {
                    lstPlanCases.Add((PlanCase)dgr.DataBoundItem);
                }

                dgvCases.SuspendLayout();
                if (lstPlanCases.Count > 0)
                {
                    foreach (PlanCase plancase in lstPlanCases)
                    {
                        try
                        {
                            bindingCases.Remove(plancase);
                        }
                        catch (MyException ex)
                        {
                            MyMessageBox.Show(this, "Plan Case", MyDisplayMessage.RemoveError, ex);
                        }
                    }
                }
                dgvCases.ResumeLayout();

                lstPlanCases.Clear();

                dgvCases.ClearSelection();
            }

            /********************************************************************************
            *   Paste
            ********************************************************************************/
            else if (sender.Equals(mnuPlanCasePaste))
            {
                PasteClipboard();
            }

            /********************************************************************************
            *   Commit
            ********************************************************************************/
            else if (sender.Equals(mnuPlanCaseCommit))
            {
                List <PlanCase> lstPlanCases = new List <PlanCase>();

                foreach (DataGridViewRow dgr in dgvCases.SelectedRows)
                {
                    lstPlanCases.Add((PlanCase)dgr.DataBoundItem);
                }

                dgvCases.SuspendLayout();
                if (lstPlanCases.Count > 0)
                {
                    foreach (PlanCase plancase in lstPlanCases)
                    {
                        DateTime commitdate = DateTime.Now;

                        plancase.CommitBaseDate = commitdate.ToString();
                        plancase.CommitDaysTill = Convert.ToDouble(mnuPlanCaseCommitUntil.SelectedItem);

                        plancase.CommitDate = commitdate.AddDays(plancase.CommitDaysTill).ToString();
                    }
                }
                dgvCases.ResumeLayout();
                lstPlanCases.Clear();
                dgvCases.ClearSelection();
            }
        }
        private void mnuPaymentArrangementType_Click(object sender, EventArgs e)
        {
            PaymentArrangementType paymentarrangementtype = (PaymentArrangementType)bindingPaymentArrangementTypes.Current;

            /********************************************************************************
            *   New
            ********************************************************************************/
            if (sender.Equals(mnuPaymentArrangementTypeNew))
            {
                if (CanChangeCurrentPaymentArrangementType())
                {
                    _GridViewState = GridViewState.Adding;
                    bindingPaymentArrangementTypes.AddNew();
                    _GridViewState = GridViewState.None;
                }
            }

            /********************************************************************************
            *   Remove
            ********************************************************************************/
            else if (sender.Equals(mnuPaymentArrangementTypeRemove))
            {
                if (DialogResult.OK == MyMessageBox.Show(this, "Payment Arrangement Type", MyDisplayMessage.RemoveConfirm))
                {
                    try
                    {
                        bindingPaymentArrangementTypes.RemoveCurrent();
                        bindingPaymentArrangementTypes.ResetBindings(false);
                    }
                    catch (MyException ex)
                    {
                        MyMessageBox.Show(this, "Payment Arrangement Type", MyDisplayMessage.RemoveError, ex);
                    }
                }
            }

            /********************************************************************************
            *   Refresh
            ********************************************************************************/
            else if (sender.Equals(mnuPaymentArrangementTypeRefresh))
            {
                if (!paymentarrangementtype.MyState.Equals(MyObjectState.Current))
                {
                    if (DialogResult.Cancel == MyMessageBox.Show(this, "Payment Arrangement Type", MyDisplayMessage.RefreshConfirm))
                    {
                        return;
                    }
                }

                try
                {
                    paymentarrangementtype.Refresh();
                    bindingPaymentArrangementTypes.ResetBindings(false);
                }
                catch (MyException ex)
                {
                    MyMessageBox.Show(this, "Payment Arrangement Type", MyDisplayMessage.RefreshError, ex);
                }
            }

            /********************************************************************************
            *   Save
            ********************************************************************************/
            else if (sender.Equals(mnuPaymentArrangementTypeSave))
            {
                dgvPaymentArrangementTypes.EndEdit();
                bindingPaymentArrangementTypes.EndEdit();
                try
                {
                    paymentarrangementtype.Save(true);
                    bindingPaymentArrangementTypes.ResetBindings(false);


                    bindingPaymentArrangementTypes.Sort = "";
                    if (dgvPaymentArrangementTypes.SortOrder == SortOrder.Descending)
                    {
                        bindingPaymentArrangementTypes.Sort = dgvPaymentArrangementTypes.SortedColumn.DataPropertyName + " DESC";
                    }
                    else
                    {
                        bindingPaymentArrangementTypes.Sort = dgvPaymentArrangementTypes.SortedColumn.DataPropertyName + " ASC";
                    }

                    ResetDataGridViewPaymentArrangementType(paymentarrangementtype);
                }
                catch (MyException ex)
                {
                    MyMessageBox.Show(this, "Payment Arrangement Type", MyDisplayMessage.SaveError, ex);
                }
            }

            /********************************************************************************
            *   Cancel
            ********************************************************************************/
            else if (sender.Equals(mnuPaymentArrangementTypeCancel))
            {
                if (paymentarrangementtype.MyState == MyObjectState.New)
                {
                    bindingPaymentArrangementTypes.RemoveCurrent();
                }
                else
                {
                    paymentarrangementtype.Reset();
                    bindingPaymentArrangementTypes.ResetCurrentItem();
                }
            }
        }
Ejemplo n.º 8
0
        private void mnuFeeType_Click(object sender, EventArgs e)
        {
            FeeType feetype = (FeeType)bindingFeeTypes.Current;

            if (sender.Equals(mnuFeeTypeNew))
            {
                /********************************************************************************
                *   New
                ********************************************************************************/
                if (CanChangeCurrentFeeType())
                {
                    _GridViewState = GridViewState.Adding;
                    bindingFeeTypes.AddNew();
                    _GridViewState = GridViewState.None;
                }
            }
            else if (sender.Equals(mnuFeeTypeRemove))
            {
                /********************************************************************************
                *   Remove
                ********************************************************************************/
                if (DialogResult.OK == MyMessageBox.Show(this, "Fee Type", MyDisplayMessage.RemoveConfirm))
                {
                    try
                    {
                        bindingFeeTypes.RemoveCurrent();
                        bindingFeeTypes.ResetBindings(false);
                    }
                    catch (MyException ex)
                    {
                        MyMessageBox.Show(this, "Fee Type", MyDisplayMessage.RemoveError, ex);
                    }
                }
            }
            else if (sender.Equals(mnuFeeTypeRefresh))
            {
                /********************************************************************************
                *   Refresh
                ********************************************************************************/
                if (!feetype.MyState.Equals(MyObjectState.Current))
                {
                    if (DialogResult.Cancel == MyMessageBox.Show(this, "Fee Type", MyDisplayMessage.RefreshConfirm))
                    {
                        return;
                    }
                }

                try
                {
                    feetype.Refresh();
                    bindingFeeTypes.ResetBindings(false);
                }
                catch (MyException ex)
                {
                    MyMessageBox.Show(this, "Fee Type", MyDisplayMessage.RefreshError, ex);
                }
            }
            else if (sender.Equals(mnuFeeTypeSave))
            {
                /********************************************************************************
                *   Save
                ********************************************************************************/
                dgvFeeTypes.EndEdit();
                bindingFeeTypes.EndEdit();
                try
                {
                    feetype.Save(true);
                    bindingFeeTypes.ResetBindings(false);

                    /*
                     *
                     *
                     * will need to come up with better sorting when this form is updated.
                     *
                     *
                     *
                     *
                     */
                    bindingFeeTypes.Sort = "";
                    if (dgvFeeTypes.SortOrder == SortOrder.Descending)
                    {
                        bindingFeeTypes.Sort = dgvFeeTypes.SortedColumn.DataPropertyName + " DESC";
                    }
                    else
                    {
                        bindingFeeTypes.Sort = dgvFeeTypes.SortedColumn.DataPropertyName + " ASC";
                    }

                    ResetDataGridViewFeeType(feetype);
                }
                catch (MyException ex)
                {
                    MyMessageBox.Show(this, "Fee Type", MyDisplayMessage.SaveError, ex);
                }
            }
            else if (sender.Equals(mnuFeeTypeCancel))
            {
                /********************************************************************************
                *   Cancel
                ********************************************************************************/
                if (feetype.MyState == MyObjectState.New)
                {
                    bindingFeeTypes.RemoveCurrent();
                }
                else
                {
                    feetype.Reset();
                    bindingFeeTypes.ResetCurrentItem();
                }
            }
        }