public string Get(string config, string para)
        {
            try
            {
                string id = JsonConvert.DeserializeObject <Dictionary <string, string> >(para)["id"];
                if (id.Equals("id_user"))
                {
                    if (dicAppSet == null || dicAppSet.Count == 0)
                    {
                        general gn = new general();
                        dicAppSet = gn.ReadAppseting();
                        if (dicAppSet == null || dicAppSet.Count == 0)
                        {
                            return("{\"result\":\"ERROR\",\"data\":[{\"status\":\"Đọc appsetting lỗi\"}]}");
                        }
                    }

                    if (config == null || para == null)
                    {
                        return("{\"result\":\"ERROR\",\"data\":[{\"status\":\"Kiểm tra lại định dạng json đầu vào\"}]}");
                    }

                    Db_Access ac    = new Db_Access();
                    var       check = ac.checkRequertLienTuc(HttpContext.Current, dicAppSet, config, para);
                    if (!check)
                    {
                        return("{\"result\":\"ERROR\",\"data\":[{\"status\":\"Không cho phép request liên tục\"}]}");
                    }

                    gnOracle orc  = new gnOracle();
                    var      json = orc.ExcuteStores(config, para, dicAppSet);
                    return(json);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Exemple #2
0
        // POST api/ExcuteOracle
        public string Post(ValueModelOracle value)
        {
            if (dicAppSet == null || dicAppSet.Count == 0)
            {
                general gn = new general();
                dicAppSet = gn.ReadAppseting();
                if (dicAppSet == null || dicAppSet.Count == 0)
                {
                    return("{\"result\":\"ERROR\",\"data\":[{\"status\":\"Đọc appsetting lỗi\"}]}");
                }
            }

            if (value == null || value.config == null)
            {
                return("{\"result\":\"ERROR\",\"data\":[{\"status\":\"Kiểm tra lại định dạng json đầu vào\"}]}");
            }

            Db_Access ac    = new Db_Access();
            var       check = ac.checkRequertLienTuc(HttpContext.Current, dicAppSet, value.config, value.para);

            if (!check)
            {
                return("{\"result\":\"ERROR\",\"data\":[{\"status\":\"Không cho phép request liên tục\"}]}");
            }
            //Db_Access_Cookie cook = new Db_Access_Cookie();
            //HttpCookie cookie = HttpContext.Current.Request.Cookies["Cookie"];
            //var checkCook = cook.checkCookie(cookie, dicAppSet, value.config);

            //var json = "";
            //if (checkCook == "ERROR")
            //{
            //    return "{\"result\":\"CookieError\",\"data\":[]}";
            //}
            //else
            //{
            gnOracle orc  = new gnOracle();
            var      json = orc.ExcuteStores(value.config, value.para, dicAppSet);

            //  }
            return(json);
        }