Пример #1
0
        protected void btnIndFind_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnIndFind_Click";

            try
            {
                Common.AppHelper.HideWarning(indWarning);

                IndividualsListBox.Items.Clear();

                string searchTerm = IndName.Text.TrimEnd();

                if (searchTerm.Length > 0)
                {
                    if (!searchTerm.Contains("*"))
                    {
                        searchTerm = "%" + searchTerm + "%";
                    }
                    else
                    {
                        searchTerm = searchTerm.Replace("*", "%");
                    }
                }

                List <Individual> indList = PACData.GetPACIndividuals(0, searchTerm);
                IndividualsListBox.DataSource = indList;
                IndividualsListBox.DataBind();
            }
            catch (System.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);
            }
        }
Пример #2
0
        protected void btnIndAdd_Click(object sender, EventArgs e)
        {
            pacMessages.InnerText = "";
            int userId = 0;

            if (newIndividualName != null && newIndividualName.Text.Length > 1)
            {
                var i = new Individual
                {
                    IndividualID = 0,
                    FullName     = newIndividualName.Text,
                    Email        = newIndividualEmail.Text,
                    SHID         = Convert.ToInt32(txtSHID.Text)
                };
                userId = PACData.SaveIndividual(i);
                if (userId > 0)
                {
                    Individual user = PACData.GetPACIndividuals(userId, null)[0];
                    if (user != null)
                    {
                        this.IndTable.Add(user);
                        ReBuildTable();
                        UpdatePACDetails.Update();
                        CloseAndResolve("PACIndividuals");
                    }
                }
            }
        }
Пример #3
0
        // Signer Search

        protected void btnIndAdd_Click(object sender, EventArgs e)
        {
            pacMessages.InnerText = "";

            if (newIndividualName != null && newIndividualName.Text.Length > 1)
            {
                int userId = PACData.SaveIndividual(new Individual(0, newIndividualName.Text));
                if (userId > 0)
                {
                    Individual user = PACData.GetPACIndividuals(userId, null)[0];
                    if (user != null)
                    {
                        this.IndTable.Add(user);
                        ReBuildTable();
                        UpdatePACDetails.Update();
                        CloseAndResolve("PACIndividuals");
                    }
                }
            }
        }
