using DapperExtensions; using System.Collections.Generic; using WX.CRM.DataSynServer.Dao; using WX.CRM.DataSynServer.Domain; namespace WX.CRM.DataSynServer.Application { public class SyncPushService { public IEnumerable GetList(int topNum, string deptCode = "") { using (var db = MySqlStore.GetConnection()) { var predicate = Predicates.Field(f => f.deptcode, Operator.Eq, deptCode); IList sort = new List(); sort.Add(new Sort { PropertyName = "pkid", Ascending = true }); return db.GetPage(predicate, sort, 0, topNum); } } public void PushSucc(SYNC_PUSH info) { if (info == null) return; using (var db = MySqlStore.GetConnection()) { var suc = new SYNC_PUSH_SUCC(info.jsontext, info.bidatatype, info.deptcode); suc.ISBATCH = info.isbatch; db.Insert(suc); db.Delete(info); } } public void PushError(SYNC_PUSH info, string errstr) { if (info == null) return; using (var db = MySqlStore.GetConnection()) { var err = new SYNC_PUSH_ERR(info.jsontext, errstr, info.bidatatype, info.deptcode); db.Insert(err); db.Delete(info); } } } }