public bool IsExistETLEntryObjectHistory(Session session, Guid jobId, Int64 objectEntryLogId) { bool result = false; try { ETLJob job = session.GetObjectByKey <ETLJob>(jobId); ObjectEntryLog objectEntryLog = session.GetObjectByKey <ObjectEntryLog>(objectEntryLogId); CriteriaOperator criteria_0 = new BinaryOperator(new OperandProperty("ETLBusinessObjectId.ETLJobId.ETLJobId"), job.ETLJobId, BinaryOperatorType.Equal); CriteriaOperator criteria_1 = new BinaryOperator("ObjectEntryLogId", objectEntryLog, BinaryOperatorType.Equal); CriteriaOperator criteria_2 = new BinaryOperator("RowStatus", 1, BinaryOperatorType.GreaterOrEqual); CriteriaOperator criteria = GroupOperator.Combine(GroupOperatorType.And, criteria_0, criteria_1, criteria_2); ETLEntryObjectHistory etlEntryObjectHistory = session.FindObject <ETLEntryObjectHistory>(criteria); if (etlEntryObjectHistory != null) { result = true; } }catch (Exception) { throw; } return(result); }
public bool CreateObjectEntryLog(Session session, BusinessObject businessObject) { try { ObjectEntryLog objectEntryLog = new ObjectEntryLog(session); objectEntryLog.LastUpdatedObjectTimeStamp = DateTime.Now; objectEntryLog.RowStatus = Constant.ROWSTATUS_ACTIVE; objectEntryLog.BusinessObjectId = businessObject; objectEntryLog.Save(); return(true); } catch (Exception) { return(false); } }
public bool NeedToBeProcessed(Session session, Int64 ObjectId, Guid jobId) { bool result = false; BusinessObject businessObject = session.GetObjectByKey <BusinessObject>(ObjectId); if (businessObject == null) { return(false); } ETLJob etlJob = session.GetObjectByKey <ETLJob>(jobId); if (etlJob == null) { return(false); } CriteriaOperator criteria_0 = new BinaryOperator("ETLJobId", etlJob, BinaryOperatorType.Equal); CriteriaOperator criteria_1 = new BinaryOperator("BusinessObjectId", businessObject, BinaryOperatorType.Equal); CriteriaOperator criteria_2 = new BinaryOperator("RowStatus", 0, BinaryOperatorType.Greater); CriteriaOperator criteria = GroupOperator.Combine(GroupOperatorType.And, criteria_0, criteria_1, criteria_2); ETLBusinessObject etlBusinessObject = session.FindObject <ETLBusinessObject>(criteria); if (etlBusinessObject == null) { return(true); } ObjectEntryLogBO objectEntryLogBO = new ObjectEntryLogBO(); ObjectEntryLog objectEntryLog = objectEntryLogBO.GetNewestObjectEntryLog(session, businessObject.BusinessObjectId); if (objectEntryLog == null) { objectEntryLogBO.CreateObjectEntryLog(session, businessObject); objectEntryLog = objectEntryLogBO.GetNewestObjectEntryLog(session, businessObject.BusinessObjectId); } if (!IsExistETLEntryObjectHistory(session, jobId, objectEntryLog.ObjectEntryLogId)) { return(true); } return(result); }
public void CreatETLEntryObjectHistory(Session session, Guid jobId, Int64 businessObjectId, int ErrorCode) { try { ETLJob job = session.GetObjectByKey <ETLJob>(jobId); if (job == null) { return; } BusinessObject businessObject = session.GetObjectByKey <BusinessObject>(businessObjectId); if (businessObject == null) { return; } ObjectEntryLogBO objectEntryLogBO = new ObjectEntryLogBO(); ETLLogBO etlLogBO = new ETLLogBO(); ObjectEntryLog newestObjectEntryLog = objectEntryLogBO.GetNewestObjectEntryLog(session, businessObjectId); if (newestObjectEntryLog == null) { return; } ETLBusinessObject etlBusinessObject = etlLogBO.GetETLBusinessObject(session, jobId, businessObjectId); if (etlBusinessObject == null) { return; } ETLEntryObjectHistory etlEntryObjectHistory = new ETLEntryObjectHistory(session); etlEntryObjectHistory.ErrorCode = ErrorCode; etlEntryObjectHistory.ETLBusinessObjectId = etlBusinessObject; etlEntryObjectHistory.ObjectEntryLogId = newestObjectEntryLog; etlEntryObjectHistory.RowTimeStamp = DateTime.Now; etlEntryObjectHistory.RowStatus = 0; etlEntryObjectHistory.Save(); } catch (Exception) { throw; } }
public bool CreateObjectEntryLog(Session session, Int64 businessObjectId) { try { BusinessObject businessObject = session.GetObjectByKey <BusinessObject>(businessObjectId); if (businessObject == null) { return(false); } ObjectEntryLog objectEntryLog = new ObjectEntryLog(session); objectEntryLog.LastUpdatedObjectTimeStamp = DateTime.Now; objectEntryLog.RowStatus = Constant.ROWSTATUS_ACTIVE; objectEntryLog.BusinessObjectId = businessObject; objectEntryLog.Save(); return(true); } catch (Exception) { return(false); } }
public ETLEntryObjectHistory GetETLEntryObjectHistory(Session session, Guid jobId, Int64 businessObjectId) { ETLEntryObjectHistory etlEntryObjectHistory = null; try { ETLJob job = session.GetObjectByKey <ETLJob>(jobId); if (job == null) { return(null); } BusinessObject businessObject = session.GetObjectByKey <BusinessObject>(businessObjectId); if (businessObject == null) { return(null); } ObjectEntryLogBO objectEntryLogBO = new ObjectEntryLogBO(); ETLLogBO etlLogBO = new ETLLogBO(); ObjectEntryLog newestObjectEntryLog = objectEntryLogBO.GetNewestObjectEntryLog(session, businessObjectId); ETLBusinessObject etlBusinessObject = etlLogBO.GetETLBusinessObject(session, jobId, businessObjectId); if (etlBusinessObject == null) { return(null); } CriteriaOperator criteria_0 = new BinaryOperator("ETLBusinessObjectId", etlBusinessObject, BinaryOperatorType.Equal); CriteriaOperator criteria_1 = new BinaryOperator(new OperandProperty("ObjectEntryLogId.BusinessObjectId.BusinessObjectId"), businessObject.BusinessObjectId, BinaryOperatorType.Equal); CriteriaOperator criteria = GroupOperator.Combine(GroupOperatorType.And, criteria_0, criteria_1); etlEntryObjectHistory = session.FindObject <ETLEntryObjectHistory>(criteria); } catch (Exception) { throw; } return(etlEntryObjectHistory); }
public ObjectEntryLog GetNewestObjectEntryLog(Session session, Int64 businessObjectId) { ObjectEntryLog objectEntryLog = null; try { BusinessObject businessObject = session.GetObjectByKey <BusinessObject>(businessObjectId); CriteriaOperator criteria_0 = new BinaryOperator("RowStatus", 0, BinaryOperatorType.Greater); CriteriaOperator criteria_1 = new BinaryOperator("BusinessObjectId", businessObject, BinaryOperatorType.Equal); CriteriaOperator criteria = new GroupOperator(GroupOperatorType.And, criteria_0, criteria_1); XPCollection <ObjectEntryLog> objectEntryLogCollection = new XPCollection <ObjectEntryLog>(session, criteria); objectEntryLogCollection.Sorting.Add(new SortProperty("LastUpdatedObjectTimeStamp", SortingDirection.Descending)); objectEntryLog = objectEntryLogCollection.FirstOrDefault(); } catch (Exception) { throw; } return(objectEntryLog); }