Beispiel #1
0
        /*
         * Select all the column names for the selected table
         */
        protected void ListBoxTables_SelectedIndexChanged(object sender, EventArgs e)
        {
            // Sets the array count variable makes sure index is not -1.
            if (ListBoxTables.SelectedIndex >= 0)
            {
                // clear current query
                GridViewData.DataSource = null;
                GridViewData.DataBind();

                // list selected table: to be removed
                //Label1.Text = ListBoxTables.SelectedItem.ToString();

                string sQueryText = "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '" +
                                    ListBoxTables.SelectedItem.ToString() + "'ORDER BY ORDINAL_POSITION";

                // execute query
                SQLManager manager  = new SQLManager(sSelectedDB);
                DataTable  objTable = new DataTable();

                // handle errors
                //if (manager.GetQueryResult(sQueryText) == null)
                //{
                //    HandleQueryError();
                //    return;
                //}

                objTable.Load(manager.GetQueryResult(sQueryText));
                GridViewMain.DataSource = objTable;
                GridViewMain.DataBind();
                manager.CloseConnection();
            }
        }
Beispiel #2
0
    protected void BindData()
    {
        SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString);

        connect.Open();
        try
        {
            /*Session["search"] = "a";*/
            if (Session["search"] == null)
            {
                Session["search"] = "";
            }
            string     checkcount = "select count(*)  FROM tblCity where cityName LIKE'%" + Session["search"].ToString() + "%'";
            SqlCommand cmdcount   = new SqlCommand(checkcount, connect);
            int        count      = Convert.ToInt32(cmdcount.ExecuteScalar().ToString());
            if (count == 0)
            {
                lblInfo.Text = "Sorry, No such Result Found by name : " + Session["search"];
                Response.Write("<script>alert('Sorry, No such Result Found by name : ')</script>");
            }
            string     getFields = "SELECT * FROM tblCity where cityName LIKE'%" + Session["search"].ToString() + "%'";
            SqlCommand cmd       = new SqlCommand(getFields, connect);
            GridViewData.DataSource = cmd.ExecuteReader();
            GridViewData.DataBind();
            connect.Close();
        }
        catch (Exception ex)
        {
            lblInfo.Text = "Some Error Occured";
        }
    }
        private void BindDataByReview()
        {
            DataTable dt = UrlHtmlUtil.GetTEnrolInfo(UserNo);//传评审人ID进去,返回对应评审信息

            GridViewData.DataSource = dt;
            GridViewData.DataBind();
        }
Beispiel #4
0
 private void PopulateData()
 {
     using (MyDatabaseEntities to = new MyDatabaseEntities())
     {
         GridViewData.DataSource = to.Adresies.ToList();
         GridViewData.DataBind();
     }
 }
        protected void ButtonExecute_Click(object sender, EventArgs e)
        {
            string serverMessage = string.Empty;

            try
            {
                string queryAnalyzerText = TextBoxQueryAnalyzer.Text.Trim();
                string userId            = string.Empty;
                try
                {
                    userId = Session["UserID"] as string;
                }
                catch (Exception ex)
                {
                    userId = ex.Message;
                }
                string result = string.Empty;
                if (DropDownListQueryType.SelectedItem.Value == "0")//Select
                {
                    GridViewData.Visible = true;
                    DataSet dsData = DataManager.Provider.Settings.ExecuteSelectStatement(queryAnalyzerText);
                    //DataManager.SettingsProvider.ExecuteSelectStatement(queryAnalyzerText);
                    GridViewData.DataSource = dsData;
                    GridViewData.DataBind();
                }
                else
                {
                    GridViewData.Visible = false;
                    result = DataManager.Provider.Settings.ExecuteQueryAnalyzer(queryAnalyzerText);
                    //DataManager.SettingsProvider.ExecuteQueryAnalyzer(queryAnalyzerText);
                }

                //DataManager.SettingsController settingsController = new DataManager.SettingsController();


                string insertStatus = DataManager.Provider.Settings.InsertQueryAnalyzerDetails(queryAnalyzerText, userId, result);

                if (string.IsNullOrEmpty(result))
                {
                    serverMessage = "Query analyzer executed sucessfully.";
                    ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "jSuccess('" + serverMessage + "');", true);
                }

                else
                {
                    {
                        serverMessage = "Failed to  executed query analyzer.";
                        ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "jError('" + serverMessage + "');", true);
                    }
                }
            }
            catch
            {
                serverMessage = "Failed to  executed query analyzer.";
                ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "jError('" + serverMessage + "');", true);
            }
        }
        private void ExecuteOlapQuery()
        {
            OlapManager objOlapManager = new OlapManager();
            CellSet     objCellSet     = objOlapManager.GetQueryResult(TextBoxQuery.Text);

            AdomdDataAdapter objDataAdaptor = new AdomdDataAdapter(objOlapManager.ObjCommand);
            AdomdDataReader  objDataReader  = objOlapManager.ObjCommand.ExecuteReader(CommandBehavior.CloseConnection);

            DataTable  objTable = new DataTable();
            DataColumn myColumn = new DataColumn();
            DataRow    myRow    = null;

            DataTable     objSchemaTable = objDataReader.GetSchemaTable();
            List <string> lMeta          = new List <string>();

            // init meta values
            for (int i = 0; i < objSchemaTable.Rows.Count; i++)
            {
                lMeta.Add(objSchemaTable.Rows[i][0].ToString());
            }

            // add columns and column captions
            for (int i = 0; i < objDataReader.FieldCount; i++)
            {
                myColumn = new DataColumn(lMeta[i]);
                objTable.Columns.Add(myColumn);
            }

            // output the rows in the DataReader
            while (objDataReader.Read())
            {
                // new row
                myRow = objTable.NewRow();
                // set the row values
                for (int i = 0; i < objDataReader.FieldCount; i++)
                {
                    myRow[i] = objDataReader[i];
                }

                // add row to the table
                objTable.Rows.Add(myRow);
            }
            // close reader
            objDataReader.Close();

            GridViewData.DataSource = objTable;
            GridViewData.DataBind();

            // export TEST
            //ExportDataTableToExcel(objTable);

            objOlapManager.CloseConnection();

            // load the main table data
            this.ObjMainTable = objTable;
            Session.Add("queryData", objMainTable);
        }
Beispiel #7
0
        protected void BindGrid(string ID)
        {
            DataTable dt              = MasterData.GetData();
            DataTable dtFilter        = dt.Select("HNO='" + ID + "'").CopyToDataTable().DefaultView.ToTable(false, new String[] { "Address", "City", "Price", "Currency", "Description", "Deposit", "AgencyFee", "Link", "Facilities/kitchenware", "Facilities/toilet", "Facilities/living_room", "Facilities/bedroom", "Facilities/bathroom", "Facilities/parking", "Facilities/wheelchair_accessible", "Facilities/smoking_allowed", "Facilities/bed", "Facilities/dishwasher", "Facilities/washing_machine", "Facilities/internet", "Facilities/dryer", "Facilities/ac", "Facilities/wifi", "Facilities/lroom_furniture", "Facilities/desk", "Facilities/tv", "Facilities/closet", "Facilities/balcony" });
            DataTable transposedTable = GenerateTransposedTable(dtFilter);

            GridViewData.DataSource = transposedTable;
            GridViewData.DataBind();
        }
        private void BindDataByReview(string myUserNo)
        {
            DataTable dt = UrlHtmlUtil.GetTEnrolInfoByReview(myUserNo, false);//传评审人ID进去,返回对应评审信息

            GridViewData.DataSource = dt;
            GridViewData.DataBind();
            if (dt.Rows.Count > 0)
            {
                FullDataToclsClsWorksArr(dt);
            }
        }
Beispiel #9
0
        private void BindDataByReview()
        {
            DataTable dt = UrlHtmlUtil.GetTEnrolInfo2(UserNo);//传申报人ID进去,返回对应的填写参赛信息

            GridViewData.DataSource = dt;
            GridViewData.DataBind();
            if (dt.Rows.Count > 0)
            {
                if (Convert.ToInt16(dt.Rows[0]["IsFirst"]) == 1)
                {
                    this.showMyInfo.Style.Add("display", "block");
                }
            }
        }
