/// <summary> /// 通過開始時間和結束時間獲取推播設定 /// </summary> /// <param name="valid_start"></param> /// <param name="valid_end"></param> /// <returns></returns> public string GetAppnotifypool(AppNotifyPoolQuery ap) { try { string Json = string.Empty; int totalCount; //調用查詢方法 List<AppNotifyPoolQuery> liAppNotifyPool = _iapppoolImplDao.GetAppnotifypool(ap, out totalCount); IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式 timeConverter.DateTimeFormat = "yyyy-MM-dd"; Json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(liAppNotifyPool, Formatting.Indented, timeConverter) + "}";//返回json數據 return Json; } catch (Exception ex) { throw new Exception("AppNotifyPoolMgr-->GetAppnotifypool-->" + ex.Message, ex); } }
/// <summary> /// 通過條件得到推播設定列表 /// </summary> /// <returns></returns> public HttpResponseBase GetAppNotifyPoolInfo() { string json = string.Empty; AppNotifyPoolQuery ap = new AppNotifyPoolQuery(); try { _iappnotifypoolMgr = new AppNotifyPoolMgr(mySqlConnectionString); ap.Start = Convert.ToInt32(Request.Params["start"] ?? "0"); ap.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25"); string starttime = Request.Params["timestart"].ToString(); string startemdtime = Request.Params["timestartend"].ToString(); string endtime = Request.Params["timeendstart"].ToString(); string endendtime = Request.Params["timeendend"].ToString(); if (!string.IsNullOrEmpty(starttime)) { ap.valid_start = Convert.ToInt32(CommonFunction.GetPHPTime(starttime)); } if (!string.IsNullOrEmpty(endtime)) { ap.valid_end = Convert.ToInt32(CommonFunction.GetPHPTime(endtime)); } if (!string.IsNullOrEmpty(startemdtime)) { ap.startendtime = Convert.ToInt32(CommonFunction.GetPHPTime(startemdtime)); } if (!string.IsNullOrEmpty(endendtime)) { ap.endendtime = Convert.ToInt32(CommonFunction.GetPHPTime(endendtime)); } //調用查詢事件 json = _iappnotifypoolMgr.GetAppnotifypool(ap); } 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 = ""; } return BackAjaxData(json); }
/// <summary> /// 編輯方法 /// </summary> /// <param name="anpq"></param> /// <returns></returns> public string EditAppNotifyPoolInfo(AppNotifyPoolQuery anpq) { try { string Json = string.Empty; string msgstr = "保存失敗"; //判斷是插入還是修改,為空為插入 string isAddOrEidt = anpq.isAddOrEidt; if (string.IsNullOrEmpty(isAddOrEidt)) { if (_iapppoolImplDao.AddAppnotifypool(anpq) > 0) { msgstr = "保存成功"; } } Json = "{success:true,msg:'" + msgstr + "'}"; return Json; } catch (Exception ex) { throw new Exception("AppNotifyPoolMgr-->EditAppNotifyPoolInfo-->" + ex.Message, ex); } }
/// <summary> /// 通過頁面編輯播設定列表 /// </summary> /// <returns></returns> public HttpResponseBase EditAppNotifyPoolInfo() { string json = string.Empty; try { _iappnotifypoolMgr = new AppNotifyPoolMgr(mySqlConnectionString); //獲得頁面SaveReport方法提交的參數 AppNotifyPoolQuery anpq = new AppNotifyPoolQuery(); anpq.alert = Request.Params["txtafalert"].ToString(); anpq.isAddOrEidt = Request.Params["isAddOrEidt"].ToString(); anpq.notified = Convert.ToInt32(Request.Params["now_state"].ToString()); anpq.title = Request.Params["txttitle"].ToString(); anpq.to = Request.Params["txtto"].ToString(); anpq.url = Request.Params["txturl"].ToString(); string starttime = Request.Params["datevalid_start"].ToString(); string endtime = Request.Params["datevalid_end"].ToString(); if (!string.IsNullOrEmpty(starttime)) { anpq.valid_start = Convert.ToInt32(CommonFunction.GetPHPTime(starttime)); } if (!string.IsNullOrEmpty(endtime)) { anpq.valid_end = Convert.ToInt32(CommonFunction.GetPHPTime(endtime)); } //調用編輯事件 json = _iappnotifypoolMgr.EditAppNotifyPoolInfo(anpq); } 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 = ""; } return BackAjaxData(json); }