Exemplo n.º 1
0
        private void LoadPACAgreement(int cropYear, string shid)
        {
            ResetPage();

            txtSHID.Text    = shid;
            lblBusName.Text = txtAddrBName.Text;
            this.MySHID     = shid;

            switch (Convert.ToString(txtAddrType.Value))
            {
            case "1":
                lblAddressType.Text = "Individual";
                break;

            case "2":
                lblAddressType.Text = "Corporation";
                break;

            default:
                lblAddressType.Text = "Other";
                break;
            }

            uplShid.Update();

            PACAgreement pac = PACData.GetPACAgreement(shid.ToString(), cropYear);

            if (pac != null)
            {
                pACContibution.Text = Convert.ToString(pac.Contribution);
                pACDate.Text        = pac.PACDate;
                indTableField.Value = pac.IndividualsString;
                this.IndTable       = pac.Individuals;
            }

            ReBuildTable();
            UpdatePACDetails.Update();
            btnDownloadPACAgreement.Visible = true;
        }
Exemplo n.º 2
0
        // Private

        private void LoadPAC(int crop_year, string shid)
        {
            var METHOD_NAME = "LoadPAC";

            Common.AppHelper.HideWarning(addrWarning);

            ResetPage();

            txtSHID.Text    = shid;
            lblBusName.Text = txtAddrBName.Text;
            this.MySHID     = shid;

            try
            {
                var addresses = BeetDataAddress.AddressGetInfo(Convert.ToInt32(shid), 0, crop_year);


                var addr = addresses[0];



                switch (Convert.ToString(addr.AddressType))
                {
                case "1":
                    lblAddressType.Text = "Individual";
                    break;

                case "2":
                    lblAddressType.Text = "Corporation";
                    break;

                default:
                    lblAddressType.Text = "Other";
                    break;
                }

                uplShid.Update();

                PACAgreement pac = PACData.GetPACAgreement(shid, crop_year);
                if (pac != null)
                {
                    btnDownloadPACAgreement.Enabled = true;
                    pACContibution.Text             = Convert.ToString(pac.Contribution);
                    pACDate.Text = pac.PACDate;

                    if (pac.Individuals.Count == 0)
                    {
                        pac.Individuals.Add(CreateAndFetchIndividual(crop_year, shid));
                    }
                    indTableField.Value = pac.IndividualsString;
                    this.IndTable       = pac.Individuals;
                }
                else
                {
                    btnDownloadPACAgreement.Enabled = false;
                    IndTable.Add(CreateAndFetchIndividual(crop_year, shid));
                }
                UpdatePACDetails.Visible = true;
                ReBuildTable();
                UpdatePACDetails.Update();
            }
            catch (Exception ex)
            {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex, "Unable to load page correctly at this time.", indWarning);
                pacMessages.InnerHtml = "<font style='color: red;'>Invalid SHID / Crop Year</font>";
                //pacMessages.InnerHtml = ex.Message + "<br />" + ex.StackTrace;
                UpdatePACDetails.Visible = false;
                return;
            }
        }
