public void TestDeactivateVolunteer()
        {
            //Arrange
            Volunteer volunteer = new Volunteer()
            {
                VolunteerID = 1,
                FirstName   = "Tony",
                LastName    = "Stark",
                Email       = "*****@*****.**",
                PhoneNumber = "15554443322",
                OtherNotes  = "test",
                Active      = true,
                Skills      = new List <string>()
                {
                    "Dogwalker", "Groomer"
                }
            };
            IVolunteerManager _volunteerManager = new VolunteerManager(_volunteerAccessor);
            //Act
            bool expectedResults = true;
            bool isChecked       = false;
            bool actualResult    = _volunteerManager.ChangeVolunteerActiveStatus(isChecked, volunteer.VolunteerID);

            //Assert
            Assert.AreEqual(actualResult, expectedResults);
        }
        public void TestUpdateFoster()
        {
            // arrange
            Foster oldFoster = new Foster()
            {
                FosterID       = 1,
                VolunteerID    = 3,
                AddressLineOne = "22 Hell St",
                AddressLineTwo = "#666",
                City           = "Cedar Rapids",
                State          = "IA",
                Zip            = "52403"
            };
            Foster newFoster = new Foster()
            {
                FosterID       = 1,
                VolunteerID    = 3,
                AddressLineOne = "221 Hell St",
                AddressLineTwo = "#666",
                City           = "Cedar Rapids",
                State          = "IA",
                Zip            = "52403"
            };
            IVolunteerManager _volunteerManager = new VolunteerManager(_volunteerAccessor);
            //Act
            bool expectedResults = true;
            bool actualResult    = _volunteerManager.UpdateFoster(oldFoster, newFoster);

            //Assert
            Assert.AreEqual(actualResult, expectedResults);
        }
        public void TestActivateVolunteer()
        {
            //Arrange
            Volunteer volunteer = new Volunteer()
            {
                VolunteerID = 3,
                FirstName   = "Gordon",
                LastName    = "Ramsey",
                Email       = "*****@*****.**",
                PhoneNumber = "15556669988",
                OtherNotes  = "test",
                Active      = false,
                Skills      = new List <string>()
                {
                    "Dogwalker", "Groomer"
                }
            };
            IVolunteerManager _volunteerManager = new VolunteerManager(_volunteerAccessor);
            //Act
            bool expectedResults = true;
            bool isChecked       = true;
            bool actualResult    = _volunteerManager.ChangeVolunteerActiveStatus(isChecked, volunteer.VolunteerID);

            //Assert
            Assert.AreEqual(actualResult, expectedResults);
        }
Beispiel #4
0
        /// <summary>
        /// Creates the files and folders necessary for the cardolator to run if they dont already exist
        /// Loads the file into memory
        /// </summary>
        public static void Initialize(string directory, string workforce_path, string purchase_record_path)
        {
            // Create the Cardolator Director if it doesn't exist
            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }

            // Create a workforce file if it doesn't exist
            if (!File.Exists(workforce_path))
            {
                AppState.VolunteerManager = VolunteerManager.CreateNew(workforce_path);
            }
            else
            {
                AppState.VolunteerManager = VolunteerManager.Load(workforce_path);
            }

            // Create a purchase record file if it doesn't exist
            if (!File.Exists(purchase_record_path))
            {
                AppState.PurchaseManager = PurchaseManager.CreateNew(purchase_record_path);
            }
            else
            {
                AppState.PurchaseManager = PurchaseManager.Load(purchase_record_path);
            }
        }
 public ViewVolunteers()
 {
     InitializeComponent();
     _volunteerManager = new VolunteerManager();
     populateVolunteers();
     _volunteer         = new Volunteer();
     cbSort.ItemsSource = _volunteerManager.GetAllSkills();
 }
        public void TestGetAllSkills()
        {
            // arrange
            List <string>     skills;
            IVolunteerManager volunteerManager = new VolunteerManager(_volunteerAccessor);

            // act
            skills = volunteerManager.GetAllSkills();
            // assert
            Assert.AreEqual(2, skills.Count);
        }
        public void TestGetVolunteerByFirstName()
        {
            // arrange
            List <Volunteer>  volunteers;
            IVolunteerManager volunteerManager = new VolunteerManager(_volunteerAccessor);

            // Act
            volunteers = volunteerManager.GetVolunteerByFirstName("Tony");
            // assert
            Assert.AreEqual(1, volunteers.Count);
        }
        public void TestGetFosterDetailsByVolunteerID()
        {
            // arrange
            Foster            foster;
            IVolunteerManager volunteerManager = new VolunteerManager(_volunteerAccessor);

            // Act
            foster = volunteerManager.GetFosterDetailsByVolunteerID(3);
            // assert
            Assert.AreEqual(3, foster.VolunteerID);
        }
        public void TestSortVolunteersBySkill()
        {
            // arrange
            List <Volunteer>  volunteers;
            IVolunteerManager volunteerManager = new VolunteerManager(_volunteerAccessor);

            // Act
            volunteers = volunteerManager.GetVolunteersBySkill("Dogwalker");
            // assert
            Assert.AreEqual(3, volunteers.Count);
        }
        public ActionResult Index()
        {
            var volunteers = VolunteerManager.getVolunteers();

            if (volunteers == null)
            {
                volunteers = new Volunteer[] { }
            }
            ;
            return(View(volunteers));
        }
    }
