Exemplo n.º 1
0
        protected void btnDownload_Click(object sender, EventArgs e)
        {
            com.maplewood.www.mwWebSrvStAc Integration = new com.maplewood.www.mwWebSrvStAc();
            Integration.Url = GetWebServiceURL();
            Integration.Timeout = 360000;

            //Loop thru Sudbury Schools
            string strSQL = "SELECT cpSchoolCode, SchoolId, InstitutionName FROM UserInfo WHERE cpSystemNameId = " + GetSystemNameId() + " order by institutionType, schoolid";
            DataTable dtb = DataAccess.GetDataTable(strSQL);

            foreach (DataRow dr in dtb.Rows)
            {
                Response.Write("--------------------------------------<br/>");
                Response.Write(dr["cpSchoolCode"].ToString() + ":" + dr["InstitutionName"].ToString() + "<br/>");
                Response.Write("--------------------------------------<br/>");

                //Students data
                //--------------------------
                com.maplewood.www.StAc_Student Student = new com.maplewood.www.StAc_Student();
                Student = Integration.GetStudents(dr["cpSchoolCode"].ToString(), "");
                Response.Write("Student: " + Student.Student_Details.Count.ToString() + "<br/>");

                SqlBulkCopy oBulkStudent = new SqlBulkCopy(strCareerdbImportLocal);
                oBulkStudent.DestinationTableName = "MWStudent";
                oBulkStudent.WriteToServer(Student.Student_Details);
                oBulkStudent.Close();
                //--------------------------
            }
        }
Exemplo n.º 2
0
        protected void btnStudents_Click(object sender, EventArgs e)
        {
            com.maplewood.www.mwWebSrvStAc Integration = new com.maplewood.www.mwWebSrvStAc();
            Integration.Url = strWebServiceURL;
            Integration.Timeout = 60000000;

            lblResultText.Text = btnStudents.Text.ToString();

            //Loop thru selected Schools
            foreach (ListItem itm in chkSchools.Items)
            {
                if (itm.Selected)
                {
                    dtmTimeBefore = DateTime.Now;
                    com.maplewood.www.StAc_Student objMWStudent = new com.maplewood.www.StAc_Student();
                    objMWStudent = Integration.GetStudents(itm.Value.ToString(), "");
                    dtmTimeAfter = DateTime.Now;
                    timDuration = (TimeSpan)dtmTimeAfter.Subtract(dtmTimeBefore);

                    dtmTimeBefore = DateTime.Now;
                    if (objMWStudent.Student_Details.Count > 0)
                    {
                        strResults.Append(timDuration.Minutes.ToString() + ":" + timDuration.Seconds.ToString() + " - " +
                            objMWStudent.Student_Details.Count.ToString() + " : " + itm.Value.ToString() + ":" + itm.Text.ToString() + " -  ");

                    }

                    SqlBulkCopy oBulkStudent = new SqlBulkCopy(strCareerdbImportLocal);
                    oBulkStudent.DestinationTableName = "MWStudent";
                    oBulkStudent.WriteToServer(objMWStudent.Student_Details);
                    oBulkStudent.Close();
                    dtmTimeAfter = DateTime.Now;
                    timDuration = (TimeSpan)dtmTimeAfter.Subtract(dtmTimeBefore);
                    strResults.Append(" - " + timDuration.Minutes.ToString() + ":" + timDuration.Seconds.ToString() + "\r\n");
                    strResults.Append("--------------------------------------\r\n");
                    //--------------------------
                }
            }
            txtResults.Text = strResults.ToString();
        }