ATUL_v1.AtulBusinessLogic.CreateScheduledProcessInstance C# (CSharp) Method

CreateScheduledProcessInstance() public method

public CreateScheduledProcessInstance ( long ProcessID, string scheduleVersion ) : bool
ProcessID long
scheduleVersion string
return bool
        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;
        }

Usage Example

Beispiel #1
0
 public bool CreateScheduledProcessInstance(long ProcessID, string scheduleVersion)
 {
     bool success = false;
     AtulBusinessLogic adb = new AtulBusinessLogic();
     success = adb.CreateScheduledProcessInstance(ProcessID, scheduleVersion);
     return success;
 }
AtulBusinessLogic