public static bool Delete(int multicastId)
{
using (var uow = new DAL.UnitOfWork())
{
var multicast = uow.ActiveMulticastSessionRepository.GetById(multicastId);
var computers = uow.ActiveImagingTaskRepository.MulticastComputers(multicastId);
uow.ActiveMulticastSessionRepository.Delete(multicastId);
if (uow.Save())
{
ActiveImagingTask.DeleteForMulticast(multicastId);
foreach (var computer in computers)
new BLL.Workflows.CleanTaskBootFiles(computer).CleanPxeBoot();
try
{
var prs = Process.GetProcessById(Convert.ToInt32(multicast.Pid));
var processName = prs.ProcessName;
if (Environment.OSVersion.ToString().Contains("Unix"))
{
for (var x = 1; x <= 5; x++)
{
KillProcessLinux(Convert.ToInt32(multicast.Pid));
Thread.Sleep(200);
}
}
else
{
if (processName == "cmd")
KillProcess(Convert.ToInt32(multicast.Pid));
}
//Message.Text = "Successfully Deleted Task";
}
catch (Exception ex)
{
Logger.Log(ex.ToString());
//Message.Text = "Could Not Kill Process. Check The Exception Log For More Info";
}
return true;
}
else
{
//Message.Text = "Could Not Delete Task";
return false;
}
}
}