Example #1
0
        public DataTable curriculum(string studentID)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("Mã Môn");
            dt.Columns.Add("Tên Môn");
            dt.Columns.Add("Kì");

            ServiceReference2.SAPISoapClient fap = new ServiceReference2.SAPISoapClient();

            List <Curricurlum> cur    = new List <Curricurlum>();
            string             fapcur = fap.getCurriculum(studentID);

            if (!fapcur.Equals("Data not found"))
            {
                cur = JsonConvert.DeserializeObject <List <Curricurlum> >(fapcur);
            }



            for (int j = 0; j < cur.Count; j++)
            {
                var ds = dt.NewRow();

                ds["Mã Môn"]  = cur[j].subjectCode.ToString();
                ds["Tên Môn"] = cur[j].subjectName.ToString();
                ds["Kì"]      = cur[j].termNo.ToString();
                dt.Rows.Add(ds);
            }



            //}
            return(dt);
        }
        protected void btnReUpdate_Click(object sender, EventArgs e)
        {
            ServiceReference1.WebService1SoapClient ws = new ServiceReference1.WebService1SoapClient();
            Business.ScsBO sbo = new Business.ScsBO();


            List <Student> stFAP = new List <Student>();

            ServiceReference2.SAPISoapClient fap = new ServiceReference2.SAPISoapClient();
            string stf = fap.GetStudenK10JS();

            stFAP = JsonConvert.DeserializeObject <List <Student> >(stf);
            List <StaffTakeCare> listfromDB       = sbo.showListTable();
            List <String>        listStudentIdDub = new List <String>();


            Business.RankDAL    rdal = new Business.RankDAL();
            Business.StudentDAL stdl = new Business.StudentDAL();
            //Entity.Rank r = null;
            var tasks = new Task[stFAP.Count];

            for (int i = 0; i < stFAP.Count; i++)
            {
                string rollNumber = stFAP[i].rollNumber;
                tasks[i] = Task.Factory.StartNew(() =>
                {
                    List <StudentProfile> stp = new List <StudentProfile>();
                    string inf = fap.GetStudentById(rollNumber);
                    stp        = JsonConvert.DeserializeObject <List <StudentProfile> >(inf);
                    bool flag  = false;

                    for (int j = 0; j < listfromDB.Count; j++)
                    {
                        if (rollNumber.ToString().Equals(listfromDB[j].studentID.ToString()))
                        {
                            flag = true;
                            break;
                        }
                    }
                    if (!flag)
                    {
                        stdl.insertStudentToTakeCare(rollNumber.ToString(), stp[0].fullName);
                    }
                });
            }
            Task.WaitAll(tasks);
            rdal.rankking();
            stdl.filterStudent();
            string check = "";

            Response.Redirect("~/UI/distribution.aspx?check=" + check);
        }
Example #3
0
        public List <OldListTakecare> getOldStudent()
        {
            List <Student> listStudentAPI = new List <Student>();

            ServiceReference2.SAPISoapClient fap = new ServiceReference2.SAPISoapClient();
            string stf = fap.GetStudenK10JS();

            listStudentAPI = JsonConvert.DeserializeObject <List <Student> >(stf);

            List <OldListTakecare> list  = new List <OldListTakecare>();
            List <OldListTakecare> list2 = new List <OldListTakecare>();
            SqlConnection          con   = DbConnect.GetConnection();
            string sql = " SELECT Student.studentID,Account.staffName,Rank.rankName "
                         + " FROM Student"
                         + " LEFT JOIN Rank"
                         + " ON Rank.studentID = Student.studentID LEFT JOIN Account"
                         + "  ON Account.accountID = Student.accountID"
                         + " Where takecareStatus = 0 AND caution=0 ";
            SqlCommand cmd = new SqlCommand(sql, con);

            con.Open();

            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                OldListTakecare ol = new OldListTakecare();
                ol.studentID = dr["studentID"].ToString();
                ol.staffName = dr["staffName"].ToString();

                list.Add(ol);
            }

            list2 = list;
            for (int j = 0; j < listStudentAPI.Count; j++)
            {
                for (int i = 0; i < list2.Count; i++)
                {
                    if (listStudentAPI[j].rollNumber.Equals(list[i].studentID))
                    {
                        list2.Remove(list[i]);
                    }
                }
            }
            con.Close();
            return(list2);
        }
Example #4
0
        public DataTable getTimetable(string studentID)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("Mã môn");
            dt.Columns.Add("Lớp");
            dt.Columns.Add("Ngày");

            dt.Columns.Add("Trạng thái");
            ServiceReference2.SAPISoapClient fap = new ServiceReference2.SAPISoapClient();
            DateTime tm;
            DateTime today = DateTime.ParseExact("01/06/2018", "dd/MM/yyyy", CultureInfo.InvariantCulture);// Convert.ToDateTime("01/06/2018");

            for (int td = 0; td < 6; td++)
            {
                tm = today.AddDays(+td);
            }

            string t = fap.getTimeTable(studentID, today, today.AddDays(+7));

            if (t.Equals("Data not found"))
            {
                return(dt);
            }
            List <Timetable> ttable = new List <Timetable>();

            ttable = JsonConvert.DeserializeObject <List <Timetable> >(t);
            for (int i = 0; i < ttable.Count; i++)
            {
                var ds = dt.NewRow();
                ds["Mã môn"] = ttable[i].subjectCode.ToString();
                ds["Lớp"]    = ttable[i].groupName.ToString();
                ds["Ngày"]   = ttable[i].date.ToString("dd/MM/yy");

                ds["Trạng thái"] = ttable[i].status.ToString();
                dt.Rows.Add(ds);
            }

            return(dt);
        }
Example #5
0
        //public List<Comment> getAccountIDComment(string studentID)
        //{
        //    List<Comment> list = new List<Comment>();
        //    SqlConnection con = DbConnect.GetConnection();
        //    con.Open();
        //    string sql = "select accountID from Comment Where studentID=@studentID ";
        //    SqlCommand cmd = new SqlCommand(sql, con);
        //    cmd.Parameters.Add("studentID", SqlDbType.NVarChar);
        //    cmd.Parameters["studentID"].Value = studentID;
        //    SqlDataReader dr = cmd.ExecuteReader();
        //    Comment cm = null;
        //    while (dr.Read())
        //    {
        //        cm = new Comment();
        //        cm.accountID = (Int32)dr["accountID"];
        //        list.Add(cm);
        //    }

        //    con.Close();
        //    return list;
        //}



        //*********************************************************

        public DataTable scheduleExam(string studentID)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("Mssv");
            dt.Columns.Add("Ngày");
            dt.Columns.Add("Phòng");
            dt.Columns.Add("Môn thi");
            dt.Columns.Add("Giờ thi");
            dt.Columns.Add("Note");
            dt.Columns.Add("Kì thi");
            dt.Columns.Add("Công bố điểm");
            ServiceReference2.SAPISoapClient fap = new ServiceReference2.SAPISoapClient();

            List <Schedule> Sche = new List <Schedule>();
            string          exam = fap.getscheduleExam(studentID, DateTime.ParseExact("01/04/2018", "dd/MM/yyyy", CultureInfo.InvariantCulture));

            if (exam.Equals("Data not found"))
            {
                return(dt);
            }
            Sche = JsonConvert.DeserializeObject <List <Schedule> >(exam);

            for (int i = 0; i < Sche.Count; i++)
            {
                var ds = dt.NewRow();
                ds["Mssv"]         = Sche[i].rollNumber;
                ds["Ngày"]         = Sche[i].date;
                ds["Phòng"]        = Sche[i].roomNo;
                ds["Môn thi"]      = Sche[i].realSubject;
                ds["Giờ thi"]      = Sche[i].giothi;
                ds["Note"]         = Sche[i].note;
                ds["Kì thi"]       = Sche[i].kythi;
                ds["Công bố điểm"] = Sche[i].dateMark;
                dt.Rows.Add(ds);
            }
            return(dt);
        }
Example #6
0
        public List <GpaTerm> listGpa(string studentID)
        {
            GpaTerm        gpt     = new GpaTerm();
            List <GpaTerm> listGpa = new List <GpaTerm>();

            ServiceReference2.SAPISoapClient fap = new ServiceReference2.SAPISoapClient();
            string     currentSemester           = "Spring2018";
            List <Gpa> gpaList = new List <Gpa>();
            string     t2      = fap.getGPA(studentID, currentSemester);

            if (!t2.Equals("Data not found"))
            {
                gpaList = JsonConvert.DeserializeObject <List <Gpa> >(t2);
            }
            int    totalCredit = 0;
            double avg         = 0;

            for (int j = 0; j < gpaList.Count; j++)
            {
                double temp = 0;
                if (gpaList[j].averageMark != null)
                {
                    temp = gpaList[j].credits * (double)gpaList[j].averageMark;
                }
                if (temp > 0)
                {
                    totalCredit += gpaList[j].credits;
                    avg         += temp;
                }
            }

            double     gpa      = ((double)avg) / ((double)totalCredit);
            List <Gpa> gpaList2 = new List <Gpa>();
            string     getGpa2  = fap.getGPA(studentID, previousTerm(currentSemester));

            if (!getGpa2.Equals("Data not found"))
            {
                gpaList2 = JsonConvert.DeserializeObject <List <Gpa> >(getGpa2);
            }
            int    totalCredit2 = 0;
            double avg2         = 0;

            for (int k = 0; k < gpaList2.Count; k++)
            {
                double temp2 = 0;
                if (gpaList2[k].averageMark != null)
                {
                    temp2 = gpaList2[k].credits * (double)gpaList2[k].averageMark;
                }
                if (temp2 > 0)
                {
                    totalCredit2 += gpaList2[k].credits;
                    avg2         += temp2;
                }
            }

            double gpa2 = ((double)avg2) / ((double)totalCredit2);

            //gpt.gpa = gpa;
            //gpt.gpa2 = gpa2;
            //gpt.semester = currentSemester;
            //gpt.semester2 = previousTerm(currentSemester);
            //listGpa.Add(gpt);
            listGpa.Add(new GpaTerm(gpa2, previousTerm(currentSemester)));
            listGpa.Add(new GpaTerm(gpa, currentSemester));

            return(listGpa);
        }
Example #7
0
        public DataTable myStudentForHead()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("Mssv");
            dt.Columns.Add("Tên");
            dt.Columns.Add("GPA");
            dt.Columns.Add("Hành vi");
            dt.Columns.Add("Điểm danh");
            dt.Columns.Add("Môn nợ");
            dt.Columns.Add("Xếp loại");
            ServiceReference1.WebService1SoapClient ws  = new ServiceReference1.WebService1SoapClient();
            ServiceReference2.SAPISoapClient        fap = new ServiceReference2.SAPISoapClient();
            StaffTakeCare stc = null;
            RankDAL       rdl = new RankDAL();
            SqlConnection con = DbConnect.GetConnection();

            con.Open();
            string        sql = "SELECT TOP 10 Student.studentID,Student.studentName FROM Student LEFT JOIN Rank ON Student.studentID=Rank.studentID WHERE takecareStatus=0  AND caution=0 ORDER BY rankName DESC";
            SqlCommand    cmd = new SqlCommand(sql, con);
            SqlDataReader dr  = cmd.ExecuteReader();

            this.compareForHead = new List <Compare>();
            while (dr.Read())
            {
                Compare xx = null;
                stc             = new StaffTakeCare();
                stc.studentID   = dr["studentID"].ToString();
                stc.studentName = dr["studentName"].ToString();


                string currentSemester = "Spring2018";
                //FreedomeF.ServiceReference1.Failcourse[] flist = ws.getFailcourse(r.studentID, ws.getCurrentSemester(r.studentID));
                List <Curricurlum> listFail = new List <Curricurlum>();
                string             fail     = fap.getFailCourse(stc.studentID);
                string             pass     = fap.getPassCourse(stc.studentID);
                List <Curricurlum> listPass = new List <Curricurlum>();
                listPass = JsonConvert.DeserializeObject <List <Curricurlum> >(pass);
                listFail = JsonConvert.DeserializeObject <List <Curricurlum> >(fail);


                List <Gpa> gpaList = new List <Gpa>();
                string     t2      = fap.getGPA(stc.studentID, currentSemester);
                gpaList = JsonConvert.DeserializeObject <List <Gpa> >(t2);
                int    totalCredit = 0;
                double avg         = 0;

                for (int j = 0; j < gpaList.Count; j++)
                {
                    double temp = 0;
                    if (gpaList[j].averageMark != null)
                    {
                        temp = gpaList[j].credits * (double)gpaList[j].averageMark;
                    }
                    if (temp > 0)
                    {
                        totalCredit += gpaList[j].credits;
                        avg         += temp;
                    }
                }

                double gpa        = Math.Round(((double)avg) / ((double)totalCredit), 2);
                int    failcourse = listFail.Count;

                double behavior = ws.getBehaviorMark(stc.studentID, currentSemester).behaviorMark;

                List <Curricurlum> attenList = new List <Curricurlum>();
                string             t         = fap.getAttendanceMark(stc.studentID, currentSemester);
                attenList = JsonConvert.DeserializeObject <List <Curricurlum> >(t);

                int totalAbsent = 0;
                for (int i = 0; i < attenList.Count; i++)
                {
                    totalAbsent += attenList[i].absentTotal;
                }


                double atten = Math.Round(((double)(attenList.Count * 30) - totalAbsent) / ((double)attenList.Count * 30), 2) * 10;
                var    ds    = dt.NewRow();
                ds["Mssv"]      = stc.studentID;
                ds["Tên"]       = stc.studentName;
                ds["GPA"]       = gpa;
                ds["Hành vi"]   = behavior;
                ds["Điểm danh"] = atten;
                ds["Môn nợ"]    = failcourse;

                Rank rk = new Rank();


                rk             = rdl.loadRank(stc.studentID, currentSemester);
                ds["Xếp loại"] = rk.rank;
                //}
                dt.Rows.Add(ds);



                // compare previous semerter
                List <Gpa> gpaList2 = new List <Gpa>();
                string     getGpa2  = fap.getGPA(stc.studentID, previousTerm(currentSemester));
                gpaList2 = JsonConvert.DeserializeObject <List <Gpa> >(getGpa2);
                int    totalCredit2 = 0;
                double avg2         = 0;

                for (int k = 0; k < gpaList2.Count; k++)
                {
                    double temp2 = 0;
                    if (gpaList2[k].averageMark != null)
                    {
                        temp2 = gpaList2[k].credits * (double)gpaList2[k].averageMark;
                    }
                    if (temp2 > 0)
                    {
                        totalCredit2 += gpaList2[k].credits;
                        avg2         += temp2;
                    }
                }

                double gpa2      = ((double)avg2) / ((double)totalCredit2);
                double behavior2 = ws.getBehaviorMark(stc.studentID.ToString(), previousTerm(currentSemester)).behaviorMark;

                List <Curricurlum> attenList2 = new List <Curricurlum>();
                string             attent2    = fap.getAttendanceMark(stc.studentID, previousTerm(currentSemester));
                attenList2 = JsonConvert.DeserializeObject <List <Curricurlum> >(attent2);

                int totalAbsent2 = 0;
                for (int f = 0; f < attenList2.Count; f++)
                {
                    totalAbsent2 += attenList2[f].absentTotal;
                }

                double atten2 = (((double)(attenList2.Count * 30) - totalAbsent2) / ((double)attenList2.Count * 30)) * 10;
                xx             = new Compare();
                xx.gpa         = gpa;
                xx.gpa2        = gpa2;
                xx.behavior    = behavior;
                xx.behavior2   = behavior2;
                xx.atten       = atten;
                xx.atten2      = atten2;
                xx.failcourse  = failcourse;
                xx.failcourse2 = failcourse;
                this.compareForHead.Add(xx);
            }
            return(dt);
        }
