Exemplo n.º 1
0
        public Guid ETLGetNextProcessObject(Session session, Guid jobId, List <int> objectType)
        {
            Guid result = Guid.Empty;
            ETLEntryObjectHistoryBO entryHistoryBO   = new ETLEntryObjectHistoryBO();
            BusinessObjectBO        businessObjectBO = new BusinessObjectBO();
            ObjectEntryLogBO        objectEntryLogBO = new ObjectEntryLogBO();
            ETLLogBO etlLogBO = new ETLLogBO();

            try
            {
                #region Logic
                BusinessObject businessObject = businessObjectBO.GetOldestUnprocessedObject(session, jobId, objectType);
                if (businessObject == null)
                {
                    return(result);
                }
                result = businessObject.RefId;
                etlLogBO.CreateETLBusinessObject(session, jobId, businessObject.BusinessObjectId);
                entryHistoryBO.CreatETLEntryObjectHistory(session, jobId, businessObject.BusinessObjectId, 0);
                XPCollection <ETLBusinessObject> etlBusinessObjectCollection = etlLogBO.GetNewerETLBusinessObject(session, jobId, businessObject.BusinessObjectId);
                foreach (ETLBusinessObject etlBO in etlBusinessObjectCollection)
                {
                    etlBO.RowStatus = Utility.Constant.ROWSTATUS_DELETED;
                    etlBO.Save();
                }
                #endregion
            }
            catch (Exception)
            {
                return(result);
            }
            return(result);
        }
Exemplo n.º 2
0
        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;
            }
        }
Exemplo n.º 3
0
        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);
        }