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 #2
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 #3
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");
            }
        }