Example #1
0
        private void FillForm()
        {
            const string METHOD_NAME = "FillForm";

            try {
                ClearForm();

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

                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                    using (SqlDataReader dr = WSCAdmin.PassthroughAllGetByYear(conn, cropYear)) {
                        if (dr.Read())
                        {
                            int iFiscalYear   = dr.GetOrdinal("pssaFiscalYearEndDate");
                            int iPercentApply = dr.GetOrdinal("pssaPercentageToApply");
                            int iRatePerTon   = dr.GetOrdinal("pssaRatePerTon");
                            int iReportDate   = dr.GetOrdinal("pssaReportDate");
                            int iTaxYear      = dr.GetOrdinal("pssaTaxYear");

                            // Copy values into form
                            txtFiscalYearEndDate.Text = dr.GetString(iFiscalYear);
                            txtPercentageToApply.Text = dr.GetDecimal(iPercentApply).ToString("N3");
                            txtRatePerTon.Text        = dr.GetDecimal(iRatePerTon).ToString("N6");
                            txtReportDate.Text        = dr.GetString(iReportDate);
                            Common.UILib.SelectDropDown(ddlTaxYear, dr.GetInt32(iTaxYear).ToString());
                        }
                    }
                }
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
        private void FillForm()
        {
            const string METHOD_NAME = "FillForm";

            try {
                ClearForm();

                int cropYear = Convert.ToInt32(((MasterReportTemplate)Master).CropYear);

                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                    using (SqlDataReader dr = WSCAdmin.PassthroughAllGetByYear(conn, cropYear)) {
                        if (dr.Read())
                        {
                            int iFiscalYear   = dr.GetOrdinal("pssaFiscalYearEndDate");
                            int iPercentApply = dr.GetOrdinal("pssaPercentageToApply");
                            int iRatePerTon   = dr.GetOrdinal("pssaRatePerTon");
                            int iReportDate   = dr.GetOrdinal("pssaReportDate");
                            int iTaxYear      = dr.GetOrdinal("pssaTaxYear");

                            // Copy values into form
                            txtCropYear.Text          = cropYear.ToString();
                            txtFiscalYearEndDate.Text = dr.GetString(iFiscalYear);
                            txtPctToApply.Text        = dr.GetDecimal(iPercentApply).ToString("N3");
                            txtRatePerTon.Text        = dr.GetDecimal(iRatePerTon).ToString("N6");
                            txtReportDate.Text        = dr.GetString(iReportDate);
                            txtTaxYear.Text           = dr.GetInt32(iTaxYear).ToString();
                        }
                        else
                        {
                            Common.CWarning warn = new Common.CWarning(@"Before Printing you *MUST* set Coop values in Ag Admin\Passthrough Management for Crop Year "
                                                                       + cropYear.ToString());
                            throw(warn);
                        }
                    }
                }
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wex);
            }
        }