Exemplo n.º 1
0
        public List <dynamic> getAllZoneHomecellAttFeedback()
        {
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3(); // create database connection

            db.Configuration.ProxyCreationEnabled = false;                              // configure proxy to eliminate overload of memory
            return(getZoneHomecellAtt(db.Zone_Homecell_Attendance_Feedback.ToList()));  // return called method
        }
Exemplo n.º 2
0
        //Group type list - Izaan
        public List <dynamic> getAllGroupTypesReturnList(List <Group_Type> allGroupTypes)
        {
            //Database connection
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            //Configure proxy to eliminate memory overload
            db.Configuration.ProxyCreationEnabled = false;

            //Creating dynamic list
            List <dynamic> dynamicGroupTypes = new List <dynamic>();

            try
            {
                foreach (Group_Type gType in allGroupTypes)
                {
                    //Creating dynmaic object
                    dynamic dynamicGroupType = new ExpandoObject();
                    dynamicGroupType.GroupTypeID   = gType.GroupTypeID;
                    dynamicGroupType.GroupTypeName = gType.GroupTypeName;

                    //Adding dynamic object to dynamic lits
                    dynamicGroupTypes.Add(dynamicGroupType);
                }
            }
            catch (Exception)
            {
            }

            return(dynamicGroupTypes);
        }
Exemplo n.º 3
0
        public void delAnnouncement([FromBody] dynamic announcement)
        {
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            db.Configuration.ProxyCreationEnabled = false;

            int id = announcement.ann.AnnouncementID;
            List <Person_Announcement> thisAnn = db.Person_Announcement.Where(x => x.AnnouncementID == id).ToList();

            try
            {
                foreach (Person_Announcement a in thisAnn)
                {
                    db.Person_Announcement.Remove(a);
                }

                Announcement x = db.Announcements.Where(d => d.AnnouncementID == id).FirstOrDefault();
                db.Announcements.Remove(x);

                Audit_Trail auditLog = new Audit_Trail();
                auditLog.PersonID         = announcement.PersonID;
                auditLog.EventDescription = "Removed announcement with ID: " + id;
                auditLog.EventDateTime    = DateTime.Now;
                db.Audit_Trail.Add(auditLog);

                db.SaveChanges();
            }
            catch (Exception e)
            {
            }
        }
        public List <dynamic> GetCounsellingRequest()
        {
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            db.Configuration.ProxyCreationEnabled = false;
            return(GetCounsellingRequestList(db.Counselling_Request.ToList()));
        }
Exemplo n.º 5
0
        public List <dynamic> getDiscipleshipList(List <Discipleship> allDiscipleships)
        {
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            db.Configuration.ProxyCreationEnabled = false;

            List <dynamic> dynamicDiscipleships = new List <dynamic>();

            //get dynamic object list

            try
            {
                foreach (Discipleship thisDiscipleship in allDiscipleships)
                {
                    dynamic dynamicDiscipleship = new ExpandoObject();

                    dynamicDiscipleship.DiscipleshipID          = thisDiscipleship.DiscipleshipID;
                    dynamicDiscipleship.DiscipleshipDescription = thisDiscipleship.DiscipleshipDescription;

                    dynamicDiscipleships.Add(dynamicDiscipleship);
                }
            }
            catch (Exception e)
            {
            }

            return(dynamicDiscipleships);
        }
Exemplo n.º 6
0
        public dynamic delDiscipleship([FromBody] dynamic currentDiscipleship)
        {
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            db.Configuration.ProxyCreationEnabled = false;


            int id = currentDiscipleship.discipleship.DiscipleshipID;

            try
            {
                //retrieve selected
                Discipleship thisDiscipleship = db.Discipleships.Where(x => x.DiscipleshipID == id).FirstOrDefault();


                Audit_Trail auditLog = new Audit_Trail();
                auditLog.PersonID         = currentDiscipleship.userID;
                auditLog.EventDescription = "Deleted a Discipleship with ID: " + thisDiscipleship.DiscipleshipID + " and Name: " + thisDiscipleship.DiscipleshipDescription;
                auditLog.EventDateTime    = DateTime.Now;
                db.Audit_Trail.Add(auditLog);

                //remove from db
                db.Discipleships.Remove(thisDiscipleship);
                //save
                db.SaveChanges();
                return(getAllDiscipleships());
            }
            catch (Exception e)
            {
                //else error
                dynamic toReturn = new ExpandoObject();
                toReturn.Error = e.Message;
                return(toReturn);
            }
        }
        public dynamic removeHomecellNotes(dynamic HomecellNotesName)                   //get string parameter
        {
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3(); //establish database connection

            db.Configuration.ProxyCreationEnabled = false;                              //configure proxy to eliminate overload of data

            try
            {
                string file = HomecellNotesName.FileName;
                //retrieve Homecell notes to remove based on selected Homecell notes
                Homecell_Notes HCNotes = db.Homecell_Notes.Where(z => z.HomecellNotes == file).FirstOrDefault();
                db.Homecell_Notes.Remove(HCNotes);

                //Add to Audit trail entity
                Audit_Trail auditLog = new Audit_Trail();
                auditLog.PersonID         = HomecellNotesName.PersonID;
                auditLog.EventDescription = "Removed Homecell Notes with with ID: " + HCNotes.HCNID;
                auditLog.EventDateTime    = DateTime.Now;
                db.Audit_Trail.Add(auditLog);

                db.SaveChanges();
            }
            catch (Exception)
            {
                return(null);
            }

            return(getHomecellNotes());
        }
        public List <dynamic> getAllRequestsReturnList(List <Person> allrequests)
        {
            //Database conncection
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            db.Configuration.ProxyCreationEnabled = false;

            List <dynamic> dynamicRequests = new List <dynamic>();

            try
            {
                foreach (Person requests in personList)
                {
                    dynamic dynamicPerson = new ExpandoObject();
                    dynamicPerson.Name                 = requests.Name;
                    dynamicPerson.Surname              = requests.Surname;
                    dynamicPerson.PersonID             = requests.PersonID;
                    dynamicPerson.Activation_Status_ID = requests.Activation_Status_ID;

                    dynamicRequests.Add(personList);
                }
            }
            catch (Exception e)
            {
            }

            return(dynamicRequests);
        }
        public dynamic delOrgIndivPos([FromBody] dynamic currentOrgIndivPos)
        {
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            db.Configuration.ProxyCreationEnabled = false;

            int id = currentOrgIndivPos.form.OrgIndivPosID;

            //retrieve selected object
            Organisational_Individual_Position thisOrgIndivPos = db.Organisational_Individual_Position.Where(x => x.OrgIndivPosID == id).FirstOrDefault();

            //remove object
            db.Organisational_Individual_Position.Remove(thisOrgIndivPos);

            try
            {
                Audit_Trail auditLog = new Audit_Trail();
                auditLog.PersonID         = currentOrgIndivPos.PersonID;
                auditLog.EventDescription = "Removed Organisational Individual Structure Position with ID: " + id;
                auditLog.EventDateTime    = DateTime.Now;
                db.Audit_Trail.Add(auditLog);

                db.SaveChanges();            //save
                return(getAllOrgIndivPos()); //return all
            }
            catch (Exception e)
            {
                //else return error
                dynamic toReturn = new ExpandoObject();
                toReturn.Error = e.Message + e.InnerException;
                return(toReturn);
            }
        }
        public List <dynamic> getAllOrgIndivPosList(List <Organisational_Individual_Position> allOrgIndivPos)
        {
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            db.Configuration.ProxyCreationEnabled = false;


            List <dynamic> dynamicOrgIndivPosList = new List <dynamic>();

            foreach (Organisational_Individual_Position thisOrgIndivPos in allOrgIndivPos)
            {
                dynamic dynamicOrgIndivPos = new ExpandoObject();

                //create a dynamic object that contains all relevent attributes of OrgIndivPos
                dynamicOrgIndivPos.OrgIndivPosID = thisOrgIndivPos.OrgIndivPosID;
                dynamicOrgIndivPos.Decription    = thisOrgIndivPos.Decription;
                dynamicOrgIndivPos.Goal_Access   = db.Organisational_Individual_Position.Select(x => x.Goal_Access);
                dynamicOrgIndivPos.Use_Cases     = db.Organisational_Individual_Position.Select(x => x.Use_Cases);



                dynamicOrgIndivPosList.Add(dynamicOrgIndivPos); // add dynamic object to list
            }
            return(dynamicOrgIndivPosList);                     //send back ot get All method
        }
Exemplo n.º 11
0
        public List <dynamic> getAuditTrail()
        {
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            db.Configuration.ProxyCreationEnabled = false; // configure proxy to eliminate overload of memory

            List <dynamic> auditTrailList = new List <dynamic>();

            foreach (Audit_Trail a in db.Audit_Trail.OrderByDescending(x => x.AuditTrailID))
            {
                //get person details and Audit trail details
                dynamic AT = new ExpandoObject();

                var person = db.People.Where(x => x.PersonID == a.PersonID).FirstOrDefault();


                AT.Person           = "[ID: " + person.PersonID + "] " + person.Name + " " + person.Surname;
                AT.EventDateTime    = a.EventDateTime.ToString("yyyy-MM-dd HH:mm:ss");
                AT.EventDescription = a.EventDescription;

                auditTrailList.Add(AT);
            }

            return(auditTrailList);
        }
Exemplo n.º 12
0
        //Sububrb List - Izaan
        public List <dynamic> getAllSuburbsList(List <Suburb> suburbList)
        {
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            db.Configuration.ProxyCreationEnabled = false;

            List <dynamic> dynamicSuburbs = new List <dynamic>();

            try
            {
                foreach (Suburb s in suburbList)
                {
                    dynamic dynamicSuburb = new ExpandoObject();
                    dynamicSuburb.SuburbID   = s.SuburbID;
                    dynamicSuburb.SuburbName = s.SuburbName;
                    dynamicSuburb.CityID     = s.CityID;

                    dynamicSuburbs.Add(dynamicSuburb);
                }
            }
            catch (Exception e)
            {
            }

            return(dynamicSuburbs);
        }
Exemplo n.º 13
0
        //Groups list - Izaan
        public List <dynamic> getAllGroupsReturnList(List <Organisational_Group> allGroups)
        {
            //Database connection
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            db.Configuration.ProxyCreationEnabled = false;

            List <dynamic> dynamicGroups = new List <dynamic>();

            try
            {
                foreach (Organisational_Group thisGroup in allGroups)
                {
                    dynamic dynamicGroup = new ExpandoObject();
                    dynamicGroup.OrgGroupID  = thisGroup.OrgGroupID;
                    dynamicGroup.GroupTypeID = thisGroup.GroupTypeID;
                    dynamicGroup.Description = thisGroup.Description;
                    dynamicGroup.Size        = thisGroup.Size;
                    dynamicGroup.Address     = thisGroup.Address;
                    dynamicGroup.SuburbID    = thisGroup.SuburbID;

                    dynamicGroups.Add(dynamicGroup);
                }
            }
            catch (Exception e)
            {
            }


            return(dynamicGroups);
        }
        public List <dynamic> getsignOutChildRequestConfirm()
        {
            //Database connection
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            //Configure proxy to eliminate overload of data
            db.Configuration.ProxyCreationEnabled = false;

            List <dynamic> returnList = new List <dynamic>();

            foreach (int request in signOutRequestList)
            {
                Person_Children personChild = db.Person_Children.Include(x => x.KidsChurch).Include(y => y.Child).Include(z => z.Person).Where(c => c.ChildID == request).FirstOrDefault();
                returnList.Add(personChild);
            }

            if (returnList.Count() != 0)
            {
                return(getChildConfirmation(returnList));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 15
0
        public IHttpActionResult UpdatePerson(Person psn)
        {
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            db.Configuration.ProxyCreationEnabled = false;

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                Person objEmp = new Person();
                objEmp = db.People.Find(psn.PersonID);
                if (objEmp != null)
                {
                    objEmp.Name    = psn.Name;
                    objEmp.Surname = psn.Surname;
                    objEmp.Address = psn.Address;
                    objEmp.Suburb  = psn.Suburb;
                    objEmp.City    = psn.City;
                    objEmp.Number  = psn.Number;
                    objEmp.Email   = psn.Email;
                }
                db.SaveChanges();
            }
            catch (Exception e)
            {
                toReturn.Error = e.Message;
                return(toReturn);
            }
            return(Ok(psn));
        }
        public List <dynamic> getAllChildrenReturnList(List <Child> allChildren)
        {
            //Database connection
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            //Configure proxy to eliminatate memory overload
            db.Configuration.ProxyCreationEnabled = false;

            //Create dynamic list to be returned with all the children in the list in JSON format
            List <dynamic> dynamicChildren = new List <dynamic>();

            try
            {
                //Loop through each child in the list
                foreach (Child thisChild in allChildren)
                {
                    //create dynamic objecct to be added to the dynamic list to be returned
                    dynamic dynamicChild = new ExpandoObject();

                    dynamicChild.ChildID     = thisChild.ChildID;
                    dynamicChild.Name        = thisChild.Name;
                    dynamicChild.Surname     = thisChild.Surname;
                    dynamicChild.DateOfBirth = thisChild.DateOfBirth;

                    dynamicChildren.Add(dynamicChild);
                }
            }
            catch (Exception e)
            {
            }

            return(dynamicChildren);
        }
        public List <dynamic> getAllChildren()
        {
            //Database connection
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            //Configure proxy to eliminatate memory overload
            db.Configuration.ProxyCreationEnabled = false;

            // !!--User Management--!!
            //string sessionId = Request.Headers.Authorization.ToString();
            //var user = db.Where(o => o.SessionID == sessionId).FirstOrDefault();
            //if(user != null)

            try
            {
                //Return list of all children
                return(getAllChildrenReturnList(db.Children.ToList()));
            }
            catch (Exception e)
            {
                //Creating dynamic object to be returned with error message
                dynamic toReturn = new ExpandoObject();
                toReturn.Error = e;
                return(toReturn);
            }
        }
        public dynamic getChildByID(int ID)
        {
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            db.Configuration.ProxyCreationEnabled = false;

            if (ID == null)
            {
                return(null);
            }
            else
            {
                Child           thisChild = db.Children.Where(x => x.ChildID == ID).FirstOrDefault();
                Person_Children pc        = db.Person_Children.Where(x => x.ChildID == thisChild.ChildID).FirstOrDefault();

                dynamic child = new ExpandoObject();
                child.Name         = thisChild.Name;
                child.Surname      = thisChild.Surname;
                child.DateOfBirth  = thisChild.DateOfBirth;
                child.KidsChurchID = pc.KidsChurch.KidsChurchID;


                return(child);
            }
        }
        public List<dynamic> getAllMembersReturnList(List<Person> allPeople)
        {
            //Database conncection
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            //Configure proxy to eliminate overload of data
            db.Configuration.ProxyCreationEnabled = false;

            List<dynamic> dynamicPeople = new List<dynamic>();

            try
            {

                foreach (Person person in allPeople)
                {
                    dynamic dynamicPerson = new ExpandoObject();
                    dynamicPerson.PersonID = person.PersonID;
                    dynamicPerson.Name = person.Name;
                    dynamicPerson.Surname = person.Surname;
                    dynamicPerson.DateOfBirth = person.DateOfBirth;
                    dynamicPerson.Number = person.Number;
                    dynamicPerson.Email = person.Email;
                    dynamicPerson.Address = person.Address;
                    dynamicPerson.Activation_Status = person.Activation_Status_ID;

                    dynamicPeople.Add(dynamicPerson);
                }
            }
            catch (Exception e)
            {

            }

            return dynamicPeople;
        }
        private List <dynamic> getAllPersonChildren(Child child)
        {
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            db.Configuration.ProxyCreationEnabled = false;

            List <dynamic> dynamicChildren = new List <dynamic>();

            try
            {
                foreach (Person_Children personChild in child.Person_Children)
                {
                    dynamic dynamicPersonChild = new ExpandoObject();
                    dynamicPersonChild.KidsChurchID            = personChild.KidsChurchID;
                    dynamicPersonChild.KidsChurchName          = db.KidsChurches.Where(x => x.KidsChurchID == personChild.KidsChurchID).Select(o => o.KidsChurchName).FirstOrDefault();
                    dynamicPersonChild.PersonID                = personChild.PersonID;
                    dynamicPersonChild.ChildID                 = personChild.ChildID;
                    dynamicPersonChild.KCVolunteerConfirmation = personChild.KCVolunteerConfirmation;
                    dynamicPersonChild.CheckIn                 = personChild.CheckIn;
                    dynamicPersonChild.ChekcInDateTime         = personChild.CheckInDateTime;
                    dynamicPersonChild.SignOut                 = personChild.SignOut;
                    dynamicPersonChild.SignOutDateTime         = personChild.SignOutDateTime;

                    dynamicChildren.Add(dynamicPersonChild);
                }
            }
            catch (Exception e)
            {
            }

            return(dynamicChildren);
        }
        public List<dynamic> MemberList(List<Person> person)
        {
            //Database connection
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            //Configure proxy to eliminate memory overload
            db.Configuration.ProxyCreationEnabled = false;

            List<dynamic> dynamicMember = new List<dynamic>();

            try
            {
                foreach (Person mem in person)
                {
                    dynamic dynamicOrgPosition = new ExpandoObject();

                    dynamicOrgPosition.OrgStructID = mem.OrgStructID;
                    dynamicOrgPosition.AssignLeader = mem.AssignLeader;
                    dynamicOrgPosition.PersonID = mem.PersonID;
                    dynamicOrgPosition.Name = mem.Name;
                    dynamicOrgPosition.Surname = mem.Surname;


                    dynamicMember.Add(dynamicOrgPosition);
                }
            }
            catch (Exception e)
            {

            }

            return dynamicMember;
        }
        public List<dynamic> getUnassignedLeaderList(List<Person> structPosition)
        {
            //Database connection
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            //Configure proxy to eliminate memory overload
            db.Configuration.ProxyCreationEnabled = false;

            List<dynamic> dynamicOrgStructurePositions = new List<dynamic>();

            try
            {
                foreach (Person structpos in structPosition)
                {
                    Organisational_Structure_Position orgStruct = db.Organisational_Structure_Position.Include(x => x.Organisational_Individual_Position).Where(z => z.OrgStructID == structpos.OrgStructID).FirstOrDefault();
                    dynamic dynamicOrgPos = new ExpandoObject();

                    dynamicOrgPos.OrgStructID = structpos.OrgStructID;

                    dynamicOrgPos.Description = orgStruct.Organisational_Individual_Position.Decription;
                    dynamicOrgPos.PersonID = structpos.PersonID;
                    dynamicOrgPos.Name = structpos.Name;
                    dynamicOrgPos.Surname = structpos.Surname;


                    dynamicOrgStructurePositions.Add(dynamicOrgPos);
                }
            }
            catch (Exception e)
            {

            }

            return dynamicOrgStructurePositions;
        }
Exemplo n.º 23
0
        public List <dynamic> GetGroupTypes()
        {
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            db.Configuration.ProxyCreationEnabled = false;
            return(GetGroupTypeList(db.Group_Type.ToList()));
        }
        public dynamic getApprovalProgress()
        {
            //Database connection
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            //Configure proxy to eliminate overload of data
            db.Configuration.ProxyCreationEnabled = false;

            //Create dynamic object
            dynamic ApprovalProgress = new ExpandoObject();

            try
            {
                List<Person> RemainingApprovals = db.People.Where(z => z.Activation_Status_ID == 4).ToList();
                List<Person> CompletedApprovals = db.People.Where(z => z.Activation_Status_ID == 1).ToList();

                //Count database records
                int remaining = RemainingApprovals.Count;
                int completed = CompletedApprovals.Count;

                //Add list and perform remaining calculations
                ApprovalProgress.Remaining = remaining;
                ApprovalProgress.Completed = completed;

            }
            catch (Exception e)
            {
                return e;
            }

            return ApprovalProgress;
        }
Exemplo n.º 25
0
        public List <dynamic> PersonGroup(List <Organisational_Structure_Position> allgroups)
        {
            //Database conncection
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            db.Configuration.ProxyCreationEnabled = false;

            List <dynamic> dynamicPersonGroups = new List <dynamic>();

            try
            {
                foreach (Organisational_Structure_Position stuctureposition in allgroups)
                {
                    dynamic dynamicPersonGroup = new ExpandoObject();
                    dynamicPersonGroup.OrgStructID    = stuctureposition.OrgStructID;
                    dynamicPersonGroup.OrgStructLevel = stuctureposition.OrgStructLevel;

                    dynamicPersonGroup.Description = stuctureposition.Description;

                    dynamicPersonGroup.OrgStructTypeID      = stuctureposition.OrgStructTypeID;
                    dynamicPersonGroup.OrgIndivPosId        = stuctureposition.OrgIndivPosID;
                    dynamicPersonGroup.OrgStructIDReportsTo = stuctureposition.OrgStructIDReportsTo;


                    dynamicPersonGroups.Add(dynamicPersonGroup);
                }
            }
            catch (Exception e)
            {
            }

            return(dynamicPersonGroups);
        }
Exemplo n.º 26
0
        public List <dynamic> MemberByID(int personId)
        {
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();             //establish database connection

            db.Configuration.ProxyCreationEnabled = false;                                          //configure proxy to eliminate overload of data
            return(getUnassignedMemberList(db.People.Where(z => z.PersonID == personId).ToList())); // return called method
        }
Exemplo n.º 27
0
        public List <dynamic> MemberGroups(int personId)
        {
            //Database connection
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            db.Configuration.ProxyCreationEnabled = false;
            List <dynamic> dynamicMemberGroupList = new List <dynamic>();

            //Group_Type getHomecellTypeID = db.Group_Type.Where(z => z.GroupTypeName == "Homecell").FirstOrDefault();
            List <Persons_Group> memberGroup = db.Persons_Group.Include(z => z.Organisational_Group).Where(z => z.PersonID == personId).ToList();

            foreach (Persons_Group group in memberGroup)
            {
                dynamic dynamicMemberGroups = new ExpandoObject();
                dynamicMemberGroups.PersonGroup = group.PersonGroupID;
                dynamicMemberGroups.Group       = group.ServeGroups;
                dynamicMemberGroups.GroupName   = group.Organisational_Group.Description;
                dynamicMemberGroupList.Add(dynamicMemberGroups);
            }
            if (dynamicMemberGroupList.Count != 0)
            {
                return(dynamicMemberGroupList);
            }

            else
            {
                return(null);
            }
        }
Exemplo n.º 28
0
        public List <dynamic> getChurchesReturnList(List <Church_Banking_Details> allChurches)
        {
            //Connection to database
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            db.Configuration.ProxyCreationEnabled = false;

            //Creating a dynamic list of the churches
            List <dynamic> dynamicChurches = new List <dynamic>();

            foreach (Church_Banking_Details thisChurch in allChurches)
            {
                //creating a dynamic object of the churches
                dynamic dynamicChurch = new ExpandoObject();

                //Retrieve all the church information from the Church_Banking_Details table and saving the info as a dynamic object
                dynamicChurch.ChurchBankID = thisChurch.ChurchBankID;
                dynamicChurch.ChurchName   = thisChurch.ChurchName;

                /*dynamicChurch.Bank = thisChurch.Bank;
                 * dynamicChurch.AccountName = thisChurch.AccountName;
                 * dynamicChurch.AccountNumber = thisChurch.AccountNumber;
                 * dynamicChurch.BranchCode = thisChurch.BranchCode;
                 * dynamicChurch.Reference = thisChurch.Reference;*/

                //Adding the dynmic object to the dynamic list to be returned
                dynamicChurches.Add(dynamicChurch);
            }
            return(dynamicChurches);
        }
        public List <dynamic> checkInChild([FromBody] dynamic confirmationCheckIn) //get JSON parameter
        {
            //validate that there is no null values
            if (confirmationCheckIn != null)
            {
                ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3(); //establish database connection

                db.Configuration.ProxyCreationEnabled = false;                              //configure proxy to eliminate overload of data

                try
                {
                    foreach (var child in confirmationCheckIn.child)
                    {
                        int             id           = child;
                        Person_Children childCheckIn = db.Person_Children.Include(x => x.Person).Include(z => z.Child).Where(x => x.ChildID == id).FirstOrDefault();
                        childCheckIn.KCVolunteerConfirmation = true;
                        childCheckIn.CheckIn         = true;
                        childCheckIn.SignOut         = false;
                        childCheckIn.CheckInDateTime = DateTime.Now;

                        Audit_Trail auditLog = new Audit_Trail();
                        auditLog.PersonID         = confirmationCheckIn.PersonID;
                        auditLog.EventDescription = "Checked in child with ID: " + id;
                        auditLog.EventDateTime    = DateTime.Now;
                        db.Audit_Trail.Add(auditLog);

                        db.SaveChanges(); //Save nchanges and Add new position
                                          // return called method

                        childrenList += childCheckIn.Child.Name + " " + childCheckIn.Child.Surname + ", ";
                        toName        = childCheckIn.Person.Name;
                        toMember      = childCheckIn.Person.Email;
                    }
                    message      = childrenList + " Has been successfully checked-in of Kids Church at Christian Revival Church (CRC) Main.";
                    Emailsubject = "Kids Church Sign-out @ CRC";
                    sendEmail();
                    foreach (var child in confirmationCheckIn.child)
                    {
                        checkInRequestsList.Remove(child);
                    }
                    if (checkInRequestsList.Count() == 0)
                    {
                        return(getChilConfirmation(checkInRequestsList));
                    }
                    else
                    {
                        return(null);
                    }
                }
                catch (Exception)
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 30
0
        public List <dynamic> getAllCountries()
        {
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            db.Configuration.ProxyCreationEnabled = false;

            return(getAllCountries(db.Countries.ToList()));
        }