public virtual void ImportToDatabase(int UploadEmpID) { DBFilter sessionFilter = new DBFilter(); sessionFilter.add(new Match("SessionID", m_SessionID)); if (UploadEmpID > 0) { sessionFilter.add(new Match("UploadEmpID", UploadEmpID)); } ArrayList uploadEmpPayList = tempDB.select(dbConn, sessionFilter); foreach (EUploadEmpRecurringPayment obj in uploadEmpPayList) { EEmpRecurringPayment empRP = new EEmpRecurringPayment(); if (obj.ImportActionStatus != ImportDBObject.ImportActionEnum.INSERT) { empRP.EmpRPID = obj.EmpRPID; uploadDB.select(dbConn, empRP); } obj.ExportToObject(empRP); if (obj.ImportActionStatus == ImportDBObject.ImportActionEnum.INSERT) { empRP.EmpID = ParseTemp.GetEmpIDFromUploadEmpID(dbConn, obj.UploadEmpID); AND andTerms = new AND(); andTerms.add(new Match("EmpRPEffFr", "<=", empRP.EmpRPEffFr)); andTerms.add(new Match("PayCodeID", empRP.PayCodeID)); EEmpRecurringPayment lastObj = (EEmpRecurringPayment)AppUtils.GetLastObj(dbConn, EEmpRecurringPayment.db, "EmpRPEffFr", empRP.EmpID, andTerms); if (lastObj != null) { if (lastObj.EmpRPEffTo.Ticks == 0) { lastObj.EmpRPEffTo = empRP.EmpRPEffFr.AddDays(-1); uploadDB.update(dbConn, lastObj); } } if (obj.UploadEmpAccID > 0) { empRP.EmpAccID = ParseTemp.GetEmpBankAccIDFromUploadEmpBankAccID(dbConn, obj.UploadEmpAccID); } uploadDB.insert(dbConn, empRP); //DBFilter emplastPosFilter = new DBFilter(); } else if (obj.ImportActionStatus == ImportDBObject.ImportActionEnum.UPDATE) { uploadDB.update(dbConn, empRP); } tempDB.delete(dbConn, obj); } }
public void ImportToDatabase(int UploadEmpID) { DBFilter sessionFilter = new DBFilter(); sessionFilter.add(new Match("SessionID", m_SessionID)); if (UploadEmpID > 0) { sessionFilter.add(new Match("UploadEmpID", UploadEmpID)); } ArrayList uploadEmpFinalPayList = tempDB.select(dbConn, sessionFilter); foreach (EUploadEmpFinalPayment obj in uploadEmpFinalPayList) { EEmpFinalPayment EmpFinalPay = new EEmpFinalPayment(); if (obj.ImportActionStatus != ImportDBObject.ImportActionEnum.INSERT) { EmpFinalPay.EmpFinalPayID = obj.EmpFinalPayID; uploadDB.select(dbConn, EmpFinalPay); } obj.ExportToObject(EmpFinalPay); if (obj.ImportActionStatus == ImportDBObject.ImportActionEnum.INSERT) { EmpFinalPay.EmpID = ParseTemp.GetEmpIDFromUploadEmpID(dbConn, obj.UploadEmpID); if (obj.UploadEmpAccID > 0) { EmpFinalPay.EmpAccID = ParseTemp.GetEmpBankAccIDFromUploadEmpBankAccID(dbConn, obj.UploadEmpAccID); } uploadDB.insert(dbConn, EmpFinalPay); //DBFilter emplastPosFilter = new DBFilter(); } else if (obj.ImportActionStatus == ImportDBObject.ImportActionEnum.UPDATE) { uploadDB.update(dbConn, EmpFinalPay); } tempDB.delete(dbConn, obj); } }