public ActionResult AddYearRecords(Year year)
 {
     if (ModelState.IsValid)
     {
         if (YearsModel.AddYear(year))
         {
             ViewBag.Message = "Successfully Record Added";
             return(View());
         }
         else
         {
             ViewBag.Message = "Error! Unable to Add Record!";
             //var AlltheLevels = r.Levels.Select(s => s).OrderBy(s => s.LevelID);
             //ViewBag.Levels = AlltheLevels;
             return(View());
         }
     }
     else
     {
         ViewBag.Message = "Error! Unable to Add Record!";
         //var AlltheLevels = r.Levels.Select(s => s).OrderBy(s => s.LevelID);
         //ViewBag.Levels = AlltheLevels;
         return(View());
     }
 }
Exemplo n.º 2
0
        public void Setup()
        {
            // Create VMs
            controlVM = new ControlViewModel();
            //dataVM = new DataViewModel();


            // Link VMs to VMs
            //controlVM.DataVM = dataVM;


            // Create models
            yearsModel = new YearsModel();
            dataModel  = new DataModel();
            graphModel = new GraphModel();

            // Link models to VMs
            controlVM.YearsModel = yearsModel;
            controlVM.DataModel  = dataModel;

            filePaths = Directory.GetFiles("res\\TaxCSV", "*.csv");
            for (int i = 0; i < filePaths.Length; i++)
            {
                controlVM.YearsModel.Years.Add(i, Parser.ParseCSV(filePaths[i]));
            }
        }
        public ActionResult DeleteDurationRecords(IEnumerable <Guid> deleteyear, string btnBackUpYear, string hiddenInput)
        {
            //Check if User Wants To BackUp
            if (btnBackUpYear != null)
            {
                if (deleteyear != null && hiddenInput != "")
                {
                    string result = YearsModel.BackUpYearRecords(deleteyear);
                    if (result == "OK")
                    {
                        string outputMessage = SherlockHolmesEncryptDecrypt.Encrypt("Successfully Records Saved!");

                        return(RedirectToAction("ManageDegreeDurations", "Years", new { delFunResult = outputMessage }));
                    }
                    else
                    {
                        string outputMessage = SherlockHolmesEncryptDecrypt.Encrypt("Unable To BackUp Data!");

                        return(RedirectToAction("ManageDegreeDurations", "Years", new { delFunResult = outputMessage }));
                    }
                }
                else
                {
                    string outputMessage = SherlockHolmesEncryptDecrypt.Encrypt("Plz Select Records To BackUp!");

                    return(RedirectToAction("ManageDegreeDurations", "Years", new { delFunResult = outputMessage }));
                }
            }
            //Check if user wants to delete
            else
            {
                if (deleteyear != null && hiddenInput != "")
                {
                    string result = YearsModel.DeleteYearRecords(deleteyear);

                    if (result == "OK")
                    {
                        string outputMessage = SherlockHolmesEncryptDecrypt.Encrypt("Successfully Records Deleted!");

                        return(RedirectToAction("ManageDegreeDurations", "Years", new { delFunResult = outputMessage }));
                    }
                    else
                    {
                        string outputMessage = SherlockHolmesEncryptDecrypt.Encrypt("Unable To Delete Records!");

                        return(RedirectToAction("ManageDegreeDurations", "Years", new { delFunResult = outputMessage }));
                    }
                }
                else
                {
                    string outputMessage = SherlockHolmesEncryptDecrypt.Encrypt("Plz Select Records To Delete!");

                    return(RedirectToAction("ManageDegreeDurations", "Years", new { delFunResult = outputMessage }));
                }
            }
        }
        public ActionResult ManageDegreeDurations(int?page, string programID, int category)
        {
            var gettingYears = YearsModel.getAllYears(category);

            if (gettingYears == null)
            {
                ViewBag.Message = "No Records Found";
                return(View(gettingYears.ToPagedList(page ?? 1, 10)));
            }
            return(View(gettingYears.ToPagedList(page ?? 1, 10)));
        }
Exemplo n.º 5
0
        public Loader()
        {
            // Make models

            YearsModel = new YearsModel();
            GraphModel = new GraphModel();
            DataModel  = new DataModel();

            // Load CSVs
            LoadYears();

            // make viewmodels
            MainVM     = new MainViewModel();
            DataVM     = new DataViewModel();
            ControlVM  = new ControlViewModel();
            GraphVM    = new GraphViewModel();
            OutputVM   = new OutputViewModel();
            SettingsVM = new SettingsViewModel();

            // Link VMs
            MainVM.DataVM     = DataVM;
            MainVM.SettingsVM = SettingsVM;

            DataVM.ControlVM = ControlVM;
            DataVM.GraphVM   = GraphVM;
            DataVM.OutputVM  = OutputVM;

            ControlVM.MainVM   = MainVM;
            ControlVM.DataVM   = DataVM;
            ControlVM.OutputVM = OutputVM;
            ControlVM.GraphVM  = GraphVM;

            SettingsVM.MainVM = MainVM;

            // Connect models to VMs

            DataVM.DataModel  = DataModel;
            DataVM.YearsModel = YearsModel;
            DataVM.GraphModel = GraphModel;

            ControlVM.YearsModel = YearsModel;
            ControlVM.GraphModel = GraphModel;
            ControlVM.DataModel  = DataModel;

            GraphVM.GraphModel = GraphModel;
            GraphVM.YearsModel = YearsModel;
            GraphVM.DataModel  = DataModel;

            OutputVM.DataModel = DataModel;

            DataVM.DataInit();
        }
Exemplo n.º 6
0
        public void Setup()
        {
            ControlVM = new ControlViewModel();
            YearsModel yearsModel = new YearsModel();
            DataModel  dataModel  = new DataModel();

            ControlVM.YearsModel = yearsModel;
            ControlVM.DataModel  = dataModel;

            filePaths = Directory.GetFiles("res\\TaxCSV", "*.csv");
            for (int i = 0; i < filePaths.Length; i++)
            {
                ControlVM.YearsModel.Years.Add(i, Parser.ParseCSV(filePaths[i]));
            }
        }
Exemplo n.º 7
0
        public void Setup()
        {
            // Create VMs
            mainVM    = new MainViewModel();
            dataVM    = new DataViewModel();
            controlVM = new ControlViewModel();
            outputVM  = new OutputViewModel();
            graphVM   = new GraphViewModel();


            // Link VMs to VMs
            dataVM.ControlVM = controlVM;
            dataVM.GraphVM   = graphVM;
            //controlVM.DataVM = dataVM;
            controlVM.MainVM = mainVM;

            // Create models
            yearsModel = new YearsModel();
            dataModel  = new DataModel();
            graphModel = new GraphModel();

            // Link models to VMs

            dataVM.YearsModel = yearsModel;
            dataVM.DataModel  = dataModel;
            dataVM.GraphModel = graphModel;

            controlVM.YearsModel = yearsModel;
            controlVM.DataModel  = dataModel;
            controlVM.GraphModel = graphModel;

            outputVM.DataModel = dataModel;

            graphVM.YearsModel = yearsModel;
            graphVM.GraphModel = graphModel;
            graphVM.DataModel  = dataModel;

            string[] filePaths = Directory.GetFiles("res\\TaxCSV", "*.csv");
            for (int i = 0; i < filePaths.Length; i++)
            {
                IncomeYearModel year = Parser.ParseCSV(filePaths[i]);
                yearsModel.Years.Add(year.Year, year);
            }
        }