Exemplo n.º 3
0
        // PAC Form

        protected void btnDownloadPACAgreement_Click(object server, EventArgs e)
        {
            var METHOD_NAME = "btnDownloadPACAgreement_Click";
            var qs          = new NameValueCollection();

            if (lblAddressType.Text == "Corporation")
            {
                pacMessages.InnerText = "";

                string searchTerm = txtSHID.Text.Trim();
                int    searchType = 1;
                int    cropYear   = Convert.ToInt16(ddlCropYear.Text);
                List <ListAddressItem> addrList = BeetDataAddress.AddressFindByTerm(searchTerm, cropYear, searchType);
                var address = new StringBuilder();
                address.AppendFormat("{0}, {1}, {2}, {3}", addrList[0].AdrLine1, addrList[0].AdrLine2, addrList[0].CityName, addrList[0].StateName);
                var phone = addrList[0].PhoneNo ?? "";

                var pac             = PACData.GetPACAgreement(txtSHID.Text, Convert.ToInt16(ddlCropYear.Text));
                var inds            = PACData.GetPACIndividuals(pac.Individuals[0].IndividualID, null);
                var i               = new Individual();
                var signerFirstName = inds[0].FullName.Split(" ".ToCharArray())[0];
                var signerLastName  = inds[0].FullName.Split(" ".ToCharArray())[1];

                var date         = DateTime.Now;
                var mfi          = new DateTimeFormatInfo();
                var strMonthName = mfi.GetMonthName(date.Month).ToString();

                qs.Add("Filename", "PACDuesCorp");
                qs.Add("CORPORATION NAME", Server.UrlEncode(lblBusName.Text));
                qs.Add("CorporationName", Server.UrlEncode(lblBusName.Text));
                qs.Add("LastNameFirstName", signerLastName + ", " + signerFirstName);
                //qs.Add("Dated", DateTime.Now.ToString("MM/dd/yyyy"));
                qs.Add("CentsPerTonDevlivered", pACContibution.Text);
                qs.Add("TwoDigitCents", (pACContibution.Text.Length == 1) ? "0" + pACContibution.Text : pACContibution.Text);
                qs.Add("Address", address.ToString());
                qs.Add("PHONE", phone);
                qs.Add("Text1", DateTime.Now.Year.ToString());
                qs.Add("Year2", DateTime.Now.Year.ToString());

                try
                {
                    qs.Add("Individual1", (PACData.GetPACIndividuals(pac.Individuals[0].IndividualID, null)[0].FullName));
                    qs.Add("IndividualPercentage1", pac.Individuals[0].Percentage.ToString());
                    qs.Add("Individual2", (PACData.GetPACIndividuals(pac.Individuals[1].IndividualID, null)[0].FullName));
                    qs.Add("IndividualPercentage2", pac.Individuals[1].Percentage.ToString());
                    qs.Add("Individual3", (PACData.GetPACIndividuals(pac.Individuals[2].IndividualID, null)[0].FullName));
                    qs.Add("IndividualPercentage3", pac.Individuals[2].Percentage.ToString());
                    qs.Add("Individual4", (PACData.GetPACIndividuals(pac.Individuals[3].IndividualID, null)[0].FullName));
                    qs.Add("IndividualPercentage4", pac.Individuals[3].Percentage.ToString());
                }
                catch (Exception ex)
                {
                    Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                    ((PrimaryTemplate)Page.Master).ShowWarning(ex, "Unable to load page correctly at this time.", indWarning);
                }
            }
            else
            {
                var pac  = PACData.GetPACAgreement(txtSHID.Text, Convert.ToInt16(ddlCropYear.Text));
                var inds = PACData.GetPACIndividuals(pac.Individuals[0].IndividualID, null);
                var i    = new Individual();

                var date         = DateTime.Now;
                var mfi          = new DateTimeFormatInfo();
                var strMonthName = mfi.GetMonthName(date.Month).ToString();

                var ds             = WSCContract.GetContracts(txtSHID.Text, 2014, ConfigurationManager.ConnectionStrings["BeetConn"].ToString());
                var strContractIds = "";
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    strContractIds += dr[0] + ", ";
                }
                if (strContractIds.Length > 2)
                {
                    strContractIds = strContractIds.Substring(0, strContractIds.Length - 2);
                }

                qs.Add("Filename", "PACDuesNonCorp");
                qs.Add("CurrentTwoDigitYear", date.ToString("yy"));
                qs.Add("CurrentDayMonth", mfi.GetMonthName(date.Month).ToString() + " " + date.Day);
                qs.Add("SumOfMoneyPerTon", pACContibution.Text);
                qs.Add("CropYear1", DateTime.Now.Year.ToString());
                qs.Add("SomeBullshit", DateTime.Now.Year.ToString());
                qs.Add("PrintShareholderName", ((Individual)inds[0]).FullName);
                qs.Add("ContractNumber1", strContractIds);
            }

            Response.Redirect("~/Downloads/Downloader.aspx" + qs.ToQueryString());
        }
