コード例 #1
0
        public List <GetTraineeList> GetTraineeLists()
        {
            TraineeLists.Clear();
            wcf.parti.Service1 _parti     = new wcf.parti.Service1();
            partiDB.RootObject rootObject = new partiDB.RootObject();

            string json_str = _parti.GetTraineeList("");

            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);
                foreach (var vl in rootObject.GetTraineeList)
                {
                    TraineeLists.Add(new GetTraineeList(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.approval_id, vl.doc1_url, vl.doc2_url, vl.doc3_url, vl.doc4_url, vl.doc5_url, vl.appr_id, vl.appr_fullname, vl.appr_position_name, vl.appr_position_major,
                                                        vl.appr_relationship_trainee, vl.appr_office_name, vl.appr_office_tel, vl.appr_mobile_tel, vl.appr_email, vl.education_level, vl.education_major,
                                                        vl.education_country, vl.educated_year, vl.education_name));
                    //Render Table
                    HtmlElement _tbody = new HtmlElement();
                    _tbody.InnerHtml = "<tr id='" + i + "' class='search_result'>" +
                                       "<td>" + i + "</td>" +
                                       "<td><img class='materialboxed circle z-depth-3' width='50' " +
                                       "height='50' src='" + vl.avatar_url + "'></td>" +
                                       "<td>" + vl.id + "</td>" +
                                       "<td>" + vl.fullname_la + "</td>" +
                                       "<td>" + vl.work_place + "</td>" +
                                       "<td><div class='row'><div class='col'><button type='button' " +
                                       "class='btn btn-small teal darken-2 tooltipped hvr-grow-shadow modal-trigger z-depth-3' " +
                                       "href='#modalTrainee' data-position='left' data-tooltip='ແກ້ໄຂຂໍ້ມູນ' " +
                                       "id='" + (i - 1) + "' onclick='SetTraineeInfo(this.id)'>" +
                                       "<i class='material-icons'>edit</i></button></div></div></td></tr>";
                    tbBody.Controls.Add(_tbody);
                    i++;
                }
                lblTotalTrainer.InnerText = (i - 1).ToString();
            }
            return(TraineeLists);
        }
コード例 #2
0
        public List <Trainee.GetTraineeList> GetTraineeLists()
        {
            TraineeLists.Clear();
            wcf.parti.Service1 _parti     = new wcf.parti.Service1();
            partiDB.RootObject rootObject = new partiDB.RootObject();

            string json_str = _parti.GetTraineeList("");

            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.GetTraineeList, vl =>
                //{
                foreach (var vl in rootObject.GetTraineeList)
                {
                    TraineeLists.Add(new Trainee.GetTraineeList(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.approval_id, vl.doc1_url, vl.doc2_url, vl.doc3_url, vl.doc4_url, vl.doc5_url, vl.appr_id, vl.appr_fullname, vl.appr_position_name, vl.appr_position_major,
                                                                vl.appr_relationship_trainee, vl.appr_office_name, vl.appr_office_tel, vl.appr_mobile_tel, vl.appr_email, 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='1Tnee" + i + "' class='trTrainee'>" +
                                       "<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='1Tnee" + i + "' name='2Tnee" + 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='i1Tnee" + i + "'/></tr>";

                    _tbody2.InnerHtml = "<tr id='2Tnee" + 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='2Tnee" + i + "' name='1Tnee" + 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='i2Tnee" + i + "' value='" + vl.id + "' /></tr>";
                    tbTneeBody1.Controls.Add(_tbody);
                    tbTneeBody2.Controls.Add(_tbody2);
                    i++;
                }//);
            }
            return(TraineeLists);
        }