private void cmdGetFiles_Click(object sender, EventArgs e)
        {
            string filesDir = Path.Combine(folder, _config.BareName);
            DirectoryInfo d = new DirectoryInfo(filesDir);
            if (!d.Exists)
            {
                d.Create();
            }

             var dt = _config.GetDataTable(
                    "select  * from tb_submissions");

            var iCnt = 0;

            foreach (DataRow item in dt.Rows)
            {
                var minSub = new TurnitInSubmission(
                    item["SUB_UserId"].ToString(),
                    item["SUB_PaperId"].ToString(),
                    item["SUB_Title"].ToString()
                    );

                if (minSub.DownloadDocument(filesDir, elpSessionId.Text))
                    iCnt++;
            }
            MessageBox.Show(iCnt + " documents downloaded");
        }
Пример #2
0
        private void cmdFetch_Click(object sender, EventArgs e)
        {
            students.Clear();

            if (!File.Exists(fullname))
            {
                MessageBox.Show("Excel File not found");
                return;
            }

            var con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fullname + ";Extended Properties=Excel 8.0;"); // Extended Properties=Excel 8.0;
            con.Open();
            var da = new OleDbDataAdapter("select * from [Sheet1$]", con);
            var dt = new DataTable();
            da.Fill(dt);
            con.Close();

            foreach (DataRow row in dt.Rows)
            {
                var stud = new TurnitInSubmission();
                foreach (DataColumn col in dt.Columns)
                {
                    var val = row[col.ColumnName].ToString();
                    if (val != string.Empty)
                    {
                        stud.SetProp(val, col.ColumnName);
                    }
                }
                students.Add(stud);
            }

            MessageBox.Show(
                string.Format("{0} submissions found", students.Count)
                );

            if (students.Count > 0)
                cmdMakeDatabase.Enabled = true;
        }