예제 #1
0
        public static List <CheckTraineeForTraining> checkTraineeForTrainings(string trainee_id, string course_id)
        {
            listCheckTraineeForTraining.Clear();
            wcf.parti.Service1 _parti     = new wcf.parti.Service1();
            partiDB.RootObject rootObject = new partiDB.RootObject();

            string json_str = _parti.CheckTraineeForTraining(trainee_id, course_id);

            if (json_str == "e0")//code error
            {
                MessageBox.swalModal(_Page, "error", "e0:ລະບົບຂັດຂ້ອງຕິດຕໍ່ຜູ້ເບີ່ງແຍ່ງດ່ວນ.", "");
            }
            else if (json_str == "e1")//no data found
            {
                MessageBox.swalModal(_Page, "info", "e1:ບໍ່ມີຂໍ້ມູນທີ່ຈະສະແດງ.", "");
            }
            else if (json_str == "e2")//can't connect databbase
            {
                MessageBox.swalModal(_Page, "warning", "e2:ບໍ່ສາມາດເຊື່ອມຕໍ່ຖານຂໍ້ມູນໄດ້.", "");
            }
            else
            {
                rootObject = JsonConvert.DeserializeObject <partiDB.RootObject>(json_str);
                foreach (var vl in rootObject.CheckTraineeForTraining)
                {
                    listCheckTraineeForTraining.Add(new CheckTraineeForTraining(vl.id, vl.trainee_id, vl.course_id, vl.course_name,
                                                                                vl.title, vl.training_address, vl.training_date, vl.code));
                }
            }

            return(listCheckTraineeForTraining);
        }