Пример #1
0
        private PMSModel.JsonModel GetDataHelper(HttpRequest request, HashtableCustom ht)
        {
            PMSModel.JsonModel jsonModel = new PMSModel.JsonModel();
            try
            {
                ht.Add_Key(MenuIds, request);
                ht.Add_Key(IsDelete, request);

                ht.Add_Key(isPush, request);
                ht.Add_Key(PageIndex, request);
                ht.Add_Key(PageSize, request);
                ht.Add_Key(ImageUrl, request);

                ht.Add_Key(NotItem, request);
                ht.Add_Key(ChildId, request);
                ht.Add_Key(isAll, request);

                jsonModel = BllAdvert.GetDataInfo(ht);
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }

            return(jsonModel);
        }
Пример #2
0
        public void GetNewData(HttpContext context)
        {
            HttpRequest request = context.Request;

            PMSModel.JsonModel jsonModel = new PMSModel.JsonModel();
            try
            {
                HashtableCustom ht = new HashtableCustom();
                ht.Add_Key(PageIndex, request);
                ht.Add_Key(PageSize, request);
                ht.Add_Key(isPush, request);
                ht.Add_Key(IsDelete, request);

                jsonModel = BllAdvert.GetAdvertData(ht);
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
                jsonModel = new PMSModel.JsonModel()
                {
                    errMsg  = ex.Message,
                    retData = "",
                    status  = "no"
                };
            }
            finally
            {
                context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}");
            }
        }
Пример #3
0
        public void SetAdvertisingTop(HttpContext context)
        {
            HttpRequest request = context.Request;

            PMSModel.JsonModel jsonModel = new PMSModel.JsonModel();
            try
            {
                HashtableCustom ht = new HashtableCustom();
                ht.Add_Key(MenuId, request);
                ht.Add_Key(Id, request);
                jsonModel = BllAdvert.SetAdvertisingTop(ht);
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
                jsonModel = new PMSModel.JsonModel()
                {
                    errMsg = ex.Message,
                };
            }
            finally
            {
                context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}");
            }
        }
Пример #4
0
        /// <summary>
        /// 根据菜单子节点和父节点获得菜单下的分类信息(以及不包括那些节点NotItem)
        /// </summary>
        /// <param name="context"></param>
        public void GetAdvertising(HttpContext context)
        {
            HttpRequest request = context.Request;

            PMSModel.JsonModel jsonModel = new PMSModel.JsonModel();
            try
            {
                HashtableCustom ht = new HashtableCustom();

                string sqlWhere = "";

                var d = request["IsDelete"];

                if (!string.IsNullOrEmpty(request[IsDelete]))
                {
                    sqlWhere += "IsDelete=" + request[IsDelete];
                }
                if (!string.IsNullOrEmpty(request[isPush]))
                {
                    sqlWhere += " and isPush =" + request[isPush];
                }


                if (!Null_Check(request, MenuId))
                {
                    if (string.IsNullOrEmpty(sqlWhere))
                    {
                        jsonModel = BllAdvert.GetEntityListByField(MenuId, request[MenuId]);
                    }
                    else
                    {
                        jsonModel = BllAdvert.GetEntityListByField(MenuId, request[MenuId], sqlWhere);
                    }
                }
                else
                {
                    jsonModel = GetDataHelper(request, ht);
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
                jsonModel = new PMSModel.JsonModel()
                {
                    errMsg = ex.Message,
                };
            }
            finally
            {
                context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}");
            }
        }
