Пример #1
0
        protected void RemoveItem()
        {
            KingTop.Common.AjaxMessage msg = new KingTop.Common.AjaxMessage();
            string sId = Utils.RequestStr("id");

            try
            {
                string sSql    = string.Format("update K_Category set IsDel=1 where ID=" + sId);
                int    iCounts = SQLHelper.ExecuteNonQuery(sSql);
                if (iCounts > 0)
                {
                    msg.Code = 200;
                    KingTop.Modules.BLL.Categorys bCategory = new KingTop.Modules.BLL.Categorys();
                    bCategory.SetCategoryCache();
                }
                else
                {
                    msg.Code    = 404;
                    msg.Message = "数据不存在";
                }
            }
            catch (Exception err)
            {
                msg.Code    = 500;
                msg.Message = err.Message;
            }


            ShowText(msg.ToJson());
        }
Пример #2
0
        protected void GetSelect()
        {
            KingTop.Common.AjaxMessage msg = new KingTop.Common.AjaxMessage();
            string sName = Utils.RequestStr("name");

            if (string.IsNullOrEmpty(sName))
            {
                sName = "CategoryIDS";
            }
            try
            {
                KingTop.Modules.BLL.Categorys bCategory = new KingTop.Modules.BLL.Categorys();
                dt = bcategory.GetCategoryCache();
                StringBuilder sb = new StringBuilder();
                sb.Append("<span class=\"spancategory\">");
                sb.AppendFormat("<select name=\"{0}\" class=\"addcategorycss\">", sName);
                sb.Append("<option value=\"0\">请选择分类</option>");
                sb.Append(InnerCategory("0"));
                sb.Append("</select>");
                sb.Append("<a href=\"javascript:\" onclick=\"removeCategory(this)\">删除</a>");
                sb.Append("</span>");
                msg.Code    = 200;
                msg.Message = sb.ToString();
            }
            catch (Exception err)
            {
                msg.Code    = 500;
                msg.Message = err.Message;
            }
            ShowText(msg.ToJson());
        }
Пример #3
0
        protected void ShowIndex()
        {
            KingTop.Common.AjaxMessage msg = new KingTop.Common.AjaxMessage();
            string sId = Utils.RequestStr("id");

            try
            {
                string sStr = string.Empty;
                KingTop.Modules.BLL.Categorys bCategory = new KingTop.Modules.BLL.Categorys();
                DataTable dt = bcategory.GetCategoryCache();
                if (dt != null && dt.Rows.Count > 0)
                {
                    DataRow[] dr = dt.Select("ID=" + sId);
                    if (dr.Length > 0)
                    {
                        sStr = dr[0]["IsIndex"].ToString() == "1" ? "0" : "1";
                    }
                    string sSql    = string.Format("update K_Category set IsIndex={0} where ID={1}", sStr, sId);
                    int    iCounts = SQLHelper.ExecuteNonQuery(sSql);
                    if (iCounts > 0)
                    {
                        msg.Code = 200;
                        msg.Data = sStr;
                        bCategory.SetCategoryCache();
                    }
                    else
                    {
                        msg.Code    = 404;
                        msg.Message = "数据不存在";
                    }
                }
                else
                {
                    msg.Code    = 404;
                    msg.Message = "数据不存在";
                }
            }
            catch (Exception err)
            {
                msg.Code    = 500;
                msg.Message = err.Message;
            }
            ShowText(msg.ToJson());
        }