Пример #4
0
        private void ReBuildTable()
        {
            const string METHOD_NAME = "ReBuildTable";

            try
            {
                int    crop_year = Convert.ToInt16(ddlCropYear.Text);
                string shid      = txtSHID.Text;

                List <Contract> contractList = BeetDataContract.GetContracts(shid, crop_year, 0);

                if (contractList != null && contractList.Count > 0)
                {
                    TableHeaderRow headerRow = new TableHeaderRow();

                    TableHeaderCell h1 = new TableHeaderCell();
                    h1.Text = "Contract No";
                    headerRow.Cells.Add(h1);

                    TableHeaderCell h2 = new TableHeaderCell();
                    h2.Text = "PAC Dues";
                    headerRow.Cells.Add(h2);

                    contractTable.Rows.Add(headerRow);

                    for (int i = 0; i < contractList.Count; i++)
                    {
                        TableRow row = new TableRow();

                        TableCell cell1 = new TableCell();
                        cell1.Text = Convert.ToString(contractList[i].contractNo);
                        row.Cells.Add(cell1);

                        TableCell cell2 = new TableCell();
                        cell2.Text = Convert.ToString(contractList[i].pacDues);
                        row.Cells.Add(cell2);

                        contractTable.Rows.Add(row);
                    }
                }

                if (IndTable.Count > 0)
                {
                    TableHeaderRow headerRow = new TableHeaderRow();

                    TableHeaderCell hshid = new TableHeaderCell();
                    hshid.Text = "SHID";
                    headerRow.Cells.Add(hshid);

                    TableHeaderCell h1 = new TableHeaderCell();
                    h1.Text = "Sort";
                    headerRow.Cells.Add(h1);

                    TableHeaderCell h2 = new TableHeaderCell();
                    h2.Text = "Individual";
                    headerRow.Cells.Add(h2);

                    TableHeaderCell hEmail = new TableHeaderCell();
                    hEmail.Text = "Email";
                    headerRow.Cells.Add(hEmail);

                    TableHeaderCell h3 = new TableHeaderCell();
                    h3.Text = "Individual Id";
                    h3.Attributes.Add("style", "display: none");
                    headerRow.Cells.Add(h3);

                    TableHeaderCell h4 = new TableHeaderCell();
                    h4.Text = "Percent";
                    headerRow.Cells.Add(h4);

                    TableHeaderCell h5 = new TableHeaderCell();
                    h5.Text = "Signature Date";
                    headerRow.Cells.Add(h5);

                    TableHeaderCell h6 = new TableHeaderCell();
                    h6.Text = "Remove";
                    headerRow.Cells.Add(h6);

                    indTable.Rows.Add(headerRow);

                    for (int i = 0; i < this.IndTable.Count; i++)
                    {
                        var ind = PACData.GetPACIndividuals(this.IndTable[i].IndividualID, null)[0];

                        TableRow row = new TableRow();

                        TableCell cellshid = new TableCell();
                        cellshid.Text = GetShid(ind.SHID.ToString());
                        row.Cells.Add(cellshid);

                        TableCell cell1 = new TableCell();
                        TextBox   Sort  = new TextBox();
                        Sort.ID        = "Sort_" + i;
                        Sort.Width     = 15;
                        Sort.MaxLength = 1;
                        Sort.Attributes.Add("runat", "server");
                        Sort.Attributes.Add("class", "sort");
                        Sort.Text = Convert.ToString(this.IndTable[i].Sort).Trim();
                        cell1.Controls.Add(Sort);
                        row.Cells.Add(cell1);

                        TableCell cell2 = new TableCell();
                        cell2.Text  = ind.FullName;
                        cell2.Width = 150;
                        row.Cells.Add(cell2);

                        TableCell cellEmail = new TableCell();
                        cellEmail.Text  = ind.Email;
                        cellEmail.Width = 150;
                        row.Cells.Add(cellEmail);

                        TableCell       cell3 = new TableCell();
                        HtmlInputHidden IndId = new HtmlInputHidden();
                        IndId.ID    = "IndividualID_" + i;
                        IndId.Value = Convert.ToString(this.IndTable[i].IndividualID);
                        IndId.Attributes.Add("class", "individualid");
                        cell3.Controls.Add(IndId);
                        cell3.Attributes.Add("style", "display: none");
                        row.Cells.Add(cell3);

                        TableCell cell4      = new TableCell();
                        TextBox   Percentage = new TextBox();
                        Percentage.ID        = "Percentage_" + i;
                        Percentage.Width     = 25;
                        Percentage.MaxLength = 5;
                        Percentage.Attributes.Add("runat", "server");
                        Percentage.Attributes.Add("class", "percentage");
                        Percentage.Text = Convert.ToString(this.IndTable[i].Percentage);
                        cell4.Controls.Add(Percentage);
                        row.Cells.Add(cell4);

                        /*
                         * TableCell cell4 = new TableCell();
                         * HtmlInputCheckBox Signed = new HtmlInputCheckBox();
                         * Signed.ID = "Signed_" + i;
                         * Signed.Checked = this.IndTable[i].Signed;
                         * Signed.Attributes.Add("runat", "server");
                         * Signed.Attributes.Add("class", "signed");
                         * cell4.Controls.Add(Signed);
                         * row.Cells.Add(cell4);
                         */

                        TableCell     cell5      = new TableCell();
                        HtmlInputText SignedDate = new HtmlInputText();
                        SignedDate.ID   = "SignedDate_" + i;
                        SignedDate.Size = 10;
                        if (this.IndTable[i].Signed)
                        {
                            SignedDate.Value = this.IndTable[i].SignedDate.ToString("MM/dd/yyyy");
                        }
                        SignedDate.Attributes.Add("class", "signedDate");
                        SignedDate.Attributes.Add("onclick", "JavaScript:LaunchDatePicker(this);");
                        cell5.Controls.Add(SignedDate);
                        row.Cells.Add(cell5);

                        TableCell cell6 = new TableCell();
                        cell6.Attributes.Add("style", "text-align: center;");
                        HtmlAnchor anchor = new HtmlAnchor();
                        anchor.HRef      = "javascript:void(0);";
                        anchor.InnerText = "X";
                        anchor.Attributes.Add("onclick", "DeleteIndRow(this);");
                        cell6.Controls.Add(anchor);
                        row.Cells.Add(cell6);

                        indTable.Rows.Add(row);
                    }
                }
            }
            catch (Exception ex)
            {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wex);
            }
        }
Пример #5
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());
        }
