// public bool HaveAllDistributionAttemptsFailed(decimal distributionId, ushort historyAttempts) // { // string sql="select top " + historyAttempts.ToString() + // " status from tdistribution_log where distribution_id=" + distributionId.ToString() + // " and status in ('Ok', 'Error') order by timestamp"; // // DataTable dt=new DataTable(); // DataBase.Instance.ExecuteCommand(sql, CommandType.Text, null, dt); // if(dt==null || dt.Rows.Count==0) // return false; // foreach(DataRow r in dt.Rows) // if(r[0].ToString().ToUpper()=="OK") // return false; // // return true; // } public bool CancelQueuedItem(decimal queueItemId, string message) { bool ok = false; // try to cancel DataTable dt = new DataTable(); DataBase.Instance.ExecuteCommand( string.Format("select taskGuid from tdistribution_log where id={0} and status in ('Pending', 'Executing')", queueItemId.ToString()), CommandType.Text, null, dt); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { // if taskId is not empty, cancel it if (dr[0] != null && dr[0] != DBNull.Value) { Guid taskId = (Guid)dr[0]; OlapSystem os = new OlapSystem(); os.CancelOlapCommand(taskId.ToString()); } // write status WriteDistributionQueueCanceled(queueItemId, (message == null ? "" : message)); } } return(ok); }
// public bool HaveAllDistributionAttemptsFailed(decimal distributionId, ushort historyAttempts) // { // string sql="select top " + historyAttempts.ToString() + // " status from tdistribution_log where distribution_id=" + distributionId.ToString() + // " and status in ('Ok', 'Error') order by timestamp"; // // DataTable dt=new DataTable(); // DataBase.Instance.ExecuteCommand(sql, CommandType.Text, null, dt); // if(dt==null || dt.Rows.Count==0) // return false; // foreach(DataRow r in dt.Rows) // if(r[0].ToString().ToUpper()=="OK") // return false; // // return true; // } public bool CancelQueuedItem(decimal queueItemId, string message) { bool ok=false; // try to cancel DataTable dt=new DataTable(); DataBase.Instance.ExecuteCommand( string.Format("select taskGuid from tdistribution_log where id={0} and status in ('Pending', 'Executing')", queueItemId.ToString()), CommandType.Text, null, dt); if(dt!=null && dt.Rows.Count>0) foreach(DataRow dr in dt.Rows) { // if taskId is not empty, cancel it if(dr[0]!=null && dr[0]!=DBNull.Value) { Guid taskId=(Guid)dr[0]; OlapSystem os=new OlapSystem(); os.CancelOlapCommand(taskId.ToString()); } // write status WriteDistributionQueueCanceled(queueItemId, (message==null ? "" : message)); } return ok; }
public FIDataTable GetCashedReportsToRefresh(decimal companyId) { FIDataTable dt = new FIDataTable(); // seelct reports linked to gauges string sql = string.Format(@" select tbl.user_id, tbl.rpt_id, c.server, c.[database], c.cube, c.cube_processed_on from ( select distinct r.user_id, l.rpt_id from dbo.t_gauges_reports l inner join dbo.t_olap_reports r on l.rpt_type=0 and l.rpt_id=(case when r.sharing_status=4 then parent_report_id else id end) inner join dbo.tusers u on r.user_id=u.id and u.company_id={0} ) tbl left outer join dbo.t_olap_reports_cache c on tbl.rpt_id=c.rpt_id ", companyId.ToString()); DataBase.Instance.ExecuteCommand(sql, CommandType.Text, null, dt); // check whther they are outdated OlapSystem osys = new OlapSystem(); for (int i = dt.Rows.Count - 1; i >= 0; i--) { string server = dt.Rows[i]["server"] as string; string database = dt.Rows[i]["database"] as string; string cube = dt.Rows[i]["cube"] as string; // no cache exists if (cube == null) { continue; } // check if cube wasn't processed after last run DateTime rptProcess = (dt.Rows[i]["cube_processed_on"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[i]["cube_processed_on"]); DateTime lastProcess = osys.GetCubeLastProcessed(server, database, cube, false); if (rptProcess >= lastProcess) { dt.Rows.RemoveAt(i); } } return(dt); }
private string GetReportSchemaXml(string Server, string Database, string Cube, string OpenNodesXml) { FI.DataAccess.OlapSystem olapSystem = new OlapSystem(); return(olapSystem.GetReportSchemaXml(Server, Database, Cube, OpenNodesXml)); }
private string GetReportXml(string Server, string Database, string Cube, string InReportXml) { FI.DataAccess.OlapSystem olapSystem = new OlapSystem(); return(olapSystem.GetReportXml(Server, Database, Cube, InReportXml)); }
private string GetReportXml(string Server , string Database, string Cube, string InReportXml) { FI.DataAccess.OlapSystem olapSystem=new OlapSystem(); return olapSystem.GetReportXml(Server , Database, Cube , InReportXml); }
private string GetReportSchemaXml(string Server , string Database, string Cube, string OpenNodesXml) { FI.DataAccess.OlapSystem olapSystem=new OlapSystem(); return olapSystem.GetReportSchemaXml(Server , Database, Cube , OpenNodesXml); }