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