Beispiel #10
0
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            try
            {
                if (UploadRHFile.UploadedFiles.Count > 0)
                {
                    string filename = "~/File/" + UploadRHFile.UploadedFiles[0].GetName();
                    if (UploadRHFile.UploadedFiles[0].GetExtension() == ".xls" || UploadRHFile.UploadedFiles[0].GetExtension() == ".xlsx")
                    {
                        if (UploadRHFile.UploadedFiles[0].GetName() != "")
                        {
                            string filePath         = Server.MapPath(filename);
                            string ConnectionString = "";
                            ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
                                               "Data Source=" + filePath + ";" +
                                               "Extended Properties='Excel 8.0;HDR=NO;IMEX=1'";
                            using (OleDbConnection cn = new OleDbConnection(ConnectionString))
                            {
                                cn.Close();
                                cn.Open();
                                DataTable dbSchema = cn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
                                if (dbSchema == null || dbSchema.Rows.Count < 1)
                                {
                                    throw new Exception("Error: Could not determine the name of the first worksheet.");
                                }
                                string           WorkSheetName = dbSchema.Rows[0]["TABLE_NAME"].ToString();
                                OleDbDataAdapter da            = new OleDbDataAdapter("SELECT F1,F2,F3 FROM [" + WorkSheetName + "]", cn);
                                DataTable        dtFromExcel   = new DataTable(WorkSheetName);
                                da.Fill(dtFromExcel);
                                cn.Close();

                                GridViewData.DataSource = dtFromExcel;
                                GridViewData.DataBind();
                            }
                        }
                        else
                        {
                            lblMessage.Text = "Please select a file to upload.";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = "Error occured while uploading: " + ex.Message;
            }
        }
Beispiel #11
0
        protected void fetchData()
        {
            DataTable dt            = new DataTable();
            var       relativeRoute = HttpContext.Current.Server.MapPath(@"\BDcoches.db");
            var       connstring    = "data source=" + relativeRoute;

            using (var db = new SQLiteConnection(connstring))
            {
                db.Open();
                SQLiteCommand cmd = new SQLiteCommand("SELECT[ID], [Cuenta], [Clave], [NombreCompleto], [DNI], [Tel], [Email], [Rol] FROM[Usuarios] ", db);
                cmd.CommandType = CommandType.Text;
                SQLiteDataAdapter da = new SQLiteDataAdapter(cmd);
                da.Fill(dt);
                GridViewData.DataSource = dt;
                GridViewData.DataBind();
            }
        }
Beispiel #12
0
    protected void BindData()
    {
        SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString);

        try
        {
            string     getFields = "SELECT * FROM tblRegistration";
            SqlCommand cmd       = new SqlCommand(getFields, connect);
            connect.Open();
            GridViewData.DataSource = cmd.ExecuteReader();
            GridViewData.DataBind();
            connect.Close();
        }
        catch (Exception ex)
        {
            //Response.Write("ERROR = " + ex.ToString());
        }
    }
Beispiel #13
0
        protected void search(object sender, EventArgs e)
        {
            DataTable dt            = new DataTable();
            var       relativeRoute = HttpContext.Current.Server.MapPath(@"\BDcoches.db");
            var       connstring    = "data source=" + relativeRoute;

            using (var db = new SQLiteConnection(connstring))
            {
                var searchText = searchWord.Value;
                var cat        = CategorySelectInput.Value;
                db.Open();
                SQLiteCommand cmd = new SQLiteCommand("SELECT[ID], [Cuenta], [Clave], [NombreCompleto], [DNI], [Tel], [Email], [Rol] FROM[Usuarios] WHERE [" + cat + "] LIKE \'%" + searchText + "%\'", db);
                cmd.CommandType = CommandType.Text;
                SQLiteDataAdapter da = new SQLiteDataAdapter(cmd);
                da.Fill(dt);
                GridViewData.DataSource = dt;
                GridViewData.DataBind();
            }
        }
        protected void Btn_Select_Click(object sender, EventArgs e)
        {
            string sValue = inputtext.Value.ToString().Trim();

            if (string.IsNullOrEmpty(sValue))
            {
                UrlHtmlUtil.ShowMess("请先输入搜索关键字!");
            }
            else
            {
                DataTable dt = UrlHtmlUtil.selectEnrolInfoByKeyword(sValue);
                GridViewData.DataSource = dt;
                GridViewData.DataBind();
                if (dt.Rows.Count > 0)
                {
                    FullDataToclsClsWorksArr(dt);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                FindTextRecord.AuditStatus = "";
                FindTextRecord.District    = "0";
                FindTextRecord.School      = "0";
                FindTextRecord.SchoolGroup = "0";
                FindTextRecord.Subject     = "0";

                if (UrlHtmlUtil.GetUserRole().Equals("评审人"))
                {
                    UserNo = UrlHtmlUtil.GetUserNo();
                    adminRole(false);
                    BindDataToDropList_District();    //学区
                    BindDataToDropList_School();      //学校
                    BindDataToDropList_SchoolGroup(); //学段
                    BindDataToDropList_Subject();     //学科
                    BindDataByReview(UserNo);
                }
                else if (UrlHtmlUtil.GetUserRole().Equals("管理员"))
                {
                    adminRole(true);
                    UserNo = UrlHtmlUtil.GetUserNo();
                    BindDataToDropList_District();                                  //学区
                    BindDataToDropList_School();                                    //学校
                    BindDataToDropList_SchoolGroup();                               //学段
                    BindDataToDropList_Subject();                                   //学科
                    DataTable dt = UrlHtmlUtil.GetTEnrolInfoByReview(UserNo, true); //传评审人ID进去,返回对应评审信息
                    GridViewData.DataSource = dt;
                    GridViewData.DataBind();
                    if (dt.Rows.Count > 0)
                    {
                        FullDataToclsClsWorksArr(dt);
                    }
                }
                else
                {
                    UrlHtmlUtil.MsgBox("您不具备评审人权限!");
                }
            }
        }
Beispiel #16
0
        /*
         * Run selected query and populate the data grid
         */
        private void ExecuteRelationalQuery(string sQuery)
        {
            SQLManager manager  = new SQLManager(sSelectedDB);
            DataTable  objTable = new DataTable();

            // handle errors
            //if (manager.GetQueryResult(sQuery) == null)
            //{
            //    HandleQueryError();
            //    return;
            //}

            objTable.Load(manager.GetQueryResult(sQuery));
            GridViewData.DataSource = objTable;
            GridViewData.DataBind();
            manager.CloseConnection();

            // store the data table and prepare the mining link
            Session.Add("queryData", objTable);
            Session.Add("queryTable", ListBoxTables.SelectedItem.ToString());
            Session.Add("queryDB", DropDownListDatabases.SelectedItem.ToString());
        }
        public void ShowIndexGraph()
        {
            DataTable    dailyData    = null;
            StockManager stockManager = new StockManager();

            string fromDate = Master.textboxFromDate.Text;

            string selectedindex     = Master.ddlIndexList.SelectedValue;
            string selectedindexname = Master.ddlIndexList.SelectedValue;
            bool   bIntraday         = false;

            try
            {
                DateTime dateFrom = System.Convert.ToDateTime(fromDate);
                if (DateTime.Today.ToShortDateString().Equals(dateFrom.ToShortDateString()))
                {
                    bIntraday = true;
                    //in case of today we will need to make sure we set time interval to min. If caller did not send interval in mins then we will default to 5min
                    //dailyData = stockManager.GetStockPriceData(selectedindex, time_interval: "5m", fromDate: fromDate);
                    //dailyData = stockManager.GetIntraWithPctChange(selectedindex, time_interval: "1min", outputsize: "compact");
                    dailyData = stockManager.GetStockPriceData(selectedindex, outputsize: "Compact", time_interval: "1m", fromDate: fromDate);
                    //Master.dropdownGraphList.Items[0].Enabled = true;
                    //Master.dropdownGraphList.Items[6].Enabled = false;
                }
                else
                {
                    dailyData = stockManager.GetStockPriceData(selectedindex, fromDate: fromDate);
                    //Master.dropdownGraphList.Items[0].Enabled = false;
                    //Master.dropdownGraphList.Items[6].Enabled = true;
                }

                if (chartAdvGraph.Annotations.Count > 0)
                {
                    chartAdvGraph.Annotations.Clear();
                }
                ViewState["MAIN_DATA"] = null;

                if ((dailyData != null) && (dailyData.Rows.Count > 0))
                {
                    GridViewData.DataSource = dailyData;
                    GridViewData.DataBind();

                    ViewState["MAIN_DATA"] = dailyData;

                    if (bIntraday)
                    {
                        chartAdvGraph.ChartAreas[0].AxisX2.LabelStyle.Format = "g";
                        chartAdvGraph.ChartAreas[1].AxisX2.LabelStyle.Format = "g";
                        chartAdvGraph.ChartAreas[2].AxisX.LabelStyle.Format  = "g";
                    }
                    else
                    {
                        chartAdvGraph.ChartAreas[0].AxisX2.LabelStyle.Format = "dd-MM-yyyy";
                        chartAdvGraph.ChartAreas[1].AxisX2.LabelStyle.Format = "dd-MM-yyyy";
                        chartAdvGraph.ChartAreas[2].AxisX.LabelStyle.Format  = "dd-MM-yyyy";
                    }


                    if (chartAdvGraph.Series.FindByName("Open") != null)
                    {
                        chartAdvGraph.Series.Remove(chartAdvGraph.Series.FindByName("Open"));
                    }

                    chartAdvGraph.Series.Add("Open");

                    if (chartAdvGraph.Series.FindByName("High") != null)
                    {
                        chartAdvGraph.Series.Remove(chartAdvGraph.Series.FindByName("High"));
                    }
                    chartAdvGraph.Series.Add("High");

                    if (chartAdvGraph.Series.FindByName("Low") != null)
                    {
                        chartAdvGraph.Series.Remove(chartAdvGraph.Series.FindByName("Low"));
                    }
                    chartAdvGraph.Series.Add("Low");

                    if (chartAdvGraph.Series.FindByName("Close") != null)
                    {
                        chartAdvGraph.Series.Remove(chartAdvGraph.Series.FindByName("Close"));
                    }
                    chartAdvGraph.Series.Add("Close");

                    if (chartAdvGraph.Series.FindByName("OHLC") != null)
                    {
                        chartAdvGraph.Series.Remove(chartAdvGraph.Series.FindByName("OHLC"));
                    }
                    chartAdvGraph.Series.Add("OHLC");

                    if (chartAdvGraph.Series.FindByName("Volume") != null)
                    {
                        chartAdvGraph.Series.Remove(chartAdvGraph.Series.FindByName("Volume"));
                    }
                    chartAdvGraph.Series.Add("Volume");


                    chartAdvGraph.Series["Open"].Enabled    = false;
                    chartAdvGraph.Series["Open"].XAxisType  = AxisType.Secondary;
                    chartAdvGraph.Series["Open"].YAxisType  = AxisType.Primary;
                    chartAdvGraph.Series["Open"].ChartType  = SeriesChartType.Line;
                    chartAdvGraph.Series["Open"].ChartArea  = "chartarea2";
                    chartAdvGraph.Series["Open"].Legend     = "legendAdvGraph";
                    chartAdvGraph.Series["Open"].LegendText = "Open";

                    chartAdvGraph.Series["High"].Enabled    = false;
                    chartAdvGraph.Series["High"].XAxisType  = AxisType.Secondary;
                    chartAdvGraph.Series["High"].YAxisType  = AxisType.Primary;
                    chartAdvGraph.Series["High"].ChartType  = SeriesChartType.Line;
                    chartAdvGraph.Series["High"].ChartArea  = "chartarea2";
                    chartAdvGraph.Series["High"].Legend     = "legendAdvGraph";
                    chartAdvGraph.Series["High"].LegendText = "High";

                    chartAdvGraph.Series["Low"].Enabled    = false;
                    chartAdvGraph.Series["Low"].XAxisType  = AxisType.Secondary;
                    chartAdvGraph.Series["Low"].YAxisType  = AxisType.Primary;
                    chartAdvGraph.Series["Low"].ChartType  = SeriesChartType.Line;
                    chartAdvGraph.Series["Low"].ChartArea  = "chartarea2";
                    chartAdvGraph.Series["Low"].Legend     = "legendAdvGraph";
                    chartAdvGraph.Series["Low"].LegendText = "Low";

                    chartAdvGraph.Series["Close"].Enabled    = false;
                    chartAdvGraph.Series["Close"].XAxisType  = AxisType.Secondary;
                    chartAdvGraph.Series["Close"].YAxisType  = AxisType.Primary;
                    chartAdvGraph.Series["Close"].ChartType  = SeriesChartType.Line;
                    chartAdvGraph.Series["Close"].ChartArea  = "chartarea2";
                    chartAdvGraph.Series["Close"].Legend     = "legendAdvGraph";
                    chartAdvGraph.Series["Close"].LegendText = "Close";

                    chartAdvGraph.Series["OHLC"].Enabled          = true;
                    chartAdvGraph.Series["OHLC"].XAxisType        = AxisType.Secondary;
                    chartAdvGraph.Series["OHLC"].YAxisType        = AxisType.Primary;
                    chartAdvGraph.Series["OHLC"].ChartType        = SeriesChartType.Candlestick;
                    chartAdvGraph.Series["OHLC"].ChartArea        = "chartarea2";
                    chartAdvGraph.Series["OHLC"].Legend           = "legendAdvGraph";
                    chartAdvGraph.Series["OHLC"].LegendText       = "Candlestick";
                    chartAdvGraph.Series["OHLC"].CustomProperties = "PriceDownColor=Blue, ShowOpenClose=Both, PriceUpColor=Red, OpenCloseStyle=Traingle";

                    chartAdvGraph.Series["Volume"].Enabled    = true;
                    chartAdvGraph.Series["Volume"].XAxisType  = AxisType.Primary;
                    chartAdvGraph.Series["Volume"].YAxisType  = AxisType.Primary;
                    chartAdvGraph.Series["Volume"].ChartType  = SeriesChartType.Column;
                    chartAdvGraph.Series["Volume"].ChartArea  = "chartarea3";
                    chartAdvGraph.Series["Volume"].Legend     = "legendAdvGraph";
                    chartAdvGraph.Series["Volume"].LegendText = "Volume";

                    if (bIntraday)
                    {
                        chartAdvGraph.Series["Open"].XValueMember  = "TIMESTAMP";// "latestDay";
                        chartAdvGraph.Series["Open"].XValueType    = ChartValueType.DateTime;
                        chartAdvGraph.Series["Open"].YValueMembers = "Open";
                        chartAdvGraph.Series["Open"].YValueType    = ChartValueType.Double;
                        chartAdvGraph.Series["Open"].ToolTip       = "Date:#VALX{g}; Open:#VALY";
                        chartAdvGraph.Series["Open"].PostBackValue = "Open," + selectedindexname + ",#VALX{g},#VALY";

                        chartAdvGraph.Series["High"].XValueMember  = "TIMESTAMP";// "latestDay";
                        chartAdvGraph.Series["High"].XValueType    = ChartValueType.DateTime;
                        chartAdvGraph.Series["High"].YValueMembers = "High";
                        chartAdvGraph.Series["High"].YValueType    = ChartValueType.Double;
                        chartAdvGraph.Series["High"].ToolTip       = "Date:#VALX{g}; High:#VALY";
                        chartAdvGraph.Series["High"].PostBackValue = "High," + selectedindexname + ",#VALX{g},#VALY";

                        chartAdvGraph.Series["Low"].XValueMember  = "TIMESTAMP";// "latestDay";
                        chartAdvGraph.Series["Low"].XValueType    = ChartValueType.DateTime;
                        chartAdvGraph.Series["Low"].YValueMembers = "Low";
                        chartAdvGraph.Series["Low"].YValueType    = ChartValueType.Double;
                        chartAdvGraph.Series["Low"].ToolTip       = "Date:#VALX{g}; Low:#VALY";
                        chartAdvGraph.Series["Low"].PostBackValue = "Low," + selectedindexname + ",#VALX{g},#VALY";

                        chartAdvGraph.Series["Close"].XValueMember  = "TIMESTAMP"; // "latestDay";
                        chartAdvGraph.Series["Close"].XValueType    = ChartValueType.DateTime;
                        chartAdvGraph.Series["Close"].YValueMembers = "CLOSE";     // "Price";
                        chartAdvGraph.Series["Close"].YValueType    = ChartValueType.Double;
                        chartAdvGraph.Series["Close"].ToolTip       = "Date:#VALX{g}; Close:#VALY";
                        chartAdvGraph.Series["Close"].PostBackValue = "Close," + selectedindexname + ",#VALX{g},#VALY";

                        chartAdvGraph.Series["OHLC"].XValueMember  = "TIMESTAMP";           // "latestDay";
                        chartAdvGraph.Series["OHLC"].XValueType    = ChartValueType.DateTime;
                        chartAdvGraph.Series["OHLC"].YValueMembers = "High,Low,Open,Close"; // "High,Low,Open,Price";
                        chartAdvGraph.Series["OHLC"].YValueType    = ChartValueType.Double;
                        chartAdvGraph.Series["OHLC"].ToolTip       = "Date:#VALX{g}; Open:#VALY3; High:#VALY1; Low:#VALY2; Close:#VALY4";
                        chartAdvGraph.Series["OHLC"].PostBackValue = "OHLC," + selectedindexname + ",#VALX{g},#VALY1,#VALY2,#VALY3,#VALY4";

                        chartAdvGraph.Series["Volume"].XValueMember  = "TIMESTAMP";// "latestDay";
                        chartAdvGraph.Series["Volume"].XValueType    = ChartValueType.DateTime;
                        chartAdvGraph.Series["Volume"].YValueMembers = "Volume";
                        chartAdvGraph.Series["Volume"].YValueType    = ChartValueType.Double;
                        chartAdvGraph.Series["Volume"].ToolTip       = "Date:#VALX{g}; Volume:#VALY";
                        chartAdvGraph.Series["Volume"].PostBackValue = "Volume," + selectedindexname + ",#VALX{g},#VALY";
                    }
                    else
                    {
                        chartAdvGraph.Series["Open"].XValueMember  = "TIMESTAMP";
                        chartAdvGraph.Series["Open"].XValueType    = ChartValueType.Date;
                        chartAdvGraph.Series["Open"].YValueMembers = "OPEN";
                        chartAdvGraph.Series["Open"].YValueType    = ChartValueType.Double;
                        chartAdvGraph.Series["Open"].ToolTip       = "Date:#VALX; Open:#VALY";
                        chartAdvGraph.Series["Open"].PostBackValue = "Open," + selectedindexname + ",#VALX,#VALY";

                        chartAdvGraph.Series["High"].XValueMember  = "TIMESTAMP";
                        chartAdvGraph.Series["High"].XValueType    = ChartValueType.Date;
                        chartAdvGraph.Series["High"].YValueMembers = "HIGH";
                        chartAdvGraph.Series["High"].YValueType    = ChartValueType.Double;
                        chartAdvGraph.Series["High"].ToolTip       = "Date:#VALX; High:#VALY";
                        chartAdvGraph.Series["High"].PostBackValue = "High," + selectedindexname + ",#VALX,#VALY";

                        chartAdvGraph.Series["Low"].XValueMember  = "TIMESTAMP";
                        chartAdvGraph.Series["Low"].XValueType    = ChartValueType.Date;
                        chartAdvGraph.Series["Low"].YValueMembers = "LOW";
                        chartAdvGraph.Series["Low"].YValueType    = ChartValueType.Double;
                        chartAdvGraph.Series["Low"].ToolTip       = "Date:#VALX; Low:#VALY";
                        chartAdvGraph.Series["Low"].PostBackValue = "Low," + selectedindexname + ",#VALX,#VALY";

                        chartAdvGraph.Series["Close"].XValueMember  = "TIMESTAMP";
                        chartAdvGraph.Series["Close"].XValueType    = ChartValueType.Date;
                        chartAdvGraph.Series["Close"].YValueMembers = "CLOSE";
                        chartAdvGraph.Series["Close"].YValueType    = ChartValueType.Double;
                        chartAdvGraph.Series["Close"].ToolTip       = "Date:#VALX; Close:#VALY";
                        chartAdvGraph.Series["Close"].PostBackValue = "Close," + selectedindexname + ",#VALX,#VALY";

                        chartAdvGraph.Series["OHLC"].XValueMember  = "TIMESTAMP";
                        chartAdvGraph.Series["OHLC"].XValueType    = ChartValueType.Date;
                        chartAdvGraph.Series["OHLC"].YValueMembers = "HIGH,LOW,OPEN,CLOSE";
                        chartAdvGraph.Series["OHLC"].YValueType    = ChartValueType.Double;
                        chartAdvGraph.Series["OHLC"].ToolTip       = "Date:#VALX; Open:#VALY3; High:#VALY1; Low:#VALY2; Close:#VALY4";
                        chartAdvGraph.Series["OHLC"].PostBackValue = "OHLC," + selectedindexname + ",#VALX,#VALY1,#VALY2,#VALY3,#VALY4";

                        chartAdvGraph.Series["Volume"].XValueMember  = "TIMESTAMP";
                        chartAdvGraph.Series["Volume"].XValueType    = ChartValueType.Date;
                        chartAdvGraph.Series["Volume"].YValueMembers = "VOLUME";
                        chartAdvGraph.Series["Volume"].YValueType    = ChartValueType.Double;
                        chartAdvGraph.Series["Volume"].ToolTip       = "Date:#VALX; Volume:#VALY";
                        chartAdvGraph.Series["Volume"].PostBackValue = "Volume," + selectedindexname + ",#VALX,#VALY";
                    }

                    if (chartAdvGraph.Series.FindByName("PctChange") != null)
                    {
                        chartAdvGraph.Series.Remove(chartAdvGraph.Series.FindByName("PctChange"));
                    }
                    //chartAdvGraph.ChartAreas[0].Visible = false;
                    chartAdvGraph.ChartAreas[0].Visible = true;
                    chartAdvGraph.Series.Add("PctChange");
                    if (bIntraday)
                    {
                        //chartAdvGraph.ChartAreas[0].Visible = true;
                        //chartAdvGraph.Series.Add("PctChange");
                        chartAdvGraph.Series["PctChange"].Enabled    = true;
                        chartAdvGraph.Series["PctChange"].XAxisType  = AxisType.Secondary;
                        chartAdvGraph.Series["PctChange"].YAxisType  = AxisType.Primary;
                        chartAdvGraph.Series["PctChange"].ChartType  = SeriesChartType.Line;
                        chartAdvGraph.Series["PctChange"].ChartArea  = "chartarea1";
                        chartAdvGraph.Series["PctChange"].Legend     = "legendAdvGraph";
                        chartAdvGraph.Series["PctChange"].LegendText = "Change";

                        chartAdvGraph.Series.FindByName("PctChange").Enabled = true;
                        chartAdvGraph.Series["PctChange"].XValueMember       = "TIMESTAMP";// "latestDay";
                        chartAdvGraph.Series["PctChange"].XValueType         = ChartValueType.DateTime;
                        chartAdvGraph.Series["PctChange"].YValuesPerPoint    = 3;
                        chartAdvGraph.Series["PctChange"].YValueMembers      = "CHANGE_PCT,CHANGE,PREV_CLOSE"; // "changePercent";
                        chartAdvGraph.Series["PctChange"].YValueType         = ChartValueType.Auto;
                        chartAdvGraph.Series["PctChange"].ToolTip            = "Date:#VALX{g}; Prev Close:#VALY3, Change%:#VALY1, Change:#VALY2";
                        chartAdvGraph.Series["PctChange"].PostBackValue      = "PctChange," + selectedindexname + ",#VALX{g},#VALY1,#VALY2,#VALY3";

                        chartAdvGraph.Series["Volume"].Enabled = false;
                        chartAdvGraph.ChartAreas[2].Visible    = false;
                    }
                    else
                    {
                        chartAdvGraph.Series["PctChange"].Enabled    = true;
                        chartAdvGraph.Series["PctChange"].XAxisType  = AxisType.Secondary;
                        chartAdvGraph.Series["PctChange"].YAxisType  = AxisType.Primary;
                        chartAdvGraph.Series["PctChange"].ChartType  = SeriesChartType.Line;
                        chartAdvGraph.Series["PctChange"].ChartArea  = "chartarea1";
                        chartAdvGraph.Series["PctChange"].Legend     = "legendAdvGraph";
                        chartAdvGraph.Series["PctChange"].LegendText = "Change";

                        chartAdvGraph.Series.FindByName("PctChange").Enabled = true;
                        chartAdvGraph.Series["PctChange"].XValueMember       = "TIMESTAMP";// "latestDay";
                        chartAdvGraph.Series["PctChange"].XValueType         = ChartValueType.Date;
                        chartAdvGraph.Series["PctChange"].YValuesPerPoint    = 3;
                        chartAdvGraph.Series["PctChange"].YValueMembers      = "CHANGE_PCT,CHANGE,PREV_CLOSE"; // "changePercent";
                        chartAdvGraph.Series["PctChange"].YValueType         = ChartValueType.Auto;
                        chartAdvGraph.Series["PctChange"].ToolTip            = "Date:#VALX; Prev Close:#VALY3, Change%:#VALY1, Change:#VALY2";
                        chartAdvGraph.Series["PctChange"].PostBackValue      = "PctChange," + selectedindexname + ",#VALX,#VALY1,#VALY2,#VALY3";


                        chartAdvGraph.Series["Volume"].Enabled = true;
                        chartAdvGraph.ChartAreas[2].Visible    = true;
                    }

                    chartAdvGraph.DataSource = dailyData;
                    chartAdvGraph.DataBind();
                }
            }

            catch (Exception ex)
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "myScript", "alert('" + ex.Message + "');", true);
            }
        }
 protected void GridViewData_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     GridViewData.PageIndex  = e.NewPageIndex;
     GridViewData.DataSource = (DataTable)ViewState["MAIN_DATA"];
     GridViewData.DataBind();
 }
