protected void Page_Load(object sender, EventArgs e)
        {
            const string METHOD_NAME = "Page_Load";

            Common.AppHelper.HideWarning((HtmlGenericControl)Master.FindControl("divWarning"));
            ((HarvestReportTemplate)Master).LocPDF = "";

            ((HarvestReportTemplate)Master).PrintReady += new CommandEventHandler(DoPrintReady);

            try {

                // Hide Master page Crop Year control
                DropDownList ddlMasterCropYear = (DropDownList)((HarvestReportTemplate)Master).FindControl("ddlCropYear");
                ddlMasterCropYear.CssClass = "DisplayOff";

                HtmlGenericControl lblMasterCropYear = (HtmlGenericControl)((HarvestReportTemplate)Master).FindControl("lblCropYear");
                lblMasterCropYear.Attributes.Add("class", "DisplayOff");

                if (!Page.IsPostBack) {
                    radCalYear.Checked = true;
                    WSCField.FillCropYear(ddlYear, DateTime.Now.Year.ToString());

                    // Only allow years from 2010 forward.
                    for (int i = ddlYear.Items.Count - 1; i >= 0; i--) {
                        if (Convert.ToInt32(ddlYear.Items[i].Value) < 2010) {
                            ddlYear.Items.Remove(ddlYear.Items[i]);
                        }
                    }
                }
                _shs = Globals.ShsData;
            }
            catch (System.Exception ex) {

                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                if (Common.AppHelper.IsDebugBuild()) {
                    Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), wex);
                } else {
                    Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "Unable to load page correctly at this time.", wex);
                    Common.AppHelper.LogException(wex, HttpContext.Current);
                }
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            const string METHOD_NAME = "Page_Load";

            try {

                Common.AppHelper.HideWarning((HtmlGenericControl)Master.FindControl("divWarning"));
                _shs = Globals.ShsData;

                HtmlGenericControl body = (HtmlGenericControl)this.Master.FindControl("MasterBody");
                body.Attributes.Add("onload", "DoOnLoad();");

                locPDF.Text = "";
                ShowHideFrames();

                if (!Page.IsPostBack) {

                    FillCropYear();
                    FindAddress(_shs.SHID);
                    InitShareholder();

                    if (MemberID > 0) {

                        FillFieldGrid();
                        FillFieldLabResults();
                        FillOtherLabResults();

                    } else {

                        Common.CWarning warn = new Common.CWarning("Please enter a valid SHID and press the Find button.");
                        throw (warn);
                    }
                }

                _busName = lblBusName.Text;
                if (ddlCropYear.SelectedIndex != -1) {
                    CropYear = Convert.ToInt32(ddlCropYear.SelectedValue);
                }
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            const string METHOD_NAME = "Page_Load";

            try {

                Common.AppHelper.HideWarning((HtmlGenericControl)Master.FindControl("divWarning"));
                _shs = Globals.ShsData;

                if (Globals.IsUserPermissionReadOnly((RolePrincipal)User)) {
                    btnChange.Enabled = false;
                }

                if (!Common.CodeLib.IsValidSHID(txtSHID.Text)) {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Please enter a valid SHID and press the Find button.");
                    throw (warn);
                }

                if (!Page.IsPostBack) {
                    FillCropYear();
                    FindAddress(_shs.SHID.ToString());
                }
            }
            catch (System.Exception ex) {

                ResetShareholder();
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            const string METHOD_NAME = "Page_Load";

            try {

                Common.AppHelper.HideWarning((HtmlGenericControl)Master.FindControl("divWarning"));
                Common.AppHelper.HideWarning(lblEmail);
                Common.AppHelper.HideWarning(lblFax);

                _shs = Globals.ShsData;

                if (Globals.IsUserPermissionReadOnly((RolePrincipal)User)) {
                    btnSave.Enabled = false;
                }

                if (!Page.IsPostBack) {

                    FillCropYear();

                    if (_shs.SHID != 0) {

                        FindAddress(_shs.SHID.ToString());

                        if (txtEmail.Text.Length == 0) {
                            lblEmail.CssClass = "WarningOn";
                            lblEmail.Text = "* Missing *";
                        } else {
                            lblEmail.CssClass = "WarningOff";
                            lblEmail.Text = "";
                        }

                        if (txtFax.Text.Length == 0) {
                            lblFax.CssClass = "WarningOn";
                            lblFax.Text = "* Missing *";
                        } else {
                            lblFax.CssClass = "WarningOff";
                            lblFax.Text = "";
                        }

                        string sendRptOption = null;
                        WSCMember.GetSendRptOption(MemberID, ref sendRptOption);
                        SetSendRptOption(sendRptOption);

                    } else {
                        Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "Please enter a SHID and press the Find button.");
                    }
                } else {
                    CropYear = Convert.ToInt32(Common.UILib.GetDropDownText(ddlCropYear));
                }
            }
            catch (System.Exception ex) {

                ResetShareholder();
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
        protected void btnPrint_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnPrint_Click";

            try {

                ArrayList shidList = new ArrayList(1);
                _shs = Globals.ShsData;
                shidList.Add(SHID);

                WSCSecurity auth = Globals.SecurityState;
                string logoUrl = Page.MapPath(WSCReportsExec.GetReportLogo());
                string pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string fileName = auth.UserID + "_" + "Shareholder Summary".Replace(" ", "");

                if (grdRegionArea.SelectedIndex != -1) {

                    string regionCode = grdRegionArea.SelectedRow.Cells[1].Text;
                    string regionName = grdRegionArea.SelectedRow.Cells[3].Text;
                    string areaCode = grdRegionArea.SelectedRow.Cells[2].Text;
                    string areaName = grdRegionArea.SelectedRow.Cells[4].Text;
                    string growerPerformanceID = grdRegionArea.SelectedRow.Cells[0].Text;

                    string busName = _busName;

                    // pro-actively refresh the manually crafted table before we make the call to generate the PDF.
                    FillContractPerfGrid();

                    string locpdf = WSCReports.rptShareholderSummary.ReportPackager( CropYear, shidList, busName,
                        growerPerformanceID, regionCode, areaCode, regionName, areaName, auth.UserName, fileName, logoUrl, pdfTempFolder);

                    if (locpdf.Length > 0) {
                        // convert file system path to virtual path
                        locpdf = locpdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                    }

                    locPDF.Text = locpdf;

                } else {
                    Common.CWarning warn = new Common.CWarning("Please select a Region / Area from the top grid, or use the Print All button.");
                }

            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            const string METHOD_NAME = "Page_Load";
            Common.AppHelper.HideWarning((HtmlGenericControl)Master.FindControl("divWarning"));

            try {

                _shs = Globals.ShsData;

                if (!Page.IsPostBack) {

                    FillCropYear();
                    lblQCPayment.Text = "$0.0000";
                }
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }