private Dictionary <Int64, List <TimeSpan> > GetTenantAlaramList() { string ServiceParams = dtServiceSchedule.Rows[0]["ServiceParams"].ToString(); var Params = XDocument.Parse(ServiceParams).Descendants("add").Select(z => new { Key = z.Attribute("key").Value, Value = z.Value }).ToList(); string AlaramListSp = Params.Find(f => f.Key == "AlarmStoredprocedure").Value; Dictionary <Int64, List <TimeSpan> > TenantAlaramList = new Dictionary <long, List <TimeSpan> >(); DataTable timeDT = ServiceLoaderDataAccess.GetTenantSpecificTime(AlaramListSp); foreach (DataRow row in timeDT.Rows) { Int64 curTenant = Convert.ToInt64(row["TENANT_ID"]); List <TimeSpan> executionTimeList = new List <TimeSpan>(); if (TenantAlaramList.Keys.Contains(curTenant)) { executionTimeList = TenantAlaramList[curTenant]; } foreach (string time in Convert.ToString(row["EXECUTION_TIME"]).Trim().Split(',')) { if (time.Trim().Split('|').Length > 1) { if ((Convert.ToInt16(time.Trim().Split('|')[0]) - 1) == (int)DateTime.Now.DayOfWeek) { string weekTime = time.Trim().Split('|')[1]; foreach (string wtime in weekTime.Trim().Split(';')) { TimeSpan exeTime = new TimeSpan(Convert.ToInt32(wtime.Split(':')[0]), Convert.ToInt32(wtime.Split(':')[1]), 0); if (!executionTimeList.Contains(exeTime)) { executionTimeList.Add(exeTime); } } } } else { TimeSpan exeTime = new TimeSpan(Convert.ToInt32(time.Split(':')[0]), Convert.ToInt32(time.Split(':')[1]), 0); if (!executionTimeList.Contains(exeTime)) { executionTimeList.Add(exeTime); } } } executionTimeList.Sort(); if (!TenantAlaramList.Keys.Contains(curTenant)) { TenantAlaramList.Add(Convert.ToInt64(row["TENANT_ID"]), executionTimeList); } } return(TenantAlaramList); }
private bool LoadServiceSchedule() { dtServiceSchedule = null; dtServiceSchedule = ServiceLoaderDataAccess.GetServiceServiceConfig(SName); if (dtServiceSchedule.Rows.Count == 0) { return(false); } return(true); }
private bool LoadServiceSchedule() { while (true) { try { dtServiceSchedule = null; dtServiceSchedule = ServiceLoaderDataAccess.GetServiceServiceConfig(SName); if (dtServiceSchedule.Rows.Count == 0) { return(false); } return(true); } catch (Exception ex) { Thread.Sleep(10000); Exception exnew = new Exception("Exception while getting service schedule for the service.Will Retry after 10 sec", ex); MTSExceptionHandler.HandleException(ref exnew); } } }
private void UpdateServiceStatus(string ServiceName, short Status) { ServiceLoaderDataAccess.UpdateServiceStatus(ServiceName, Status); }