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); } }
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); }