예제 #1
0
        protected void btnDeleteDeduction_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnDeleteDeduction_Click";

            try {
                // Switch Grids
                GridViewRow row = grdEqDeduction.SelectedRow;
                if (row == null)
                {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Before pressing Delete, please select an row from the Member Equity Deduction grid.");
                    throw (warn);
                }
                int    equityDeductionMemberID = Convert.ToInt32(row.Cells[(int)EqDedGridCols.colMemberEquityDeductionID].Text);
                string rowVersion = row.Cells[(int)EqDedGridCols.colRowVersion].Text;

                BeetEquityDeduction.EquityDeductionMemberDelete(equityDeductionMemberID, rowVersion);

                ClearEdit();
                int cropYear = Convert.ToInt32(Common.UILib.GetDropDownText(ddlCropYear));
                FillGridEqDeduction(MySHID, cropYear);
            }
            catch (Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
예제 #2
0
        protected void btnUpdateDeduction_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnUpdateDeduction_Click";

            try {
                GridViewRow row = grdPayment.SelectedRow;
                if (row == null)
                {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Before pressing Update, please select a Payment from the Available Equity Payments grid.");
                    throw (warn);
                }

                //--------------------------------------------------
                // Marry a Member to a Deduction and a payment.
                //--------------------------------------------------
                int    equityCropYear    = Convert.ToInt32(row.Cells[(int)PaymentGridCols.colEquityCropYear].Text);
                string equityType        = row.Cells[(int)PaymentGridCols.colEquityType].Text;
                int    sequence          = Convert.ToInt32(row.Cells[(int)PaymentGridCols.colSequence].Text);
                string paymentDesc       = row.Cells[(int)PaymentGridCols.colPaymentDesc].Text;
                int    equityDeductionID = Convert.ToInt32(Common.UILib.GetDropDownValue(ddlEquityDeductions));
                int    memberID          = Convert.ToInt32(MyMemberID);
                int    cropYear          = Convert.ToInt32(Common.UILib.GetDropDownText(ddlCropYear));

                // Switch Grids
                row = grdEqDeduction.SelectedRow;
                if (row == null)
                {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Before pressing Update, please select an row from the Member Equity Deduction grid.");
                    throw (warn);
                }
                int    equityDeductionMemberID = Convert.ToInt32(row.Cells[(int)EqDedGridCols.colMemberEquityDeductionID].Text);
                string rowVersion = row.Cells[(int)EqDedGridCols.colRowVersion].Text;

                string  amountText      = txtDeductionAmount.Text.TrimEnd().Replace(BLANK_CELL, "");
                decimal deductionAmount = 0;
                try {
                    deductionAmount = Convert.ToDecimal(amountText);
                }
                catch {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Please enter a positive number for Deduction Amount.");
                    throw (warn);
                }

                string   userName      = Common.AppHelper.GetIdentityName();
                DateTime deductionDate = Convert.ToDateTime(DateTime.Now.ToShortDateString());

                BeetEquityDeduction.EquityDeductionMemberSave(equityDeductionMemberID, memberID, equityDeductionID,
                                                              equityCropYear, cropYear, equityType, sequence, paymentDesc, deductionAmount, deductionDate, rowVersion, userName);

                ClearEdit();
                FillGridEqDeduction(MySHID, cropYear);
            }
            catch (Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
예제 #3
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnAdd_Click";

            try {
                //----------------------------------------------------------------------
                // Use the constructor to clean up state values, especially from grid.
                //----------------------------------------------------------------------
                ListEquityDeductionItem state = new ListEquityDeductionItem(
                    "",
                    txtEDedNumber.Text,
                    txtEDedDescription.Text,
                    (chkEDedIsActive.Checked ? "Y" : "N"),
                    "");


                string tmpNum          = state.DeductionNumber;
                int    deductionNumber = 0;
                try {
                    deductionNumber = Convert.ToInt32(tmpNum);
                }
                catch {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Please enter a positive number for Deduction Number.");
                    throw (warn);
                }
                if (deductionNumber == 0)
                {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Please enter a Deduction Number to a number greater than zero.");
                    throw (warn);
                }

                if (state.DeductionDescription.Length == 0)
                {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Please enter a Deduction Description.");
                    throw (warn);
                }

                string userName = Common.AppHelper.GetIdentityName();

                BeetEquityDeduction.EquityDeductionSave(Convert.ToInt32(state.EquityDeductionID), Convert.ToInt32(state.DeductionNumber),
                                                        state.DeductionDescription, state.IsActiveAsBool(), state.RowVersion, userName);

                ResetEquityDeductionEdit();
                FillEqDeductionGrid();
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
예제 #4
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnDelete_Click";

            try {
                //------------------------------------
                // Pull info from grid selection.
                //------------------------------------
                GridViewRow row = grdEqDeduction.SelectedRow;
                if (row == null)
                {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Before pressing Delete, please select an Equity Deduction from the Equity Deductions grid.");
                    throw (warn);
                }

                //----------------------------------------------------------------------
                // Use the constructor to clean up state values, especially from grid.
                //----------------------------------------------------------------------
                ListEquityDeductionItem state = new ListEquityDeductionItem(
                    row.Cells[(int)EqDedGridCols.colEquityDeductionID].Text,
                    txtEDedNumber.Text,
                    txtEDedDescription.Text,
                    (chkEDedIsActive.Checked ? "Y" : "N"),
                    row.Cells[(int)EqDedGridCols.colRowVersion].Text);

                int equityDeductionID = Convert.ToInt32(state.EquityDeductionID);
                if (equityDeductionID <= 0)
                {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Unable to identify your Equity Deductions grid selection.  Try making your selection again.");
                    throw (warn);
                }

                string rowVersion = state.RowVersion;
                if (rowVersion.Length == 0)
                {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Unable to identify your Equity Deductions grid selection.  Try making your selection again.");
                    throw (warn);
                }

                BeetEquityDeduction.EquityDeductionDelete(equityDeductionID, rowVersion);

                ResetEquityDeductionEdit();
                FillEqDeductionGrid();
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
예제 #5
0
        private void FillGridEqPayment(string shid, DateTime matchDate)
        {
            const string METHOD_NAME = "FillGridEqPayment";

            try {
                grdPayment.SelectedIndex = -1;

                List <ListMemberEquityPaymentItem> stateList = BeetEquityDeduction.EquityPaymentsByShid(shid, matchDate);
                grdPayment.DataSource = stateList;
                grdPayment.DataBind();
            }
            catch (Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wex);
            }
        }
예제 #6
0
        private void FillEqDeductionGrid()
        {
            const string METHOD_NAME = "FillEqDeductionGrid";

            try {
                List <ListEquityDeductionItem> stateList = BeetEquityDeduction.EquityDeductionGetAll();

                grdEqDeduction.SelectedIndex = -1;
                grdEqDeduction.DataSource    = stateList;
                grdEqDeduction.DataBind();
            }
            catch (Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wex);
            }
        }
예제 #7
0
        private void FillGridEqDeduction(string shid, int cropYear)
        {
            const string METHOD_NAME = "FillGridEqDeduction";

            try {
                grdEqDeduction.SelectedIndex = -1;

                List <ListMemberEquityDeductionItem> stateList = BeetEquityDeduction.EquityDeductionMemberGetBySHID(shid, cropYear);
                grdEqDeduction.DataSource = stateList;
                grdEqDeduction.DataBind();

                //---------------------------------------------
                // Without a selected row, you can only add
                //---------------------------------------------
                btnAddDeduction.Enabled    = true;
                btnUpdateDeduction.Enabled = false;
                btnDeleteDeduction.Enabled = false;
            }
            catch (Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wex);
            }
        }
예제 #8
0
        private void FillEquityDeductionList()
        {
            const string METHOD_NAME = "FillEquityDeductionList";

            try {
                ddlEquityDeductions.Items.Clear();
                List <ListEquityDeductionItem> stateList = BeetEquityDeduction.EquityDeductionGetAll();

                ddlEquityDeductions.Items.Add(new ListItem(" ", "0"));
                foreach (ListEquityDeductionItem state in stateList)
                {
                    ddlEquityDeductions.Items.Add(new ListItem(state.DeductionNumber + " - " + state.DeductionDescription, state.EquityDeductionID.ToString()));
                }
                if (ddlEquityDeductions.Items.Count > 0)
                {
                    ddlEquityDeductions.Items[0].Selected = true;
                }
            }
            catch (Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wex);
            }
        }
