示例#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();
 }
示例#2
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;
 }