예제 #1
0
파일: Extractor.cs 프로젝트: Rarve/FRES
 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");
     }
 }
예제 #2
0
파일: DataHelper.cs 프로젝트: Rarve/FRES
 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;
 }
예제 #3
0
파일: DataHelper.cs 프로젝트: Rarve/FRES
 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;
 }