Пример #5
0
        public List <ID_NameEntity> GetID_NameS(HashtableCustom ht)
        {
            List <ID_NameEntity> dicList = null;

            try
            {
                dicList = DAL.GetMenuInfoByParentMoreLevelID_Name(Convert.ToInt32(ht["MenuIds"]));
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(dicList);
        }
Пример #6
0
        public String GetIDS(HashtableCustom ht)
        {
            string ids = string.Empty;

            try
            {
                ids = DAL.GetMenuInfoByParentMoreLevelID(Convert.ToInt32(ht["MenuIds"]));
                if (string.IsNullOrEmpty(ids))
                {
                    ids = DAL.GetMenuInfoByParentID(Convert.ToInt32(ht["MenuIds"]));
                }
            }
            catch (Exception ex)
            {
            }
            return(ids);
        }
Пример #7
0
        /// <summary>
        /// 根据菜单子节点或父节点获得 菜单下的分类信息。
        /// </summary>
        /// <param name="context"></param>
        public void GetPageListForMenuId(HttpContext context)
        {
            HttpRequest request = context.Request;

            PMSModel.JsonModel jsonModel = new PMSModel.JsonModel();
            try
            {
                HashtableCustom ht = new HashtableCustom();
                ht.Add_Key(PageIndex, request);
                ht.Add_Key(PageSize, request);
                ht.Add_Key(isPush, request);
                if (!Null_Check(request, isAll))
                {
                    ht.Add(isAll, Convert.ToBoolean(request[isAll]));
                }
                if (!Null_Check(request, MenuId))
                {
                    int    mid  = Convert.ToInt32(request[MenuId]);
                    string pids = GetMenuChild(mid);
                    if (!string.IsNullOrWhiteSpace(pids))
                    {
                        ht.Add(MenuId, pids);
                        jsonModel = BllAdvert.GetAdvertData(ht);
                    }
                }
                else
                {
                    jsonModel = BllAdvert.GetAdvertData(ht);
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
                jsonModel = new PMSModel.JsonModel()
                {
                    errMsg  = ex.Message,
                    retData = "",
                    status  = "no"
                };
            }
            finally
            {
                context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}");
            }
        }
Пример #8
0
        /// <summary>
        /// 统计文章访问率
        /// </summary>
        /// <param name="context"></param>
        public void GetStatistics(HttpContext context)
        {
            PMSModel.JsonModel jsonModel = new PMSModel.JsonModel();
            HttpRequest        request   = context.Request;

            try
            {
                HashtableCustom ht = new HashtableCustom();
                ht.Add_Key(PageIndex, request);
                ht.Add_Key(PageSize, request);
                string where = string.Empty;
                ht.Add(TableName, Advertising);

                where += " and IsDelete =" + (int)PMSUtility.SysStatus.正常;

                string notIn    = string.Empty;
                string _NotItem = Convert.ToString(request["NotItem"]);
                if (!string.IsNullOrEmpty(_NotItem))
                {
                    notIn = string.Format(" and MenuId not in ({0})", _NotItem);
                }

                if (!Null_Check(request, isPush))
                {
                    where += " and isPush=" + request[isPush].SafeToString() + notIn;
                }
                ht.Add(Order, "ClickNum desc ");
                jsonModel = BllAdvert.GetPage(ht, true, where);
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
                jsonModel = new PMSModel.JsonModel()
                {
                    errMsg  = ex.Message,
                    retData = "",
                    status  = "no"
                };
            }
            finally
            {
                context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}");
            }
        }
Пример #9
0
        static void Main()
        {
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new Form1());
            HashtableCustom ht = new HashtableCustom();

            ht.Add("PageIndex", "1");
            ht.Add("PageSize", "7");
            ht.Add("ImgUrl", "/Common.ashx");

            ht.Add("IsDelete", "0");
            ht.Add("MenuIdList", "11,20,35,45");



            Dictionary <string, object> diclist = new Dictionary <string, object>();

            PMSModel.JsonModel jsonModel = null;
            try
            {
                var menuids = ht["MenuIdList"].ToString().Split(new char[] { ',' });
                if (menuids.Length > 0)
                {
                    foreach (var item in menuids)
                    {
                        var moder = BllAdvert.GetDataInfo(ht);
                        diclist.Add(item, moder.retData);
                    }
                }
            }
            catch (Exception ex)
            {
                jsonModel = new PMSModel.JsonModel()
                {
                    errMsg = ex.Message,
                };
            }
        }
