Ejemplo n.º 1
0
        private void FillTransferGrid(int memberID, int cropYear)
        {
            const string METHOD_NAME = "FillTransferGrid";

            try {
                grdTransfers.SelectedIndex = -1;
                List <ListShareTransferItem> listItems = BeetDataMember.ShareTransferGetYear(memberID, cropYear);

                _hideTransferContractCol = true;
                foreach (ListShareTransferItem item in listItems)
                {
                    if (item.ContractNumber.Length > 0)
                    {
                        _hideTransferContractCol = false;
                        break;
                    }
                }

                grdTransfers.DataSource = listItems;
                grdTransfers.DataBind();
            }
            catch (Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wex);
            }
        }
Ejemplo n.º 2
0
        private void FindToAddress(string shid, int cropYear)
        {
            const string METHOD_NAME = "FindToAddress";

            try {
                ResetToSHID();

                if (shid.Length > 0)
                {
                    int    memberID = 0, addressID = 0, factoryID = 0, factoryNumber = 0;
                    string phone = "", email = "", fax = "", busName = "", factoryName = "";

                    BeetDataMember.GetMemberInfo(shid, cropYear, ref memberID, ref addressID, ref busName, ref phone, ref email, ref fax,
                                                 ref factoryID, ref factoryNumber, ref factoryName);

                    txtToSHID.Text    = shid;
                    MyToSHID          = shid;
                    MyToMemberID      = memberID.ToString();
                    lblToBusName.Text = busName;
                    MyToFactoryNumber = factoryNumber.ToString();
                    lblToFactory.Text = factoryNumber.ToString("0#") + " " + factoryName;
                }
            }
            catch (Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wex);
            }
        }
Ejemplo n.º 3
0
        private void FillGridToSummary(int memberID, int cropYear)
        {
            const string METHOD_NAME = "FillGridToSummary";

            try {
                List <ListMemberStockSummaryItem> itemList = BeetDataMember.MemberStockGetSummary(memberID, cropYear);

                grdToSummary.DataSource = itemList;
                grdToSummary.DataBind();

                grdToSummary2.DataSource = itemList;
                grdToSummary2.DataBind();
            }
            catch (Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wex);
            }
        }