예제 #9
0
        private void FillControls()
        {
            ddlPatPaymentDesc.Items.Clear();
            ddlRetPaymentDesc.Items.Clear();
            ddlPatStatementDate.Items.Clear();
            ddlRetStatementDate.Items.Clear();
            txtStatementDate.Text = "";

            // Load the Payment controls
            string cropYear = ((MasterReportTemplate)Master).CropYear;
            List <ListEquityPaymentScheduleItem> stateList = BeetEquityDeduction.EquityPaymentSchedule(Convert.ToInt32(cropYear));

            foreach (ListEquityPaymentScheduleItem state in stateList)
            {
                ListItem liDesc = new ListItem(state.EquityType);
                ListItem liDate = new ListItem(state.PayDate);

                if (state.GroupType == "PAT")
                {
                    ddlPatPaymentDesc.Items.Add(liDesc);
                    ddlPatStatementDate.Items.Add(liDate);
                }
                else
                {
                    // Fill Unit Retain Payment control
                    ddlRetPaymentDesc.Items.Add(liDesc);
                    ddlRetStatementDate.Items.Add(liDate);
                }
            }

            // Handle empty controls.
            if (ddlPatPaymentDesc.Items.Count == 0)
            {
                ddlPatPaymentDesc.Items.Add("None Available");
                ddlPatStatementDate.Items.Add(" ");
            }
            if (ddlRetPaymentDesc.Items.Count == 0)
            {
                ddlRetPaymentDesc.Items.Add("None Available");
                ddlRetStatementDate.Items.Add(" ");
            }

            if (Common.UILib.GetDropDownText(ddlEquityType).StartsWith("Pat"))
            {
                if (ddlPatPaymentDesc.Items.Count > 0)
                {
                    ddlPatPaymentDesc.SelectedIndex = 0;
                    txtStatementDate.Text           = ddlPatStatementDate.Items[0].Text;
                }
                wrapPatPaymentDesc.Attributes.Add("class", "DisplayOn");
                wrapRetPaymentDesc.Attributes.Add("class", "DisplayOff");
            }
            else
            {
                if (ddlRetPaymentDesc.Items.Count > 0)
                {
                    ddlRetPaymentDesc.SelectedIndex = 0;
                    txtStatementDate.Text           = ddlRetStatementDate.Items[0].Text;
                }
                wrapPatPaymentDesc.Attributes.Add("class", "DisplayOff");
                wrapRetPaymentDesc.Attributes.Add("class", "DisplayOn");
            }
        }