Пример #6
0
        private void ReBuildTable()
        {
            int    crop_year = Convert.ToInt16(ddlCropYear.Text);
            string shid      = txtSHID.Text;

            List <Contract> contractList = BeetDataContract.GetContracts(shid, crop_year, 0);

            if (contractList != null && contractList.Count > 0)
            {
                TableHeaderRow headerRow = new TableHeaderRow();

                TableHeaderCell h1 = new TableHeaderCell();
                h1.Text = "Contract No";
                headerRow.Cells.Add(h1);

                TableHeaderCell h2 = new TableHeaderCell();
                h2.Text = "PAC Dues";
                headerRow.Cells.Add(h2);

                contractTable.Rows.Add(headerRow);

                for (int i = 0; i < contractList.Count; i++)
                {
                    TableRow row = new TableRow();

                    TableCell cell1 = new TableCell();
                    cell1.Text = Convert.ToString(contractList[i].contractNo);
                    row.Cells.Add(cell1);

                    TableCell cell2 = new TableCell();
                    cell2.Text = Convert.ToString(contractList[i].pacDues);
                    row.Cells.Add(cell2);

                    contractTable.Rows.Add(row);
                }
            }

            if (IndTable.Count > 0)
            {
                TableHeaderRow headerRow = new TableHeaderRow();

                TableHeaderCell hshid = new TableHeaderCell();
                hshid.Text = "SHID";
                headerRow.Cells.Add(hshid);

                TableHeaderCell h1 = new TableHeaderCell();
                h1.Text = "Sort";
                headerRow.Cells.Add(h1);

                TableHeaderCell h2 = new TableHeaderCell();
                h2.Text = "Individual";
                headerRow.Cells.Add(h2);

                TableHeaderCell h3 = new TableHeaderCell();
                h3.Text = "Individual Id";
                h3.Attributes.Add("style", "display: none");
                headerRow.Cells.Add(h3);

                TableHeaderCell h4 = new TableHeaderCell();
                h4.Text = "Assigned Percentage";
                headerRow.Cells.Add(h4);

                TableHeaderCell h5 = new TableHeaderCell();
                h5.Text = "Signature Date";
                headerRow.Cells.Add(h5);

                TableHeaderCell h6 = new TableHeaderCell();
                h6.Text = "Remove";
                headerRow.Cells.Add(h6);

                grdIndividuals.Rows.Add(headerRow);

                for (int i = 0; i < this.IndTable.Count; i++)
                {
                    TableRow row = new TableRow();

                    TableCell cellshid = new TableCell();
                    TextBox   SHID     = new TextBox();
                    SHID.ID        = "SHID_" + i;
                    SHID.Width     = 50;
                    SHID.MaxLength = 6;
                    SHID.Attributes.Add("runat", "server");
                    SHID.Attributes.Add("class", "shid");
                    SHID.Text = Convert.ToString(this.IndTable[i].SHID).Trim();
                    if (SHID.Text == "0")
                    {
                        SHID.Text = this.MySHID;
                    }
                    cellshid.Controls.Add(SHID);
                    row.Cells.Add(cellshid);

                    TableCell cell1 = new TableCell();
                    TextBox   Sort  = new TextBox();
                    Sort.ID        = "Sort_" + i;
                    Sort.Width     = 15;
                    Sort.MaxLength = 1;
                    Sort.Attributes.Add("runat", "server");
                    Sort.Attributes.Add("class", "sort");
                    Sort.Text = Convert.ToString(this.IndTable[i].Sort).Trim();
                    cell1.Controls.Add(Sort);
                    row.Cells.Add(cell1);

                    TableCell cell2 = new TableCell();
                    string    fName = this.IndTable[i].FullName;
                    if (fName == null || fName.Length == 0)
                    {
                        List <Individual> inds = PACData.GetPACIndividuals(this.IndTable[i].IndividualID, null);
                        if (inds != null && inds.Count > 0)
                        {
                            fName = ((Individual)inds[0]).FullName;
                        }
                    }
                    cell2.Text = fName;
                    row.Cells.Add(cell2);

                    TableCell       cell3 = new TableCell();
                    HtmlInputHidden IndId = new HtmlInputHidden();
                    IndId.ID    = "IndividualID_" + i;
                    IndId.Value = Convert.ToString(this.IndTable[i].IndividualID);
                    IndId.Attributes.Add("class", "individualid");
                    cell3.Controls.Add(IndId);
                    cell3.Attributes.Add("style", "display: none");
                    row.Cells.Add(cell3);

                    TableCell cell4      = new TableCell();
                    TextBox   Percentage = new TextBox();
                    Percentage.ID        = "Percentage_" + i;
                    Percentage.Width     = 25;
                    Percentage.MaxLength = 5;
                    Percentage.Attributes.Add("runat", "server");
                    Percentage.Attributes.Add("class", "percentage");
                    Percentage.Text = Convert.ToString(this.IndTable[i].Percentage);
                    cell4.Controls.Add(Percentage);
                    row.Cells.Add(cell4);

                    /*
                     * TableCell cell4 = new TableCell();
                     * HtmlInputCheckBox Signed = new HtmlInputCheckBox();
                     * Signed.ID = "Signed_" + i;
                     * Signed.Checked = this.IndTable[i].Signed;
                     * Signed.Attributes.Add("runat", "server");
                     * Signed.Attributes.Add("class", "signed");
                     * cell4.Controls.Add(Signed);
                     * row.Cells.Add(cell4);
                     */

                    TableCell     cell5      = new TableCell();
                    HtmlInputText SignedDate = new HtmlInputText();
                    SignedDate.ID   = "SignedDate_" + i;
                    SignedDate.Size = 10;
                    if (this.IndTable[i].Signed)
                    {
                        SignedDate.Value = this.IndTable[i].SignedDate.ToString("MM/dd/yyyy");
                    }
                    SignedDate.Attributes.Add("class", "signedDate");
                    SignedDate.Attributes.Add("onclick", "JavaScript:LaunchDatePicker(this);");
                    cell5.Controls.Add(SignedDate);
                    row.Cells.Add(cell5);

                    TableCell cell6 = new TableCell();
                    cell6.Attributes.Add("style", "text-align: center;");
                    HtmlAnchor anchor = new HtmlAnchor();
                    anchor.HRef      = "javascript:void(0);";
                    anchor.InnerText = "X";
                    anchor.Attributes.Add("onclick", "DeleteIndRow(this);");
                    cell6.Controls.Add(anchor);
                    row.Cells.Add(cell6);

                    grdIndividuals.Rows.Add(row);
                }
            }
        }
Пример #7
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());
        }