Пример #10
0
        public JsonModel GetDataMore_LevelInfo(HashtableCustom ht)
        {
            JsonModel jsmodel = new JsonModel();

            try
            {
                DataTable dt = DAL.GetDataLevelInfo(ht);

                DataView dv = dt.DefaultView;

                dv.Sort = " SortId desc,CreateTime desc ";

                DataTable dt2 = dv.ToTable();

                jsmodel = GetDataTableToJsonModel(dt2, ht);
            }
            catch (Exception ex)
            {
                //jsmodel.status = ex.Message;
            }

            return(jsmodel);
        }
Пример #11
0
        /// <summary>
        /// 新闻导读上移、下移
        /// </summary>
        /// <param name="context"></param>
        public void UpOrDownAdvert(HttpContext context)
        {
            HttpRequest request = context.Request;

            PMSModel.JsonModel jsonModel = new PMSModel.JsonModel();
            try
            {
                HashtableCustom ht = new HashtableCustom();
                ht.Add_Key(upOrdown, request);
                if (!Null_Check(request, MenuId))
                {
                    ht.Add(MenuId, GetMenuChild(Convert.ToInt32(request[MenuId])));
                }
                else
                {
                    ht.Add_Key(MenuId, request);
                }


                ht.Add_Key(isPush, request);
                ht.Add_Key(Id, request);
                ht.Add_Key(SortId, request);
                jsonModel = BllAdvert.UpdateAdertSort(ht);
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
                jsonModel = new PMSModel.JsonModel()
                {
                    errMsg = ex.Message,
                };
            }
            finally
            {
                context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}");
            }
        }
