Exemplo n.º 1
0
        public void Sel_ByID(HttpContext context)
        {
            String jSonString = "";
            int IDCategoryLevel1 = int.Parse(context.Request.QueryString["IDCategoryLevel1"]);
            bool Disable = !String.IsNullOrEmpty(context.Request.QueryString["Disable"])
             ? Convert.ToBoolean(context.Request.QueryString["Disable"])
             : false;
            CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO();
            CategoryLevel1 obj = String.IsNullOrEmpty(context.Request.QueryString["Disable"]) ?
            aCategoryLevel1BO.Sel_ByID(IDCategoryLevel1) :
            aCategoryLevel1BO.Sel_ByID(IDCategoryLevel1, Disable);

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

                jSonString = JsonConvert.SerializeObject(obj, _converter);
            }
            jSonString = "{\"data\":" + jSonString + "}";
            context.Response.Write(jSonString);
        }
Exemplo n.º 2
0
        //=================================================================================================
        public void Upd_Disable(HttpContext context)
        {
            int ret = -1;
            String jSonString = "";
            try
            {
                CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO();
                List<CategoryLevel1> listCategoryLevel1 = new List<CategoryLevel1>();
                string Code = aCategoryLevel1BO.Sel_ByID(int.Parse(context.Request.QueryString["IDCategoryLevel1"])).Code;

                for (int i = 0; i < listCategoryLevel1.Count; i++)
                {
                    listCategoryLevel1[i].Disable = true;
                    ret = aCategoryLevel1BO.Upd(listCategoryLevel1[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);
            }
        }