Esempio n. 1
0
        public IList getMembersByOrgID(int orgID)
        {
            List <MemberList> students = new List <MemberList>();
            var stud = dataContext.sp_GetMembersByOrgID(orgID);

            foreach (var x in stud)
            {
                MemberList student = new MemberList();
                student.Student_ID = x.Student_ID;
                student.FirstName  = x.FirstName;
                student.LastName   = x.LastName;
                student.Name       = x.FirstName + " " + x.LastName;
                student.Position   = x.MemberName;
                students.Add(student);
            }
            return(students);
        }
        public bool updateOrganizationMembers(int orgID, List <OrgMember> newMemberList)
        {
            try
            {
                List <OrgMember> oldMemberList = new List <OrgMember>();
                var advis = dataContext.sp_GetMembersByOrgID(orgID);
                foreach (var x in advis)
                {
                    OrgMember member = new OrgMember();
                    member.Student_ID = x.Student_ID;
                    member.LastName   = x.LastName;
                    member.FirstName  = x.FirstName;
                    oldMemberList.Add(member);
                }

                for (int i = 0; i < oldMemberList.Count; ++i)
                {
                    for (int j = 0; j < newMemberList.Count; ++j)
                    {
                        if (oldMemberList[i].Student_ID == newMemberList[j].Student_ID)
                        {
                            oldMemberList[i].FirstName = "Please Delete";
                        }
                    }
                }

                for (int i = 0; i < oldMemberList.Count; ++i)
                {
                    if (oldMemberList[i].FirstName != "Please Delete")
                    {
                        dataContext.sp_UpdateStudentRosterRow(oldMemberList[i].Student_ID, orgID);
                    }
                }
                for (int i = 0; i < newMemberList.Count; ++i)
                {
                    dataContext.sp_NewStudentRosterRow(orgID, newMemberList[i].Student_ID);
                }
            }
            catch (Exception)
            {
                return(false);
            }

            return(true);
        }
        public List <OrgMember> getMembersByOrgID(int orgID)
        {
            List <OrgMember> members = new List <OrgMember>();
            var mem = dataContext.sp_GetMembersByOrgID(orgID);

            foreach (var x in mem)
            {
                OrgMember member = new OrgMember();
                member.Position         = x.MemberName;
                member.MemberID         = x.Member_ID;
                member.LastName         = x.LastName;
                member.FirstName        = x.FirstName;
                member.CarrollID        = Convert.ToInt32(x.Carroll_ID);
                member.IsPrimaryContact = Convert.ToBoolean(x.PrimaryContact);
                member.AddDate          = Convert.ToDateTime(x.BeginDate).ToShortDateString();
                member.Student_ID       = x.Student_ID;
                //member.Status = x.StatusName;

                members.Add(member);
            }
            return(members);
        }