Exemplo n.º 1
0
 public ActionResult BannerImageList()
 {
     ViewBag.sid = Request.Params["sid"];
     List<BannerSite> store = new List<BannerSite>();
     BannerSite bs = new BannerSite();
     _bsMgr = new BannerSiteMgr(mySqlConnectionString);
     if (!string.IsNullOrEmpty(Request.Params["sid"]))
     {
         bs.banner_site_id = uint.Parse(Request.Params["sid"]);
     }
     store = _bsMgr.GetBannerSiteName(bs);
     if (store.Count > 0)
     {
         ViewBag.sname = store[0].banner_site_name;
     }
     else
     {
         ViewBag.sname = "";
     }
     if (!string.IsNullOrEmpty(Request.Params["history"]))
     {
         ViewBag.history = Request.Params["history"];
     }
     else
     {
         ViewBag.history = "0";
     }
     return View();
 }
Exemplo n.º 2
0
        public List<BannerSite> GetList(BannerSite bs, out int totalCount)
        {
            StringBuilder sqlfield = new StringBuilder();
            StringBuilder sqlwhere = new StringBuilder();
            StringBuilder sqlorderby = new StringBuilder();
            StringBuilder sql = new StringBuilder();
            sqlfield.AppendLine(@"SELECT banner_site_id,banner_site_sort,banner_site_status,banner_site_name,");
            sqlfield.AppendLine(@"banner_site_description,banner_site_createdate,banner_site_updatedate,banner_site_ipfrom  ");
            sqlfield.AppendLine(@"from banner_site where 1=1 ");
            sql.Append(sqlfield);
            if (bs.banner_site_status != 0)
            {
                sqlwhere.AppendFormat(@" and banner_site_status='{0}' ", bs.banner_site_status);
            }
            sql.Append(sqlwhere);
            sqlorderby.AppendFormat(@" ORDER BY banner_site_status ASC, banner_site_sort DESC ");
            sql.Append(sqlorderby);
            sql.AppendFormat(@" limit {0},{1};", bs.Start, bs.Limit);
            //int totalCount;
            totalCount = 0;
            try
            {
                if (bs.IsPage)
                {
                    DataTable dt = _access.getDataTable("select count(*) from banner_site where 1=1 " + sqlwhere);
                    totalCount = int.Parse(dt.Rows[0][0].ToString());
                }
                return _access.getDataTableForObj<BannerSite>(sql.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("BannerSiteDao-->GetList" + ex.Message + sql.ToString(), ex);
            }

        }
Exemplo n.º 3
0
 public List<BannerSite> GetBannerSiteName(BannerSite bs)
 {
     try
     {
         return _bsDao.GetBannerSiteName(bs);
     }
     catch (Exception ex)
     {
         throw new Exception("BannerSiteMgr-->GetBannerSiteName" + ex.Message, ex);
     }
 }
Exemplo n.º 4
0
 public List<BannerSite> GetList(BannerSite bs, out int totalCount)
 {
     try
     {
         return _bsDao.GetList(bs, out totalCount);
     }
     catch (Exception ex)
     {
         throw new Exception("BannerSiteMgr-->GetList" + ex.Message, ex);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// 獲取站點名稱
 /// </summary>
 /// <param name="bs"></param>
 /// <returns></returns>
 public List<BannerSite> GetBannerSiteName(BannerSite bs)
 {
     StringBuilder sql = new StringBuilder();
     sql.AppendLine(@" SELECT banner_site_id,banner_site_name FROM banner_site ");
     sql.AppendLine(@" WHERE 1=1 ");
     if (bs.banner_site_id != 0)
     {
         sql.AppendFormat(@" AND banner_site_id='{0}'",bs.banner_site_id);
     }
     try
     {
         return _access.getDataTableForObj<BannerSite>(sql.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("BannerSiteDao-->GetBannerSiteName" + ex.Message + sql.ToString(), ex);
     }
 }
Exemplo n.º 6
0
 public HttpResponseBase GetBannerImageSiteList()
 {
     string json = string.Empty;
     List<BannerSite> store = new List<BannerSite>();
     BannerSite bs = new BannerSite();
     try
     {
         bs.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量
         bs.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");//用於分頁的變量
         _bsMgr = new BannerSiteMgr(mySqlConnectionString);
         int totalCount = 0;
         store = _bsMgr.GetList(bs, out totalCount);
         IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
         //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式     
         timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss ";
         json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(store, Formatting.Indented, timeConverter) + "}";//返回json數據
     }
     catch (Exception ex)
     {
         Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
         logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
         logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
         log.Error(logMessage);
         json = "{success:false}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }