コード例 #1
0
        public ActionResult Data_DB_AD()
        {
            string[] keys = this.Request.Form.AllKeys;
            string   page = this.Request.Form["page"];
            string   rows = this.Request.Form["rows"];

            string where = this.Request.Form["where"];
            string order = this.Request.Form["order"];

            int _page = 0, _rows = 0;

            int.TryParse(page, out _page);
            int.TryParse(rows, out _rows);
            if (_page == 0)
            {
                _page = 1;
            }
            if (_rows == 0)
            {
                _rows = 50;
            }

            BLL.DB_AD           dal = new BLL.DB_AD();
            List <NModel.DB_AD> inModel = new List <NModel.DB_AD>();

            inModel = dal.GetSortAndWherePagerList(_page, _rows, order, where);

            NModel.PageData <NModel.DB_AD> outModel = BLL.Fun.SetJsonData <NModel.DB_AD>(inModel);

            // inModel[0].Count_Show
            dal.Close();

            return(View(outModel));
        }
コード例 #2
0
        public ActionResult Edit_DB_AD()
        {
            this.Response.ContentType = "text/plain";

            NModel.DB_AD model = new NModel.DB_AD();
            BLL.DB_AD    dal   = new BLL.DB_AD();

            String JsonStr = "";

            bool isGet = Tool.NStr.PostForSetVal <NModel.DB_AD>(ref model, ref JsonStr, "");

            // 下面代码编写
            if (isGet && !string.IsNullOrEmpty(model.AD_Name) &&
                !string.IsNullOrEmpty(model.AD_Num)

                && !string.IsNullOrEmpty(model.AD_Img)

                && model.AD_AddTime != null

                )
            {
                //取默认值

                model.AD_EditTime = DateTime.Parse(DateTime.Now.ToString("s"));

                bool isEdit = dal.Edit(model) > 0 ? true : false;

                string msg = dal.ErrorMsg;
                if (!string.IsNullOrEmpty(msg))
                {
                    msg = "原因:" + msg;
                }

                if (isEdit)
                {
                    this.Response.Write(Tool.NMsg.SetMsg("修改成功", "1"));
                    this.Response.End();
                }
                else
                {
                    this.Response.Write(Tool.NMsg.SetMsg("修改失败" + msg, "0"));
                    this.Response.End();
                }

                dal.Close();
            }
            else
            {
                this.Response.Write(Tool.NMsg.SetMsg("提交失败", "0"));
                this.Response.End();
            }

            return(View());
        }
コード例 #3
0
        public ActionResult Index()
        {
            NModel.NewsPager model_pager = LoadConfig("Index");

            BLL.DB_News bll_news = new BLL.DB_News();

            model_pager.IDctNewsList = new Dictionary <string, IList <NModel.DB_News> >();

            LoadLeftRight(ref model_pager);

            IList <NModel.DB_News> model_news_num = null;
            IList <string>         numList        = new List <string>();

            numList.Add("0101");
            numList.Add("0102");
            numList.Add("0103");
            numList.Add("0201");
            numList.Add("0202");
            numList.Add("0203");
            numList.Add("0301");
            numList.Add("0302");
            numList.Add("0303");
            numList.Add("0401");
            numList.Add("0402");
            numList.Add("0403");
            numList.Add("0501");
            numList.Add("0502");
            numList.Add("0503");
            numList.Add("0504");
            numList.Add("0601");
            numList.Add("0602");
            numList.Add("0603");

            foreach (string val in numList)
            {
                model_news_num = bll_news.GetNewListByWhereAndTop(string.Format(" news_num=''{0}''and  News_IsIndex=1", val), 6);

                model_pager.IDctNewsList.Add(val, model_news_num != null ? model_news_num : new List <NModel.DB_News>());
            }

            model_pager.IDictListAd = new Dictionary <string, IList <NModel.DB_AD> >();
            BLL.DB_AD            bll_ad        = new BLL.DB_AD();
            string               sql_ad        = string.Format(" ''01'' ");
            IList <NModel.DB_AD> model_ad_list = bll_ad.GetListByNumAndTop(sql_ad, 8);

            model_pager.IDictListAd.Add("中间广告", model_ad_list != null ? model_ad_list : new List <NModel.DB_AD>());

            bll_ad.Close();
            bll_news.Close();
            return(View(model_pager));
        }
コード例 #4
0
        public ActionResult Add_DB_AD()
        {
            this.Response.ContentType = "text/plain";
            NModel.DB_AD model = new NModel.DB_AD();
            BLL.DB_AD    dal   = new BLL.DB_AD();

            String JsonStr = "";

            bool isGet = Tool.NStr.PostForSetVal <NModel.DB_AD>(ref model, ref JsonStr, "");

            // 下面代码编写
            if (isGet && !string.IsNullOrEmpty(model.AD_Name) &&
                !string.IsNullOrEmpty(model.AD_Num)

                && !string.IsNullOrEmpty(model.AD_Img)

                )
            {
                {
                    model.AD_EditTime = DateTime.Parse(DateTime.Now.ToString("s"));
                    model.AD_AddTime  = DateTime.Parse(DateTime.Now.ToString("s"));
                    //
                    bool isAdd = dal.Add(model) > 0 ? true : false;

                    if (isAdd)
                    {
                        this.Response.Write(Tool.NMsg.SetMsg("增加成功", "1"));
                        this.Response.End();
                    }
                    else
                    {
                        this.Response.Write(Tool.NMsg.SetMsg("增加失败" + dal.ErrorMsg, "1"));
                        this.Response.End();
                    }
                }
            }
            else
            {
                this.Response.Write(Tool.NMsg.SetMsg("提交失败", "0"));
            }

            dal.Close();

            return(View());
        }
