Example #1
0
    /// <summary>
    /// 获取PID栏目
    /// </summary>
    /// <param name="Pid"></param>
    /// <returns></returns>
    protected string GetChannelJson(int Pid)
    {
        string             json  = "";
        List <ModeChannel> list1 = ModeChannelProvider.GetMyID(Pid);
        List <ModeChannel> list  = ModeChannelProvider.SelectByParentID(Pid);

        for (int i = 0; i < list1.Count; i++)
        {
            json += "{\"ID\":" + list1[i].ID + ", \"Name\":\"" + list1[i].Name + "\", \"Brief\":\"" + Null(list1[i].Brief) + "\", \"OrderID\":\"" + list1[i].OrderID + "\", \"IsChild\":\"" + list1[i].Child.ToString() + "\", \"ParentID\":\"" + list1[i].ParentID + "\", \"Depth\":\"" + list1[i].Depth + "\", \"RootID\":\"" + list1[i].RootID + "\",\"News\":" + GetNews(list1[i].ID) + "},";
        }
        for (int i = 0; i < list.Count; i++)
        {
            json += "{\"ID\":" + list[i].ID + ", \"Name\":\"" + list[i].Name + "\", \"Brief\":\"" + Null(list[i].Brief) + "\", \"OrderID\":\"" + list[i].OrderID + "\", \"IsChild\":\"" + list[i].Child.ToString() + "\", \"ParentID\":\"" + list[i].ParentID + "\", \"Depth\":\"" + list[i].Depth + "\", \"RootID\":\"" + list[i].RootID + "\",\"News\":" + GetNews(list[i].ID) + "},";
        }
        json = json.Trim(',');

        return(json);
    }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        m_ExhibitionList = ModeChannelProvider.SelectAll();
        ChannelNews condition = new ChannelNews();
        ChannelNews value     = new ChannelNews();
        string      title     = GetstringKey("name");

        PCID = GetIntKey("pcid");
        if (title != "")
        {
            condition.Title = "%" + title + "%";
            condition.AddAttach("Title", "like");
        }
        if (PCID != 0)
        {
            condition.ChannelID = PCID;
        }
        condition.ExhibitionID = AdminMethod.ExhibitionID;
        m_tableManageList      = TableOperate <ChannelNews> .SelectByPage(value, condition, "order by  OrderID asc", PageSize, PageIndex, ref Count);

        DataBind();
        name.Value = title;
    }
Example #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Result result           = new Result();
        JavaScriptSerializer js = new JavaScriptSerializer();

        try
        {
            if (!string.IsNullOrEmpty(this.Request["iD"]))
            {
                int iD = Convert.ToInt32(this.Request["iD"]);

                if (TableOperate <ModeChannel> .Delete(iD) > 0)
                {
                    List <ModeChannel> channelList = ModeChannelProvider.SelectAll();
                    foreach (var item in channelList)
                    {
                        if (item.Path.IndexOf(this.Request["iD"]) > -1)
                        {
                            TableOperate <ModeChannel> .Delete(item.ID);
                        }
                    }
                    result.isOk = true;
                }
                else
                {
                    result.msg = "删除失败";
                }
            }
            else if (!string.IsNullOrEmpty(this.Request["checkshop"]))
            {
                string checkshop = Convert.ToString(this.Request["checkshop"]);
                checkshop = RequestString.NoHTML(checkshop);

                int id = TableOperate <ModeChannel> .MultiDelete(checkshop);

                if (id > 0)
                {
                    result.isOk = true;
                }
                else
                {
                    result.msg = "删除失败";
                }
            }
            else if (!string.IsNullOrEmpty(this.Request["all"]))
            {
                ModeChannel condition = new ModeChannel();
                condition.ExhibitionID = AdminMethod.ExhibitionID;
                int id = TableOperate <ModeChannel> .Delete(condition);

                if (id > 0)
                {
                    result.isOk = true;
                }
                else
                {
                    result.msg = "删除失败";
                }
            }
        }
        catch (Exception ex)
        {
            result.isOk = false;
            result.msg  = ex.ToString();
        }

        Response.ContentType = "text/json";
        Response.Write(js.Serialize(result));
        Response.End();
    }