Exemplo n.º 4
0
        protected void btnDownloadPACAgreement_Click(object server, EventArgs e)
        {
            var qs = new NameValueCollection();

            if (lblAddressType.Text == "Corporation")
            {
                pacMessages.InnerText = "";

                string searchTerm = txtSHID.Text.Trim();
                int    searchType = 1;
                int    cropYear   = Convert.ToInt16(ddlCropYear.Text);
                List <ListAddressItem> addrList = BeetDataAddress.AddressFindByTerm(searchTerm, cropYear, searchType);
                var address = new StringBuilder();
                address.AppendFormat("{0}, {1}, {2}, {3}", addrList[0].AdrLine1, addrList[0].AdrLine2, addrList[0].CityName, addrList[0].StateName);
                var phone = addrList[0].PhoneNo ?? "";

                var pac             = PACData.GetPACAgreement(txtSHID.Text, Convert.ToInt16(ddlCropYear.Text));
                var inds            = PACData.GetPACIndividuals(pac.Individuals[0].IndividualID, null);
                var i               = new Individual();
                var signerFirstName = inds[0].FullName.Split(" ".ToCharArray())[0];
                var signerLastName  = inds[0].FullName.Split(" ".ToCharArray())[1];

                var date         = DateTime.Now;
                var mfi          = new DateTimeFormatInfo();
                var strMonthName = mfi.GetMonthName(date.Month).ToString();

                qs.Add("Filename", "PACDuesCorp");
                qs.Add("CORPORATION NAME", Server.UrlEncode(lblBusName.Text));
                qs.Add("CorporationName", Server.UrlEncode(lblBusName.Text));
                qs.Add("LastNameFirstName", signerLastName + ", " + signerFirstName);
                qs.Add("Dated", DateTime.Now.ToString("MM/dd/yyyy"));
                qs.Add("CentsPerTonDevlivered", pACContibution.Text);
                qs.Add("TwoDigitCents", (pACContibution.Text.Length == 1) ? "0" + pACContibution.Text : pACContibution.Text);
                qs.Add("Address", address.ToString());
                qs.Add("PHONE", phone);
                qs.Add("Text1", DateTime.Now.Year.ToString());
                qs.Add("Year2", DateTime.Now.Year.ToString());

                try
                {
                    qs.Add("Individual1", (PACData.GetPACIndividuals(pac.Individuals[0].IndividualID, null)[0].FullName));
                    qs.Add("IndividualPercentage1", pac.Individuals[0].Percentage.ToString());
                    qs.Add("Individual2", (PACData.GetPACIndividuals(pac.Individuals[1].IndividualID, null)[0].FullName));
                    qs.Add("IndividualPercentage2", pac.Individuals[1].Percentage.ToString());
                    qs.Add("Individual3", (PACData.GetPACIndividuals(pac.Individuals[2].IndividualID, null)[0].FullName));
                    qs.Add("IndividualPercentage3", pac.Individuals[2].Percentage.ToString());
                    qs.Add("Individual4", (PACData.GetPACIndividuals(pac.Individuals[3].IndividualID, null)[0].FullName));
                    qs.Add("IndividualPercentage4", pac.Individuals[3].Percentage.ToString());
                }
                catch
                {
                }
            }
            else
            {
                var pac  = PACData.GetPACAgreement(txtSHID.Text, Convert.ToInt16(ddlCropYear.Text));
                var inds = PACData.GetPACIndividuals(pac.Individuals[0].IndividualID, null);
                var i    = new Individual();


                var date         = DateTime.Now;
                var mfi          = new DateTimeFormatInfo();
                var strMonthName = mfi.GetMonthName(date.Month).ToString();

                qs.Add("CurrentTwoDigitYear", date.ToString("yy"));
                qs.Add("CurrentDayMonth", mfi.GetMonthName(date.Month).ToString() + " " + date.Day);
                qs.Add("SumOfMoneyPerTon", pACContibution.Text);
                qs.Add("CropYear1", DateTime.Now.Year.ToString());
                qs.Add("SomeBullshit", DateTime.Now.Year.ToString());
                qs.Add("PrintShareholderName", ((Individual)inds[0]).FullName);
                qs.Add("Filename", "PACDuesNonCorp");
            }

            Response.Redirect("~/Downloads/Downloader.aspx" + qs.ToQueryString());
        }