示例#1
0
        // UPLOAD BUTTON HANDLER -------------------------------------------------------------------------------------------------------

        protected void uploadbutton_Click(object sender, EventArgs e)
        {
            // Get button ID
            Button getbuttonID = (Button)sender;
            string id          = getbuttonID.ID.Replace("_button", "");

            // Use button ID to find similarly named upload control ID
            FileUpload uploadcontrol = (FileUpload)Form.FindControl(id);

            // Only upload if control has file selected
            if (uploadcontrol.HasFile)
            {
                // Add upload path
                String savePath = @"c:\temp\";

                // Retrieve filename from upload control
                String fileName = uploadcontrol.FileName;

                // Save data to web server
                uploadcontrol.SaveAs(savePath + fileName);

                // Fill GridView

                // Establish text driver connection
                System.Data.Odbc.OdbcConnection  csv_connection;
                System.Data.Odbc.OdbcDataAdapter csv_adapter;

                // Create temporary data table to store CSV data
                DataTable csv_data = new DataTable();

                // Create connection string and execute connection to CSV
                string csv_connectionString = @"Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + savePath + ";";
                csv_connection = new System.Data.Odbc.OdbcConnection(csv_connectionString);

                // Fill adapter with SELECT * query from CSV
                csv_adapter = new System.Data.Odbc.OdbcDataAdapter("select * from [" + fileName + "]", csv_connection);
                csv_adapter.Fill(csv_data);

                // Close CSV connection
                csv_connection.Close();

                // Find GridView and fill
                GridView filedata = (GridView)Form.FindControl(id + "_table");
                filedata.DataSource = csv_data;
                filedata.DataBind();

                // SESSION MODIFICATION //

                DataSet session_datanew = new DataSet();
                session_datanew.Tables.Add(csv_data);
                session_datanew.DataSetName = "PCADATA";

                Registry.Registry registry = Registry.Registry.getRegistry(Session);
                registry.registerDataset(session_datanew);
                Analysis.ParameterStream stream = Analysis.ParameterStream.getStream(Session);
                stream.set("dataSetName", "PCADATA");

                //----------------------//
            }
        }
示例#2
0
 protected void Next_Click(object sender, EventArgs e)
 {
     if (DatasetList.Text != "")
     {
         Analysis.Analysis        analysis = (Analysis.Analysis)Session["analysis"];
         Analysis.ParameterStream stream   = Analysis.ParameterStream.getStream(Session);
         stream.set("dataSetName", DatasetList.Text);
         analysis.next(Response, Session);
     }
 }
示例#3
0
        void Session_Start(object sender, EventArgs e)
        {
            // Code that runs when a new session is started
            // Session data
            //Selected analysis
            Session.Add("analysis", null);
            Analysis.ParameterStream stream = new Analysis.ParameterStream(Session);
            sessionRegistry = new Registry.Registry(Session);
            Session.Add("stepid", stepid);
            stepid = 0;


            //Add pre-existing user data sets
            //Add pre-existing user-defined scripts
        }
        void Session_Start(object sender, EventArgs e)
        {
            // Code that runs when a new session is started
            // Session data
            //Selected analysis
            Session.Add("analysis", null);
            Analysis.ParameterStream stream = new Analysis.ParameterStream(Session);
            sessionRegistry = new Registry.Registry(Session);
            Session.Add("stepid", stepid);
            stepid = 0;


            //Add pre-existing user data sets
            //Add pre-existing user-defined scripts
        }