Пример #1
0
        public static List <GetUserProfile> GetUserProfileInfo(string id)
        {
            getUserProfile.Clear();
            wcf.parti.Service1 _parti     = new wcf.parti.Service1();
            partiDB.RootObject rootObject = new partiDB.RootObject();

            string json_str = _parti.GetTrainerList(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.GetTrainerList)
                {
                    getUserProfile.Add(new GetUserProfile(vl.id, vl.fullname_la, vl.fullname_eng, vl.date_of_birth, vl.sex, vl.status, vl.village, vl.district,
                                                          vl.province, vl.work_place, vl.department, vl.position, vl.date_of_govermented, vl.office_tel, vl.mobile_tel, vl.email,
                                                          vl.avatar_url, vl.doc1_url, vl.doc2_url, vl.doc3_url, vl.doc4_url, vl.doc5_url, vl.username, vl.education_level, vl.education_major,
                                                          vl.education_country, vl.educated_year, vl.education_name));
                }
            }
            return(getUserProfile);
        }
Пример #2
0
        private List <GetTrainerList> GetTrainerLists()
        {
            TrainerLists.Clear();
            wcf.parti.Service1 _parti     = new wcf.parti.Service1();
            partiDB.RootObject rootObject = new partiDB.RootObject();

            string json_str = _parti.GetTrainerList("");

            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
            {
                int i = 0;
                rootObject = JsonConvert.DeserializeObject <partiDB.RootObject>(json_str);
                foreach (var vl in rootObject.GetTrainerList)
                {
                    TrainerLists.Add(new GetTrainerList(vl.id, vl.fullname_la, vl.fullname_eng, vl.date_of_birth, vl.sex, vl.status, vl.village, vl.district,
                                                        vl.province, vl.work_place, vl.department, vl.position, vl.date_of_govermented, vl.office_tel, vl.mobile_tel, vl.email,
                                                        vl.avatar_url, vl.doc1_url, vl.doc2_url, vl.doc3_url, vl.doc4_url, vl.doc5_url, vl.username, vl.education_level, vl.education_major,
                                                        vl.education_country, vl.educated_year, vl.education_name));
                    //Render Carousel
                    HtmlElement carouselItem = new HtmlElement();
                    carouselItem.InnerHtml = "<div class='card card-profiler laotxt hvr-grow-shadow' data-cindex='" + i + "'>" +
                                             "<div class='card-image'>" +
                                             "<a href='#'><img class='img' src='" + vl.avatar_url.Replace("~", "") + "'></a>" +
                                             "</div>" +
                                             "<div class='table center'>" +
                                             "<p class='truncate'>" + vl.fullname_la + "</p>" +
                                             "<p class='truncate'>" + vl.position + "</p>" +
                                             "<button id='btn" + i + "' value='" + i + "' onclick='SetTrainerInfo(this.value); return false;' type='button' " +
                                             "class='btn-floating btn-small waves-effect waves-light red darken-3 tooltipped modal-trigger' href='#modalTrainer' data-position='buttom' " +
                                             "data-tooltip='ຂໍ້ມູນເພີ່ມຕື່ມ'><i class='material-icons'>keyboard_arrow_down</i></button>" +
                                             "</div></div>";
                    crsTrainerList.Controls.AddAt(i, carouselItem);
                    i++;
                }
                lblTotalTrainer.InnerText = i.ToString();
            }
            return(TrainerLists);
        }
Пример #3
0
        public List <Trainers.GetTrainerList> GetTrainerLists()
        {
            TrainerLists.Clear();
            wcf.parti.Service1 _parti     = new wcf.parti.Service1();
            partiDB.RootObject rootObject = new partiDB.RootObject();

            string json_str = _parti.GetTrainerList("");

            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
            {
                int i = 1;
                rootObject = JsonConvert.DeserializeObject <partiDB.RootObject>(json_str);
                //Parallel.ForEach(rootObject.GetTrainerList, vl =>
                //{

                //});
                foreach (var vl in rootObject.GetTrainerList)
                {
                    TrainerLists.Add(new Trainers.GetTrainerList(vl.id, vl.fullname_la, vl.fullname_eng, vl.date_of_birth, vl.sex, vl.status, vl.village, vl.district,
                                                                 vl.province, vl.work_place, vl.department, vl.position, vl.date_of_govermented, vl.office_tel, vl.mobile_tel, vl.email,
                                                                 vl.avatar_url, vl.doc1_url, vl.doc2_url, vl.doc3_url, vl.doc4_url, vl.doc5_url, vl.username, vl.education_level, vl.education_major,
                                                                 vl.education_country, vl.educated_year, vl.education_name));
                    //Render Table Trainer Choice
                    HtmlElement _tbody  = new HtmlElement();
                    HtmlElement _tbody2 = new HtmlElement();

                    _tbody.InnerHtml = "<tr id='1Tner" + i + "' class='trTrainer'>" +
                                       "<td>" + vl.fullname_la + ", " + vl.work_place + ".</td>" +
                                       "<td><div class='row'><div class='col'>" +
                                       "<button type='button' class='btn-floating btn-small z-depth-3 blue tooltipped " +
                                       "hvr-grow-shadow' " +
                                       "href='#!' data-position='left' data-tooltip='ເລືອກເອົາ' id='1Tner" + i + "' name='2Tner" + i + "' " +
                                       "onclick='Select(this.id, this.name)'><i class='material-icons'>send</i></button>" +
                                       "</div>&nbsp;<div class='col'></div></div></td>" +
                                       "<input type='hidden' value='" + vl.id + "' id='i1Tner" + i + "'/></tr>";

                    _tbody2.InnerHtml = "<tr id='2Tner" + i + "' hidden>" +
                                        "<td>" + vl.fullname_la + ", " + vl.work_place + ".</td>" +
                                        "<td><div class='row'><div class='col'>" +
                                        "<button type='button' class='btn-floating btn-small z-depth-3 red darken-3 tooltipped " +
                                        "hvr-grow-shadow' " +
                                        "href='#!' data-position='right' data-tooltip='ລົບອອກ' id='2Tner" + i + "' name='1Tner" + i + "' " +
                                        "onclick='Disselect(this.id, this.name)'><i class='material-icons'>delete_forever</i></button>" +
                                        "</div>&nbsp;<div class='col'></div></div></td>" +
                                        "<input type='hidden' id='i2Tner" + i + "' value='" + vl.id + "' /></tr>";
                    tbTnerBody1.Controls.Add(_tbody);
                    tbTnerBody2.Controls.Add(_tbody2);
                    i++;
                }//);
            }
            return(TrainerLists);
        }