コード例 #5
0
        public ActionResult Del_DB_AD()
        {
            this.Response.ContentType = "text/plain";

            string delList = this.Request.Form["delList[]"];

            if (!string.IsNullOrEmpty(delList))
            {
                string[] arrStr = delList.Split(',');

                int[] delIntArr = Tool.NTool.ArrayToAll <int, string>(arrStr);

                if (Tool.NTool.IsArrNULL <int>(delIntArr))
                {
                    BLL.DB_AD dal         = new BLL.DB_AD();
                    long      long_Result = dal.DelList(delIntArr);

                    if (long_Result > 0)
                    {
                        this.Response.Write(Tool.NMsg.SetMsg(string.Format("删除成功!总共删除{0}条", long_Result), "1"));
                        this.Response.End();
                    }
                    else
                    {
                        this.Response.Write(Tool.NMsg.SetMsg("删除失败!", "0"));
                        this.Response.End();
                    }

                    dal.Close();
                }
                else
                {
                    this.Response.Write(Tool.NMsg.SetMsg("提交失败/填写数据不完整!", "0"));
                    this.Response.End();
                }
            }
            else
            {
                this.Response.Write(Tool.NMsg.SetMsg("提交失败/填写数据不完整!", "0"));
                this.Response.End();
            }

            return(View());
        }
コード例 #6
0
        public ActionResult Del_All_DB_AD()
        {
            string num = this.Request.QueryString["Num"];

            BLL.DB_AD bll       = new BLL.DB_AD();
            long      delNumber = bll.DelAllByNum(num);

            if (delNumber > 0)
            {
                this.Response.Write(Tool.NMsg.SetMsg("删除成功", "1"));
                this.Response.End();
            }
            else
            {
                this.Response.Write(Tool.NMsg.SetMsg("删除失败", "0"));
                this.Response.End();
            }
            bll.Close();
            return(View());
        }
コード例 #7
0
        public ActionResult Index()
        {           //分类
            BLL.DB_Classify bll_Classify = new BLL.DB_Classify();
            //广告
            BLL.DB_AD        bll_ad      = new BLL.DB_AD();
            NModel.NewsPager model_pager = LoadConfig("/nlcq/index");

            model_pager.IDictClassify = new Dictionary <string, IList <NModel.DB_Classify> >();
            {
                IList <NModel.DB_Classify> modelClassifyList = null;
                modelClassifyList = bll_Classify.GetListByNumAndTop("1", 150);
                modelClassifyList = modelClassifyList != null ? modelClassifyList : new List <NModel.DB_Classify>();

                model_pager.IDictClassify.Add("代码分类", modelClassifyList);
            }

            {
                IList <NModel.DB_Classify> modelClassifyList = null;
                modelClassifyList = bll_Classify.GetListByNumAndTop("2", 150);
                modelClassifyList = modelClassifyList != null ? modelClassifyList : new List <NModel.DB_Classify>();

                model_pager.IDictClassify.Add("素材分类", modelClassifyList);
            }

            {
                model_pager.IDictListAd = new Dictionary <string, IList <NModel.DB_AD> >();

                string sql_ad = string.Format(" ''01'' ");
                IList <NModel.DB_AD> model_ad_list = bll_ad.GetListByNumAndTop(sql_ad, 8);

                model_pager.IDictListAd.Add("首页广告一", model_ad_list != null ? model_ad_list : new List <NModel.DB_AD>());
            }

            bll_ad.Close();

            bll_Classify.Close();
            return(View(model_pager));
        }
コード例 #8
0
        public ActionResult Item_db_ad()
        {
            BLL.DB_AD dal = new BLL.DB_AD();

            string pagenum    = this.Request.Form["pagenum"];
            string numPerPage = this.Request.Form["numPerPage"];

            string dbaddate = this.Request.Form["dbaddate"];

            string dbadname = this.Request.Form["dbadname"];
            string num      = this.Request.QueryString["Num"];

            string where = "", order = "ad_addtime desc";

            if (string.IsNullOrEmpty(numPerPage))
            {
                numPerPage = "20";
            }
            if (string.IsNullOrEmpty(pagenum))
            {
                pagenum = "1";
            }

            where += " 1=1 ";

            if (!string.IsNullOrEmpty(num))
            {
                where += string.Format(" and ad_num=''{0}''  ", num);
            }
            if (!string.IsNullOrEmpty(dbaddate))
            {
                where += string.Format(" and ( CONVERT(varchar(100), ad_addtime, 23)=''{0}''  )", dbaddate);
            }

            if (!string.IsNullOrEmpty(dbadname))
            {
                where += string.Format(" and ad_name like ''%{0}%''  ", dbadname);
            }

            string _where      = Server.UrlDecode(this.Request.QueryString["nwhere"] + "");
            bool   HasOneEqOne = !((_where + "").Trim().Length <= 3);

            bool IsOneEqOne = ((where + "").Trim().Length <= 3);

            if (IsOneEqOne && !string.IsNullOrEmpty(_where) && HasOneEqOne)
            {
                _where = this.Server.UrlDecode(_where);

                where = _where;
            }
            else
            {
                _where = where;
            }

            NModel.PageData <NModel.DB_AD> PD = new NModel.PageData <NModel.DB_AD>()
            {
                NumPerPage = numPerPage,
                PageNum    = pagenum,
                TotalPage  = dal.GetWhereListTotal(where),
                Where      = where,
                OrderField = order
            };
            dal.Close();
            return(View(PD));
        }