Example #8
0
        public DataTable todayReportForHead(DateTime date)
        {
            //DateTime today = DateTime.Today;

            DateTime  today = DateTime.ParseExact("10/06/2018", "dd/MM/yyyy", CultureInfo.InvariantCulture); //Convert.ToDateTime("10/06/2018");
            DataTable dt    = new DataTable();

            dt.Columns.Add("Mssv");
            dt.Columns.Add("Tên");
            dt.Columns.Add("Vắng mặt ngày " + "" + date.ToString("dd/MM"));
            dt.Columns.Add("Báo cáo vắng mặt tuần này");
            dt.Columns.Add("Trạng thái");
            dt.Columns.Add("Nhận xét");
            dt.Columns.Add("Giảng viên");
            dt.Columns.Add("Xếp loại");
            ServiceReference2.SAPISoapClient fap = new ServiceReference2.SAPISoapClient();

            StaffTakeCare stc = null;
            SqlConnection con = DbConnect.GetConnection();

            con.Open();
            string     sql = "   SELECT TOP 10 Student.studentID ,Student.studentName,Rank.rankName FROM Student LEFT JOIN Rank ON Student.studentID=Rank.studentID WHERE takecareStatus=0  AND caution=0 ORDER BY rankName DESC";
            SqlCommand cmd = new SqlCommand(sql, con);

            SqlDataReader dr = cmd.ExecuteReader();
            Rank          r  = null;

            while (dr.Read())
            {
                r               = new Rank();
                stc             = new StaffTakeCare();
                stc.studentID   = dr["studentID"].ToString();
                stc.studentName = dr["studentName"].ToString();
                r.rank          = dr["rankName"].ToString();
                List <StudentProfile> profile = new List <StudentProfile>();

                string info = fap.GetStudentById(stc.studentID);

                profile = JsonConvert.DeserializeObject <List <StudentProfile> >(info);
                var ds = dt.NewRow();
                ds["Mssv"] = stc.studentID;
                ds["Tên"]  = stc.studentName;
                List <Report> dayRp  = new List <Report>();
                List <Report> weekRp = new List <Report>();
                string        day    = fap.getInfoToday(stc.studentID, DateTime.ParseExact(date.ToString("dd/MM/yyyy"), "dd/MM/yyyy", null));
                string        week   = fap.getWeeklyReport(stc.studentID, date.AddDays(-7), date);
                if (day.ToLower().Equals("data not found") && !week.ToLower().Equals("data not found"))
                {
                    weekRp = JsonConvert.DeserializeObject <List <Report> >(week);
                    string temp = "";
                    for (int k = 0; k < weekRp.Count; k++)
                    {
                        temp += weekRp[k].subjectCode.ToString() + " " + " Slot " + weekRp[k].slot.ToString() + " " + "Ngày " + weekRp[k].date.ToString("dd/MM") + "</br>";
                    }
                    ds["Báo cáo vắng mặt tuần này"] = temp;
                    ds["Trạng thái"] = profile[0].statusCode;
                    ds["Xếp loại"]   = r.rank;
                    dt.Rows.Add(ds);
                    continue;
                }
                else if (!day.ToLower().Equals("data not found") && week.ToLower().Equals("data not found"))
                {
                    dayRp = JsonConvert.DeserializeObject <List <Report> >(day);
                    for (int j = 0; j < dayRp.Count; j++)
                    {
                        ds["Vắng mặt ngày " + "" + date.ToString("dd/MM")] += " " + dayRp[j].subjectCode.ToString() + " Slot " + dayRp[j].slot.ToString() + "</br>";
                        ds["Nhận xét"]   += dayRp[j].comment.ToString() + "<br/>";
                        ds["Giảng viên"] += " " + dayRp[j].lecturer + "</br>";
                        ds["Trạng thái"]  = profile[0].statusCode;
                        ds["Xếp loại"]    = r.rank;
                    }
                    dt.Rows.Add(ds);
                    continue;
                }
                else if (day.ToLower().Equals("data not found") && week.ToLower().Equals("data not found"))
                {
                    ds["Trạng thái"] = profile[0].statusCode;
                    ds["Xếp loại"]   = r.rank;
                    dt.Rows.Add(ds);
                    continue;
                }
                dayRp  = JsonConvert.DeserializeObject <List <Report> >(day);
                weekRp = JsonConvert.DeserializeObject <List <Report> >(week);
                for (int j = 0; j < dayRp.Count; j++)
                {
                    ds["Vắng mặt ngày " + "" + date.ToString("dd/MM")] += " " + dayRp[j].subjectCode.ToString() + " Slot " + dayRp[j].slot.ToString() + "</br>";
                    ds["Nhận xét"]   += dayRp[j].comment.ToString() + "<br/>";
                    ds["Giảng viên"] += " " + dayRp[j].lecturer + "</br>";
                }


                for (int k = 0; k < weekRp.Count; k++)
                {
                    ds["Báo cáo vắng mặt tuần này"] += weekRp[k].subjectCode.ToString() + " " + " Slot " + weekRp[k].slot.ToString() + " " + "Ngày " + weekRp[k].date.ToString("dd/MM") + "</br>";
                }



                ds["Trạng thái"] = profile[0].statusCode;

                ds["Xếp loại"] = r.rank;

                dt.Rows.Add(ds);
            }
            return(dt);
        }
