Ejemplo n.º 1
0
 public HttpResponseBase GetEmailBlockList()
 {
     string json = string.Empty;
     try
     {
         _emailBlockListMgr = new EmailBlockListMgr(mySqlConnectionString);
         DataTable store = new DataTable();
         EmailBlockListQuery query = new EmailBlockListQuery();
         if (!string.IsNullOrEmpty(Request.Params["email"]))
         {
             query.email_address = Request.Params["email"];
         }
         store = _emailBlockListMgr.GetEmailBlockList(query);
         if (store != null)
         {
             IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
             timeConverter.DateTimeFormat = "yyyy-MM-dd";
             json = "{success:true" + ",data:" + JsonConvert.SerializeObject(store, Formatting.Indented, timeConverter) + "}";
         }
     }
     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,data:[]}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }