Пример #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                SelectDateRange.rblRange.SelectedValue = "max";
                SelectDateRange.BindValue();
                DataTable dt = DB.GetDataTable("select QuoteCode,QuoteName from stockdata where Exchange='Economic'");
                BindLookup(ddlSymbol1, dt, 0, lDefault1.Text);
                DataRow dr = dt.NewRow();
                dr[0] = "";
                dr[1] = "N/A";
                dt.Rows.InsertAt(dr, 0);
                BindLookup(ddlSymbol2, dt, 0, "");
                BindLookup(ddlSymbol3, dt, 0, "");
            }

            string Scale = rblScale.SelectedItem.Value;
            string Skin  = Config.DefaultSkin;

            ibChart.ImageUrl = "../Chart.aspx?Provider=DB&Code=" +
                               ddlSymbol1.SelectedValue +
                               "&Over=EXTEND.COMPARE(" + ddlSymbol2.SelectedValue + ");EXTEND.COMPARE(" + ddlSymbol3.SelectedValue + ")" +
                               "&Scale=" + Scale +
                               "&Skin=" + Skin +
                               "&Size=700*500" +
                               "&Start=" + SelectDateRange.Start +
                               "&End=" + SelectDateRange.End +
                               "&Cycle=" + SelectDateRange.Cycle +
                               "&Type=1" +
                               "&His=0" +
                               "&X=" + Tools.ToIntDef(Request.Form[ibChart.ID + ".x"], 0) +
                               "&Y=" + Tools.ToIntDef(Request.Form[ibChart.ID + ".y"], 0);
        }