Пример #12
0
        public DataTable GetDataLevelInfo(HashtableCustom ht)
        {
            try
            {
                StringBuilder       sbSql4org = new StringBuilder();
                List <SqlParameter> List      = new List <SqlParameter>();
                if (ht.ContainsKey("isAll") && Convert.ToBoolean(ht["isAll"]) == true)
                {
                    sbSql4org.Append(@"select [Id]
      ,[Description]
      ,[MenuId]
      ,[IsDelete]
      ,[CreateTime]
      ,[Creator]
      ,[ClickNum]
      ,[ImageUrl]
      ,[ModelType]
      ,[FileName]
      ,[FilePath]
      ,[SortId]
      ,[isPush]
  FROM [dbo].[Advertising] where 1=1 ");
                }
                else
                {
                    sbSql4org.Append("select * from Advertising where 1=1 ");
                }

                if (ht.Add_Key("MenuIds"))
                {
                    string ids = string.Empty;
                    if (ht.Add_Key("ChildId"))
                    {
                        ids = ht["MenuIds"].ToString();
                        sbSql4org.Append(" and [MenuId] in (" + ids + ")");
                    }
                    else
                    {
                        ids = GetMenuInfoByParentMoreLevelID(Convert.ToInt32(ht["MenuIds"]));
                        if (string.IsNullOrEmpty(ids))
                        {
                            ids = GetMenuInfoByParentID(Convert.ToInt32(ht["MenuIds"]));
                        }
                        sbSql4org.Append(" and [MenuId] in (" + ids + ")");
                    }
                }
                if (ht.Add_Key("isPush"))
                {
                    sbSql4org.Append(" and isPush=" + ht["isPush"].SafeToString());
                }
                if (ht.Add_Key("IsDelete"))
                {
                    sbSql4org.Append(" and IsDelete=@IsDelete");
                    List.Add(new SqlParameter("@IsDelete", ht["IsDelete"].ToString()));
                }
                if (ht.Add_Key("ImgUrl"))
                {
                    sbSql4org.Append(" and (ImageUrl is not null and ImageUrl!='')");
                }
                if (ht.Add_Key("NotItem"))
                {
                    sbSql4org.Append(" and ([MenuId] not in (" + ht["NotItem"].ToString() + "))");
                }

                DataTable dt = SQLHelp.ExecuteDataTable(sbSql4org.ToString(), CommandType.Text, List.ToArray());

                return(dt);
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
                return(null);
            }
        }
Пример #13
0
        public void GetMenuOwnLevel(HttpContext context)
        {
            PMSModel.JsonModel jsonModel = null;
            PMSModel.JsonModel Model     = null;
            HttpRequest        request   = context.Request;

            try
            {
                if (menu == null)
                {
                    HashtableCustom ht1 = new HashtableCustom();

                    ht1.Add(TableName, PortalTreeData);
                    string where = string.Empty;
                    bool isPage = false;
                    if (!string.IsNullOrWhiteSpace(request["MenuLevelIndex"]))
                    {
                        where += " and MenuLevelIndex=" + request["MenuLevelIndex"];
                    }
                    if (!string.IsNullOrWhiteSpace(request[Display]))
                    {
                        where += " and Display=" + request[Display];
                    }
                    if (!string.IsNullOrWhiteSpace(request[IsDelete]))
                    {
                        where += " and IsDelete=" + request[IsDelete];
                    }

                    ht1.Add(Order, " SortId desc ,CreateTime desc,ShowIndexSort desc ");
                    //获取菜单数据
                    Model = BllPTDS.GetPage(ht1, isPage, where);
                    List <Dictionary <string, object> > dic  = Model.retData as List <Dictionary <string, object> >;
                    List <MenuLevelModel> menuLevelModelList = new List <MenuLevelModel>();
                    foreach (var item in dic)
                    {
                        #region 获取数据或IDs

                        HashtableCustom ht2 = new HashtableCustom();
                        ht2.Add_Key(Display, request);
                        ht2.Add_Key(IsDelete, request);
                        ht2.Add(TableName, PortalTreeData);
                        ht2.Add(Order, " SortId asc ,CreateTime desc ");
                        string where2 = string.Empty;

                        if (!string.IsNullOrWhiteSpace(request[Display]))
                        {
                            where2 += " and Display=" + request[Display];
                        }
                        if (!string.IsNullOrWhiteSpace(request[IsDelete]))
                        {
                            where2 += " and IsDelete=" + request[IsDelete];
                        }

                        //跳级获取,listChild 如果为null 说明只有两级(获取三级数据)
                        where2 = string.Format(" and Id in(select pid from PortalTreeData where pid in(select id from PortalTreeData where PId ={0}) group by PId)", item[Id]);
                        ht2.Add(MenuIds, item[Id]);
                        var moder = BllPTDS.GetPage(ht2, isPage, where2);

                        string ids = BllAdvert.GetIDS(ht2);

                        #endregion

                        //菜单级别数据(携带跳级数据)
                        MenuLevelModel menLevelModel = null;
                        if (Convert.ToString(moder.retData) != string.Empty)
                        {
                            menLevelModel = new MenuLevelModel()
                            {
                                ChildList = moder.retData, IsMore2Level = true
                            };
                        }
                        else
                        {
                            menLevelModel = new MenuLevelModel()
                            {
                                IsMore2Level = false
                            };
                        }

                        menLevelModel.Id_Bottom_List = ids;

                        #region 实体属性

                        menLevelModel.Id         = Convert.ToInt32(item[Id]);
                        menLevelModel.Name       = Convert.ToString(item[Name]);
                        menLevelModel.CreateTime = Convert.ToDateTime(item[CreateTime]);

                        menLevelModel.Creator     = Convert.ToString(item["Creator"]);
                        menLevelModel.PId         = Convert.ToInt32(item["PId"]);
                        menLevelModel.BeforeUrl   = Convert.ToString(item["BeforeUrl"]);
                        menLevelModel.BeforeAfter = Convert.ToInt32(item["BeforeAfter"]);
                        menLevelModel.AfterUrl    = Convert.ToString(item["AfterUrl"]);
                        menLevelModel.SortId      = Convert.ToInt32(item[SortId]);

                        menLevelModel.DisplayCount   = Convert.ToInt32(item["DisplayCount"]);
                        menLevelModel.DisplayType    = Convert.ToString(item["DisplayType"]);
                        menLevelModel.MenuLevelIndex = Convert.ToInt32(item["MenuLevelIndex"]);
                        menLevelModel.ShowIndexSort  = Convert.ToInt32(item["ShowIndexSort"]);


                        #endregion

                        menuLevelModelList.Add(menLevelModel);
                    }

                    jsonModel = new PMSModel.JsonModel()
                    {
                        retData = menuLevelModelList, errMsg = "success"
                    };

                    menu = jsonModel;
                }
                else
                {
                    jsonModel = menu;
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
                jsonModel = new PMSModel.JsonModel()
                {
                    errMsg  = ex.Message,
                    retData = "",
                    status  = "no"
                };
            }
            finally
            {
                if (jsonModel == null)
                {
                    jsonModel = new JsonModel();
                }
                context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}");
            }
        }
Пример #14
0
        /// <summary>
        /// 不需要传IDS和PageSize(根据菜单获取所有数据)
        /// </summary>
        /// <param name="context"></param>
        public void GetMenusItemsData(HttpContext context)
        {
            HttpRequest     request = context.Request;
            HashtableCustom ht1     = new HashtableCustom();

            List <IndexModelEntity> IndexModelEntityList = new List <IndexModelEntity>();

            PMSModel.JsonModel jsonModel = new PMSModel.JsonModel();
            PMSModel.JsonModel Model     = new PMSModel.JsonModel();
            try
            {
                #region 获取首页导读的一级菜单(包括了三级的菜单)||获取指定菜单ID的二级菜单(通过一级菜单的ID去获取)

                ht1.Add(TableName, PortalTreeData);
                string where = string.Empty;
                bool isPage = false;

                if (!string.IsNullOrWhiteSpace(request[Display]))
                {
                    where += " and Display=" + request[Display];
                }
                if (!string.IsNullOrWhiteSpace(request[IsDelete]))
                {
                    where += " and IsDelete=" + request[IsDelete];
                }
                if (!string.IsNullOrWhiteSpace(request[IsShowIndex]))
                {
                    where += " and IsShowIndex=" + request[IsShowIndex];
                }
                else if (!string.IsNullOrWhiteSpace(request[MenuIds]))
                {
                    where += string.Format(" and PId in({0})  ", request[MenuIds]);
                }
                //获取显示在首页导读工作区域的菜单
                ht1.Add(Order, " ShowIndexSort asc, SortId desc ,CreateTime desc ");
                Model = BllPTDS.GetPage(ht1, isPage, where);

                #endregion

                List <Dictionary <string, object> > dic = Model.retData as List <Dictionary <string, object> >;
                foreach (var item in dic)
                {
                    IndexModelEntity indexModielEntity = new IndexModelEntity();

                    #region 实体属性

                    indexModielEntity.Id         = Convert.ToInt32(item[Id]);
                    indexModielEntity.Name       = Convert.ToString(item[Name]);
                    indexModielEntity.CreateTime = Convert.ToDateTime(item[CreateTime]);

                    indexModielEntity.Creator     = Convert.ToString(item["Creator"]);
                    indexModielEntity.PId         = Convert.ToInt32(item["PId"]);
                    indexModielEntity.BeforeUrl   = Convert.ToString(item["BeforeUrl"]);
                    indexModielEntity.BeforeAfter = Convert.ToInt32(item["BeforeAfter"]);
                    indexModielEntity.AfterUrl    = Convert.ToString(item["AfterUrl"]);
                    indexModielEntity.SortId      = Convert.ToInt32(item[SortId]);


                    indexModielEntity.DisplayCount   = Convert.ToInt32(item["DisplayCount"]);
                    indexModielEntity.DisplayType    = Convert.ToString(item["DisplayType"]);
                    indexModielEntity.MenuLevelIndex = Convert.ToInt32(item["MenuLevelIndex"]);
                    indexModielEntity.ShowIndexSort  = Convert.ToInt32(item["ShowIndexSort"]);


                    #endregion

                    #region 获取导读数据(后台获取限制数据的条数)

                    int displayCount = 0;
                    if (request["DisplayCount"] != null)
                    {
                        displayCount = Convert.ToInt32(request["DisplayCount"]);
                    }
                    else
                    {
                        displayCount = Convert.ToInt32(item["DisplayCount"]);
                    }

                    HashtableCustom ht2 = new HashtableCustom();
                    ht2.Add(MenuIds, item[Id]);
                    ht2.Add(MenuId, item[Id]);
                    ht2.Add(PageSize, displayCount);
                    ht2.Add_Key(IsDelete, request);
                    ht2.Add_Key(isPush, request);
                    ht2.Add(PageIndex, 1);

                    if (!string.IsNullOrWhiteSpace(request[IsShowIndex]))
                    {
                        //获取三级数据,没有则获取二级数据
                        var moder = BllAdvert.GetDataMore_LevelInfo(ht2);
                        indexModielEntity.ListData = moder.retData;
                    }
                    else if (!string.IsNullOrWhiteSpace(request[MenuIds]))
                    {
                        //获取直接二级数据,没有则获取二级数据
                        var moder = BllAdvert.GetAdvertData(ht2);
                        indexModielEntity.ListData = moder.retData;
                    }



                    #endregion

                    IndexModelEntityList.Add(indexModielEntity);
                }
                jsonModel = new PMSModel.JsonModel()
                {
                    retData = IndexModelEntityList, errMsg = "success"
                };
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
                jsonModel = new PMSModel.JsonModel()
                {
                    errMsg = ex.Message,
                };
            }
            finally
            {
                context.Response.Write("{\"result\":" + Hander_C.jss.Serialize(jsonModel) + "}");
            }
        }
Пример #15
0
        /// <summary>
        /// 获得新闻或菜单下的分类信息。
        /// </summary>
        /// <param name="context"></param>
        public void GetPageList(HttpContext context)
        {
            HttpRequest request = context.Request;

            PMSModel.JsonModel jsonModel = null;
            HashtableCustom    ht        = new HashtableCustom();

            try
            {
                bool is_Page = true;
                bool is_All  = false;

                ht.Add_Key(PageIndex, request);
                ht.Add_Key(PageSize, request);
                if (!Null_Check(request, isPage))
                {
                    is_Page = Convert.ToBoolean(request[isPage]);
                }
                if (!Null_Check(request, isAll))
                {
                    is_All = Convert.ToBoolean(request[isAll]);
                }
                if (is_All)
                {
                    ht.Add_Key(MenuId, request);
                    ht.Add(IsDelete, (int)PMSUtility.SysStatus.正常);
                    ht.Add_Key(isPush, request);
                    jsonModel = BllAdvert.GetAdvertPageList(ht);
                }
                else
                {
                    ht.Add(TableName, Advertising);
                    string where = string.Empty;
                    if (!Null_Check(request, MenuId))
                    {
                        where += " and [MenuId]=" + request[MenuId];
                    }
                    where += " and IsDelete =" + (int)PMSUtility.SysStatus.正常;
                    if (!Null_Check(request, isPush))
                    {
                        where += " and isPush=" + request[isPush].SafeToString();
                    }
                    if (!Null_Check(request, MenuIds))
                    {
                        where += " and [MenuId] in (" + request[MenuIds].SafeToString() + ")";
                    }
                    if (!Null_Check(request, ImageUrl))
                    {
                        where += " and(ImageUrl is not null and ImageUrl != '')";
                    }
                    ht.Add(Order, " MenuId asc,SortId desc ,CreateTime desc ");
                    jsonModel = BllAdvert.GetPage(ht, is_Page, where);
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
                jsonModel = new PMSModel.JsonModel()
                {
                    errMsg  = ex.Message,
                    retData = "",
                    status  = "no"
                };
            }
            finally
            {
                if (jsonModel == null)
                {
                    jsonModel = new PMSModel.JsonModel();
                }
                ht.Clear();
                string js = Hander_C.jss.Serialize(jsonModel);
                context.Response.Write("{\"result\":" + js + "}");
            }
        }