Example #9
0
        public void calRank(string studentID, Entity.Rate rt)
        {
            ServiceReference1.WebService1SoapClient ws  = new ServiceReference1.WebService1SoapClient();
            ServiceReference2.SAPISoapClient        fap = new ServiceReference2.SAPISoapClient();
            Entity.Rank r = new Entity.Rank();
            r.studentID = studentID;
            string             currentSemester = "Spring2018";
            string             fail            = fap.getFailCourse(r.studentID);
            string             pass            = fap.getPassCourse(r.studentID);
            List <Curricurlum> listPass        = new List <Curricurlum>();
            List <Curricurlum> listFail        = new List <Curricurlum>();

            if (!pass.Equals("Data not found"))
            {
                listPass = JsonConvert.DeserializeObject <List <Curricurlum> >(pass);
            }
            if (!fail.Equals("Data not found"))
            {
                listFail = JsonConvert.DeserializeObject <List <Curricurlum> >(fail);
            }
            List <Gpa> gpaList = new List <Gpa>();
            string     t2      = fap.getGPA(r.studentID, currentSemester);

            if (!t2.Equals("Data not found"))
            {
                gpaList = JsonConvert.DeserializeObject <List <Gpa> >(t2);
            }
            int    totalCredit = 0;
            double avg         = 0;

            for (int j = 0; j < gpaList.Count; j++)
            {
                double temp = 0;
                if (gpaList[j].averageMark != null)
                {
                    temp = gpaList[j].credits * (double)gpaList[j].averageMark;
                }
                if (temp > 0)
                {
                    totalCredit += gpaList[j].credits;
                    avg         += temp;
                }
            }
            double gpa = ((double)avg) / ((double)totalCredit);
            double failcourse;

            if (listFail.Count != 0 && listPass.Count != 0)
            {
                failcourse = ((1 - ((double)listFail.Count) / ((double)listPass.Count + (double)listFail.Count))) * 10;
            }
            failcourse = 0;
            double             behavior  = ws.getBehaviorMark(r.studentID, currentSemester).behaviorMark;
            List <Curricurlum> attenList = new List <Curricurlum>();
            string             t         = fap.getAttendanceMark(r.studentID, currentSemester);

            if (!t.Equals("Data not found"))
            {
                attenList = JsonConvert.DeserializeObject <List <Curricurlum> >(t);
            }
            int totalAbsent = 0;

            for (int i = 0; i < attenList.Count; i++)
            {
                totalAbsent += attenList[i].absentTotal;
            }
            double atten = Math.Round(((double)(attenList.Count * 30) - totalAbsent) / ((double)attenList.Count * 30), 2) * 10;

            r.rank = Caculate(gpa, behavior, failcourse, atten, rt.markRate, rt.behRate, rt.failCout, rt.attentRate);
            if (checkExistRank(r.studentID, currentSemester))
            {
                isInsertRank(r.studentID, r.rank, currentSemester);
            }
            else
            {
                isUpdateRank2(r.studentID, r.rank, currentSemester);
            }
        }
Example #10
0
        public Entity.Rank changeRankByCoefficient()
        {
            ServiceReference1.WebService1SoapClient ws = new ServiceReference1.WebService1SoapClient();
            //FreedomeF.ServiceReference1.ListStudentID[] list = ws.getStudentID();
            ServiceReference2.SAPISoapClient fap = new ServiceReference2.SAPISoapClient();

            Entity.Rank   r   = null;
            SqlConnection con = DbConnect.GetConnection();

            con.Open();
            string        sql = "SELECT studentID FROM Student WHERE takecareStatus=0";
            SqlCommand    cmd = new SqlCommand(sql, con);
            RankDAL       rdl = new RankDAL();
            SqlDataReader dr  = cmd.ExecuteReader();

            while (dr.Read())
            {
                r           = new Entity.Rank();
                r.studentID = dr["studentID"].ToString();
                string currentSemester = "Spring2018";

                List <Curricurlum> listFail = new List <Curricurlum>();
                string             fail     = fap.getFailCourse(r.studentID);
                string             pass     = fap.getPassCourse(r.studentID);
                List <Curricurlum> listPass = new List <Curricurlum>();
                if (!pass.Equals("Data not found"))
                {
                    listPass = JsonConvert.DeserializeObject <List <Curricurlum> >(pass);
                }
                if (!fail.Equals("Data not found"))
                {
                    listFail = JsonConvert.DeserializeObject <List <Curricurlum> >(fail);
                }
                List <Gpa> gpaList = new List <Gpa>();
                string     t2      = fap.getGPA(r.studentID, currentSemester);

                if (!t2.Equals("Data not found"))
                {
                    gpaList = JsonConvert.DeserializeObject <List <Gpa> >(t2);
                }

                int    totalCredit = 0;
                double avg         = 0;

                for (int j = 0; j < gpaList.Count; j++)
                {
                    double temp = 0;
                    if (gpaList[j].averageMark != null)
                    {
                        temp = gpaList[j].credits * (double)gpaList[j].averageMark;
                    }
                    if (temp > 0)
                    {
                        totalCredit += gpaList[j].credits;
                        avg         += temp;
                    }
                }

                double gpa        = ((double)avg) / ((double)totalCredit);
                double failcourse = ((1 - ((double)listFail.Count) / ((double)listPass.Count + (double)listFail.Count))) * 10;

                double behavior = ws.getBehaviorMark(r.studentID, currentSemester).behaviorMark;

                List <Curricurlum> attenList = new List <Curricurlum>();

                string t = fap.getAttendanceMark(r.studentID, currentSemester);
                if (!t.Equals("Data not found"))
                {
                    attenList = JsonConvert.DeserializeObject <List <Curricurlum> >(t);
                }


                int totalAbsent = 0;
                for (int i = 0; i < attenList.Count; i++)
                {
                    totalAbsent += attenList[i].absentTotal;
                }


                double      atten = Math.Round(((double)(attenList.Count * 30) - totalAbsent) / ((double)attenList.Count * 30), 2) * 10;
                Entity.Rate rt    = new Entity.Rate();
                rt               = getRate();
                r.rank           = Caculate(gpa, behavior, failcourse, atten, rt.markRate, rt.behRate, rt.failCout, rt.attentRate);
                r                = new Entity.Rank();
                r.studymark      = gpa;
                r.failcourseNumb = failcourse;
                r.behaviorMark   = behavior;
                r.attendance     = atten;
                r.rank           = Caculate(gpa, behavior, failcourse, atten, rt.markRate, rt.behRate, rt.failCout, rt.attentRate);
                isUpdateRank2(r.studentID.ToString(), r.rank, currentSemester);
            }
            return(r);
        }
