Exemplo n.º 1
0
 protected virtual void GetHtml(RealEstateE toProcessItem)
 {
     var html = string.Empty;
     try
     {
         toProcessItem.Data = Client.RetrieveHtmlStrGet(toProcessItem.Url).Result.Trim();
         DataHelper.UpdateRealEstateE(toProcessItem);
     }
     catch (Exception ex)
     {
         File.AppendAllText("D:/RE/E_" + GetType().Name + ".log", DateTime.Now.ToString("yyyyMMdd HH:mm") + "," + toProcessItem.Url + "," + ex.GetBaseException().Message + "\r\n");
     }
 }
Exemplo n.º 2
0
 public static int UpdateRealEstateE(RealEstateE res)
 {
     var count = 0;
     using (var ctx = new FRESContext())
     {
         ctx.RealEstateE.Attach(res);
         var entry = ctx.Entry(res);
         entry.Property(e => e.Data).IsModified = true;
         entry.Property(e => e.State).IsModified = true;
         ctx.SaveChanges();
     }
     return count;
 }
Exemplo n.º 3
0
 public static int InsertRealEstateE(RealEstateE res)
 {
     var count = 0;
     using (var ctx = new FRESContext())
     {
         ctx.RealEstateE.Add(res);
         count = ctx.SaveChanges();
         if (count == 0)
             throw new Exception("Row affected is 0");
     }
     return count;
 }