Exemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (this.MySHID != null && this.MySHID.Length > 0)
            {
                UpdateIndTable();

                if (pACDate.Text == null || pACDate.Text.Length == 0)
                {
                    pACDate.Text = DateTime.Now.ToString("MM/dd/yyyy");
                }

                if (pACContibution.Text == null || pACContibution.Text.Length == 0)
                {
                    pACContibution.Text = "0";
                }

                if (this.IndTable != null && this.MySHID != null && this.MySHID.Length > 0)
                {
                    PACAgreement pacAgreement = new PACAgreement(this.MySHID, Convert.ToDouble(pACContibution.Text), pACDate.Text, Convert.ToInt16(ddlCropYear.Text), this.IndTable);
                    PACData.SavePACAgreement(pacAgreement);
                }

                btnResolveShid_Click(sender, e);
                pacMessages.InnerText           = "PAC Agreement Saved";
                btnDownloadPACAgreement.Enabled = true;
            }
        }
Exemplo n.º 2
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.º 3
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;
            }
        }