Example #1
0
        public void ProcessCurrent(XPObjectSpace objSpace)
        {
            var prevSshot = CashFlowHelper.GetPreviousSnapshot(objSpace);

            if (prevSshot == null)
            {
                ProcessCurrentWithoutPrev();
                _LastReturnMessage = "Processed without previous snapshot is defined in XPO.";
                return;
            }

            var    dax = new DaxClient();
            string connectionString = AppConfig.SsasConnectionString;
            var    cnn = new ADOMD.AdomdConnection(connectionString);

            cnn.Open();
            var reader = dax.ExecuteReader(@"EVALUATE
ROW
(
	""Result"",
	CALCULATE (
		COUNTROWS( CashFlow ),
		CashFlow[Snapshot OID] = ""{OID}""
	)
)".Replace("{OID}", "{" + prevSshot.Oid + "}"), cnn);

            reader.Read();
            var prevRowCount = reader.GetValue(0);

            if (prevRowCount == null)
            {
                ProcessCurrentWithPrev();
                _LastReturnMessage = "Processed previous snapshot as it currently does not exist in SSAS.";
            }
            else
            {
                ProcessCurrentWithoutPrev();
                _LastReturnMessage = "Did not process previous snapshot because previous snapshot already exists in SSAS.";
            }
        }
Example #2
0
 private CashFlowSnapshot GetCurrentSnapshot(Session session)
 {
     return(CashFlowHelper.GetCurrentSnapshot(session));
 }