public bool DealMessage302(string orderNoFake, string guid, string status, string returnTime, string returnInfo, string destPath)
 {
     bool success = true;
     try
     {
         EntryReceive entry = new EntryReceive();
         entry.ItemGuid = new Guid(guid);
         entry.Status = Convert.ToInt32(status);
         entry.ReturnTime = returnTime;
         entry.ReturnInfo = returnInfo;
         entry.FilePath = destPath;
         using (var db = new EntryContext())
         {
             var query = from m in db.MessageTracks.Include("Entry302s")
                         where m.OrderNoFake == orderNoFake
                         select m;
             var msTrack = query.FirstOrDefault();
             msTrack.Entry302s.Add(entry);
             msTrack.LastUpdateTicks = DateTime.Now.Ticks;
             if (msTrack.Schedule < 302)
             {
                 msTrack.Schedule = 302;
             }
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         Logs.Error(string.Format("DealMessage302 OrderNoFake: {0} , Exception: {1}", orderNoFake, ex.ToString()));
         success = false;
     }
     return success;
 }
        public bool DealMessage301(string orderNo, string orderNoFake, string logisticsNo, bool isReceived, bool isCreated, string guid, string destPath, string logisticCode)
        {
            bool success = true;
            try
            {
                EntryCreate entry = new EntryCreate();
                entry.ItemGuid = new Guid(guid);
                entry.IsReceived = isReceived;
                entry.IsCreated = isCreated;
                entry.CreateTime = entry.ReceiveTime = DateTime.Now.ToString("yyyyMMddHHmmss");
                entry.FilePath = destPath;

                MessageTrack msTrack = new MessageTrack();
                msTrack.ItemGuid = Guid.NewGuid();
                msTrack.OrderNo = orderNo;
                msTrack.OrderNoFake = orderNoFake;
                msTrack.LogisticsNo = logisticsNo;
                msTrack.Schedule = 301;
                msTrack.LastUpdateTicks = DateTime.Now.Ticks;
                msTrack.Commnet1 = logisticCode;
                msTrack.Entry301s = new List<EntryCreate>();
                msTrack.Entry302s = new List<EntryReceive>();
                msTrack.Entry501s = new List<EntryCreate>();
                msTrack.Entry502s = new List<EntryReceive>();
                msTrack.Entry503s = new List<EntryCreate>();
                msTrack.Entry504s = new List<EntryReceive>();
                msTrack.Entry601s = new List<EntryCreate>();
                msTrack.Entry602s = new List<EntryReceive>();
                msTrack.Entry301s.Add(entry);
                using (var db = new EntryContext())
                {
                    db.MessageTracks.Add(msTrack);
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                Logs.Error(string.Format("DealMessage301 OrderNo: {0} , Exception: {1}", orderNo, ex.ToString()));
                success = false;
            }
            return success;
        }
 public bool DealMessage501(bool isReceived, bool isCreated, string guid, string orderNoFake, string logisticNo, string destPath)
 {
     bool success = true;
     try
     {
         EntryCreate entry = new EntryCreate();
         entry.ItemGuid = new Guid(guid);
         entry.IsReceived = isReceived;
         entry.IsCreated = isCreated;
         entry.ReceiveTime = entry.CreateTime = DateTime.Now.ToString("yyyyMMddHHmmss");
         entry.FilePath = destPath;
         using (var db = new EntryContext())
         {
             var query = from m in db.MessageTracks.Include("Entry501s")
                         where m.OrderNoFake == orderNoFake
                         select m;
             var msTrack = query.FirstOrDefault();
             msTrack.Entry501s.Add(entry);
             msTrack.LastUpdateTicks = DateTime.Now.Ticks;
             msTrack.Schedule = 501;
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         Logs.Error(string.Format("DealMessage501 OrderNoFake: {0} , Exception: {1}", orderNoFake, ex.ToString()));
         success = false;
     }
     return success;
 }
 public string GetLogisticCodeByOrderNoFake(string orderNoFake)
 {
     string result = null;
     try
     {
         using (var db = new EntryContext())
         {
             var query = from m in db.MessageTracks
                         where m.OrderNoFake.Equals(orderNoFake)
                         select m.Commnet1;
             result = query.FirstOrDefault().ToString();
         }
     }
     catch (Exception ex)
     {
         Logs.Error(string.Format("GetLogisticCodeByOrderNoFake OrderNoFake: {0} , Exception: {1}", orderNoFake, ex.ToString()));
     }
     return result;
 }
 public bool DealMessage504(string logisticsNo, string guid, string status, string logisticsStatus, string returnTime, string returnInfo, string destPath)
 {
     bool success = true;
     try
     {
         EntryReceive entry = new EntryReceive();
         entry.ItemGuid = new Guid(guid);
         entry.Status = Convert.ToInt32(status);
         entry.ReturnTime = returnTime;
         entry.ReturnInfo = returnInfo;
         entry.FilePath = destPath;
         entry.Commnet1 = logisticsStatus;
         using (var db = new EntryContext())
         {
             var query = from m in db.MessageTracks.Include("Entry504s")
                         where m.LogisticsNo == logisticsNo
                         select m;
             var msTrack = query.FirstOrDefault();
             msTrack.Entry504s.Add(entry);
             msTrack.LastUpdateTicks = DateTime.Now.Ticks;
             msTrack.Schedule = 504;
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         Logs.Error(string.Format("DealMessage504 LogisticsNo: {0} Exception: {1}", logisticsNo, ex.ToString()));
         success = false;
     }
     return success;
 }