Exemplo n.º 1
0
        public void Upd_Disable(HttpContext context)
        {
            int ret = -1;
            String jSonString = "";
            try {
                ContentsBO aContentsBO = new ContentsBO();
                List<Contents> listContents = new List<Contents>();
                string Code = aContentsBO.Sel_ByID(int.Parse(context.Request.QueryString["IDContents"])).Code;
                //listContents = aContentsBO.Sel_all_ByCode(Code);
                for (int i = 0; i < listContents.Count; i++) {
                    listContents[i].Disable = true;
                    ret = aContentsBO.Upd(listContents[i]);
                }

                if (ret != 0) {
                    jSonString = "{\"status\":\"error|" + ret.ToString() + "\"}";

                }

                if (ret == 0) { jSonString = "{\"status\": \"success\"}"; }
            }
            catch (Exception ex) {
                jSonString = "{\"status\":\"error\" ,\"message\":\"" + ex.Message.ToString() + "\"}";
            }
            finally {
                context.Response.Write(jSonString);
            }
        }
Exemplo n.º 2
0
        public void Sel_ByID(HttpContext context)
        {
            String jSonString = "";
            int IDContents = int.Parse(context.Request.QueryString["IDContents"]);

            ContentsBO aContentsBO = new ContentsBO();
            Contents obj = aContentsBO.Sel_ByID(IDContents);
            //obj.Info = HttpUtility.HtmlDecode(obj.Info);
            //obj.Intro = HttpUtility.HtmlDecode(obj.Intro);

            if (obj != null) {
                _converter.DateTimeFormat = "dd/MM/yyyy";

                jSonString = JsonConvert.SerializeObject(obj, _converter);
            }
            jSonString = "{\"data\":" + jSonString + "}";
            context.Response.Write(jSonString);
        }