Exemple #1
0
        public ActionResult Index(VMs vm)
        {
            using (HardwareDBEntities db = new HardwareDBEntities())
            {
                db.Configuration.ProxyCreationEnabled = false;

                vm.Employees = GetEmployees(vm.SelectedEmployeeID);

                vm.employee = db.lgemployees.Where(x => x.emp_num == vm.SelectedEmployeeID).FirstOrDefault();

                var list = db.lginvoices.Where(x => x.employee_id == vm.SelectedEmployeeID && x.inv_DATETIME >= vm.DateFrom && x.inv_DATETIME <= vm.DateTo).ToList().Select(rr => new ReportRecord
                {
                    OrderDate       = Convert.ToDateTime(rr.inv_DATETIME).ToString("MMM. dd, yyyy"),
                    Amount          = Convert.ToDouble(rr.inv_total),
                    CustomerID      = Convert.ToInt32(rr.cust_code),
                    CustomerName    = db.lgcustomers.Where(x => x.cust_code == rr.cust_code).FirstOrDefault().cust_fname,
                    CustomerSurname = db.lgcustomers.Where(x => x.cust_code == rr.cust_code).FirstOrDefault().cust_lname
                }
                                                                                                                                                                            );

                vm.results = list.GroupBy(x => x.CustomerID).ToList();

                vm.chartData = list.GroupBy(g => g.OrderDate.ToString()).ToDictionary(g => g.Key, g => g.Sum(v => v.Amount));

                TempData["chartdata"] = vm.chartData;
                TempData["records"]   = list.ToList();
                TempData["employee"]  = vm.employee;

                return(View(vm));
            }
        }
        public void LoadRegistrationPage()
        {
            VMs vMs = new VMs();

            vMs.GetVMs();
            VM vm = vMs.Vm;

            ViewBag.NameVM = vm.NameVM;
            ViewBag.AllIp  = vm.IP;
        }
Exemple #3
0
        public ActionResult Index()
        {
            VMs vm = new VMs();

            vm.Employees = GetEmployees(0);

            vm.DateFrom = new DateTime(2014, 12, 1);
            vm.DateTo   = new DateTime(2014, 12, 31);

            return(View(vm));
        }
Exemple #4
0
        private void LoadAdminPage()
        {
            VMs vMs = new VMs();

            vMs.GetVMs();
            VM vm = vMs.Vm;

            ViewBag.NameVM  = vm.NameVM;
            ViewBag.StateVM = vm.StateVM;
            ViewBag.AllIp   = vm.IP;
            ViewBag.Ip      = vMs.IpDb;
        }
Exemple #5
0
        public void GetUpdateVM()
        {
            Db db = new Db();

            vMUsers = db.SelectVM(Id);

            VMs vMs = new VMs();

            vMs.GetUserVMs(vMUsers);

            ViewBag.NameVM  = vMs.Vm.NameVM;
            ViewBag.StateVM = vMs.Vm.StateVM;
            ViewBag.Ip      = vMs.Vm.IP;
        }
Exemple #6
0
        private void LoadUserPage(int id)
        {
            Db  db     = new Db();
            var vMUser = db.SelectVM(id);

            VMs vMs = new VMs();

            vMs.GetUserVMs(vMUser);

            ViewBag.NameVM  = vMs.Vm.NameVM;
            ViewBag.StateVM = vMs.Vm.StateVM;
            ViewBag.Ip      = vMs.Vm.IP;

            UserController.Id = id;
        }
Exemple #7
0
        // GET: Registration
        public ActionResult Registration(string action)
        {
            if (action.StartsWith("checkbox"))
            {
                GetNewUser(action);
            }
            else
            {
                LoadAdminPage();
                return(View("~/Views/Admin/Admin.cshtml"));
            }
            VMs vMs = new VMs();

            vMs.GetVMs();
            VM vm = vMs.Vm;

            ViewBag.NameVM = vm.NameVM;
            ViewBag.AllIp  = vm.IP;

            return(View());
        }
Exemple #8
0
        public static bool IsValidCombination(int level, string value, string parentValue)
        {
            bool isValid = true;

            switch (level)
            {
            case 1:
                VMs vm = (VMs)Enum.Parse(typeof(VMs), value);
                OSs os = (OSs)Enum.Parse(typeof(OSs), parentValue);
                isValid = VMRules[(int)os, (int)vm];
                break;

            case 3:
                WinVersions version = (WinVersions)Enum.Parse(typeof(WinVersions), value);
                Browsers    browser = (Browsers)Enum.Parse(typeof(Browsers), parentValue);
                isValid = WinVersionRules[(int)browser, (int)version];
                break;

            default:
                break;
            }
            return(isValid);
        }