Exemplo n.º 1
0
        public ActionResult DeleteMultipleJobs(List <PrintJob> printjobs)
        {
            if (Support.AdditionalSecurity() == true)
            {
                var  theADGroup = Support.ADGroupCanPurgePrintQueues();
                bool isInRole   = User.IsInRole(theADGroup);
                if (isInRole == false)
                {
                    Support.SendEmail("Failed cancel print job", "User :"******" attempted to purge print jobs and failed because user does not have access.");
                    return(RedirectToAction("Index"));
                }
            }


            List <string> outcome = new List <string>();

            foreach (var pj in printjobs)
            {
                if (pj.ToDelete)
                {
                    if (CancelPrintJob(pj.Server, pj.Printer, pj.PrintJobID))
                    {
                        outcome.Add("The following print job has been canceled: " + pj.PrintJobName + Environment.NewLine + "Printer: " + pj.Printer + Environment.NewLine + "Print server: " + pj.Server + Environment.NewLine + "User: "******"The following print job failed to cancel: " + pj.PrintJobName + Environment.NewLine + "Printer: " + pj.Printer + Environment.NewLine + "Print server: " + pj.Server + Environment.NewLine + "User: "******"Canceled Print Jobs", string.Concat(outcome));
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public ActionResult Delete(PrintJob printJob)
        {
            if (Support.AdditionalSecurity() == true)
            {
                var  theADGroup = Support.ADGroupCanPurgePrintQueues();
                bool isInRole   = User.IsInRole(theADGroup);
                if (isInRole == false)
                {
                    Support.SendEmail("Failed cancel print job", "User :"******" attempted to purge print jobs and failed because user does not have access.");
                    return(RedirectToAction("Index"));
                }
            }

            if (CancelPrintJob(printJob.Server, printJob.Printer, printJob.PrintJobID))
            {
                Support.SendEmail("Canceled Print Job", "The following print job has been canceled: " + printJob.PrintJobName + Environment.NewLine + "Printer: " + printJob.Printer + Environment.NewLine + "Print server: " + printJob.Server + Environment.NewLine + "User: "******"Canceled Print Job", "The following print job failed to cancel: " + printJob.PrintJobName + Environment.NewLine + "Printer: " + printJob.Printer + Environment.NewLine + "Print server: " + printJob.Server + Environment.NewLine + "User: "******"Index"));
        }