示例#1
0
    private void SetGuideDetail()
    {
        int    id     = SiteAbout.gInt("id");
        string name   = SiteAbout.gStr("name");
        string url    = SiteAbout.gStr("url");
        string type   = SiteAbout.gStr("type");
        int    sortid = SiteAbout.gInt("sortid");

        if (id > 0)
        {
            zs.Model.Tbl_Guide modelGuide = bllGuide.GetModel(id);
            modelGuide.sortid    = sortid;
            modelGuide.type      = type;
            modelGuide.url       = url;
            modelGuide.name      = name;
            Response.ContentType = "application/json";
            if (bllGuide.Update(modelGuide))
            {
                if (type == "news")
                {
                    modelGuide.url = "./newslist.aspx?id=" + ApplicationMethod.encript(id.ToString());
                    bllGuide.Update(modelGuide);
                }
                Response.Write("{\"status\":\"true\"}");
            }
            else
            {
                Response.Write("{\"status\":\"false\"}");
            }
        }
        else
        {
            if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(url) || string.IsNullOrEmpty(type))
            {
                return;
            }
            zs.Model.Tbl_Guide modelGuide = new zs.Model.Tbl_Guide();
            modelGuide.pid       = 0;
            modelGuide.sortid    = sortid;
            modelGuide.type      = type;
            modelGuide.url       = url;
            modelGuide.name      = name;
            Response.ContentType = "application/json";
            int ret = bllGuide.Add(modelGuide);
            if (ret > 0)
            {
                if (type == "news")
                {
                    modelGuide.id  = ret;
                    modelGuide.url = "./newslist.aspx?id=" + ApplicationMethod.encript(ret.ToString());
                    bllGuide.Update(modelGuide);
                }
                Response.Write("{\"status\":\"true\"}");
            }
            else
            {
                Response.Write("{\"status\":\"false\"}");
            }
        }
    }
示例#2
0
    private void GetGuideDetail()
    {
        int id = SiteAbout.gInt("id");

        zs.Model.Tbl_Guide modelGuide = bllGuide.GetModel(id);
        string             temp       = "";

        if (modelGuide != null)
        {
            temp = ("{\"id\":\"" + id +
                    "\",\"name\":\"" + modelGuide.name +
                    "\",\"url\":\"" + modelGuide.url +
                    "\",\"type\":\"" + modelGuide.type +
                    "\",\"sortid\":\"" + modelGuide.sortid.ToString() + "\"}");
        }
        Response.ContentType = "application/json";
        Response.Write(temp);
    }
示例#3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <zs.Model.Tbl_Guide> DataTableToList(DataTable dt)
        {
            List <zs.Model.Tbl_Guide> modelList = new List <zs.Model.Tbl_Guide>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                zs.Model.Tbl_Guide model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new zs.Model.Tbl_Guide();
                    if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    if (dt.Rows[n]["pid"] != null && dt.Rows[n]["pid"].ToString() != "")
                    {
                        model.pid = int.Parse(dt.Rows[n]["pid"].ToString());
                    }
                    if (dt.Rows[n]["name"] != null && dt.Rows[n]["name"].ToString() != "")
                    {
                        model.name = dt.Rows[n]["name"].ToString();
                    }
                    if (dt.Rows[n]["url"] != null && dt.Rows[n]["url"].ToString() != "")
                    {
                        model.url = dt.Rows[n]["url"].ToString();
                    }
                    if (dt.Rows[n]["sortid"] != null && dt.Rows[n]["sortid"].ToString() != "")
                    {
                        model.sortid = int.Parse(dt.Rows[n]["sortid"].ToString());
                    }
                    if (dt.Rows[n]["type"] != null && dt.Rows[n]["type"].ToString() != "")
                    {
                        model.type = dt.Rows[n]["type"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
示例#4
0
    public string GetGuides()
    {
        StringBuilder             sb     = new StringBuilder();
        List <zs.Model.Tbl_Guide> models = bll.GetModelList(" pid=0 order by sortid asc");

        zs.Model.Tbl_Guide ri = new zs.Model.Tbl_Guide();
        for (int i = 0; i < models.Count; i++)
        {
            ri = models[i];
            if (i == (models.Count - 1))
            {
                sb.Append("<li class='last'>");
                sb.Append("<a href='" + ri.url + "'>");
                sb.Append(ri.name);
                sb.Append("</a>");
                List <zs.Model.Tbl_Guide> modelss = bll.GetModelList(" pid=" + ri.id + " order by sortid asc");
                if (modelss.Count > 0)
                {
                    sb.Append(erjizuhe(modelss));
                }
                sb.Append("</li>");
            }
            else
            {
                sb.Append("<li>");
                sb.Append("<a href='" + ri.url + "'>");
                sb.Append(ri.name);
                sb.Append("</a>");
                List <zs.Model.Tbl_Guide> modelss = bll.GetModelList(" pid=" + ri.id + " order by sortid asc");
                if (modelss.Count > 0)
                {
                    sb.Append(erjizuhe(modelss));
                }
                sb.Append("</li>");
            }
        }
        return(sb.ToString());
    }
示例#5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(zs.Model.Tbl_Guide model)
 {
     return(dal.Update(model));
 }
示例#6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(zs.Model.Tbl_Guide model)
 {
     return(dal.Add(model));
 }