public ActionResult Index(int id)
        {
            SOSOshop.BLL.Db bll = new SOSOshop.BLL.Db();
            ViewBag._101资讯 = bll.ExecuteTableForCache("SELECT TOP 10 Id,Title,Channel FROM dbo.yxs_article WHERE State=1 AND Channel LIKE('102%')");
            string sql = "SELECT Title,SubTitle,KeyWord,Content,Introduction, (SELECT TOP (1) Name FROM yxs_articlechannel WHERE Id = a.Channel) AS Channel FROM dbo.yxs_article a WHERE State=1 AND Id=" + id;

            return(View(bll.ExecuteTableForCache(sql).Rows));
        }
Beispiel #2
0
        public ActionResult Index(int id)
        {
            SOSOshop.BLL.Db bll = new SOSOshop.BLL.Db();
            ViewBag._101资讯 = bll.ExecuteTableForCache("SELECT TOP 10 id,Title FROM dbo.yxs_article WHERE Channel LIKE('100%') and id<>" + id + " ORDER BY id DESC");
            string sql = "SELECT Title,SubTitle,KeyWord,Content,Introduction,CopyFrom,updateTime FROM dbo.yxs_article WHERE id=" + id;

            return(View(bll.ExecuteTableForCache(sql).Rows));
        }
        public static string Get_Json(int value)
        {
            string js = "";

            //查询数据库
            try
            {
                SOSOshop.BLL.Db db         = new SOSOshop.BLL.Db();
                StringBuilder   json       = new StringBuilder();
                string          ParentPath = "";
                string          sql        = "SELECT ParentPath FROM Region WHERE (ParentPath <> '') GROUP BY ParentPath ORDER BY ParentPath";
                DataTable       dt         = db.ExecuteTableForCache(sql);
                if (dt != null)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        ParentPath += dr[0] + ":";
                    }
                    if (ParentPath != "")
                    {
                        ParentPath = ParentPath.Substring(0, ParentPath.Length - 1);
                    }

                    string[] Paths = ParentPath.Split(":".ToCharArray());
                    foreach (string Path in Paths)
                    {
                        sql = "select Id,Name,ParentPath from Region where ParentPath='" + Path + "' ORDER BY OrderID";
                        dt  = db.ExecuteTableForCache(sql);
                        if (dt != null)
                        {
                            json.Append("'" + Path + "':{");
                            string option = "";
                            foreach (DataRow dr in dt.Rows)
                            {
                                option += dr["Id"].ToString() + ":'" + dr["Name"].ToString().Trim("\r\n '".ToCharArray()) + "',";
                            }
                            if (option != "")
                            {
                                json.Append(option.Substring(0, option.Length - 1) + "},");
                            }
                        }
                    }
                }
                js = json.ToString(); if (js != "")
                {
                    js = js.Substring(0, js.Length - 1);
                }
            }
            catch { }
            return("{" + js + "}");
        }
Beispiel #4
0
        /// <summary>
        /// 取网站配置信息
        /// </summary>
        /// <returns></returns>
        public static WebSiteInfo GetNetSiteInfo()
        {
            //WebSiteInfo wsi = new WebSiteInfo();
            string sql = @"SELECT TOP 1 [id]
                              ,[websitetitle]
                              ,[tel]
                              ,[fax]
                              ,[email]
                              ,[metekey]
                              ,[meteinfo]
                              ,[websitename]
                              ,[usersagreement]
                              ,[websitedomain]
                          FROM [yxs_websetting]";

            SOSOshop.BLL.Db     db   = new SOSOshop.BLL.Db();
            DataTable           dt   = db.ExecuteTableForCache(sql, DateTime.Now.AddDays(1));
            IList <WebSiteInfo> list = dt.AsEnumerable().Select(x =>
                                                                new WebSiteInfo
            {
                NetName     = x.Field <string>("websitename"),
                Domain      = System.Configuration.ConfigurationManager.AppSettings["CompanyDomainName"],
                NetTitle    = x.Field <string>("websitetitle"),
                Phone       = x.Field <string>("tel"),
                Fax         = x.Field <string>("fax"),
                Email       = x.Field <string>("email"),
                Keys        = x.Field <string>("metekey"),
                NetInfo     = x.Field <string>("meteinfo"),
                NetProtocol = x.Field <string>("usersagreement")
            }).ToList();

            return(list[0]);
        }
Beispiel #5
0
        /// <summary>
        /// 资讯列表
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult list(string id = "100")
        {
            //记录总数
            int recordCount = 0;

            //页总数
            int pageCount = 0;

            //页大小
            int pageSize = 12;

            //当前页
            int pageIndex = 1;

            if (!string.IsNullOrEmpty(Request["pageindex"]))
            {
                pageIndex = int.Parse(Request["pageindex"]);
            }
            ViewBag.id = id;
            var       bll = new SOSOshop.BLL.Db();
            DataTable key = bll.ExecuteTableForCache("SELECT Name,Description,MeteKey,MeteDescription FROM dbo.yxs_articlechannel where id=" + Library.Lang.Input.Filter(id));

            if (key.Rows.Count > 0)
            {
                ViewBag.Name            = key.Rows[0]["Name"];
                ViewBag.MeteKey         = key.Rows[0]["MeteKey"];
                ViewBag.MeteDescription = key.Rows[0]["MeteDescription"];
            }
            string where = string.Format(" AND Channel LIKE('{0}%')", Library.Lang.Input.Filter(id));
            DataTable dt = bll.GetListByPage("yxs_article", "id,Title,CreateTime", pageSize, pageIndex, " id desc ", where, out recordCount, out pageCount);
            //定义页面
            PagedList <DataRow> pl = new PagedList <DataRow>(dt.Select(), pageIndex, pageSize, recordCount);

            return(View(pl));
        }
Beispiel #6
0
        /// <summary>
        /// 取热门搜索列表
        /// </summary>
        /// <returns></returns>
        public static Dictionary <string, string> GetHotSearch()
        {
            string sql = "select top 5 name,linkad from yxs_topsearches where isshow=1 order by [sort]";

            SOSOshop.BLL.Db             db  = new SOSOshop.BLL.Db();
            DataTable                   dt  = db.ExecuteTableForCache(sql, DateTime.Now.AddHours(1));
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic = dt.AsEnumerable().ToDictionary(x => x.Field <string>("name"), x => x.Field <string>("linkad"));
            return(dic);
        }