Ejemplo n.º 1
0
        protected void btnDownloadClasses_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/>");

                //Student Courses in Progress
                //--------------------------
                com.maplewood.www.StAc_StuClass objMWProgress = new com.maplewood.www.StAc_StuClass();
                objMWProgress = Integration.GetStudentClasses(dr["cpSchoolCode"].ToString(), "");
                Response.Write("In Progress Courses: " + objMWProgress.Student_Class_Details.Count.ToString() + "<br/>");

                SqlBulkCopy oBulkInProgress = new SqlBulkCopy(strCareerdbImportLocal);
                oBulkInProgress.DestinationTableName = "MWStudentClasses";
                oBulkInProgress.WriteToServer(objMWProgress.Student_Class_Details);
                oBulkInProgress.Close();
                //--------------------------
            }
        }
Ejemplo n.º 2
0
        protected void btnDownloadOnTranscript_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();
            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/>");

                //Student Course History
                //--------------------------
                com.maplewood.www.StAc_StuOnTrans objMWHistory = new com.maplewood.www.StAc_StuOnTrans();
                objMWHistory = Integration.GetStudentOnTranscript(dr["cpSchoolCode"].ToString(), "");
                Response.Write("History Courses: " + objMWHistory.Student_OnTranscript_Details.Count.ToString() + "<br/>");

                SqlBulkCopy oBulkHistory = new SqlBulkCopy(strCareerdbImportLocal);
                oBulkHistory.BulkCopyTimeout = 120000;
                oBulkHistory.DestinationTableName = "MWStudentOnTranscript";
                oBulkHistory.WriteToServer(objMWHistory.Student_OnTranscript_Details);
                oBulkHistory.Close();
                //--------------------------
            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region InitializeForm
            Server.ScriptTimeout = 3600;    //1 hr
            GetSystemSchoolInfo();
            if (strSystemNameID == "") strSystemNameID = CPSystemSchoolInfo["SystemNameID"].ToString();
            Header1.strSearchFormName = "SearchResults.aspx?SystemNameID=" + strSystemNameID + "&";
            Header1.strPageTitle = "School System Management";
            #endregion

            //Get SystemNameId and Web Service URL
            strSystemNameID = CPSystemSchoolInfo["SystemNameID"].ToString();
            DataTable dtb = DataAccess.GetDataTable("select top 1 WebServiceURL, left(ImportScript, 20) as BoardCode from CP_SystemName where SystemNameId = " + strSystemNameID);
            if (dtb.Rows.Count > 0)
            {
                strWebServiceURL = dtb.Rows[0]["WebServiceURL"].ToString();
                strBoardCode = dtb.Rows[0]["BoardCode"].ToString();
                txtDetails.Text = strBoardCode + "\r\n" + strWebServiceURL;
            }

            if (!Page.IsPostBack)
            {
                //Load Schools list in dropdown
                strSQL = String.Format(@"select CPSChoolCode, CPSChoolCode + ' - ' + InstitutionName as InstitutionName
                                        from UserInfo ui INNER JOIN cp_School s ON ui.SchoolID = s.SchoolID WHERE CoursePlanner > 0
                                        and CPSchoolCode is not null and CPSystemNameId = {0} ORDER BY SchoolType Desc, InstitutionName", strSystemNameID);
                DataTable dtbSchools = DataAccess.GetDataTable(strSQL);
                chkSchools.DataSource = dtbSchools;
                chkSchools.DataBind();

                foreach (ListItem itm in chkSchools.Items)
                {
                    itm.Selected = true;
                }

                strSQL = String.Format(@"SELECT DISTINCT School_Code, InstitutionName FROM UserInfo ui
                    INNER JOIN careerdbImport..MWExport e ON ui.CPSchoolCode = e.School_Code WHERE CoursePlanner > 0
                    and CPSchoolCode is not null and CPSystemNameId = {0} ORDER BY InstitutionName", strSystemNameID);
                DataTable dtbSch = DataAccess.GetDataTable(strSQL);
                ddlSchoolCode.DataSource = dtbSch;
                ddlSchoolCode.DataBind();
            }
            //Response.Write(DateTime.Now);

            com.maplewood.www.mwWebSrvStAc Integration = new com.maplewood.www.mwWebSrvStAc();
            Integration.Url = strWebServiceURL;
            txtDetails.Text += "\r\n" + Integration.GetVersion();
        }
Ejemplo n.º 4
0
        protected void btnUpGetStudentChoices_Click(object sender, EventArgs e)
        {
            com.maplewood.www.mwWebSrvStAc Integration = new com.maplewood.www.mwWebSrvStAc();
            Integration.Url = strWebServiceURL;
            Integration.Timeout = 60000000;

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

            //Loop thru selected Schools
            foreach (ListItem itm in chkSchools.Items)
            {
                if (itm.Selected)
                {
                    strSQL = "DELETE FROM MWStudentChoices WHERE Board_Code = " + CP.SQLClean(strBoardCode) + " AND School_Code = " + CP.SQLClean(itm.Value.ToString());
                    //Response.Write(strSQL);
                    SqlConnection oConn = new SqlConnection(strCareerdbImportLocal);
                    oConn.Open();
                    SqlDataAdapter oDA = new SqlDataAdapter(strSQL, oConn);
                    DataTable dtb = new DataTable();
                    oDA.Fill(dtb);
                    oConn.Close();

                    com.maplewood.www.StAc_StuChoice objMW = new com.maplewood.www.StAc_StuChoice();
                    objMW = Integration.GetStudentChoices(itm.Value.ToString(), "");

                    if (objMW.HasErrors)
                    {
                        Response.Write("<br />" + objMW.Errors.Rows.Count.ToString());
                        Response.Write(objMW.Errors[0].Error_Details.ToString());
                    }

                    if (objMW.Student_Choice_Details.Count > 0)
                    {
                        strResults.Append(objMW.Student_Choice_Details.Count.ToString() + " : " + itm.Value.ToString() + ":" + itm.Text.ToString() + "\r\n");
                        strResults.Append("--------------------------------------" + "\r\n");
                    }

                    SqlBulkCopy oBulk = new SqlBulkCopy(strCareerdbImportLocal);
                    oBulk.BulkCopyTimeout = 120000;
                    oBulk.DestinationTableName = "MWStudentChoices";
                    oBulk.WriteToServer(objMW.Student_Choice_Details);
                    oBulk.Close();
                    //--------------------------
                }
            }
            txtResults.Text = strResults.ToString();
        }
Ejemplo n.º 5
0
        protected void btnUpExportToMaplewood_Click(object sender, EventArgs e)
        {
            lblResultText.Text = btnUpExportToMaplewood.Text.ToString();
            txtResults.Text = "";

            SqlConnection oConn = new SqlConnection(strCareerdbImportLocal);
            oConn.Open();

            //Get parts of CC student choices based on ExportPart
            strSQL = String.Format(@"SELECT board_code, school_code, course_code, student_code, choice_type, choice_type_title
                 FROM MWExport WHERE board_code = {0} AND school_code = {1} AND ExportPart = {2} order by board_code, school_code, student_code, choice_type, CourseDateAdded"
                , CP.SQLClean(strBoardCode), CP.SQLClean(ddlSchoolCode.SelectedValue.ToString())
                , ddlExportPart.SelectedValue.ToString());
            SqlDataAdapter oDA = new SqlDataAdapter(strSQL, oConn);
            DataTable dtb = new DataTable();
            oDA.Fill(dtb);

            //Maplewood code to store all choices and then pass everythign together
            com.maplewood.www.StAc_StuChoice stuChoice = new com.maplewood.www.StAc_StuChoice();
            int iCounter = 0;
            foreach (DataRow dr in dtb.Rows)
            {
                stuChoice.Student_Choices.AddStudent_ChoicesRow(iCounter);
                stuChoice.Student_Choice_Details.AddStudent_Choice_DetailsRow(dr["board_code"].ToString(),
                        dr["school_code"].ToString(), dr["course_code"].ToString(), dr["student_code"].ToString(),
                        dr["choice_type"].ToString(), dr["choice_type_title"].ToString(), stuChoice.Student_Choices[iCounter]);
                iCounter += 1;
            }

            //Call Update student choices and get errors
            com.maplewood.www.mwWebSrvStAc Integration = new com.maplewood.www.mwWebSrvStAc();
            Integration.Url = strWebServiceURL;
            Integration.Timeout = 60000000;

            dtmTimeBefore = DateTime.Now;
            com.maplewood.www.StAc_StuChoiceUpdate stuResults;
            stuResults = Integration.UpdateStuChoices(ddlSchoolCode.SelectedValue.ToString(), "Y", "N", stuChoice);
            DataTable dtbErrors = stuResults.UpdateError;
            dtmTimeAfter = DateTime.Now;
            timDuration = (TimeSpan)dtmTimeAfter.Subtract(dtmTimeBefore);

            foreach (DataRow dr in dtbErrors.Rows)
            {
                if (dr["Message"].ToString() != "Student already has choice selected.")
                {
                    strSQL = "INSERT INTO MWUploadErrors(SystemNameId, SchoolCode, StudentId, CourseCode, ErrorMessage)";
                    strSQL += "VALUES(" + strSystemNameID + ", '" + dr["school_code"].ToString() + "','";
                    strSQL += dr["student_code"].ToString() + "','" + dr["course_code"].ToString() + "',";
                    strSQL += CP.SQLClean(dr["Message"].ToString()) + ")";
                    SqlCommand oCmd = new SqlCommand(strSQL, oConn);
                    oCmd.ExecuteNonQuery();
                }
            }

            //Display Transfer Result.
            if (stuResults.UpdateError.Rows.Count > 0)
                txtResults.Text += "Success (Y/N) 1:" + stuResults.UpdateError.Rows[0][0] + " - " + stuResults.UpdateError.Rows[0][1] + "\n";
            else
                txtResults.Text += "Success (Y/N) 2:" + stuResults.StuChoiceUpdate.Rows[0][0] + " - " + stuResults.StuChoiceUpdate.Rows[0][1] + "\n";

            txtResults.Text += " - " + timDuration.Minutes.ToString() + ":" + timDuration.Seconds.ToString() + "\r\n";

            oConn.Close();
        }
Ejemplo n.º 6
0
        protected void btnStudentTranscript_Click(object sender, EventArgs e)
        {
            com.maplewood.www.mwWebSrvStAc Integration = new com.maplewood.www.mwWebSrvStAc();
            Integration.Url = strWebServiceURL;
            Integration.Timeout = 60000000;

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

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

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

                    SqlBulkCopy oBulkHistory = new SqlBulkCopy(strCareerdbImportLocal);
                    oBulkHistory.BulkCopyTimeout = 120000;
                    oBulkHistory.DestinationTableName = "MWStudentOnTranscript";
                    oBulkHistory.WriteToServer(objMWTranscript.Student_OnTranscript_Details);
                    oBulkHistory.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();
        }
Ejemplo n.º 7
0
        protected void btnSchool_Click(object sender, EventArgs e)
        {
            com.maplewood.www.mwWebSrvStAc Integration = new com.maplewood.www.mwWebSrvStAc();
            Integration.Url = strWebServiceURL;
            Integration.Timeout = 360000;
            //Response.Write(Integration.GetVersion());
            com.maplewood.www.StAc_School School = new com.maplewood.www.StAc_School();
            School = Integration.GetSchools("");

            foreach (DataRow drow in School.School_Details.Rows)
            {
                strResults.Append(drow["board_code"].ToString() + ", " + drow["school_code"].ToString() + ", " + drow["school_name"].ToString() + ", " + drow["street_address"].ToString() + ", " + drow["City"].ToString() + "\r\n");
            }

            txtResults.Text = strResults.ToString();
        }
Ejemplo n.º 8
0
        protected void btnScheduledCourses_Click(object sender, EventArgs e)
        {
            com.maplewood.www.mwWebSrvStAc Integration = new com.maplewood.www.mwWebSrvStAc();
            Integration.Url = strWebServiceURL;
            Integration.Timeout = 60000000;

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

            foreach (ListItem itm in chkSchools.Items)
            {
                if (itm.Selected)
                {
                    //Student Courses in Progress
                    //--------------------------
                    dtmTimeBefore = DateTime.Now;
                    com.maplewood.www.StAc_Course objMWCourses = new com.maplewood.www.StAc_Course();
                    objMWCourses = Integration.GetCoursesSched(itm.Value.ToString());
                    dtmTimeAfter = DateTime.Now;
                    timDuration = (TimeSpan)dtmTimeAfter.Subtract(dtmTimeBefore);

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

                    SqlBulkCopy oBulkInProgress = new SqlBulkCopy(strCareerdbImportLocal);
                    oBulkInProgress.DestinationTableName = "MWCourses";
                    oBulkInProgress.WriteToServer(objMWCourses.Course_Details);
                    oBulkInProgress.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();
        }