Ejemplo n.º 1
0
 private string TranslatedText(string label)
 {
     if (objSvcInfo == null)
        objSvcInfo = (ServiceInfo)Session["serviceInfo"];
        objPopPresenter = new PopupPresenter(this);
        objPopPresenter.getTranslatedText(label, objSvcInfo.Culture);
        return strTransText;
 }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
              //  btnsave.Attributes.Add("onclick", "javascript:closePopup();");

                //ScriptManager.RegisterStartupScript(this, typeof(string),"focus", "self.focus();", true);
                if (HttpContext.Current.Request.QueryString.Count != 0)
                {
                    setControlText();
                    objAdvancedOptionInfo = new AdvancedOptionInfo();
                    objSeriesInfo = SeriesInfo.getSeriesInfoObject;

                    objAdvancedOptionInfo.Series = HttpContext.Current.Request.QueryString["series"];
                    objAdvancedOptionInfo.Serie = HttpContext.Current.Request.QueryString["serie"];
                    if (!IsPostBack)
                    {
                        objPopPresenter = new PopupPresenter(this);
                        objPopPresenter.GetAdvancedOptions(objAdvancedOptionInfo.Series, objAdvancedOptionInfo.Serie);

                        if (al[0][1] != "")
                        {
                            string[] AggFunctions = al[0][1].Split(',');
                            foreach (string Aggregation in AggFunctions)
                            {
                                if (Aggregation.Trim() != "")
                                    ddlAggregationFunction.Items.Add(newItem(Aggregation, Aggregation));
                            }
                            ddlAggregationFunction.DataBind();
                        }
                        else
                        {
                            lblAggregationFunction.Attributes.Add("class","hide");
                            ddlAggregationFunction.CssClass = "hide";
                        }
                        if (al[1][1].ToString() != "")
                        {
                            if (al[1][1].Trim().ToLower() == "true")
                            {
                                cbAccumulate.Checked = true;
                            }
                        }
                        else
                        {
                            lblAccumulate.Attributes.Add("class", "hide");
                            cbAccumulate.CssClass = "hide";
                        }

                        if (al[2][1].ToString() != "0" && (al[2][1].ToString() != ""))
                        {
                            int Year = Int32.Parse(al[2][1]);
                            int currYear = DateTime.Now.Year;
                            ddlYear.Items.Add("");
                            for (int i = currYear; i >= Year; i--)
                            {
                                ddlYear.Items.Add(i.ToString());
                            }
                            ddlYear.DataBind();
                        }
                        else
                        {
                            lblYearCompare.Attributes.Add("class", "hide");
                            ddlYear.CssClass = "hide";
                        }

                        if (al[3][1] != "")
                        {
                            string[] Trends = al[3][1].Split(',');
                            ddlTrends.Items.Add("");
                            foreach (string trend in Trends)
                            {
                                ddlTrends.Items.Add(newItem(trend, trend));
                            }
                            ddlTrends.DataBind();
                        }
                        else
                        {
                            ddlTrends.CssClass = "hide";
                            lblTrends.Attributes.Add("class", "hide");
                            ddlTrends.Visible = false;
                            lblTrends.Visible = false;
                        }

                        if (al[4][1] != "")
                        {
                            if (al[4][1].Trim().ToLower() != "true")
                            {
                                cbAltitude.Enabled = false;
                            }
                        }
                        else
                        {
                            lblAltitude.Attributes.Add("class", "hide");
                            cbAltitude.CssClass = "hide";
                        }

                        if (al.Count == 8)
                        {

                            if (al[5][1] != "")
                            {
                                string[] Methods = al[5][1].Split(',');
                                ddlMethod.Items.Add("");
                                foreach (string Method in Methods)
                                {
                                    ddlMethod.Items.Add(newItem(Method, Method));
                                }
                                ddlMethod.DataBind();
                            }
                            else
                            {
                                ddlMethod.CssClass = "hide";
                                lblMethod.Attributes.Add("class", "hide");
                                ddlMethod.Visible = false;
                                lblMethod.Visible = false;
                            }

                            if (al[6][1] != "")
                            {
                                txtCap.Text = al[6][1].ToString();
                            }
                            else
                            {
                                txtCap.CssClass = "hide";
                                lblCap.Attributes.Add("class", "hide");
                                txtCap.Visible = false;
                                lblCap.Visible = false;
                            }

                            if (al[7][1] != "")
                            {
                                txtBase.Text = al[7][1].ToString();
                            }
                            else
                            {
                                txtBase.CssClass = "hide";
                                lblBase.Attributes.Add("class", "hide");
                                txtBase.Visible = false;
                                lblBase.Visible = false;
                            }
                        }
                        else
                        {
                            ddlMethod.CssClass = "hide";
                            lblMethod.Attributes.Add("class", "hide");
                            ddlMethod.Visible = false;
                            lblMethod.Visible = false;
                            txtCap.CssClass = "hide";
                            lblCap.Attributes.Add("class", "hide");
                            txtCap.Visible = false;
                            lblCap.Visible = false;
                            txtBase.CssClass = "hide";
                            lblBase.Attributes.Add("class", "hide");
                            txtBase.Visible = false;
                            lblBase.Visible = false;
                        }

                        if (objSeriesInfo.SeriesList != null)
                        {
                            foreach (AdvancedOptionInfo obj in objSeriesInfo.SeriesList)
                            {
                                if ((obj.Series == objAdvancedOptionInfo.Series) && (obj.Serie == objAdvancedOptionInfo.Serie))
                                {
                                    if (obj.Aggregation.ToString() != "")
                                    ddlAggregationFunction.SelectedValue = obj.Aggregation.ToString();
                                    if(obj.Accumulate.ToString()!="")
                                    cbAccumulate.Checked = bool.Parse(obj.Accumulate.ToString());
                                    ddlYear.SelectedValue = obj.Year.ToString();
                                    if(obj.Trend.ToString()!="")
                                    ddlTrends.SelectedValue = obj.Trend.ToString();
                                    if (obj.Altitude.ToString() != "")
                                    cbAltitude.Checked = bool.Parse(obj.Altitude.ToString());
                                    if (obj.Method.ToString() != "")
                                        ddlMethod.SelectedValue = obj.Method.ToString();
                                    if (obj.Cap.ToString() != "")
                                        txtCap.Text = obj.Cap.ToString();
                                    if (obj.Base.ToString() != "")
                                        txtBase.Text = obj.Base.ToString();

                                }

                            }
                        }

                    }

                }
            }
            catch (Exception ex)
            {
                AgriCastException currEx = new AgriCastException(objSvcPre.GetServiceDetails(), ex);
                AgriCastLogger.Publish(currEx, AgriCastLogger.LogType.Error);
                HttpContext.Current.Session["ErrorMessage"] = "The page could not be loaded due to the following error: " + ex.Message.ToString();
            }
        }