Пример #1
0
        public static string EditQAnswers(string action, string a_id, string answer_text, string q_id, string t_id, string status)
        {
            string result = null;

            wcf.parti.Service1 _parti = new wcf.parti.Service1();
            string             json_str;

            json_str = _parti.GetAnswer(a_id, q_id, t_id);
            if (json_str == "e0")//code error
            {
                result = "e0:ລະບົບຂັດຂ້ອງຕິດຕໍ່ຜູ້ເບີ່ງແຍ່ງດ່ວນ.";
            }
            else if (json_str == "e1" && action == "add")//no data found
            {
                json_str = _parti.EditQAnswers(action, a_id, answer_text, q_id, t_id, status);
                if (json_str == "e0")//code error
                {
                    result = "e0:ລະບົບຂັດຂ້ອງຕິດຕໍ່ຜູ້ເບີ່ງແຍ່ງດ່ວນ.";
                }
                else if (json_str == "e1")//no data found
                {
                    result = "e1:ບໍ່ມີຂໍ້ມູນທີ່ຈະສະແດງ.";
                }
                else if (json_str == "e2")//can't connect databbase
                {
                    result = "e2:ບໍ່ສາມາດເຊື່ອມຕໍ່ຖານຂໍ້ມູນໄດ້.";
                }
                else if (json_str == "e5")
                {
                    result = "e5";
                }
            }
            else if (json_str == "e2")//can't connect databbase
            {
                result = "e2:ບໍ່ສາມາດເຊື່ອມຕໍ່ຖານຂໍ້ມູນໄດ້.";
            }
            else if (json_str == "e3")
            {
                if (action == "add")
                {
                    result = "e3:ຄຳຕອບນີ້ມີໃນຖານຂໍ້ມູນແລ້ວ.";
                }
                else if (action == "del")
                {
                    json_str = _parti.EditQAnswers(action, a_id, answer_text, q_id, t_id, status);
                    if (json_str == "e0")//code error
                    {
                        result = "e0:ລະບົບຂັດຂ້ອງຕິດຕໍ່ຜູ້ເບີ່ງແຍ່ງດ່ວນ.";
                    }
                    else if (json_str == "e1")//no data found
                    {
                        result = "e1:ບໍ່ມີຂໍ້ມູນທີ່ຈະສະແດງ.";
                    }
                    else if (json_str == "e2")//can't connect databbase
                    {
                        result = "e2:ບໍ່ສາມາດເຊື່ອມຕໍ່ຖານຂໍ້ມູນໄດ້.";
                    }
                    else if (json_str == "e5")
                    {
                        result = "e5";
                    }
                }
            }

            return(result);
        }