Exemplo n.º 1
0
        public ActionResult ConfirmStaffDelete(int id)
        {
            int i = id;

            StaffDataAccess.DeleteStaff(i);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public ActionResult DeleteStaff(int id)
        {
            int i = id;
            List <staffModel> staff = new List <staffModel>();

            staff = StaffDataAccess.SelectStaff(i);
            return(View(staff));
        }
        public override void PopulateFromDatabase()
        {
            //WCSA_Entity_Classes.Staff requiredStaff = new WCSA_Entity_Classes.Staff();
            //new StaffDataAccess().Add(requiredStaff);
            //WCSA_Entity_Classes.Staff requiredStaff = list.Find(staffList => staffList.Name.Equals("Nawaz"));
            //if (requiredStaff == null)
            //{
            //    list.Add(new WCSA_Entity_Classes.Staff("Nawaz", "*****@*****.**", "32452623", "NK-2", "Nawaz", "123"));
            //    Console.WriteLine("Inserted into list \n");
            //}
            //Execute query and fill up the list here
            List <Staff> staffList = new StaffDataAccess().GetAll();

            foreach (Staff stf in staffList)
            {
                list.Add(stf);
            }
        }
Exemplo n.º 4
0
        public IActionResult Index(int?value)
        {
            //dropwdown list
            List <SelectListItem> items = new List <SelectListItem>();
            SelectListItem        item1 = new SelectListItem()
            {
                Text = "Select Option", Value = "null"
            };
            SelectListItem item2 = new SelectListItem()
            {
                Text = "Teacher", Value = "1"
            };
            SelectListItem item3 = new SelectListItem()
            {
                Text = "Staff", Value = "2"
            };

            items.Add(item1);
            items.Add(item2);
            items.Add(item3);
            ViewBag.Options = items;

            if (value != null)
            {
                ViewBag.Value = value;
            }

            //Teacher Model
            List <teacherModel> teacher = new List <teacherModel>();

            teacher          = DataAccess.LoadTeachers();
            ViewBag.Teachers = teacher;

            //Staff Model
            List <staffModel> staff = new List <staffModel>();

            staff         = StaffDataAccess.LoadStaff();
            ViewBag.Staff = staff;

            return(View());
        }
Exemplo n.º 5
0
        public IList <TeacherStatsInfo> GetTeachersStats(int schoolYearId, string filter, int?start, int?count, TeacherSortType?sortType)
        {
            start = start ?? 0;
            count = count ?? int.MaxValue;
            var iNowSortType = EnumMapperFactory.GetMapper <TeacherSortType, SectionSummarySortOption>()
                               .Map(sortType ?? TeacherSortType.TeacherAsc);

            try
            {
                var iNowRes = ConnectorLocator.ClassesDashboardConnector.GetTeachersSummaries(schoolYearId,
                                                                                              Context.NowSchoolYearTime, start.Value + 1, start.Value + count.Value, filter, iNowSortType);

                return(iNowRes.Select(TeacherStatsInfo.Create).ToList());
            }
            catch (ChalkableSisNotSupportVersionException)
            {
                using (var u = Read())
                {
                    var teachers = new StaffDataAccess(u).GetShortStaffSummary(schoolYearId, filter, start.Value, count.Value, (int?)sortType);
                    var classes  = new ClassDataAccess(u).GetClassesByTeachers(schoolYearId, teachers.Select(x => x.Id).ToList());
                    return(TeacherStatsInfo.Create(teachers, classes));
                }
            }
        }
Exemplo n.º 6
0
 public IActionResult StaffCreate(staffModel m)
 {
     StaffDataAccess.CreateNewStaff(m);
     return(RedirectToAction("Index"));
 }
Exemplo n.º 7
0
 public IActionResult UpdateStaff(staffModel m)
 {
     StaffDataAccess.UpdateStaff(m);
     return(RedirectToAction("Index"));
 }
Exemplo n.º 8
0
 public StaffService()
 {
     this.staffDataAccess = new StaffDataAccess();
 }