Example #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        m_ExhibitionList = ModeChannelProvider.SelectAll();
        string action = GetstringKey("action");

        pid = GetIntKey("pid");
        if (action != "save")
        {
            if (!string.IsNullOrEmpty(this.Request["iD"]))
            {
                int         _iD       = Convert.ToInt32(this.Request["iD"]);
                ModeChannel condition = new ModeChannel();
                condition.ID = _iD;
                news         = TableOperate <ModeChannel> .GetRowData(condition);

                m_nowChild = Convert.ToString(news.Child).ToLower();
                iD.Value   = Convert.ToString(news.ID);
            }
            DataBind();
        }
        else
        {
            Result      result         = new Result();
            string      logbrief       = "";
            ModeChannel newChannelNews = new ModeChannel();
            newChannelNews.ID = 0;
            newChannelNews.AutoForm(this.Page);
            string Title = newChannelNews.Name;
            int    _iD;
            if (!string.IsNullOrEmpty(this.Request["iD"]))
            {
                _iD = Convert.ToInt32(this.Request["iD"]);
                ModeChannelProvider.Update(newChannelNews);
                result.msg = "编辑成功,等待返回列表";
                logbrief   = "管理员:【" + AdminMethod.AdminFullName + "】在" + DateTime.Now.GetDateTimeFormats('f')[0].ToString() + "编辑了为【" + Title + "】的场景模式";
            }
            else
            {
                newChannelNews.AddTime      = DateTime.Now;
                newChannelNews.AddID        = AdminMethod.AdminID;
                newChannelNews.ExhibitionID = AdminMethod.ExhibitionID;
                _iD        = ModeChannelProvider.Insert(newChannelNews);
                result.msg = "添加成功,等待返回列表";
                logbrief   = "管理员:【" + AdminMethod.AdminFullName + "】在" + DateTime.Now.GetDateTimeFormats('f')[0].ToString() + "添加了为【" + Title + "】的场景模式";
            }

            if (_iD > 0)
            {
                result.isOk = true;
                Lognet.AddLogin(logbrief);
            }
            else
            {
                result.msg = "操作失败";
            }
            Response.ContentType = "text/json";
            Response.Write(new JavaScriptSerializer().Serialize(result));
            Response.End();
        }
        DataBind();
    }
