public static int addsystemprocess(SystemProcessThreadModel obj)
 {
     ControlPanel.Core.Entities.SystemProcess sysprocesentity = new ControlPanel.Core.Entities.SystemProcess();
     ControlPanel.Repository.SystemProcessRepository sprepo = new ControlPanel.Repository.SystemProcessRepository();
     sysprocesentity.Name = obj.SystemProcessName;
     sysprocesentity.Description = obj.SystemProcessDesc;
     sysprocesentity.Enabled = true;
     sysprocesentity.DisplayOrder = 10;
     var entry = sprepo.InsertSystemProcess(sysprocesentity);
     return entry.SystemProcessId;
 }
        public static void getdata(SystemProcessThreadModel obj)
        {
            ControlPanel.Core.Entities.SystemProcessThread SystemProcessThreadEntity = new ControlPanel.Core.Entities.SystemProcessThread();
            var continuouschk = obj.Continuous;
            var isnewsysprocess = obj.SystemProcessId;

            if (isnewsysprocess == "-1")
            {
                var sysId = addsystemprocess(obj);
                SystemProcessThreadEntity.SystemProcessId = sysId;
            }
            else
            {
                SystemProcessThreadEntity.SystemProcessId = Convert.ToInt16(obj.SystemProcessId);
            }

            TimeSpan scheduleTime;
            SystemProcessThreadEntity.Name = obj.Name;
            SystemProcessThreadEntity.Description = obj.Description;
            SystemProcessThreadEntity.SpringEntryName = obj.SpringEntryName;
            TimeSpan.TryParse(obj.ScheduledTime, out scheduleTime);
            SystemProcessThreadEntity.ScheduledTime = scheduleTime;
            SystemProcessThreadEntity.Enabled = false;

            if (continuouschk == "on")
            SystemProcessThreadEntity.Continuous = true;

            else
            SystemProcessThreadEntity.Continuous = false;

            SystemProcessThreadEntity.SleepTime = 10;
            SystemProcessThreadEntity.AutoStart = false;
            SystemProcessThreadEntity.ContinuousDelay = Convert.ToInt16(obj.ContinuousDelay);
            SystemProcessThreadEntity.IsDeleted = false;
            SystemProcessThreadEntity.DisplayOrder = "0";
            SystemProcessThreadEntity.Argument = obj.Argument;

            ControlPanel.Repository.SystemProcessThreadRepository sptrepo = new ControlPanel.Repository.SystemProcessThreadRepository();

            var threadId = obj.HiddenField;

            if (threadId == null)
            {
                sptrepo.InsertSystemProcessThread(SystemProcessThreadEntity);

            }
            else
            {
                SystemProcessThreadEntity.SystemProcessThreadId = Convert.ToInt16(threadId);
                sptrepo.UpdateSystemProcessThread(SystemProcessThreadEntity);
            }
        }
 public static int addsystemprocess(SystemProcessThreadModel obj)
 {
     ControlPanel.Core.Entities.SystemProcess sysprocesentity = new ControlPanel.Core.Entities.SystemProcess();
     ControlPanel.Repository.SystemProcessRepository sprepo = new ControlPanel.Repository.SystemProcessRepository();
     sysprocesentity.Name = obj.SystemProcessName;
     sysprocesentity.Description = obj.SystemProcessDesc;
     sysprocesentity.Enabled = true;
     sysprocesentity.DisplayOrder = 10;
     sysprocesentity.Ip = obj.SystemProcessIp;
     if (obj.SystemProcessPort != null && obj.SystemProcessPort != "")
     {
         sysprocesentity.Port = Convert.ToInt16(obj.SystemProcessPort);
     }
     var entry = sprepo.InsertSystemProcess(sysprocesentity);
     return entry.SystemProcessId;
 }