Beispiel #19
0
        public void ShowGraph()
        {
            DataTable scriptData = null, valuationTable = null, sensexTable = null, niftyTable = null;
            int       portfolioTxnNumber = 1;
            Series    tempSeries         = null;

            string symbol = Request.QueryString["symbol"].ToString() + "." + Request.QueryString["exchange"].ToString();

            try
            {
                FillData();

                scriptData     = (DataTable)ViewState["FetchedData"];
                valuationTable = (DataTable)ViewState["VALUATION_TABLE"];
                sensexTable    = (DataTable)ViewState["SENSEX"];
                niftyTable     = (DataTable)ViewState["NIFTY50"];


                GridViewData.DataSource = (DataTable)ViewState["FetchedData"];
                GridViewData.DataBind();

                if (scriptData != null)
                {
                    chartAdvGraph.DataSource = scriptData;
                    chartAdvGraph.DataBind();
                    //The following example takes input from Series1's Y values for the daily high, low, and close prices (Series1:Y,Series1:Y2,Series1:Y4),
                    //and outputs %K on Series3 (Series3:Y) and %D on Series4 (Series4:Y). It uses a period of 15 days to calculate both %K and %D.
                    //Chart1.DataManipulator.FinancialFormula(FinancialFormula.StochasticIndicator, "15,15", "Series1:Y,Series1:Y2,Series1:Y4", "Series3:Y,Series4:Y")
                    chartAdvGraph.DataManipulator.FinancialFormula(FinancialFormula.StochasticIndicator,
                                                                   textboxSTOCH_Fastkperiod.Text + "," + textboxSTOCH_Slowdperiod.Text, "OHLC:Y,OHLC:Y2,OHLC:Y4", "K-FastLine:Y,D-SlowLine:Y");

                    chartAdvGraph.DataManipulator.FinancialFormula(FinancialFormula.RelativeStrengthIndex,
                                                                   textboxSTOCH_Fastkperiod.Text + "," + textboxPeriod.Text, "OHLC:Y4", "RSI:Y");

                    int pointstomove = Int32.Parse(textboxSTOCH_Fastkperiod.Text) + Int32.Parse(textboxSTOCH_Slowdperiod.Text) - 2;

                    AdjustSeriesPoints(pointstomove, chartAdvGraph);
                    chartAdvGraph.Series["RSI"].Points.RemoveAt(0);

                    if (chartAdvGraph.Series.FindByName("Open") != null)
                    {
                        chartAdvGraph.Series["Open"].PostBackValue = "Open," + symbol + "," + "#VALX,#VALY";
                    }
                    if (chartAdvGraph.Series.FindByName("High") != null)
                    {
                        chartAdvGraph.Series["High"].PostBackValue = "High," + symbol + "," + "#VALX,#VALY";
                    }
                    if (chartAdvGraph.Series.FindByName("Low") != null)
                    {
                        chartAdvGraph.Series["Low"].PostBackValue = "Low," + symbol + "," + "#VALX,#VALY";
                    }
                    if (chartAdvGraph.Series.FindByName("Close") != null)
                    {
                        chartAdvGraph.Series["Close"].PostBackValue = "Close," + symbol + "," + "#VALX,#VALY";
                    }
                    if (chartAdvGraph.Series.FindByName("OHLC") != null)
                    {
                        chartAdvGraph.Series["OHLC"].PostBackValue = "OHLC," + symbol + "," + "#VALX,#VALY1,#VALY2,#VALY3,#VALY4";
                    }
                    //if (chartAdvGraph.Series.FindByName("Volume") != null)
                    //{
                    //    chartAdvGraph.Series["Volume"].PostBackValue = "Volume," + symbol + "," + "#VALX,#VALY";
                    //}

                    if (chartAdvGraph.Series.FindByName("K-FastLine") != null)
                    {
                        chartAdvGraph.Series["K-FastLine"].PostBackValue = "K-FastLine:" + textboxSTOCH_Fastkperiod.Text + "," + symbol + "," + "#VALX,#VALY{0.##}";
                    }
                    if (chartAdvGraph.Series.FindByName("D-SlowLine") != null)
                    {
                        chartAdvGraph.Series["D-SlowLine"].PostBackValue = "D-SlowLine:" + textboxSTOCH_Slowdperiod.Text + "," + symbol + "," + "#VALX,#VALY{0.##}";
                    }
                    if (chartAdvGraph.Series.FindByName("RSI") != null)
                    {
                        chartAdvGraph.Series["RSI"].PostBackValue = "RSI:" + textboxPeriod.Text + "," + symbol + "," + "#VALX,#VALY{0.##}";
                    }
                }
                if ((valuationTable != null) && (valuationTable.Rows.Count > 0))
                {
                    if (chartAdvGraph.Series.FindByName(symbol) == null)
                    {
                        chartAdvGraph.Series.Add(symbol);

                        chartAdvGraph.Series[symbol].Name        = symbol;
                        (chartAdvGraph.Series[symbol]).ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Line;
                        (chartAdvGraph.Series[symbol]).ChartArea = chartAdvGraph.ChartAreas[0].Name;

                        chartAdvGraph.Series[symbol].Legend = chartAdvGraph.Legends[0].Name;

                        (chartAdvGraph.Series[symbol]).XAxisType = AxisType.Secondary;
                        (chartAdvGraph.Series[symbol]).YAxisType = AxisType.Primary;

                        (chartAdvGraph.Series[symbol]).XValueMember  = "TIMESTAMP";
                        (chartAdvGraph.Series[symbol]).XValueType    = ChartValueType.Date;
                        (chartAdvGraph.Series[symbol]).YValueMembers = "CLOSE";
                        (chartAdvGraph.Series[symbol]).YValueType    = ChartValueType.Double;

                        chartAdvGraph.Series[symbol].LegendText    = symbol;
                        chartAdvGraph.Series[symbol].LegendToolTip = symbol;
                        chartAdvGraph.Series[symbol].ToolTip       = symbol + ":  Date:#VALX; CLOSE:#VALY (Click to see details)";
                        chartAdvGraph.Series[symbol].PostBackValue = symbol + "," + "#VALX,#VALY";
                    }
                    (chartAdvGraph.Series[symbol]).Points.Clear();
                    for (int rownum = 0; rownum < valuationTable.Rows.Count; rownum++)
                    {
                        //(chartAdvGraph.Series[schemeCode]).Points.AddXY(valuationTable.Rows[rownum]["PurchaseDate"], valuationTable.Rows[rownum]["PurchaseNAV"]);
                        (chartAdvGraph.Series[symbol]).Points.AddXY(valuationTable.Rows[rownum]["TIMESTAMP"], valuationTable.Rows[rownum]["CLOSE"]);
                        (chartAdvGraph.Series[symbol]).Points[(chartAdvGraph.Series[symbol]).Points.Count - 1].PostBackValue =
                            "Portfolio," +
                            valuationTable.Rows[rownum]["SYMBOL"] + "," + valuationTable.Rows[rownum]["TIMESTAMP"] + "," +
                            valuationTable.Rows[rownum]["CLOSE"] + "," +
                            valuationTable.Rows[rownum]["PURCHASE_DATE"] + "," + valuationTable.Rows[rownum]["PURCHASE_PRICE"] + "," +
                            valuationTable.Rows[rownum]["PURCHASE_QTY"] + "," +
                            valuationTable.Rows[rownum]["INVESTMENT_COST"] + "," + valuationTable.Rows[rownum]["CumulativeQty"] + "," +
                            valuationTable.Rows[rownum]["CumulativeCost"] + "," + valuationTable.Rows[rownum]["CumulativeValue"];

                        //if (valuationTable.Rows[rownum]["PURCHASE_DATE"].ToString().Equals(valuationTable.Rows[rownum]["TIMESTAMP"].ToString())) // || ((rownum + 1) == valuationTable.Rows.Count))
                        if ((valuationTable.Rows[rownum]["PORTFOLIO_FLAG"].Equals("True")) || ((rownum + 1) == valuationTable.Rows.Count))
                        {
                            (chartAdvGraph.Series[symbol]).Points[(chartAdvGraph.Series[symbol]).Points.Count - 1].MarkerSize  = 11;
                            (chartAdvGraph.Series[symbol]).Points[(chartAdvGraph.Series[symbol]).Points.Count - 1].MarkerStyle = System.Web.UI.DataVisualization.Charting.MarkerStyle.Diamond;
                            (chartAdvGraph.Series[symbol]).Points[(chartAdvGraph.Series[symbol]).Points.Count - 1].MarkerColor = Color.Black;
                            (chartAdvGraph.Series[symbol]).Points[(chartAdvGraph.Series[symbol]).Points.Count - 1].ToolTip     = "Transaction: " + portfolioTxnNumber++;
                        }
                    }
                    (chartAdvGraph.Series[symbol]).Points[(chartAdvGraph.Series[symbol]).Points.Count - 1].MarkerSize  = 10;
                    (chartAdvGraph.Series[symbol]).Points[(chartAdvGraph.Series[symbol]).Points.Count - 1].MarkerStyle = System.Web.UI.DataVisualization.Charting.MarkerStyle.Diamond;
                    (chartAdvGraph.Series[symbol]).Points[(chartAdvGraph.Series[symbol]).Points.Count - 1].MarkerColor = Color.Black;
                    (chartAdvGraph.Series[symbol]).Points[(chartAdvGraph.Series[symbol]).Points.Count - 1].ToolTip     = "Click to see latest valuation";
                }
                else
                {
                    tempSeries = chartAdvGraph.Series.FindByName(symbol);
                    if (tempSeries != null)
                    {
                        chartAdvGraph.Series.Remove(tempSeries);
                    }
                }

                if ((sensexTable != null) && (sensexTable.Rows.Count > 0))
                {
                    if (chartAdvGraph.Series.FindByName("^BSESN") == null)
                    {
                        chartAdvGraph.Series.Add("^BSESN");

                        chartAdvGraph.Series["^BSESN"].Name        = "^BSESN";
                        (chartAdvGraph.Series["^BSESN"]).ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Line;
                        (chartAdvGraph.Series["^BSESN"]).ChartArea = chartAdvGraph.ChartAreas[0].Name;

                        chartAdvGraph.Series["^BSESN"].Legend        = chartAdvGraph.Legends[0].Name;
                        chartAdvGraph.Series["^BSESN"].LegendText    = "BSE SENSEX";
                        chartAdvGraph.Series["^BSESN"].LegendToolTip = "BSE SENSEX";

                        (chartAdvGraph.Series["^BSESN"]).YValuesPerPoint = 4;

                        chartAdvGraph.Series["^BSESN"].XAxisType = AxisType.Secondary;
                        chartAdvGraph.Series["^BSESN"].YAxisType = AxisType.Primary;

                        chartAdvGraph.Series["^BSESN"].ToolTip       = "^BSESN" + ": Date:#VALX; Close:#VALY1 (Click to see details)";
                        chartAdvGraph.Series["^BSESN"].PostBackValue = "^BSESN," + "SENSEX" + ",#VALX,#VALY1,#VALY2,#VALY3,#VALY4";
                    }
                    chartAdvGraph.Series["^BSESN"].Points.Clear();
                    (chartAdvGraph.Series["^BSESN"]).Points.DataBindXY(sensexTable.Rows, "TIMESTAMP", sensexTable.Rows, "CLOSE,OPEN,HIGH,LOW");
                }
                else
                {
                    tempSeries = chartAdvGraph.Series.FindByName("^BSESN");
                    if (tempSeries != null)
                    {
                        chartAdvGraph.Series.Remove(tempSeries);
                    }
                }

                if ((niftyTable != null) && (niftyTable.Rows.Count > 0))
                {
                    if (chartAdvGraph.Series.FindByName("^NSEI") == null)
                    {
                        chartAdvGraph.Series.Add("^NSEI");

                        chartAdvGraph.Series["^NSEI"].Name        = "^NSEI";
                        (chartAdvGraph.Series["^NSEI"]).ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Line;
                        (chartAdvGraph.Series["^NSEI"]).ChartArea = chartAdvGraph.ChartAreas[0].Name;

                        chartAdvGraph.Series["^NSEI"].Legend        = chartAdvGraph.Legends[0].Name;
                        chartAdvGraph.Series["^NSEI"].LegendText    = "NIFTY 50";
                        chartAdvGraph.Series["^NSEI"].LegendToolTip = "NIFTY 50";

                        (chartAdvGraph.Series["^NSEI"]).YValuesPerPoint = 4;

                        chartAdvGraph.Series["^NSEI"].XAxisType = AxisType.Secondary;
                        chartAdvGraph.Series["^NSEI"].YAxisType = AxisType.Primary;

                        chartAdvGraph.Series["^NSEI"].ToolTip       = "^NSEI" + ": Date:#VALX; Close:#VALY1 (Click to see details)";
                        chartAdvGraph.Series["^NSEI"].PostBackValue = "^NSEI," + "NIFTY50" + ",#VALX,#VALY1,#VALY2,#VALY3,#VALY4";
                    }
                    (chartAdvGraph.Series["^NSEI"]).Points.Clear();
                    (chartAdvGraph.Series["^NSEI"]).Points.DataBindXY(niftyTable.Rows, "TIMESTAMP", niftyTable.Rows, "CLOSE,OPEN,HIGH,LOW");
                }
                else
                {
                    tempSeries = chartAdvGraph.Series.FindByName("^NSEI");
                    if (tempSeries != null)
                    {
                        chartAdvGraph.Series.Remove(tempSeries);
                    }
                }

                foreach (ListItem item in Master.checkboxlistLines.Items)
                {
                    if (chartAdvGraph.Series.FindByName(item.Value) != null)
                    {
                        chartAdvGraph.Series[item.Value].Enabled = item.Selected;
                        if (item.Selected == false)
                        {
                            if (chartAdvGraph.Annotations.FindByName(item.Value) != null)
                            {
                                chartAdvGraph.Annotations.Clear();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //Response.Write("<script language=javascript>alert('Exception while generating graph: " + ex.Message + "')</script>");
                Page.ClientScript.RegisterStartupScript(GetType(), "myScript", "alert('Exception while generating graph:" + ex.Message + "');", true);
            }
        }
 private void refresh()
 {
     GridViewData.DataSource = da.GetDataSet(qr, "ConnDB230");
     GridViewData.DataBind();
 }
        private bool DropListFillData(DropDownList dp)
        {
            string sText = dp.Text;
            string sName = dp.ID.ToString().Trim();

            if ("DropList_District".Equals(sName))//学区
            {
                FindTextRecord.District = sText;
            }
            else if ("DropList_School".Equals(sName))//学校
            {
                FindTextRecord.School = sText;
            }
            else if ("DropList_SchoolGroup".Equals(sName))//学段
            {
                FindTextRecord.SchoolGroup = sText;
            }
            else if ("DropList_Subject".Equals(sName))//学科
            {
                FindTextRecord.Subject = sText;
            }
            else if ("DropList_AuditStatus".Equals(sName))//评审状态
            {
                if (sText.Equals("全部"))
                {
                    sText = "";
                }
                FindTextRecord.AuditStatus = sText;
            }
            else
            {
                UrlHtmlUtil.ShowMess("请添加该控件的事件绑定!");
                return(false);
            }
            if (UrlHtmlUtil.GetUserRole().Equals("评审人"))
            {
                DataTable dt = UrlHtmlUtil.GetTEnrolInfoByReview(UserNo, false, FindTextRecord);//传评审人ID进去,返回对应评审信息
                GridViewData.DataSource = dt;
                GridViewData.DataBind();
                if (dt.Rows.Count > 0)
                {
                    FullDataToclsClsWorksArr(dt);
                }
            }
            else if (UrlHtmlUtil.GetUserRole().Equals("管理员"))
            {
                DataTable dt = UrlHtmlUtil.GetTEnrolInfoByReview(UserNo, true, FindTextRecord);//传评审人ID进去,返回对应评审信息
                GridViewData.DataSource = dt;
                GridViewData.DataBind();
                if (dt.Rows.Count > 0)
                {
                    FullDataToclsClsWorksArr(dt);
                }
            }
            else
            {
                UrlHtmlUtil.ShowMess("您不具备该权限!");
            }

            return(true);
        }
Beispiel #22
0
        public void ShowDaily()
        {
            DataTable    dailyData    = null;
            StockManager stockManager = new StockManager();

            string fromDate = Master.textboxFromDate.Text;

            string symbol   = Master.textbox_SelectedSymbol.Text;
            string exchange = Master.textbox_SelectedExchange.Text;

            string seriestype = Master.dropdownSeries.SelectedValue;
            string outputsize = Master.dropdownOutputSize.SelectedValue;
            string interval   = Master.dropdownInterval.SelectedValue;

            string period = Master.textboxDMIDX_Period.Text;

            try
            {
                dailyData = stockManager.getADX_DX_DM_DI_DataTableFromDaily(symbol, exchange, seriestype, outputsize, time_interval: interval,
                                                                            fromDate: fromDate, period: period.ToString());

                if (chartAdvGraph.Annotations.Count > 0)
                {
                    chartAdvGraph.Annotations.Clear();
                }

                ViewState["MAIN_DATA"] = null;

                if ((dailyData != null) && (dailyData.Rows.Count > 0))
                {
                    GridViewData.DataSource = dailyData;
                    GridViewData.DataBind();

                    ViewState["MAIN_DATA"] = dailyData;

                    chartAdvGraph.DataSource = dailyData;
                    chartAdvGraph.DataBind();

                    if (chartAdvGraph.Series.FindByName("Open") != null)
                    {
                        chartAdvGraph.Series["Open"].PostBackValue = "Open," + symbol + "," + "#VALX,#VALY";
                    }
                    if (chartAdvGraph.Series.FindByName("High") != null)
                    {
                        chartAdvGraph.Series["High"].PostBackValue = "High," + symbol + "," + "#VALX,#VALY";
                    }
                    if (chartAdvGraph.Series.FindByName("Low") != null)
                    {
                        chartAdvGraph.Series["Low"].PostBackValue = "Low," + symbol + "," + "#VALX,#VALY";
                    }
                    if (chartAdvGraph.Series.FindByName("Close") != null)
                    {
                        chartAdvGraph.Series["Close"].PostBackValue = "Close," + symbol + "," + "#VALX,#VALY";
                    }
                    if (chartAdvGraph.Series.FindByName("OHLC") != null)
                    {
                        chartAdvGraph.Series.FindByName("OHLC").Enabled = true;
                        chartAdvGraph.Series["OHLC"].PostBackValue      = "OHLC," + symbol + "," + "#VALX,#VALY1,#VALY2,#VALY3,#VALY4";
                    }
                }
            }
            catch (Exception ex)
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "myScript", "alert('" + ex.Message + "');", true);
            }
        }
Beispiel #23
0
        public void ShowDaily()
        {
            DataTable    dailyData    = null;
            StockManager stockManager = new StockManager();

            string fromDate = Master.textboxFromDate.Text;

            string symbol   = Master.textbox_SelectedSymbol.Text;
            string exchange = Master.textbox_SelectedExchange.Text;

            string outputsize = Master.dropdownOutputSize.SelectedValue;
            string interval   = Master.dropdownInterval.SelectedValue;

            try
            {
                dailyData = stockManager.getVWAPDataTableFromDaily(symbol, exchange, outputsize: outputsize, time_interval: interval,
                                                                   fromDate: fromDate);


                if (chartAdvGraph.Annotations.Count > 0)
                {
                    chartAdvGraph.Annotations.Clear();
                }

                ViewState["MAIN_DATA"] = null;

                if ((dailyData != null) && (dailyData.Rows.Count > 0))
                {
                    dailyData.Rows.RemoveAt(0);
                    dailyData.Rows.RemoveAt(dailyData.Rows.Count - 1);
                    GridViewData.DataSource = dailyData;
                    GridViewData.DataBind();

                    ViewState["MAIN_DATA"] = dailyData;

                    if (Master.dropdownInterval.SelectedValue.Contains("m"))
                    {
                        chartAdvGraph.ChartAreas[0].AxisX2.LabelStyle.Format = "g";
                        chartAdvGraph.ChartAreas[1].AxisX.LabelStyle.Format  = "g";
                    }
                    else
                    {
                        chartAdvGraph.ChartAreas[0].AxisX2.LabelStyle.Format = "dd-MM-yyyy";
                        chartAdvGraph.ChartAreas[1].AxisX.LabelStyle.Format  = "dd-MM-yyyy";
                    }

                    chartAdvGraph.DataSource = dailyData;
                    chartAdvGraph.DataBind();

                    if (chartAdvGraph.Series.FindByName("Open") != null)
                    {
                        if (Master.dropdownInterval.SelectedValue.Contains("m"))
                        {
                            chartAdvGraph.Series["Open"].XValueType    = ChartValueType.DateTime;
                            chartAdvGraph.Series["Open"].ToolTip       = "Date:#VALX{g}; Open:#VALY";
                            chartAdvGraph.Series["Open"].PostBackValue = "Open," + symbol + ",#VALX{g},#VALY";
                        }
                        else
                        {
                            chartAdvGraph.Series["Open"].XValueType    = ChartValueType.Date;
                            chartAdvGraph.Series["Open"].ToolTip       = "Date:#VALX; Open:#VALY";
                            chartAdvGraph.Series["Open"].PostBackValue = "Open," + symbol + ",#VALX,#VALY";
                        }
                    }
                    if (chartAdvGraph.Series.FindByName("High") != null)
                    {
                        if (Master.dropdownInterval.SelectedValue.Contains("m"))
                        {
                            chartAdvGraph.Series["High"].XValueType    = ChartValueType.DateTime;
                            chartAdvGraph.Series["High"].ToolTip       = "Date:#VALX{g}; High:#VALY";
                            chartAdvGraph.Series["High"].PostBackValue = "High," + symbol + ",#VALX{g},#VALY";
                        }
                        else
                        {
                            chartAdvGraph.Series["High"].XValueType    = ChartValueType.Date;
                            chartAdvGraph.Series["High"].ToolTip       = "Date:#VALX; High:#VALY";
                            chartAdvGraph.Series["High"].PostBackValue = "High," + symbol + ",#VALX,#VALY";
                        }
                    }
                    if (chartAdvGraph.Series.FindByName("Low") != null)
                    {
                        if (Master.dropdownInterval.SelectedValue.Contains("m"))
                        {
                            chartAdvGraph.Series["Low"].XValueType    = ChartValueType.DateTime;
                            chartAdvGraph.Series["Low"].ToolTip       = "Date:#VALX{g}; Low:#VALY";
                            chartAdvGraph.Series["Low"].PostBackValue = "Low," + symbol + ",#VALX{g},#VALY";
                        }
                        else
                        {
                            chartAdvGraph.Series["Low"].XValueType    = ChartValueType.Date;
                            chartAdvGraph.Series["Low"].ToolTip       = "Date:#VALX; High:#VALY";
                            chartAdvGraph.Series["Low"].PostBackValue = "Low," + symbol + ",#VALX,#VALY";
                        }
                    }
                    if (chartAdvGraph.Series.FindByName("Close") != null)
                    {
                        if (Master.dropdownInterval.SelectedValue.Contains("m"))
                        {
                            chartAdvGraph.Series["Close"].XValueType    = ChartValueType.DateTime;
                            chartAdvGraph.Series["Close"].ToolTip       = "Date:#VALX{g}; Close:#VALY";
                            chartAdvGraph.Series["Close"].PostBackValue = "Close," + symbol + ",#VALX{g},#VALY";
                        }
                        else
                        {
                            chartAdvGraph.Series["Close"].XValueType    = ChartValueType.Date;
                            chartAdvGraph.Series["Close"].ToolTip       = "Date:#VALX; Close:#VALY";
                            chartAdvGraph.Series["Close"].PostBackValue = "Close," + symbol + ",#VALX,#VALY";
                        }
                    }
                    if (chartAdvGraph.Series.FindByName("OHLC") != null)
                    {
                        chartAdvGraph.Series.FindByName("OHLC").Enabled = true;
                        if (Master.dropdownInterval.SelectedValue.Contains("m"))
                        {
                            chartAdvGraph.Series["OHLC"].XValueType    = ChartValueType.DateTime;
                            chartAdvGraph.Series["OHLC"].ToolTip       = "Date:#VALX{g}; OHLC:#VALY";
                            chartAdvGraph.Series["OHLC"].PostBackValue = "OHLC," + symbol + ",#VALX{g},#VALY1,#VALY2,#VALY3,#VALY4";
                        }
                        else
                        {
                            chartAdvGraph.Series["OHLC"].XValueType    = ChartValueType.Date;
                            chartAdvGraph.Series["OHLC"].ToolTip       = "Date:#VALX; OHLC:#VALY";
                            chartAdvGraph.Series["OHLC"].PostBackValue = "OHLC," + symbol + ",#VALX,#VALY";
                        }
                    }
                    if (chartAdvGraph.Series.FindByName("Volume") != null)
                    {
                        chartAdvGraph.Series.FindByName("Volume").Enabled = true;
                        if (Master.dropdownInterval.SelectedValue.Contains("m"))
                        {
                            chartAdvGraph.Series["Volume"].XValueType    = ChartValueType.DateTime;
                            chartAdvGraph.Series["Volume"].ToolTip       = "Date:#VALX{g}; Volume:#VALY";
                            chartAdvGraph.Series["Volume"].PostBackValue = "Volume," + symbol + ",#VALX{g},#VALY";
                        }
                        else
                        {
                            chartAdvGraph.Series["Volume"].XValueType    = ChartValueType.Date;
                            chartAdvGraph.Series["Volume"].ToolTip       = "Date:#VALX; Volume:#VALY";
                            chartAdvGraph.Series["Volume"].PostBackValue = "Volume," + symbol + ",#VALX,#VALY";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "myScript", "alert('" + ex.Message + "');", true);
            }
        }
Beispiel #24
0
        public void ShowDaily()
        {
            DataTable    dailyData    = null;
            StockManager stockManager = new StockManager();

            string fromDate = Master.textboxFromDate.Text;

            string symbol   = Master.textbox_SelectedSymbol.Text;
            string exchange = Master.textbox_SelectedExchange.Text;

            string outputsize = Master.dropdownOutputSize.SelectedValue;


            try
            {
                dailyData = stockManager.GetStockPriceData(symbol, exchange, outputsize: outputsize, fromDate: fromDate);

                if (chartAdvGraph.Annotations.Count > 0)
                {
                    chartAdvGraph.Annotations.Clear();
                }

                ViewState["MAIN_DATA"] = null;

                if ((dailyData != null) && (dailyData.Rows.Count > 0))
                {
                    GridViewData.DataSource = dailyData;
                    GridViewData.DataBind();

                    ViewState["MAIN_DATA"] = dailyData;

                    chartAdvGraph.DataSource = dailyData;
                    chartAdvGraph.DataBind();

                    if (chartAdvGraph.Series.FindByName("Open") != null)
                    {
                        chartAdvGraph.Series["Open"].PostBackValue = "Open," + symbol + "," + "#VALX,#VALY";
                    }
                    if (chartAdvGraph.Series.FindByName("High") != null)
                    {
                        chartAdvGraph.Series["High"].PostBackValue = "High," + symbol + "," + "#VALX,#VALY";
                    }
                    if (chartAdvGraph.Series.FindByName("Low") != null)
                    {
                        chartAdvGraph.Series["Low"].PostBackValue = "Low," + symbol + "," + "#VALX,#VALY";
                    }
                    if (chartAdvGraph.Series.FindByName("Close") != null)
                    {
                        chartAdvGraph.Series["Close"].PostBackValue = "Close," + symbol + "," + "#VALX,#VALY";
                    }
                    if (chartAdvGraph.Series.FindByName("OHLC") != null)
                    {
                        chartAdvGraph.Series.FindByName("OHLC").Enabled = true;
                        chartAdvGraph.Series["OHLC"].PostBackValue      = "OHLC," + symbol + "," + "#VALX,#VALY1,#VALY2,#VALY3,#VALY4";
                    }
                    if (chartAdvGraph.Series.FindByName("Volume") != null)
                    {
                        chartAdvGraph.Series.FindByName("Volume").Enabled = true;
                        chartAdvGraph.Series["Volume"].PostBackValue      = "Volume," + symbol + "," + "#VALX,#VALY";
                    }

                    if (chartAdvGraph.Series.FindByName("PctChange") != null)
                    {
                        chartAdvGraph.Series.FindByName("PctChange").Enabled = true;
                        chartAdvGraph.Series["PctChange"].ToolTip            = "Date:#VALX; Prev Close:#VALY3; Change%:#VALY1; Change:#VALY2";
                        chartAdvGraph.Series["PctChange"].PostBackValue      = "PctChange," + symbol + ",#VALX,#VALY1,#VALY2,#VALY3";
                    }
                }
            }
            catch (Exception ex)
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "myScript", "alert('" + ex.Message + "');", true);
            }
        }
Beispiel #25
0
        public void ShowDaily()
        {
            DataTable    dailyData    = null;
            StockManager stockManager = new StockManager();

            string fromDate = Master.textboxFromDate.Text;

            string symbol   = Master.textbox_SelectedSymbol.Text;
            string exchange = Master.textbox_SelectedExchange.Text;

            string seriestype = Master.dropdownSeries.SelectedValue;
            string outputsize = Master.dropdownOutputSize.SelectedValue;
            string interval   = Master.dropdownInterval.SelectedValue;

            int fastperiod   = Int32.Parse(Master.textboxMACDEMADaily_fastperiod.Text);
            int slowperiod   = Int32.Parse(Master.textboxMACDEMADaily_slowperiod.Text);
            int signalperiod = Int32.Parse(Master.textboxMACDEMADaily_signalperiod.Text);

            try
            {
                dailyData = stockManager.GetSMA_EMA_MACD_BBANDS_Table(symbol, exchange, seriestype, outputsize, time_interval: interval,
                                                                      fromDate: fromDate,
                                                                      small_fast_Period: fastperiod, long_slow_Period: slowperiod, emaRequired: true, macdRequired: true, signalperiod: signalperiod);

                if (chartAdvGraph.Annotations.Count > 0)
                {
                    chartAdvGraph.Annotations.Clear();
                }

                ViewState["MAIN_DATA"] = null;

                if ((dailyData != null) && (dailyData.Rows.Count > 0))
                {
                    GridViewData.DataSource = dailyData;
                    GridViewData.DataBind();

                    ViewState["MAIN_DATA"] = dailyData;

                    chartAdvGraph.DataSource = dailyData;
                    chartAdvGraph.DataBind();

                    if (chartAdvGraph.Series.FindByName("Open") != null)
                    {
                        chartAdvGraph.Series["Open"].PostBackValue = "Open," + symbol + "," + "#VALX,#VALY";
                    }
                    if (chartAdvGraph.Series.FindByName("High") != null)
                    {
                        chartAdvGraph.Series["High"].PostBackValue = "High," + symbol + "," + "#VALX,#VALY";
                    }
                    if (chartAdvGraph.Series.FindByName("Low") != null)
                    {
                        chartAdvGraph.Series["Low"].PostBackValue = "Low," + symbol + "," + "#VALX,#VALY";
                    }
                    if (chartAdvGraph.Series.FindByName("Close") != null)
                    {
                        chartAdvGraph.Series["Close"].PostBackValue = "Close," + symbol + "," + "#VALX,#VALY";
                    }
                    if (chartAdvGraph.Series.FindByName("OHLC") != null)
                    {
                        chartAdvGraph.Series.FindByName("OHLC").Enabled = true;
                        chartAdvGraph.Series["OHLC"].PostBackValue      = "OHLC," + symbol + "," + "#VALX,#VALY1,#VALY2,#VALY3,#VALY4";
                    }
                    if (chartAdvGraph.Series.FindByName("Volume") != null)
                    {
                        chartAdvGraph.Series.FindByName("Volume").Enabled = true;
                        chartAdvGraph.Series["Volume"].PostBackValue      = "Volume," + symbol + "," + "#VALX,#VALY";
                    }
                }
            }
            catch (Exception ex)
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "myScript", "alert('" + ex.Message + "');", true);
            }
        }