Example #1
0
 public ActionResult ArchiveComputer(string name)
 {
     if (name != null)
     {
         RemoteComputer c = new RemoteComputer(name, @"lcps\earlyms", "Lcp$-pw1");
         c.Refresh();
         return View(c);
     }
     return View();
 }
Example #2
0
        public ActionResult ArchiveComputer(ComputerInfo m)
        {
            try
            {
                RemoteComputer c = new RemoteComputer(m.ComputerName, @"lcps\earlyms", "Lcp$-pw1");

                c.Refresh();

                c.DBAcrchive(m, User.Identity.Name);

                return View("Index", new { name = m.ComputerName });
            }
            catch (Exception ex)
            {
                AnvilExceptionModel em = new AnvilExceptionModel(ex, "Archive Computer", "Computers", "Computers", "Index");
                return View("Error", em);
            }
        }
Example #3
0
        public ActionResult RelocateComputer(string b, string r, string u, string n)
        {
            string result = "Success";

            try
            {
                if (String.IsNullOrEmpty(b))
                    throw new Exception("Building ID is required");

                if (String.IsNullOrEmpty(r))
                    throw new Exception("Room ID is required");

                if (String.IsNullOrEmpty(u))
                    throw new Exception("Unit Number is required");

                if (String.IsNullOrEmpty(n))
                    throw new Exception("Computer Name is required");

                ApplicationBase app = LcpsDbContext.DefaultApp;
                string un = string.Format("{0}\\{1}", app.LDAPDomain, app.LDAPUserName);

                RemoteComputer c = new RemoteComputer(n, un, app.LDAPPassword);

                c.Refresh();

                ComputerInfo info = c.ToComputerInfo();
                info.BuildingId = new Guid(b);
                info.RoomId = new Guid(r);
                info.UnitNumber = u.PadLeft(3, '0');

                c.DBAcrchive(info, User.Identity.Name);

                info.UpdateLDAP();
            }
            catch (Exception ex)
            {
                AnvilExceptionCollector ec = new AnvilExceptionCollector(ex);
                result = ec.ToUL();
            }

            return Content(result);
        }
Example #4
0
        public ActionResult LookupComputer(string name)
        {
            string result = "Success";

               try
               {
               if (String.IsNullOrEmpty(name))
                   throw new Exception("Please supply a computer name to search for");

               ApplicationBase app = LcpsDbContext.DefaultApp;
               string un = string.Format("{0}\\{1}", app.LDAPDomain, app.LDAPUserName);

               RemoteComputer c = new RemoteComputer(name, un, app.LDAPPassword);

               c.Refresh();
               }
            catch(Exception ex)
               {
               AnvilExceptionCollector ec = new AnvilExceptionCollector(ex);
               result = ec.ToUL();
               }

               return Content(result);
        }