Example #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        m_ExhibitionList  = ChannelProvider.SelectAll();
        m_ExhibitionList1 = ModeChannelProvider.SelectAll();
        string action = GetstringKey("action");

        PCID = GetIntKey("pcid");
        if (action != "save")
        {
            if (!string.IsNullOrEmpty(this.Request["iD"]))
            {
                int  _iD       = Convert.ToInt32(this.Request["iD"]);
                News condition = new News();
                condition.ID = _iD;
                news         = TableOperate <News> .GetRowData(condition);

                iD.Value    = Convert.ToString(news.ID);
                state.Value = Convert.ToString(news.State);
            }
            DataBind();
        }
        else
        {
            Result result   = new Result();
            string logbrief = "";
            try
            {
                News newChannelNews = new News();
                newChannelNews.ID = 0;
                newChannelNews.AutoForm(this.Page);
                newChannelNews.FileType = SysConfig.CheckPlayType(newChannelNews.Files);
                if (newChannelNews.JsonStr == "" || newChannelNews.JsonStr == null)
                {
                    newChannelNews.JsonStr = "{\"type\": \"google\",\"data\": \"\"}";
                }

                string oldFiles = GetstringKey("oldFiles");
                if (oldFiles != newChannelNews.Files && newChannelNews.FileType == 4)
                {
                    string piczip = CloudSQL.GetPicZip(newChannelNews.Files, news.Files1);
                    newChannelNews.Files1 = piczip;
                }


                string Title = newChannelNews.Title;
                int    _iD;
                if (!string.IsNullOrEmpty(this.Request["iD"]))
                {
                    _iD = Convert.ToInt32(this.Request["iD"]);
                    newChannelNews.AddTime = DateTime.Now;
                    TableOperate <News> .Update(newChannelNews);

                    result.msg = "编辑成功,等待返回列表";
                    logbrief   = "管理员:【" + AdminMethod.AdminFullName + "】在" + DateTime.Now.GetDateTimeFormats('f')[0].ToString() + "编辑了资源【" + Title + "】";
                }
                else
                {
                    newChannelNews.AddTime      = DateTime.Now;
                    newChannelNews.AddID        = AdminMethod.AdminID;
                    newChannelNews.ExhibitionID = AdminMethod.ExhibitionID;
                    newChannelNews.TypeID       = 0;
                    newChannelNews.IsShare      = 0;
                    newChannelNews.OldID        = 0;
                    newChannelNews.OrderID      = CloudSQL.GetNowTime();
                    _iD = TableOperate <News> .InsertReturnID(newChannelNews);

                    result.msg = "添加成功,等待返回列表";
                    logbrief   = "管理员:【" + AdminMethod.AdminFullName + "】在" + DateTime.Now.GetDateTimeFormats('f')[0].ToString() + "添加了资源【" + Title + "】";
                }

                if (_iD > 0)
                {
                    result.isOk = true;
                    Lognet.AddLogin(logbrief);
                    if (newChannelNews.State == 1)
                    {
                        CloudSQL.UpdataVesion(newChannelNews.PcID);
                    }
                }
                else
                {
                    result.msg = "操作失败";
                }
            }
            catch (Exception ex)
            {
                result.isOk = false;
                result.msg  = "操作失败";
            }
            Response.ContentType = "text/json";
            Response.Write(new JavaScriptSerializer().Serialize(result));
            Response.End();
        }
        DataBind();
    }
Example #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
//        [{
//	"text": "父节点 1",
//	"nodes": [{
//		"text": "子节点 1",
//		"nodes": [{
//			"text": "孙子节点 1"

//        }, {
//			"text": "孙子节点 2"
//		}]
//	}, {
//		"text": "子节点 2"
//	}]
//}, {
//	"text": "父节点 2"
//}, {
//	"text": "父节点 3"
//}, {
//	"text": "父节点 4"
//}, {
//	"text": "父节点 5"
//}]
        channelList = ModeChannelProvider.SelectAll();
        string arrstr = "";

        for (int i = 0; i < channelList.Count; i++)
        {
            arrstr += channelList[i].ID + ",";
        }
        string[] arry     = arrstr.TrimEnd(',').Split(',');
        string   TreeJson = "[";
        string   JsonData = "";

        for (int i = 0; i < channelList.Count; i++)
        {
            if (channelList[i].Depth == 0)
            {
                JsonData += "{";
                JsonData += "\"text\":\"" + channelList[i].Name + "\"";
                JsonData += ",\"id\":\"" + channelList[i].ID + "\"";
                JsonData += ",\"itemid\":\"" + i + "\"";
                if (channelList[i].Child)
                {
                    JsonData += GetChild(channelList[i].ID);
                }
                JsonData += "},";
            }
            else
            {
                if (!((IList)arry).Contains(channelList[i].ParentID + ""))
                {
                    JsonData += "{";
                    JsonData += "\"text\":\"" + channelList[i].Name + "\"";
                    JsonData += ",\"id\":\"" + channelList[i].ID + "\"";
                    JsonData += "},";
                }
            }
        }
        JsonData  = JsonData.TrimEnd(',');
        TreeJson += JsonData + "]";
        Response.Write(TreeJson);
    }