示例#1
0
        /*
         *
         * View members of the group - Done
         * Add member from current users - Done
         * Remove a member from group - Done
         * View marks of class member per work item
         * ViewEditWork - Fix "Work Name" is shows only part of the name and List of work items below - Done
         * Generate a text file report for a user and their work.
         *
         */

        public ActionResult ViewPersonDetail(int PersonNo)
        {
            Person          PersonDetail = unitOfWork.PersonRepository.FindBy(x => x.PersonNo == PersonNo);
            PersonModelEdit personmodel  = new PersonModelEdit()
            {
                PersonNo   = PersonDetail.PersonNo,
                Name       = PersonDetail.Name,
                Surname    = PersonDetail.Surname,
                Gender     = PersonDetail.GenderNo,
                ID         = PersonDetail.IdNo,
                IDType     = PersonDetail.IdTypeNo,
                PersonType = PersonDetail.PersonTypeNo,
                DOB        = PersonDetail.DOB
            };

            return(ViewUpdate(personmodel));
        }
示例#2
0
        public ActionResult Save(PersonModelEdit model)
        {
            var PersonCaptured = new Person()
            {
                Name         = model.Name,
                Surname      = model.Surname,
                GenderNo     = model.Gender,
                DOB          = model.DOB,
                IdNo         = model.ID,
                IdTypeNo     = model.IDType,
                PersonTypeNo = model.PersonType
            };

            unitOfWork.PersonRepository.Add(PersonCaptured);
            unitOfWork.Save();

            return(View("Index", ListOfPersons()));
        }
示例#3
0
        public ActionResult Update(PersonModelEdit person)
        {
            Person PersonToUpdate = unitOfWork.PersonRepository.FindBy(x => x.PersonNo == person.PersonNo);

            PersonToUpdate.Name         = person.Name;
            PersonToUpdate.Surname      = person.Surname;
            PersonToUpdate.PersonTypeNo = person.PersonType;
            PersonToUpdate.IdTypeNo     = person.IDType;
            PersonToUpdate.IdNo         = person.ID;
            PersonToUpdate.GenderNo     = person.Gender;
            PersonToUpdate.DOB          = person.DOB;
            unitOfWork.Save();

            // if Add to group do the below:
            //if (person.AddToGroup == true)
            //    AddGroupMember(person);

            return(View("Index", ListOfPersons()));
        }
示例#4
0
        public ActionResult ViewUpdate(PersonModelEdit person)
        {
            if (person != null)
            {
                Person PersonToUpdate = unitOfWork.PersonRepository.FindBy(x => x.PersonNo == person.PersonNo);
                IEnumerable <StudentData.IDType>     IDtypes     = unitOfWork.IdTypeRepository.Find(x => x.IDTypeDesc != "456");
                IEnumerable <StudentData.PersonType> PersonTypes = unitOfWork.PersonTypeRepository.Find(x => x.PersonTypeDesc != "456");
                IEnumerable <StudentData.GroupType>  GroupTypes  = unitOfWork.GroupTypeRepository.Find(x => x.GroupTypeDesc != "456");
                IEnumerable <StudentData.Group>      Group       = unitOfWork.GroupRepository.Find(x => x.GroupDesc != "456");

                List <Models.PersonType> ps = new List <Models.PersonType>();
                foreach (var PersonType in PersonTypes)
                {
                    ps.Add(new Models.PersonType()
                    {
                        PersonTypeNo = PersonType.PersonTypeNo, PersonTypeDesc = PersonType.PersonTypeDesc
                    });
                }

                List <Models.IDType> idtps = new List <Models.IDType>();
                foreach (var idtype in IDtypes)
                {
                    idtps.Add(new Models.IDType()
                    {
                        IDTypeNo = idtype.IDTypeNo, IDTypeDesc = idtype.IDTypeDesc
                    });
                }

                List <Models.GroupType> groupTypes = new List <Models.GroupType>();
                foreach (var gtype in GroupTypes)
                {
                    groupTypes.Add(new Models.GroupType()
                    {
                        GroupTypeNo = gtype.GroupTypeNo, GroupTypeDesc = gtype.GroupTypeDesc
                    });
                }

                List <GroupEdit> groups = new List <GroupEdit>();
                foreach (var g in Group)
                {
                    groups.Add(new GroupEdit()
                    {
                        GroupNo = g.GroupNo, GroupDesc = g.GroupDesc
                    });
                }

                PersonModelEdit personmodel = new PersonModelEdit()
                {
                    PersonNo    = PersonToUpdate.PersonNo,
                    Name        = PersonToUpdate.Name,
                    Surname     = PersonToUpdate.Surname,
                    Gender      = PersonToUpdate.GenderNo,
                    ID          = PersonToUpdate.IdNo,
                    IDType      = PersonToUpdate.IdTypeNo,
                    PersonType  = PersonToUpdate.PersonTypeNo,
                    DOB         = PersonToUpdate.DOB,
                    PersonTypes = ps,
                    IDTypes     = idtps,
                    GroupTypes  = groupTypes,
                    Groups      = groups
                };
                return(View("ViewUpdate", personmodel));
            }
            PersonModelEdit Dummypersonmodel = new PersonModelEdit()
            {
                PersonNo = 0, Name = "", Surname = ""
            };

            return(View("ViewUpdate", Dummypersonmodel));
        }