Esempio n. 1
0
 public int ProcessInsertData(int areaCode, string targetDbName)
 {
     try
     {
         var sList = new TQueueDAL(dbKey: areaCode.ToString()).GetModelList(c => c.sysFlag == 0).ToList();
         sList.ForEach(s =>
         {
             s.areaCode = areaCode;
             s.areaId   = s.id;
         });
         var dal  = new TQueueDAL(dbKey: targetDbName);
         var odal = new TQueueDAL(dbKey: areaCode.ToString());
         foreach (var s in sList)
         {
             dal.Insert(s);
             s.id      = s.areaId;
             s.sysFlag = 2;
             odal.Update(s);
         }
         return(sList.Count);
     }
     catch
     {
         return(-1);
     }
 }
Esempio n. 2
0
 public int ProcessUpdateData(int areaCode, string targetDbName)
 {
     try
     {
         var sdal  = new TQueueDAL(dbKey: areaCode.ToString());
         var tdal  = new TQueueDAL(dbKey: targetDbName);
         var sList = sdal.GetModelList(p => p.sysFlag == 1);
         foreach (var s in sList)
         {
             var id    = s.id;
             var nData = tdal.GetModelList(p => p.areaCode == areaCode && p.areaId == s.id).FirstOrDefault();
             if (nData == null)
             {
                 s.areaCode = areaCode;
                 s.areaId   = s.id;
                 tdal.Insert(s);
                 s.id      = s.areaId;
                 s.sysFlag = 2;
                 sdal.Update(s);
             }
             else
             {
                 var data = s;
                 data.id       = nData.id;
                 data.areaCode = nData.areaCode;
                 data.areaId   = nData.areaId;
                 tdal.Update(data);
                 s.sysFlag = 2;
                 s.id      = id;
                 sdal.Update(s);
             }
         }
         return(sList.Count);
     }
     catch
     {
         return(-1);
     }
 }