public string GetAllProcessStatus() { DataTable returnTable = new DataTable(); Atul_v1Data adb = new Atul_v1Data(); returnTable = adb.GetAllProcessStatus(); return JsonMethods.GetJSONString(returnTable); }
public bool CreateScheduledProcessInstance(long ProcessID, string scheduleVersion) { bool success = true; Atul_v1Data adb = new Atul_v1Data(); // get schedule record from db Schedule s = adb.GetProcessScheduleByProcessID(ProcessID); if (s.ScheduleVersion == scheduleVersion) { DataTable processStatusTable = adb.GetAllProcessStatus(); int processStatusID = 0; foreach (DataRow processStatusRow in processStatusTable.Rows) { if (processStatusRow["ProcessStatus"].ToString().ToLower() == "open") { processStatusID = Convert.ToInt32(processStatusRow["AtulProcessStatusID"]); } } // instantiate process foreach (string u in s.InstantiatedUserList.Split(',')) { if (u != null) { this.CreateInstanceProcess(s.AtulProcessID, Convert.ToInt32(u), Convert.ToInt32(u), processStatusID, "", ""); } } // if there's a repeat schedule involved, schedule the next fire if (s.RepeatSchedule != null && s.RepeatSchedule != string.Empty) { // calculate next date from cronstring. DateTime next = s.GetNextScheduled(); // update process schedule, passing NextScheduledDate as last run, since that should represent this one UpdateProcessSchedule(s.AtulProcessScheduleID, s.ScheduleVersion, s.NextScheduledDate, next, s.RepeatSchedule, s.InstantiatedUserList); // send new scheduled message to queue this.PushNextScheduleToAdminQueue(s, next); } else { this.DeleteProcessSchedule(s.AtulProcessScheduleID); } } return success; }