Пример #2
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here
            if (lOLname != null)
            {
                sOL = lOLname.Text;
            }
            if (lCookieIndi != null)
            {
                sCookieIndi = lCookieIndi.Text;
            }
            if (lCookieOver != null)
            {
                sCookieOver = lCookieOver.Text;
            }

            if (HasExchange && !IsPostBack)
            {
                Utils.BindExchange(ddlExchange);
            }

            SetScript();

            string Overlay   = null;
            string Indicator = null;
            string Skin      = null;
            string Size      = null;
            string Type      = null;
            string Scale     = null;
            string Range     = null;
            string RT        = null;
            string Start     = null;
            string End       = null;
            string Cycle     = null;
            string RType     = null;         //Range Type
            string His       = Request.QueryString["His"];

            if (His != null)
            {
                His = "&His=" + His;
            }

            if (!IsPostBack)
            {
                if (Config.ConvertQueryToCookie)
                {
                    ConvertQueryToCookie();
                }
                else
                {
                    Code = Request.QueryString[Config.SymbolParameterName];
                }

                if (Code == null || Code == "")
                {
                    Code = GetCookie(Config.SymbolParameterName);
                }

                if (tdOverLay.Visible)
                {
                    Overlay = GetCookie(sCookieOver);
                }
                if (tdIndicator.Visible)
                {
                    Indicator = GetCookie(sCookieIndi);
                }
                Skin  = GetCookie("Skin");
                Size  = GetCookie("Size");
                Type  = GetCookie("Type");
                Scale = GetCookie("Scale");
                Range = GetCookie("Range");
                RT    = GetCookie("RT");
                Start = GetCookie("Start");
                if (Start == "")
                {
                    string s = GetCookie("Span");
                    Start = DateTime.Today.AddMonths(-Tools.ToIntDef(s, 6)).ToString("yyyyMMdd");
                }
                //End = GetCookie("End");
                //if (End=="")
                End   = DateTime.Today.AddDays(1).ToString("yyyyMMdd");
                Cycle = GetCookie("Cycle");
                RType = GetCookie("RType");
            }

            if ((Overlay == null || Overlay == "") && tdOverLay.Visible)
            {
                Overlay = GetParam(sOL);
            }
            if ((Indicator == null || Indicator == "") && tdIndicator.Visible)
            {
                Indicator = GetParam("indi");
            }
            if (Skin == null || Skin == "")
            {
                Skin = ddlSkin.SelectedItem.Value;
            }
            if (Size == null || Size == "")
            {
                Size = ddlSize.SelectedItem.Value;
            }
            if (Type == null || Type == "")
            {
                Type = rblType.SelectedItem.Value;
            }
            if (Scale == null || Scale == "")
            {
                Scale = rblScale.SelectedItem.Value;
            }
            if (Range == null || Range == "")
            {
                Range = SelectDateRange.rblRange.SelectedItem.Value;
            }
            if (RT == null || RT == "")
            {
                RT = (cbRealTime.Checked?1:0).ToString();
            }
            if (Start == null || Start == "")
            {
                Start = SelectDateRange.Start;
            }
            if (End == null || End == "")
            {
                End = SelectDateRange.End;
            }
            if (Cycle == null || Cycle == "")
            {
                Cycle = SelectDateRange.Cycle;
            }
            if (RType == null || RType == "")
            {
                RType = SelectDateRange.RType;
            }

            if (Code == null || Code == "")
            {
                Code = PageCode;                  //tbCode.Text;
            }
            else
            {
                PageCode = Code;              //tbCode.Text
            }
            Code = Code.Trim();

            if (ddlSymbol != null && ddlSymbol.Visible && (!IsPostBack || ExchangePostBack))
            {
                DataManagerBase dmb = Utils.GetDefaultDataManager();

                string Exchange = null;
                if (HasExchange)
                {
                    Exchange = ddlExchange.SelectedValue;
                }

                if (ExchangePostBack)
                {
                    Code = Exchange;
                }

                ddlSymbol.DataSource = dmb.GetStockList(Exchange, null, null);
                try
                {
                    ddlSymbol.DataBind();
                }
                catch
                {
                }
            }

            if (Overlay == "" || Overlay == null)
            {
                Overlay = lOver.Text;
            }
            if (Indicator == "" || Indicator == null)
            {
                if (IsPostBack && tdIndicator.Visible)
                {
                    Indicator = "";
                }
                else
                {
                    Indicator = lIndicator.Text;
                }
            }
            if (IsPostBack)
            {
                SetCookie(Config.SymbolParameterName, Code);
                SetCookie(sCookieOver, Overlay);
                SetCookie(sCookieIndi, Indicator);
                SetCookie("Skin", Skin);
                SetCookie("Size", Size);
                SetCookie("Type", Type);
                SetCookie("Scale", Scale);
                SetCookie("Range", Range);
                SetCookie("RT", RT);
                SetCookie("Start", Start);
                SetCookie("End", End);
                SetCookie("Cycle", Cycle);
                SetCookie("RType", RType);
            }
            else
            {
                SetValue(ddlSkin, Skin);
                SetValue(ddlSize, Size);
                SetValue(rblType, Type);
                SetValue(rblScale, Scale);
                SetValue(SelectDateRange.rblRange, Range);

                SelectDateRange.BindValue();
                Start = SelectDateRange.Start;
                End   = SelectDateRange.End;

                cbRealTime.Checked           = RT == "1";
                PageCode                     = Code;
                SelectDateRange.dpStart.Date = DateTime.ParseExact(Start, "yyyyMMdd", null);
                SelectDateRange.dpEnd.Date   = DateTime.ParseExact(End, "yyyyMMdd", null);
                SelectDateRange.RType        = RType;
                SetValue(SelectDateRange.ddlCycle, Cycle);
            }

            cbRealTime.Visible = Config.RealtimeVisible();
            RT = Config.UseRealtime(cbRealTime)?"1":"0";

            if (tdOverLay.Visible)
            {
                CreateLine(Overlay, sOL, ddlOver, tdOverLay, false, Config.MinOverlay);
            }
            if (tdIndicator.Visible)
            {
                CreateLine(Indicator, "indi", ddlIndi, tdIndicator, true, Config.MinIndicator);
            }
            if (HasExchange)
            {
                int i = Code.IndexOf('.');
                if (i > 0)
                {
                    Code = Code.Substring(0, i);
                }
                Code += "." + ddlExchange.SelectedValue;
                SetCookie(Config.SymbolParameterName, Code);
            }
            PageCode         = Code;
            ibChart.ImageUrl =
                "~/" + Config.ChartPath + "Chart.aspx?Provider=" + Config.CustomChartDataManager +
                "&Code=" + Server.UrlEncode(Code) +
                "&Type=" + Type +
                "&Scale=" + Scale +
                "&IND=" + Indicator +
                "&OVER=" + Overlay +
                "&Skin=" + Skin +
                "&Size=" + Size +
                "&RT=" + RT +
                "&Start=" + Start +
                "&End=" + End +
                "&Layout=" + Config.LayoutForCustomChart +
                "&Cycle=" + Cycle +
                "&X=" + Tools.ToIntDef(Request.Form[ibChart.ID + ".x"], 0) +
                "&Y=" + Tools.ToIntDef(Request.Form[ibChart.ID + ".y"], 0) + His;
        }
