Пример #1
0
        public ActionResult Audit(string machineName, string scannedDate, string macAddress)
        {
            if ((machineName == null || machineName == "") &&
                (scannedDate == null || scannedDate == "" &&
                 (macAddress == null || macAddress == "")))
            {
                SetDropdownList(machineName);
                SetScannedDate(machineName, scannedDate, macAddress);
                SetMacAddress(machineName, macAddress);
                return(RedirectToAction("Index"));
            }

            System.Web.HttpContext.Current.Session["ComputerName"] = machineName;
            System.Web.HttpContext.Current.Session["ScannedDate"]  = scannedDate;
            System.Web.HttpContext.Current.Session["MacAddress"]   = macAddress;
            ViewBag.Machine = machineName;
            SetDropdownList(machineName);
            SetScannedDate(machineName, scannedDate, macAddress);
            SetMacAddress(machineName, macAddress);
            var Info = db.Auditors.Join(db.SystemInfoes,
                                        a => a.ScannedDate, s => s.ScannedDate,
                                        (a, s) => new
            {
                Technician      = a.Technician,
                Client          = a.Client,
                Site            = a.Site,
                Workstation     = a.Workstation,
                OS              = a.OS,
                MachineName     = s.MachineName,
                ManagementGroup = s.ManagementGroup,
                DisplayGroup    = s.DisplayGroup,
                PropertyName    = s.PropertyName,
                PropertyValue   = s.PropertyValue,
                ScannedDate     = a.ScannedDate,
                MacAddress      = s.MacAddress
            }).Where(a => a.MachineName == machineName && a.ScannedDate.Replace(" ", string.Empty) == scannedDate.Replace(" ", string.Empty) &&
                     a.MacAddress == macAddress).ToList();

            var systemaudit = new SystemAuditViewModel();

            foreach (var i in Info)
            {
                var pc = new SystemAudit();
                pc.Technician      = i.Technician;
                pc.Client          = i.Client;
                pc.Site            = i.Site;
                pc.Workstation     = i.Workstation;
                pc.OS              = i.OS;
                pc.MachineName     = i.MachineName;
                pc.ManagementGroup = i.ManagementGroup;
                pc.DisplayGroup    = i.DisplayGroup;
                pc.PropertyName    = i.PropertyName;
                pc.PropertyValue   = i.PropertyValue;
                pc.ScannedDate     = i.ScannedDate;
                pc.MacAddress      = i.MacAddress;
                systemaudit.SystemAudits.Add(pc);
            }

            return(View(systemaudit));
        }
Пример #2
0
        public ActionResult Audit()
        {
            var computer   = System.Web.HttpContext.Current.Session["ComputerName"] as String;
            var scanDate   = System.Web.HttpContext.Current.Session["ScannedDate"] as String;
            var macAddress = System.Web.HttpContext.Current.Session["MacAddress"] as String;

            SetDropdownList(computer);
            SetScannedDate(computer, scanDate, macAddress);
            SetMacAddress(computer, macAddress);
            var systemaudit = new SystemAuditViewModel();
            var Info        = db.Auditors.Join(db.SystemInfoes,
                                               a => a.ScannedDate, s => s.ScannedDate,
                                               (a, s) => new
            {
                Technician      = a.Technician,
                Client          = a.Client,
                Site            = a.Site,
                Workstation     = a.Workstation,
                OS              = a.OS,
                MachineName     = s.MachineName,
                ManagementGroup = s.ManagementGroup,
                DisplayGroup    = s.DisplayGroup,
                PropertyName    = s.PropertyName,
                PropertyValue   = s.PropertyValue,
                ScannedDate     = a.ScannedDate,
                MacAddress      = s.MacAddress
            }).ToList();

            foreach (var i in Info)
            {
                var pc = new SystemAudit();
                pc.Technician      = i.Technician;
                pc.Client          = i.Client;
                pc.Site            = i.Site;
                pc.Workstation     = i.Workstation;
                pc.OS              = i.OS;
                pc.MachineName     = i.MachineName;
                pc.ManagementGroup = i.ManagementGroup;
                pc.DisplayGroup    = i.DisplayGroup;
                pc.PropertyName    = i.PropertyName;
                pc.PropertyValue   = i.PropertyValue;
                pc.ScannedDate     = i.ScannedDate;
                pc.MacAddress      = i.MacAddress;
                systemaudit.SystemAudits.Add(pc);
            }
            //var PcInfo = unit.SystemInfoes.Get().Where(m => m.MachineName == computer &&
            //    m.ScannedDate.Replace(" ", string.Empty) == scanDate.Replace(" ", string.Empty) &&
            //    m.MacAddress == macAddress);
            ViewBag.Header = string.Empty;
            return(View(systemaudit));
        }