Beispiel #11
0
        /// <summary>
        /// Imports the file and merges it with the internal file
        /// </summary>
        /// <param name="file"></param>
        /// <param name="sourceFilePath"></param>
        public static void ImportAndMerge(DbFile file, string sourceFilePath)
        {
            switch (file)
            {
            case DbFile.WorkForce:
                AppState.VolunteerManager.Merge(VolunteerManager.Load(sourceFilePath));
                AppState.VolunteerManager.Save();
                break;

            case DbFile.PurchaseRecord:
                AppState.PurchaseManager.Merge(PurchaseManager.Load(sourceFilePath));
                AppState.PurchaseManager.Save();
                break;
            }
        }
        public void TestVolunteerManagerInsertVolunteer()
        {
            // arrange
            IVolunteerManager volunteerManager = new VolunteerManager(_volunteerAccessor);
            // act
            bool row = volunteerManager.AddVolunteer(new Volunteer()
            {
                VolunteerID = 101,
                FirstName   = "Tony",
                LastName    = "Stark",
                Email       = "*****@*****.**",
                PhoneNumber = "13334445567",
                OtherNotes  = "Test",
                Active      = true
            });

            // assert
            Assert.IsTrue(row);
        }
Beispiel #13
0
        public ActionResult Index()
        {
            //Get logged in user id
            var id = "";

            if (Session["id"] != null && !string.IsNullOrEmpty(Session["id"].ToString()))
            {
                id = Session["id"].ToString();
            }
            if (string.IsNullOrEmpty(id))
            {
                //if user is not logged in return to home
                return(RedirectToAction("Index", "Home"));
            }

            var volunteer = VolunteerManager.getVolunteer(id);

            return(View(volunteer));
        }
        public void TestCreateFoster()
        {
            // arrange
            IVolunteerManager volunteerManager = new VolunteerManager(_volunteerAccessor);
            Volunteer         volunteer        = new Volunteer {
                VolunteerID = 1
            };
            // act
            bool row = volunteerManager.CreateFoster(volunteer, new Foster()
            {
                AddressLineOne = "111 Poppy St",
                AddressLineTwo = "",
                City           = "Los Angeles",
                State          = "CA",
                Zip            = "44452",
            });

            // assert
            Assert.IsTrue(row);
        }
        public void TestUpdateVolunteer()
        {
            // arrange
            Volunteer oldVolunteer = new Volunteer()
            {
                VolunteerID = 1,
                FirstName   = "Tony",
                LastName    = "Stark",
                Email       = "*****@*****.**",
                PhoneNumber = "15554443322",
                OtherNotes  = "test",
                Active      = true,
                Skills      = new List <string>()
                {
                    "Dogwalker", "Groomer"
                }
            };
            Volunteer newVolunteer = new Volunteer()
            {
                VolunteerID = 1,
                FirstName   = "Tony",
                LastName    = "Stark",
                Email       = "*****@*****.**",
                PhoneNumber = "15554443322",
                OtherNotes  = "suh dude",
                Active      = true,
                Skills      = new List <string>()
                {
                    "Dogwalker", "Groomer"
                }
            };
            IVolunteerManager _volunteerManager = new VolunteerManager(_volunteerAccessor);
            //Act
            bool expectedResults = true;
            bool actualResult    = _volunteerManager.UpdateVolunteer(oldVolunteer, newVolunteer);

            //Assert
            Assert.AreEqual(actualResult, expectedResults);
        }
Beispiel #16
0
 public void TestSetup()
 {
     volunteerManager = new VolunteerManager();
 }
        public ActionResult SynchronizeData()
        {
            string SERVER_NAME_LOCAL   = Environment.GetEnvironmentVariable(Common.VolMongoConstants.SERVER_NAME_LOCAL);
            int    SERVER_PORT_LOCAL   = int.Parse(Environment.GetEnvironmentVariable(Common.VolMongoConstants.SERVER_PORT_LOCAL));
            string DATABASE_NAME_LOCAL = Environment.GetEnvironmentVariable(Common.VolMongoConstants.DATABASE_NAME_LOCAL);

            string SERVER_NAME_COMMON   = Environment.GetEnvironmentVariable(Common.VolMongoConstants.SERVER_NAME_COMMON);
            int    SERVER_PORT_COMMON   = int.Parse(Environment.GetEnvironmentVariable(Common.VolMongoConstants.SERVER_PORT_COMMON));
            string DATABASE_NAME_COMMON = Environment.GetEnvironmentVariable(Common.VolMongoConstants.DATABASE_NAME_COMMON);

            ModifiedDocumentManager modifiedDocumentManager = new ModifiedDocumentManager();
            AuxiliaryDBManager      AuxiliaryDBManager      = new AuxiliaryDBManager(SERVER_NAME_LOCAL, SERVER_PORT_LOCAL, DATABASE_NAME_LOCAL);

            EventManager               eventManager               = new EventManager(SERVER_NAME_LOCAL, SERVER_PORT_LOCAL, DATABASE_NAME_LOCAL);
            SponsorManager             sponsorManager             = new SponsorManager(SERVER_NAME_LOCAL, SERVER_PORT_LOCAL, DATABASE_NAME_LOCAL);
            VolunteerManager           volunteerManager           = new VolunteerManager(SERVER_NAME_LOCAL, SERVER_PORT_LOCAL, DATABASE_NAME_LOCAL);
            VolContractManager         volContractManager         = new VolContractManager(SERVER_NAME_LOCAL, SERVER_PORT_LOCAL, DATABASE_NAME_LOCAL);
            BeneficiaryManager         beneManager                = new BeneficiaryManager(SERVER_NAME_LOCAL, SERVER_PORT_LOCAL, DATABASE_NAME_LOCAL);
            BeneficiaryContractManager beneficiaryContractManager = new BeneficiaryContractManager(SERVER_NAME_LOCAL, SERVER_PORT_LOCAL, DATABASE_NAME_LOCAL);

            EventManager               commonEventManager         = new EventManager(SERVER_NAME_COMMON, SERVER_PORT_COMMON, DATABASE_NAME_COMMON);
            SponsorManager             commonSponsorManager       = new SponsorManager(SERVER_NAME_COMMON, SERVER_PORT_COMMON, DATABASE_NAME_COMMON);
            VolunteerManager           commonvolunteerManager     = new VolunteerManager(SERVER_NAME_COMMON, SERVER_PORT_COMMON, DATABASE_NAME_COMMON);
            VolContractManager         commonVolContractManager   = new VolContractManager(SERVER_NAME_COMMON, SERVER_PORT_COMMON, DATABASE_NAME_COMMON);
            BeneficiaryManager         commonBeneficiaryManager   = new BeneficiaryManager(SERVER_NAME_COMMON, SERVER_PORT_COMMON, DATABASE_NAME_COMMON);
            BeneficiaryContractManager commonBenefContractManager = new BeneficiaryContractManager(SERVER_NAME_COMMON, SERVER_PORT_COMMON, DATABASE_NAME_COMMON);

            List <Volunteer>           volunteerslocal           = volunteerManager.GetListOfVolunteers();
            List <Event>               eventslocal               = eventManager.GetListOfEvents();
            List <Beneficiary>         beneficiarieslocal        = beneManager.GetListOfBeneficiaries();
            List <Sponsor>             sponsorslocal             = sponsorManager.GetListOfSponsors();
            List <Volcontract>         volcontractslocal         = volContractManager.GetListOfVolunteersContracts();
            List <Beneficiarycontract> beneficiarycontractslocal = beneficiaryContractManager.GetListOfBeneficiariesContracts();
            List <Volunteer>           volunteers           = commonvolunteerManager.GetListOfVolunteers();
            List <Event>               events               = commonEventManager.GetListOfEvents();
            List <Beneficiary>         beneficiaries        = commonBeneficiaryManager.GetListOfBeneficiaries();
            List <Sponsor>             sponsors             = commonSponsorManager.GetListOfSponsors();
            List <Volcontract>         volcontracts         = commonVolContractManager.GetListOfVolunteersContracts();
            List <Beneficiarycontract> beneficiarycontracts = commonBenefContractManager.GetListOfBeneficiariesContracts();

            List <ModifiedIDs> modifiedidlist = modifiedDocumentManager.GetListOfModifications();
            List <DeletedIDS>  deletedlist    = modifiedDocumentManager.GetListOfDeletions();

            int numberOfModifictaions = modifiedidlist.Count();
            int numberOfDeletions     = deletedlist.Count();

            string modifiedids = JsonConvert.SerializeObject(modifiedidlist);
            string deletedids  = JsonConvert.SerializeObject(deletedlist);

            string commonvols                 = JsonConvert.SerializeObject(volunteers);
            string commonevents               = JsonConvert.SerializeObject(events);
            string commonbenefieciaries       = JsonConvert.SerializeObject(beneficiaries);
            string commonsponsors             = JsonConvert.SerializeObject(sponsors);
            string commonvolcontracts         = JsonConvert.SerializeObject(volcontracts);
            string commonbeneficiarycontracts = JsonConvert.SerializeObject(beneficiarycontracts);

            string outOfSyncDocuments = "";

            for (int i = 0; i < volunteerslocal.Count(); i++)
            {
                // If the common db does not contain the volunteer and it has been created since the last fetch/push it gets added.
                if (!commonvols.Contains(volunteerslocal[i]._id) && modifiedids.Contains(volunteerslocal[i]._id))
                {
                    commonvolunteerManager.AddVolunteerToDB(volunteerslocal[i]);
                }
                // if the common db contains the volunteer, but it has been edited since last sync it gets updated
                else if (modifiedids.Contains(volunteerslocal[i]._id))
                {
                    string auxiliaryDocument = AuxiliaryDBManager.GetDocumentByID(volunteerslocal[i]._id);
                    string currentDocument   = JsonConvert.SerializeObject(commonvolunteerManager.GetOneVolunteer(volunteerslocal[i]._id));
                    auxiliaryDocument = auxiliaryDocument.Replace(" ", "");
                    currentDocument   = currentDocument.Replace(" ", "");
                    //Checking whether or not the Document has been modified since we have last synced.
                    if (auxiliaryDocument != currentDocument)
                    {
                        outOfSyncDocuments += volunteerslocal[i].Fullname + ", ";
                    }
                    commonvolunteerManager.UpdateAVolunteer(volunteerslocal[i], volunteerslocal[i]._id);
                }
            }
            for (int i = 0; i < volunteers.Count(); i++)
            {
                // if the document has been deleted it will get deleted from the common db aswell.
                // the document will not be re-added unless someone has modified the document with this ID.
                if (deletedids.Contains(volunteers[i]._id))
                {
                    commonvolunteerManager.DeleteAVolunteer(volunteers[i]._id);
                }
            }

            for (int i = 0; i < eventslocal.Count(); i++)
            {
                if (!commonevents.Contains(eventslocal[i]._id) && modifiedids.Contains(eventslocal[i]._id))
                {
                    commonEventManager.AddEventToDB(eventslocal[i]);
                }
                else if (modifiedids.Contains(eventslocal[i]._id))
                {
                    string auxiliaryDocument = AuxiliaryDBManager.GetDocumentByID(eventslocal[i]._id);
                    string currentDocument   = JsonConvert.SerializeObject(commonEventManager.GetOneEvent(eventslocal[i]._id));
                    auxiliaryDocument = auxiliaryDocument.Replace(" ", "");
                    currentDocument   = currentDocument.Replace(" ", "");
                    if (auxiliaryDocument != currentDocument)
                    {
                        outOfSyncDocuments += eventslocal[i].NameOfEvent + ", ";
                    }
                    commonEventManager.UpdateAnEvent(eventslocal[i], eventslocal[i]._id);
                }
            }
            for (int i = 0; i < events.Count(); i++)
            {
                if (deletedids.Contains(events[i]._id))
                {
                    commonEventManager.DeleteAnEvent(events[i]._id);
                }
            }

            for (int i = 0; i < beneficiarieslocal.Count(); i++)
            {
                if (!commonbenefieciaries.Contains(beneficiarieslocal[i]._id) && modifiedids.Contains(beneficiarieslocal[i]._id))
                {
                    commonBeneficiaryManager.AddBeneficiaryToDB(beneficiarieslocal[i]);
                }
                else if (modifiedids.Contains(beneficiarieslocal[i]._id))
                {
                    string auxiliaryDocument = AuxiliaryDBManager.GetDocumentByID(beneficiarieslocal[i]._id);
                    string currentDocument   = JsonConvert.SerializeObject(commonBeneficiaryManager.GetOneBeneficiary(beneficiarieslocal[i]._id));
                    auxiliaryDocument = auxiliaryDocument.Replace(" ", "");
                    currentDocument   = currentDocument.Replace(" ", "");
                    if (auxiliaryDocument != currentDocument)
                    {
                        outOfSyncDocuments += beneficiarieslocal[i].Fullname + ", ";
                    }
                    commonBeneficiaryManager.UpdateABeneficiary(beneficiarieslocal[i], beneficiarieslocal[i]._id);
                }
            }
            for (int i = 0; i < beneficiaries.Count(); i++)
            {
                if (deletedids.Contains(beneficiaries[i]._id))
                {
                    commonBeneficiaryManager.DeleteBeneficiary(beneficiaries[i]._id);
                }
            }

            for (int i = 0; i < sponsorslocal.Count(); i++)
            {
                if (!commonsponsors.Contains(sponsorslocal[i]._id) && modifiedids.Contains(sponsorslocal[i]._id))
                {
                    commonSponsorManager.AddSponsorToDB(sponsorslocal[i]);
                }
                else if (modifiedids.Contains(sponsorslocal[i]._id))
                {
                    string auxiliaryDocument = AuxiliaryDBManager.GetDocumentByID(sponsorslocal[i]._id);
                    string currentDocument   = JsonConvert.SerializeObject(commonSponsorManager.GetOneSponsor(sponsorslocal[i]._id));
                    auxiliaryDocument = auxiliaryDocument.Replace(" ", "");
                    currentDocument   = currentDocument.Replace(" ", "");
                    if (auxiliaryDocument != currentDocument)
                    {
                        outOfSyncDocuments += sponsorslocal[i].NameOfSponsor + ", ";
                    }
                    commonSponsorManager.UpdateSponsor(sponsorslocal[i], sponsorslocal[i]._id);
                }
            }
            for (int i = 0; i < sponsors.Count(); i++)
            {
                if (deletedids.Contains(sponsors[i]._id))
                {
                    commonSponsorManager.DeleteSponsor(sponsors[i]._id);
                }
            }

            for (int i = 0; i < volcontractslocal.Count(); i++)
            {
                if (!commonvolcontracts.Contains(volcontractslocal[i]._id) && modifiedids.Contains(volcontractslocal[i]._id))
                {
                    commonVolContractManager.AddVolunteerContractToDB(volcontractslocal[i]);
                }
                else if (modifiedids.Contains(volcontractslocal[i]._id))
                {
                    commonVolContractManager.UpdateVolunteerContract(volcontractslocal[i], volcontractslocal[i]._id);
                }
            }
            for (int i = 0; i < volcontracts.Count(); i++)
            {
                if (deletedids.Contains(volcontracts[i]._id))
                {
                    commonVolContractManager.DeleteAVolContract(volcontracts[i]._id);
                }
            }
            for (int i = 0; i < beneficiarycontractslocal.Count(); i++)
            {
                if (!commonbeneficiarycontracts.Contains(beneficiarycontractslocal[i]._id) && modifiedids.Contains(beneficiarycontractslocal[i]._id))
                {
                    commonBenefContractManager.AddBeneficiaryContractToDB(beneficiarycontractslocal[i]);
                }
                else if (modifiedids.Contains(beneficiarycontractslocal[i]._id))
                {
                    commonBenefContractManager.UpdateBeneficiaryContract(beneficiarycontractslocal[i], beneficiarycontractslocal[i]._id);
                }
            }
            for (int i = 0; i < beneficiarycontracts.Count(); i++)
            {
                if (deletedids.Contains(beneficiarycontracts[i]._id))
                {
                    commonBenefContractManager.DeleteBeneficiaryContract(beneficiarycontracts[i]._id);
                }
            }
            modifiedDocumentManager.DeleteAuxiliaryDatabases();

            volunteers           = commonvolunteerManager.GetListOfVolunteers();
            events               = commonEventManager.GetListOfEvents();
            beneficiaries        = commonBeneficiaryManager.GetListOfBeneficiaries();
            sponsors             = commonSponsorManager.GetListOfSponsors();
            volcontracts         = commonVolContractManager.GetListOfVolunteersContracts();
            beneficiarycontracts = commonBenefContractManager.GetListOfBeneficiariesContracts();

            string volstring           = JsonConvert.SerializeObject(volunteers);
            string eventstring         = JsonConvert.SerializeObject(events);
            string benefieciarystring  = JsonConvert.SerializeObject(beneficiaries);
            string sponsorstring       = JsonConvert.SerializeObject(sponsors);
            string volcontractstring   = JsonConvert.SerializeObject(volcontracts);
            string benefcontractstring = JsonConvert.SerializeObject(beneficiarycontracts);

            string localvols                  = JsonConvert.SerializeObject(volunteerslocal);
            string localevents                = JsonConvert.SerializeObject(eventslocal);
            string localbenefieciaries        = JsonConvert.SerializeObject(beneficiarieslocal);
            string localsponsors              = JsonConvert.SerializeObject(sponsorslocal);
            string localvolcontrcarts         = JsonConvert.SerializeObject(volcontractslocal);
            string localbeneficiarycontrcarts = JsonConvert.SerializeObject(beneficiarycontractslocal);

            for (int i = 0; i < volunteers.Count(); i++)
            {
                if (!(localvols.Contains(volunteers[i]._id)))
                {
                    volunteerManager.AddVolunteerToDB(volunteers[i]);
                }
                else if (!modifiedids.Contains(volunteers[i]._id))
                {
                    volunteerManager.UpdateAVolunteer(volunteers[i], volunteers[i]._id);
                }
            }
            for (int i = 0; i < volunteerslocal.Count(); i++)
            {
                if (!volstring.Contains(volunteerslocal[i]._id))
                {
                    volunteerManager.DeleteAVolunteer(volunteerslocal[i]._id);
                }
            }

            for (int i = 0; i < events.Count(); i++)
            {
                if (!(localevents.Contains(events[i]._id)))
                {
                    eventManager.AddEventToDB(events[i]);
                }
                else if (!modifiedids.Contains(events[i]._id))
                {
                    eventManager.UpdateAnEvent(events[i], events[i]._id);
                }
            }
            for (int i = 0; i < eventslocal.Count(); i++)
            {
                if (!eventstring.Contains(eventslocal[i]._id))
                {
                    eventManager.DeleteAnEvent(eventslocal[i]._id);
                }
            }

            for (int i = 0; i < beneficiaries.Count(); i++)
            {
                if (!(localbenefieciaries.Contains(beneficiaries[i]._id)))
                {
                    beneManager.AddBeneficiaryToDB(beneficiaries[i]);
                }
                else if (!modifiedids.Contains(beneficiaries[i]._id))
                {
                    beneManager.UpdateABeneficiary(beneficiaries[i], beneficiaries[i]._id);
                }
            }
            for (int i = 0; i < beneficiarieslocal.Count(); i++)
            {
                if (!benefieciarystring.Contains(beneficiarieslocal[i]._id))
                {
                    beneManager.DeleteBeneficiary(beneficiarieslocal[i]._id);
                }
            }

            for (int i = 0; i < sponsors.Count(); i++)
            {
                if (!(localsponsors.Contains(sponsors[i]._id)))
                {
                    sponsorManager.AddSponsorToDB(sponsors[i]);
                }
                else if (!modifiedids.Contains(sponsors[i]._id))
                {
                    sponsorManager.UpdateSponsor(sponsors[i], sponsors[i]._id);
                }
            }
            for (int i = 0; i < sponsorslocal.Count(); i++)
            {
                if (!sponsorstring.Contains(sponsorslocal[i]._id))
                {
                    sponsorManager.DeleteSponsor(sponsorslocal[i]._id);
                }
            }

            for (int i = 0; i < volcontracts.Count(); i++)
            {
                if (!(localvolcontrcarts.Contains(volcontracts[i]._id)))
                {
                    volContractManager.AddVolunteerContractToDB(volcontracts[i]);
                }
                else if (!modifiedids.Contains(volcontracts[i]._id))
                {
                    volContractManager.UpdateVolunteerContract(volcontracts[i], volcontracts[i]._id);
                }
            }
            for (int i = 0; i < volcontractslocal.Count(); i++)
            {
                if (!volcontractstring.Contains(volcontractslocal[i]._id))
                {
                    volContractManager.DeleteAVolContract(volcontractslocal[i]._id);
                }
            }

            for (int i = 0; i < beneficiarycontracts.Count(); i++)
            {
                if (!(localbeneficiarycontrcarts.Contains(beneficiarycontracts[i]._id)))
                {
                    beneficiaryContractManager.AddBeneficiaryContractToDB(beneficiarycontracts[i]);
                }
                else if (!modifiedids.Contains(beneficiarycontracts[i]._id))
                {
                    beneficiaryContractManager.UpdateBeneficiaryContract(beneficiarycontracts[i], beneficiarycontracts[i]._id);
                }
            }
            for (int i = 0; i < beneficiarycontractslocal.Count(); i++)
            {
                if (!benefcontractstring.Contains(beneficiarycontractslocal[i]._id))
                {
                    beneficiaryContractManager.DeleteBeneficiaryContract(beneficiarycontractslocal[i]._id);
                }
            }

            modifiedDocumentManager.DeleteAuxiliaryDatabases();
            AuxiliaryDBManager.DropAuxiliaryDatabase();
            return(RedirectToAction("SynchronizationResults", "DatabaseManagement", new { numberOfModifictaions, numberOfDeletions, outOfSyncDocuments }));
        }
Beispiel #18
0
        public ActionResult Profile(string id)
        {
            var volunteer = VolunteerManager.getVolunteer(id);

            return(View("Index", volunteer));
        }