Example #11
0
        public void Page_Load(object sender, EventArgs e)
        {
            Label10.Text   = "";
            lbNoitice.Text = "";
            Label1.Text    = "";
            Label11.Text   = "";
            lbResult.Text  = "";

            upLabel.Text = "";

            try
            {
                if ((Session["account"]) == null || (Session["role"]) == null || (Session["accountID"]) == null)
                {
                    Response.Redirect("~/UI/Login.aspx");
                }
                string selected  = Request.QueryString["studentID"];
                string checkrole = (string)(Session["role"]);
                string account   = (string)(Session["account"]);
                int    staffID   = (int)(Session["accountID"]);

                lbUserName.Text = account;

                if (checkrole == "HeadStaff")
                {
                    divide.Visible         = true;
                    logCare.Visible        = true;
                    control.Visible        = true;
                    btnUpdateStaff.Visible = true;
                    lbGuide.Visible        = true;
                    drpStaff.Visible       = true;
                }
                else
                {
                    divide.Visible         = false;
                    logCare.Visible        = false;
                    control.Visible        = false;
                    btnUpdateStaff.Visible = false;
                    lbGuide.Visible        = false;
                    drpStaff.Visible       = false;
                }
                Business.ScsBO sbo = new Business.ScsBO();
                //int staffID = (int)(Session["accountID"]);

                //ServiceReference1.WebService1SoapClient ws = new ServiceReference1.WebService1SoapClient();
                //ServiceReference1.Student s = ws.getStudentInf(selected);
                ServiceReference2.SAPISoapClient fap = new ServiceReference2.SAPISoapClient();
                List <StudentProfile>            stp = new List <StudentProfile>();
                string inf = fap.GetStudentById(selected);
                stp = JsonConvert.DeserializeObject <List <StudentProfile> >(inf);
                decimal t = fap.CheckBlance(selected);


                stImage.ImageUrl   = "data:image/png;base64," + Convert.ToBase64String(fap.RetriveImage(selected));
                currrentTerm.Text  = stp[0].currentTermNo;
                finance.Text       = t.ToString("00.##" + "VND");
                dob.Text           = stp[0].dateOfBirth.ToString("dd/MM/yyyy");
                addr.Text          = stp[0].address;
                name.Text          = stp[0].fullName;
                rollnumb.Text      = stp[0].rollNumber;
                phonenumb.Text     = stp[0].phone;
                mail.Text          = stp[0].email;
                curr.Text          = stp[0].batch;
                member.Text        = stp[0].membercode;
                ktx.Text           = stp[0].termPaid;
                dateofissue.Text   = stp[0].dateOfIsue.ToString("dd/MM/yyyy");
                major.Text         = stp[0].major;
                mode.Text          = stp[0].chuuyenNganh;
                status.Text        = stp[0].statusCode;
                limit7year.Text    = stp[0].HanBayNam;
                dropout.Text       = stp[0].QD_ThoiHoc;
                changeCampus.Text  = stp[0].QD_BaoLuu_Exchange;
                changeMajor.Text   = stp[0].qd_chuyennganh;
                getDiscipline.Text = stp[0].qD_kyluat;
                gruadation.Text    = stp[0].qD_Tn;
                svcq.Text          = stp[0].QD_SV_ChinhQuy;
                rejoin.Text        = stp[0].qD_rejoin;
                contact.Text       = stp[0].parentPhone;
                parent.Text        = stp[0].parentName;

                if (!Page.IsPostBack)
                {
                    string  currentSemester = "Spring2018";
                    RankDAL rdal            = new RankDAL();
                    //Comment cm = sbo.getComment(selected);
                    StatusCheck stk = sbo.loadTickCheckProfile(selected);
                    Rank        r   = rdal.loadRank(selected, currentSemester);

                    Student st = sbo.loadTakecareStaff(selected);
                    if (!string.IsNullOrEmpty(st.StaffName))
                    {
                        drpStaff.SelectedValue = st.StaffName;
                    }
                    else
                    {
                        Label24.Text = "Chưa có người chăm sóc , vui lòng chọn NV";
                    }


                    //TextArea1.Value = cm.content+"  bởi  "+cm.staffName;
                    drpChangeRank.SelectedValue = r.rank;

                    cbAttent.Checked = stk.attention;
                }



                Series series = Chart1.Series["Series1"];


                List <GpaTerm> list = sbo.listGpa(selected);
                Chart1.ChartAreas[0].AxisY.Title = "Điểm trung bình (GPA)";

                for (int i = 0; i < list.Count; i++)
                {
                    series.Points.AddXY(list[i].semester.ToString(), Math.Round(list[i].gpa, 2));
                    series.ToolTip = " #VALX  #VALY";
                }

                List <BehaviorTerm> beList = sbo.beList(selected);
                Series series2             = Chart2.Series["Series2"];
                Chart2.ChartAreas[0].AxisY.Title = "Điểm hành vi (Behavior)";
                for (int b = 0; b < beList.Count; b++)
                {
                    series2.Points.AddXY(beList[b].semester.ToString(), Math.Round(beList[b].behavior, 2));
                    series2.ToolTip = " #VALX  #VALY";
                }


                List <Curricurlum> listFail   = new List <Curricurlum>();
                string             failcourse = fap.getFailCourse(selected);
                if (!failcourse.Equals("Data not found"))
                {
                    listFail = JsonConvert.DeserializeObject <List <Curricurlum> >(failcourse);
                }

                for (int f = 0; f < listFail.Count; f++)
                {
                    pnStudy.Controls.Add(new LiteralControl(listFail[f].subjectCode + "</br>"));
                }
                this.lbFailnumb.Text = listFail.Count.ToString();

                //**********************
                //string currentSemester = "Spring2018";
                ServiceReference1.WebService1SoapClient    ws    = new ServiceReference1.WebService1SoapClient();
                ServiceReference1.ArrayOfGetTeacherComment flist = ws.getCommentBehavior(selected);
                for (int be = 0; be < flist.Count; be++)
                {
                    Panel3.Controls.Add(new LiteralControl(flist[be].contentComment + "  " + flist[be].teacherID + "</br>"));
                }
                //*****************

                DataTable dt = sbo.curriculum(selected);

                //Building an HTML string.
                StringBuilder html = new StringBuilder();

                //Table start.
                html.Append("<table id='curi' class='table table-hover'>");
                html.Append("<thead>");
                //Building the Header row.
                html.Append("<tr class='info'>");
                foreach (DataColumn column in dt.Columns)
                {
                    html.Append("<th>");
                    html.Append(column.ColumnName);
                    html.Append("</th>");
                }
                html.Append("</tr>");
                html.Append("</thead>");
                html.Append("<tbody>");
                //Building the Data rows.
                foreach (DataRow row in dt.Rows)
                {
                    html.Append("<tr>");
                    foreach (DataColumn column in dt.Columns)
                    {
                        html.Append("<td>");
                        html.Append(row[column.ColumnName]);
                        html.Append("</td>");
                    }
                    html.Append("</tr>");
                }

                //Table end.
                html.Append("</table>");
                html.Append("</tbody>");
                //Append the HTML string to Placeholder.
                Panel1.Controls.Add(new Literal {
                    Text = html.ToString()
                });

                //***************************************

                DataTable dt2 = sbo.getTimetable(selected);

                //Building an HTML string.
                StringBuilder html2 = new StringBuilder();

                //Table start.
                html2.Append("<table id='time' class='table table-hover'>");
                html2.Append("<thead>");
                //Building the Header row.
                html2.Append("<tr class='info'>");
                foreach (DataColumn column2 in dt2.Columns)
                {
                    html2.Append("<th>");
                    html2.Append(column2.ColumnName);
                    html2.Append("</th>");
                }
                html2.Append("</tr>");
                html2.Append("</thead>");
                html2.Append("<tbody>");
                //Building the Data rows.
                foreach (DataRow row2 in dt2.Rows)
                {
                    html2.Append("<tr>");
                    foreach (DataColumn column2 in dt2.Columns)
                    {
                        html2.Append("<td>");
                        html2.Append(row2[column2.ColumnName]);
                        html2.Append("</td>");
                    }
                    html2.Append("</tr>");
                }

                //Table end.
                html2.Append("</table>");
                html2.Append("</tbody>");
                //Append the HTML string to Placeholder.
                scheduleStudy.Controls.Add(new Literal {
                    Text = html2.ToString()
                });

                //********************************************************

                DataTable dt3 = sbo.scheduleExam(selected);

                //Building an HTML string.
                StringBuilder html3 = new StringBuilder();

                //Table start.
                html3.Append("<table id='exam' class='table table-hover'>");
                html3.Append("<thead>");
                //Building the Header row.
                html3.Append("<tr class='info'>");
                foreach (DataColumn column3 in dt3.Columns)
                {
                    html3.Append("<th>");
                    html3.Append(column3.ColumnName);
                    html3.Append("</th>");
                }
                html3.Append("</tr>");
                html3.Append("</thead>");
                html3.Append("<tbody>");
                //Building the Data rows.
                foreach (DataRow row3 in dt3.Rows)
                {
                    html3.Append("<tr>");
                    foreach (DataColumn column3 in dt3.Columns)
                    {
                        html3.Append("<td>");
                        html3.Append(row3[column3.ColumnName]);
                        html3.Append("</td>");
                    }
                    html3.Append("</tr>");
                }

                //Table end.
                html3.Append("</table>");
                html3.Append("</tbody>");
                //Append the HTML string to Placeholder.
                scheduleExam.Controls.Add(new Literal {
                    Text = html3.ToString()
                });
                //grOtherComment.DataBind();
            }
            catch (Exception ee)
            {
                Response.Redirect("~/UI/Error.aspx");
            }
        }