Example #1
0
        public ActionResult AdminPanel()
        {
            PanelVM          model      = new PanelVM();
            UsersRepository  usersRepo  = new UsersRepository();
            OrdersRepository ordersRepo = new OrdersRepository();

            model.Users  = usersRepo.GetAll();
            model.Orders = ordersRepo.GetAll();

            return(View(model));
        }
Example #2
0
        public ActionResult YonetimPaneli()
        {
            if (CurrentUser == null)
            {
                return(RedirectToAction("Index"));
            }

            PanelVM vm = new PanelVM();

            vm.Habers   = db.habers.ToList();
            vm.Portfoys = db.portfoys.Where(x => x.danisman.IsDeleted == false && x.IsDeleted == false && x.Onay == true && !x.islems.Any(y => y.IsDeleted == false && y.YonetimOnay == true) && x.BittiTarih > DateTime.Now).OrderByDescending(x => x.Id).Take(20).ToList();



            return(View(vm));
        }
Example #3
0
        /// <summary>
        /// Creates a new instance of a room view model
        /// </summary>
        public RoomVM(string RoomName, int RoomNumber)
        {
            InitializeCommands();
            StripViewModel = new StripVM()
            {
                RoomNumber = RoomNumber
            };
            PanelViewModel = new PanelVM()
            {
                RoomNumber = RoomNumber
            };
            // Subscribe room to view model's properties
            StripViewModel.PropertyChanged     += Shelving_PropertyChanged;
            PanelViewModel.PropertyChanged     += Shelving_PropertyChanged;
            ShelfViewModel.PropertyChanged     += Shelving_PropertyChanged;
            AccessoryViewModel.PropertyChanged += Shelving_PropertyChanged;


            DataSet dataset = new DataSet();

            dataset.ReadXml("StripColorData.xml");
            StripColorData = dataset.Tables[0];

            dataset = new DataSet();
            dataset.ReadXml("ShelvingDepthData.xml");
            ShelvingDepthData = dataset.Tables[0];

            dataset = new DataSet();
            dataset.ReadXml("WoodData.xml");
            WoodData = dataset.Tables[0];


            Room = new Model.Room(RoomName, RoomNumber)
            {
                WoodColorValues     = new ObservableCollection <string>(GetWoodColorVales()),
                StripColorValues    = new ObservableCollection <string>(GetStripColorValues()),
                ShelvingDepthValues = new ObservableCollection <string>(GetShelvingDepthValues())
            };
            Room.PropertyChanged += Room_PropertyChanged;
        }
 public IncrementQuantityCommand(PanelVM viewmodel)
 {
     this.viewmodel = viewmodel;
 }
Example #5
0
        //Create the view for the Backups screen
        public ActionResult Backups()
        {
            //Set user credentials as session variables
            string username = Session["SkyscapeUsername"] as string;
            string password = Session["SkyscapePassword"] as string;

            //Initializes a new api call to Skyscape
            var api = new APIMethods();

            //Authentication details passed through from config class
            var authenticate = api.authenticateSkyscape(username, password);

            var accounts = api.getAccounts();

            //Generates viewModels for view
            VmViewModel vmViewModel = new VmViewModel();

            vmViewModel.names      = new List <string>();
            vmViewModel.accountVms = new List <PanelVM>();
            vmViewModel.accounts   = new List <Account>();
            vmViewModel.backups    = new List <Backup>();

            // "expires_after : 900" means a successful authentication
            if (authenticate.Content == "{\"expires_after\":900}")
            {
                //Generates counter to uniquely identify JQuery dialogs in Backup view
                int k = 0;
                ViewBag.response = "Authentication successful";

                //Deserializes JSON string into account objects
                vmViewModel.accounts = JsonConvert.DeserializeObject <List <Account> >(accounts.Content);
                //Loop through deserialized accounts
                for (int i = 0; i < vmViewModel.accounts.Count; i++)
                {
                    //getVms makes the call to Skyscape to retrieve vm/backup information
                    var vms = api.getSkyscapeVms(vmViewModel.accounts[i].id);

                    //result is the objects of the returned deserialized JSON String from the API with a set DateTimeFormat included
                    var result = JsonConvert.DeserializeObject <SkyscapeResponse>(vms.Content, new IsoDateTimeConverter {
                        DateTimeFormat = "dd/MM/yyyy HH:mm"
                    });

                    //To create VM objects, must loop through the different levels of JSON String
                    foreach (var vOrg in result.vOrgs)
                    {
                        foreach (var vDC in vOrg.vDCs)
                        {
                            foreach (var vApp in vDC.vApps)
                            {
                                foreach (var virtualMachine in vApp.VMs)
                                {
                                    //If any VM within an account has at a last backup which failed, count this fail to display in accordion view
                                    if (virtualMachine.LastBackupStatus.Contains("Failed"))
                                    {
                                        vmViewModel.accounts[i].allBackupsStatus = false;
                                        vmViewModel.accounts[i].numberFailedBackups++;
                                    }
                                    //create new instance of PanelVM
                                    PanelVM panelVm = new PanelVM();
                                    {
                                        panelVm.AccountId        = result.Account.id;
                                        panelVm.Name             = virtualMachine.Name;
                                        panelVm.LastBackupStatus = virtualMachine.LastBackupStatus;
                                        panelVm.LastBackup       = virtualMachine.LastBackup;
                                        panelVm.backups          = virtualMachine.Backups;
                                        panelVm.Id                    = virtualMachine.Id; //Not suitable as unique identifier for VM as may be duplicate in other accounts
                                        panelVm.Size                  = virtualMachine.Size;
                                        panelVm.MonthToDate           = virtualMachine.MonthToDate;
                                        panelVm.EstimatedMonthlyTotal = virtualMachine.EstimatedMonthlyTotal;
                                        panelVm.BilledHoursPoweredOn  = virtualMachine.BilledHoursPoweredOn;
                                        panelVm.BilledHoursPoweredOff = virtualMachine.BilledHoursPoweredOff;
                                        panelVm.PowerStatus           = virtualMachine.PowerStatus;
                                        panelVm.OperatingSystem       = virtualMachine.OperatingSystem;
                                        panelVm.NumberOfCPUs          = virtualMachine.NumberOfCPUs;
                                        panelVm.Memory                = virtualMachine.Memory;
                                        panelVm.Storage               = virtualMachine.Storage;
                                        panelVm.counter               = k++; //counter allows unique ID of VM without using any Skyscape data as key for VM
                                    }
                                    //Must add panelVm to view model in order to use in Backups view
                                    vmViewModel.accountVms.Add(panelVm);
                                }
                            }
                        }
                    }
                }
            }
            else //API Authentication has failed
            {
                ViewBag.response = "Authentication Failed";
                return(RedirectToAction("Login", "Home"));
            }
            return(View(vmViewModel)); // Must return viewModel to create view
        }
 public SelectPreviousCommand(PanelVM viewmodel)
 {
     this.viewmodel = viewmodel;
 }
Example #7
0
 public RemoveCommand(PanelVM viewmodel)
 {
     this.viewmodel = viewmodel;
 }
Example #8
0
 public AddCommand(PanelVM viewmodel)
 {
     this.viewmodel = viewmodel;
 }
Example #9
0
 public SelectNextCommand(PanelVM viewmodel)
 {
     this.viewmodel = viewmodel;
 }