Пример #3
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            ArrayList al = new ArrayList();

            foreach (Control c in Controls[1].Controls)
            {
                if (c is DropDownList)
                {
                    al.Add(c);
                }
            }

            if (!IsPostBack)
            {
                SelectDateRange.rblRange.SelectedValue = "max";
                SelectDateRange.BindValue();

                DataTable       dt;
                DataManagerBase dmb = Utils.GetDataManager(Config.DefaultDataManager);
                if (lSymbols != null && lSymbols.Text != "")
                {
                    dt = dmb.GetStockList("", "NoRealtime_" + lSymbols.Text, null);
                }
                else
                {
                    dt = dmb.GetStockList("Economic", null, null);
                }

                //DataTable dt = DB.GetDataTable("select QuoteCode,QuoteName from StockData where Exchange='Economic'");
                BindLookup(ddlSymbol1, dt, 0, lDefault1.Text);
                DataRow dr = dt.NewRow();
                dr[0] = "";
                dr[1] = "N/A";
                dt.Rows.InsertAt(dr, 0);

                foreach (DropDownList ddl in al)
                {
                    if (ddl != ddlSymbol1)
                    {
                        BindLookup(ddl, dt, 0, "");
                    }
                }
                //BindLookup(ddlSymbol2,dt,0,"");
                //BindLookup(ddlSymbol3,dt,0,"");
            }

            string Scale = rblScale.SelectedItem.Value;
            string Skin  = Config.DefaultSkin;

            string Comp = "";

            foreach (DropDownList ddl in al)
            {
                if (ddl != ddlSymbol1)
                {
                    string s = ddl.SelectedValue;
                    if (s != "" && s != null)
                    {
                        Comp += "COMPARE(" + s + ");";
                    }
                }
            }

            ibChart.ImageUrl = "../Chart.aspx?Provider=DB&Code=" +
                               ddlSymbol1.SelectedValue +
                               "&Over=" + Comp.TrimEnd(';') +// COMPARE("+ddlSymbol2.SelectedValue+");COMPARE("+ddlSymbol3.SelectedValue+")"+
                               "&Scale=" + Scale +
                               "&Skin=" + Skin +
                               "&Size=700*500" +
                               "&Start=" + SelectDateRange.Start +
                               "&End=" + SelectDateRange.End +
                               "&Cycle=" + SelectDateRange.Cycle +
                               "&Type=Line" +
                               "&His=0" +
                               "&X=" + Tools.ToIntDef(Request.Form[ibChart.ID + ".x"], 0) +
                               "&Y=" + Tools.ToIntDef(Request.Form[ibChart.ID + ".y"], 0);
        }