예제 #10
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnUpdate_Click";

            try {
                //------------------------------------
                // Pull info from grid selection.
                //------------------------------------
                GridViewRow row = grdEqDeduction.SelectedRow;
                if (row == null)
                {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Before pressing Update, please select an Equity Deduction from the Equity Deductions grid.");
                    throw (warn);
                }

                //----------------------------------------------------------------------
                // Use the constructor to clean up state values, especially from grid.
                //----------------------------------------------------------------------
                ListEquityDeductionItem state = new ListEquityDeductionItem(
                    row.Cells[(int)EqDedGridCols.colEquityDeductionID].Text,
                    txtEDedNumber.Text,
                    txtEDedDescription.Text,
                    (chkEDedIsActive.Checked? "Y": "N"),
                    row.Cells[(int)EqDedGridCols.colRowVersion].Text);

                int equityDeductionID = Convert.ToInt32(state.EquityDeductionID);
                if (equityDeductionID <= 0)
                {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Unable to identify your Equity Deductions grid selection.  Try making your selection again.");
                    throw (warn);
                }

                string rowVersion = state.RowVersion;
                if (rowVersion.Length == 0)
                {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Unable to identify your Equity Deductions grid selection.  Try making your selection again.");
                    throw (warn);
                }

                bool   isActive             = state.IsActiveAsBool();
                string deductionDescription = state.DeductionDescription;

                if (deductionDescription.Length == 0)
                {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Please enter a Deduction Description.");
                    throw (warn);
                }

                string tmpNum          = state.DeductionNumber;
                int    deductionNumber = 0;
                try {
                    deductionNumber = Convert.ToInt32(tmpNum);
                }
                catch {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Please enter a positive number for Deduction Number.");
                    throw (warn);
                }
                if (deductionNumber == 0)
                {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Please enter a Deduction Number to a number greater than zero.");
                    throw (warn);
                }
                if (deductionNumber != Convert.ToInt32(row.Cells[(int)EqDedGridCols.colDeductionNumber].Text))
                {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("You cannot update the Deduction Number of a Deduction.  If the deduction has never been used, you can delete the deduction.");
                    throw (warn);
                }

                string userName = Common.AppHelper.GetIdentityName();

                BeetEquityDeduction.EquityDeductionSave(equityDeductionID, deductionNumber, deductionDescription, isActive, rowVersion, userName);

                ResetEquityDeductionEdit();
                FillEqDeductionGrid();
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }