public void EnqueueScheduledDistributions(System.DateTime Date, string CompanyNameShort) { FI.DataAccess.Users dacObj = DataAccessFactory.Instance.GetUsersDA(); FI.Common.Data.FIDataTable table = dacObj.ReadUsers(); if (table.Rows.Count == 0) { return; } foreach (System.Data.DataRow row in table.Rows) { if (((string)row["CompanyNameShort"]).ToUpper() == CompanyNameShort.ToUpper()) { User user = new User((decimal)row["Id"], true); user.DistributionSystem.EnqueueDistributions(Date); } } }
public FI.Common.Data.FIDataTable GetSystemUsers() { FI.DataAccess.Users dacObj = DataAccessFactory.Instance.GetUsersDA(); return(dacObj.ReadUsers(this._companyId)); }
public void ExecuteAllOlapReports(string CompanyNameShort, int millisecondsTimeout, string logPath) { if (!System.IO.Path.IsPathRooted(logPath)) { logPath = FI.Common.AppConfig.TempDir + "\\" + logPath; } FI.DataAccess.Users dacObj = DataAccessFactory.Instance.GetUsersDA(); FI.Common.Data.FIDataTable table = dacObj.ReadUsers(); if (table.Rows.Count == 0) { return; } table.DefaultView.Sort = "Id asc"; int errorCount = 0; int rptCount = 1; foreach (System.Data.DataRowView userRow in table.DefaultView) { if (((string)userRow["CompanyNameShort"]).ToUpper() == CompanyNameShort.ToUpper()) { User user = new User((decimal)userRow["Id"], false); FI.Common.Data.FIDataTable t = user.ReportSystem.GetReportHeaders(typeof(OlapReport)); t.DefaultView.Sort = "id asc"; string userLog = string.Format("***************** User id={0}, login='******', password='******'", user.ID, user.Logon, user.Password); System.IO.StreamWriter sw = System.IO.File.AppendText(logPath); sw.WriteLine(userLog); sw.Close(); foreach (DataRowView rptRow in t.DefaultView) { if ((byte)rptRow["sharing_status"] == (byte)Report.SharingEnum.InheriteSubscriber || (byte)rptRow["sharing_status"] == (byte)Report.SharingEnum.SnapshotSubscriber) { continue; } string log = string.Format("{0}\t#{1}\t", DateTime.Now.ToShortTimeString(), rptCount); try { OlapReport rpt = (OlapReport)user.ReportSystem.GetReport((decimal)rptRow["id"], typeof(OlapReport), true); log += string.Format("OlapReport id={0}, name='{1}', description='{2}'", rpt.ID, rpt.Name, rpt.Description); rpt.BeginExecute(); int milisecondCount = 0; while (milisecondCount < millisecondsTimeout && rpt.State == Report.StateEnum.Executing) { System.Threading.Thread.Sleep(500); milisecondCount += 500; } if (rpt.State == Report.StateEnum.Executing) { rpt.CancelExecute(); log += "\r\n\tcanceled on timeout"; } else { rpt.EndExecute(); log += "\r\n\tcompleted, cells=" + rpt.Cellset.Axis0PosCount * rpt.Cellset.Axis1PosCount; } } catch (Exception exc) { log += string.Format("exception \r\n\t\t{0}", exc.Message); errorCount++; } rptCount++; sw = System.IO.File.AppendText(logPath); sw.WriteLine(log); sw.Close(); } } } }