Beispiel #1
0
 private void dgvFeeTypes_Sorted(object sender, EventArgs e)
 {
     if (_feeTypeTemp != null)
     {
         int row = bindingFeeTypes.IndexOf(_feeTypeTemp);
         dgvFeeTypes.BeginInvoke((MethodInvoker) delegate()
         {
             dgvFeeTypes.Rows[row].Selected = true;
             dgvFeeTypes.CurrentCell        = dgvFeeTypes[0, row];
         });
     }
     _feeTypeTemp   = null;
     _GridViewState = GridViewState.None;
 }
Beispiel #2
0
 private void ResetDataGridViewFeeType(FeeType feeType)
 {
     if (feeType != null)
     {
         int row = bindingFeeTypes.IndexOf(feeType);
         if (row >= 0)
         {
             dgvFeeTypes.BeginInvoke((MethodInvoker) delegate()
             {
                 dgvFeeTypes.Rows[row].Selected = true;
                 dgvFeeTypes.CurrentCell        = dgvFeeTypes[0, row];
             });
         }
     }
 }
Beispiel #3
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();
                }
            }
        }