Ejemplo n.º 4
0
        protected void btnTransferDelete_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnTransferDelete_Click";

            try {
                // only allowed in this crop year and last crop year.
                if (ddlCropYear.SelectedIndex > 1)
                {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Delets is not allowed to a older Crop Year.");
                    throw (warn);
                }

                GridViewRow row = grdTransfers.SelectedRow;
                if (row == null)
                {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Before pressing Delete, please select a transfer from the Transferee -- Temp Transfer listing.");
                    throw (warn);
                }
                else
                {
                    int shareTransferID = Convert.ToInt32(row.Cells[(int)TempTransferCols.colShareTransferID].Text);
                    BeetDataMember.ShareTransferDelete(shareTransferID);

                    // Clear edit controls
                    int cropYear   = Convert.ToInt32(Common.UILib.GetDropDownText(ddlCropYear));
                    int toMemberID = Convert.ToInt32(MyToMemberID);

                    ResetTransferEdit();
                    FillGridFromSummary(Convert.ToInt32(MyFromMemberID), cropYear);
                    FillGridToSummary(toMemberID, cropYear);
                    FillTransferGrid(toMemberID, cropYear);
                }
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
Ejemplo n.º 5
0
        protected void btnTransferUpdate_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnTransferUpdate_Click";

            try {
                // only allowed in this crop year and last crop year.
                if (ddlCropYear.SelectedIndex > 1)
                {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Updates are not allowed to a older Crop Year.");
                    throw (warn);
                }

                GridViewRow row = grdTransfers.SelectedRow;
                if (row == null)
                {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Before pressing Update, please select a transfer from the Transferee -- Temp Transfer listing.");
                    throw (warn);
                }
                else
                {
                    int shareTransferID = Convert.ToInt32(row.Cells[(int)TempTransferCols.colShareTransferID].Text);
                    int cropYear        = Convert.ToInt32(Common.UILib.GetDropDownText(ddlCropYear));
                    int transferNumber  = Convert.ToInt32(row.Cells[(int)TempTransferCols.colTransferNumber].Text);

                    string  tmpToRetainPct = txtTransferToPctRetain.Text;
                    decimal toRetainPct    = 0;
                    try {
                        toRetainPct = Convert.ToDecimal(tmpToRetainPct);
                    }
                    catch {
                        Common.CWarning warn = new WSCIEMP.Common.CWarning("Please enter a positive number between 0 and 100 for the Transferee % Retain.");
                        throw (warn);
                    }
                    decimal fromRetainPct = 100 - toRetainPct;

                    string tmpShares = txtTransferShares.Text;
                    int    shares    = 0;
                    try {
                        shares = Convert.ToInt32(tmpShares);
                    }
                    catch {
                        Common.CWarning warn = new WSCIEMP.Common.CWarning("Please enter a positive number for Transferee Shares.");
                        throw (warn);
                    }

                    string transferDate = "";                                                           // Do not change transfer date on update.
                    bool   isFeePaid    = (chkTransferAdminFee.Checked == true);

                    string approvalDate = txtTransferApprovalDate.Text;
                    try {
                        if (approvalDate.Length > 0)
                        {
                            DateTime tmpApprovalDate = Convert.ToDateTime(approvalDate);
                        }
                    }
                    catch {
                        Common.CWarning warn = new WSCIEMP.Common.CWarning("Please enter valid Transferee Approval Date: mm/dd/yyyy.");
                        throw (warn);
                    }

                    string  tmpPaidPricePerAcre = txtTransferPricePerAcre.Text;
                    decimal pricePerAcre        = 0;
                    try {
                        pricePerAcre = Convert.ToDecimal(tmpPaidPricePerAcre);
                    }
                    catch {
                        Common.CWarning warn = new WSCIEMP.Common.CWarning("Please enter a valid number for the Transferee Price Per Acre.");
                        throw (warn);
                    }

                    string  tmpPctCrop = txtTransferToPctCrop.Text;
                    decimal PctCrop    = 0;
                    try {
                        PctCrop = Convert.ToDecimal(tmpPctCrop);
                    }
                    catch {
                        Common.CWarning warn = new WSCIEMP.Common.CWarning("Please enter a valid number for the Transferee % of Crop.");
                        throw (warn);
                    }

                    string shareTransferTimeStamp = row.Cells[(int)TempTransferCols.colTransferTimeStamp].Text.Replace(BLANK_CELL, "");
                    string userName       = Common.AppHelper.GetIdentityName();
                    string contractNumber = row.Cells[(int)TempTransferCols.colContractNumber].Text.Replace(BLANK_CELL, "");

                    string tmpToSHID = txtToSHID.Text;
                    int    toSHID    = 0;
                    if (Common.CodeLib.IsValidSHID(tmpToSHID))
                    {
                        toSHID = Convert.ToInt32(tmpToSHID);
                    }
                    else
                    {
                        Common.CWarning warn = new Common.CWarning("Please enter a valid Transferee SHID and make sure you're seeing the correct Business Name.");
                        throw (warn);
                    }

                    string tmpFromSHID = txtFromSHID.Text;
                    int    fromSHID    = 0;
                    if (Common.CodeLib.IsValidSHID(tmpFromSHID))
                    {
                        fromSHID = Convert.ToInt32(tmpFromSHID);
                    }
                    else
                    {
                        Common.CWarning warn = new Common.CWarning("Please enter a valid Transferor SHID and make sure you're seeing the correct Business Name.");
                        throw (warn);
                    }

                    int fromFactoryNumber = Convert.ToInt32(MyFromFactoryNumber);
                    int toFactoryNumber   = Convert.ToInt32(MyToFactoryNumber);

                    BeetDataMember.ShareTransferSave(shareTransferID, contractNumber, cropYear, transferNumber, fromSHID,
                                                     fromFactoryNumber, fromRetainPct, toSHID, toRetainPct, toFactoryNumber, shares, transferDate,
                                                     isFeePaid, approvalDate, pricePerAcre, PctCrop, shareTransferTimeStamp, userName);

                    int toMemberID = Convert.ToInt32(MyToMemberID);

                    ResetTransferEdit();
                    FillGridFromSummary(Convert.ToInt32(MyFromMemberID), cropYear);
                    FillGridToSummary(toMemberID, cropYear);
                    FillTransferGrid(toMemberID, cropYear);
                }
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
Ejemplo n.º 6
0
        protected void btnTransferAdd_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnTransferAdd_Click";

            try {
                // only allowed in this crop year and last crop year.
                if (ddlCropYear.SelectedIndex > 1)
                {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Add is not allowed to a older Crop Year.");
                    throw (warn);
                }

                int shareTransferID = 0;
                int cropYear        = Convert.ToInt32(Common.UILib.GetDropDownText(ddlCropYear));
                int transferNumber  = 0;

                string  tmpToRetainPct = txtTransferToPctRetain.Text;
                decimal toRetainPct    = 0;
                try {
                    toRetainPct = Convert.ToDecimal(tmpToRetainPct);
                }
                catch {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Please enter a positive number between 0 and 100 for the Transferee % Retain.");
                    throw (warn);
                }
                decimal fromRetainPct = 100 - toRetainPct;

                string tmpShares = txtTransferShares.Text;
                int    shares    = 0;
                try {
                    shares = Convert.ToInt32(tmpShares);
                }
                catch {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Please enter a positive number for Transferee Shares.");
                    throw (warn);
                }

                string transferDate = DateTime.Now.ToShortDateString();             // Add creates the transfer date and is not editable.
                bool   isFeePaid    = (chkTransferAdminFee.Checked == true);

                string approvalDate = txtTransferApprovalDate.Text;
                try {
                    if (approvalDate.Length > 0)
                    {
                        DateTime tmpApprovalDate = Convert.ToDateTime(approvalDate);
                    }
                }
                catch {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Please enter valid Transferee Approval Date: mm/dd/yyyy.");
                    throw (warn);
                }

                string  tmpPaidPricePerAcre = txtTransferPricePerAcre.Text;
                decimal pricePerAcre        = 0;
                try {
                    pricePerAcre = Convert.ToDecimal(tmpPaidPricePerAcre);
                }
                catch {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Please enter a valid number for the Transferee Price Per Acre.");
                    throw (warn);
                }

                string  tmpPctCrop = txtTransferToPctCrop.Text;
                decimal PctCrop    = 0;
                try {
                    PctCrop = Convert.ToDecimal(tmpPctCrop);
                }
                catch {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Please enter a valid number for the Transferee % of Crop.");
                    throw (warn);
                }

                string shareTransferTimeStamp = "";
                string userName       = Common.AppHelper.GetIdentityName();
                string contractNumber = "";

                int    toSHID    = 0;
                string tmpToSHID = txtToSHID.Text;
                if (Common.CodeLib.IsValidSHID(tmpToSHID))
                {
                    toSHID = Convert.ToInt32(tmpToSHID);
                }
                else
                {
                    Common.CWarning warn = new Common.CWarning("Please enter a valid Transferee SHID and make sure you're seeing the correct Business Name.");
                    throw (warn);
                }

                int    fromSHID    = 0;
                string tmpFromSHID = txtFromSHID.Text;
                if (Common.CodeLib.IsValidSHID(tmpFromSHID))
                {
                    fromSHID = Convert.ToInt32(tmpFromSHID);
                }
                else
                {
                    Common.CWarning warn = new Common.CWarning("Please enter a valid Transferor SHID and make sure you're seeing the correct Business Name.");
                    throw (warn);
                }

                int fromFactoryNumber = 0;
                try {
                    fromFactoryNumber = Convert.ToInt32(MyFromFactoryNumber);
                }
                catch {
                    Common.CException warn = new WSCIEMP.Common.CException("Cannot determine the Transferor factory: " + lblFromFactory.Text);
                    throw (warn);
                }
                int toFactoryNumber = 0;
                try {
                    toFactoryNumber = Convert.ToInt32(MyToFactoryNumber);
                }
                catch {
                    Common.CException warn = new WSCIEMP.Common.CException("Cannot determine the Transferee factory: " + lblToFactory.Text);
                    throw (warn);
                }

                BeetDataMember.ShareTransferSave(shareTransferID, contractNumber, cropYear, transferNumber, fromSHID,
                                                 fromFactoryNumber, fromRetainPct, toSHID, toRetainPct, toFactoryNumber, shares, transferDate,
                                                 isFeePaid, approvalDate, pricePerAcre, PctCrop, shareTransferTimeStamp, userName);

                int toMemberID = Convert.ToInt32(MyToMemberID);

                ResetTransferEdit();
                FillGridFromSummary(Convert.ToInt32(MyFromMemberID), cropYear);
                FillGridToSummary(toMemberID, cropYear);
                FillTransferGrid(toMemberID, cropYear);
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }