public int ProcessInsertData(int areaCode, string targetDbName) { try { var sList = new TWindowBusinessDAL(areaCode.ToString()).GetModelList(c => c.sysFlag == 0).ToList(); sList.ForEach(s => { s.areaCode = areaCode; s.areaId = s.ID; }); var dal = new TWindowBusinessDAL(targetDbName); var odal = new TWindowBusinessDAL(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); } }
public int ProcessUpdateData(int areaCode, string targetDbName) { try { var sdal = new TWindowBusinessDAL(areaCode.ToString()); var tdal = new TWindowBusinessDAL(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); } }
public TWindowBusinessBLL(string dbKey) { this.dal = new TWindowBusinessDAL(dbKey); }
public TWindowBusinessBLL() { this.dal = new TWindowBusinessDAL(); }