コード例 #1
0
        private void AddAddresses()
        {
            ////if string changed - add new, remove old
            ////if string empty - remove old
            if (!(string.IsNullOrEmpty(Address1.City) && string.IsNullOrEmpty(Address1.ZipCode) && string.IsNullOrEmpty(Address1.Street) && string.IsNullOrEmpty(Address1.Province)))
            {
                Address1 = AddressService.AddAddress(Address1);

                AddressCandidateService.AddAddressToCandidate(new Address_Candidate()
                {
                    Address   = Address1,
                    Candidate = Candidate
                });
            }
            //remove old address
            if (!(string.IsNullOrEmpty(Address2.City) && string.IsNullOrEmpty(Address2.ZipCode) && string.IsNullOrEmpty(Address2.Street) && string.IsNullOrEmpty(Address2.Province)))
            {
                Address2 = AddressService.AddAddress(Address2);

                AddressCandidateService.AddAddressToCandidate(new Address_Candidate()
                {
                    Address   = Address2,
                    Candidate = Candidate
                });
            }

            //remove old address
            if (!(string.IsNullOrEmpty(Address3.City) && string.IsNullOrEmpty(Address3.ZipCode) && string.IsNullOrEmpty(Address3.Street) && string.IsNullOrEmpty(Address3.Province)))
            {
                Address3 = AddressService.AddAddress(Address3);

                AddressCandidateService.AddAddressToCandidate(new Address_Candidate()
                {
                    Address   = Address3,
                    Candidate = Candidate
                });
            }
        }
コード例 #2
0
        public void RemoveTest()
        {
            foreach (var v in QualificationsService.GetAllQualifications())
            {
                QualificationsService.RemoveQualification(v);
            }

            foreach (var v in AddressCandidateService.GetAllAddressCandidatePairs())
            {
                AddressCandidateService.Remove(v);
            }

            foreach (var v in AddressService.GetAllAdresses())
            {
                AddressService.RemoveAddress(v);
            }

            foreach (var v in CandidateQualificationService.GetAll())
            {
                CandidateQualificationService.RemoveQualificationFromCandidate(v.CandidateId, v.QualificationId);
            }

            foreach (var v in CandidateService.GetAllCandidates())
            {
                CandidateService.RemoveCandidate(v);
            }

            foreach (var v in CompanyService.GetAllCompanies())
            {
                CompanyService.RemoveCompany(v);
            }

            foreach (var v in CourseService.GetAllCourses())
            {
                CourseService.RemoveCourse(v);
            }

            foreach (var v in JobHistoryCompanyService.GetAll())
            {
                JobHistoryCompanyService.Remove(v.JobHistoryId, v.CompanyId);
            }

            foreach (var v in JobHistoryJobService.GetAll())
            {
                JobHistoryJobService.Remove(v.JobHistoryId, v.JobId);
            }

            foreach (var v in JobHistoryService.GetAllJobHistories())
            {
                JobHistoryService.RemoveJobHistory(v);
            }

            foreach (var v in JobService.GetAllJobs())
            {
                JobService.RemoveJob(v);
            }

            foreach (var v in LocationService.GetAllLocations())
            {
                LocationService.RemoveLocation(v);
            }

            foreach (var v in OpeningService.GetAllOpenings())
            {
                OpeningService.RemoveOpening(v);
            }

            foreach (var v in PlacementService.GetAllPlacements())
            {
                PlacementService.RemovePlacement(v);
            }

            foreach (var v in PrerequisitesForCourseService.GetAll())
            {
                PrerequisitesForCourseService.Remove(v.CourseId, v.QualificationId);
            }

            foreach (var v in QualificationDevelopedByCourseService.GetAll())
            {
                QualificationDevelopedByCourseService.Remove(v.CourseId, v.QualificationId);
            }
        }
コード例 #3
0
        private void UpdateCandidateAddresses()
        {
            ////if string changed - add new, remove old
            ////if string empty - remove old
            if (NewAddress1.FullAddress != OldAddress1.FullAddress)
            {
                if (!(string.IsNullOrEmpty(NewAddress1.City) && string.IsNullOrEmpty(NewAddress1.ZipCode) && string.IsNullOrEmpty(NewAddress1.Street) && string.IsNullOrEmpty(NewAddress1.Province)))
                {
                    NewAddress1 = AddressService.AddAddress(NewAddress1);

                    AddressCandidateService.AddAddressToCandidate(new Address_Candidate()
                    {
                        Address   = NewAddress1,
                        Candidate = NewCandidate
                    });
                }
                //remove old address
                AddressCandidateService.RemoveAddressFromCandidate(OldAddress1.Id, NewCandidate.Id);
            }

            if (NewAddress2.FullAddress != OldAddress2.FullAddress)
            {
                if (!(string.IsNullOrEmpty(NewAddress2.City) && string.IsNullOrEmpty(NewAddress2.ZipCode) && string.IsNullOrEmpty(NewAddress2.Street) && string.IsNullOrEmpty(NewAddress2.Province)))
                {
                    NewAddress2 = AddressService.AddAddress(NewAddress2);

                    AddressCandidateService.AddAddressToCandidate(new Address_Candidate()
                    {
                        Address   = NewAddress2,
                        Candidate = NewCandidate
                    });
                }

                //remove old address
                AddressCandidateService.RemoveAddressFromCandidate(OldAddress2.Id, NewCandidate.Id);
            }
            if (NewAddress3.FullAddress != OldAddress3.FullAddress)
            {
                if (!(string.IsNullOrEmpty(NewAddress3.City) && string.IsNullOrEmpty(NewAddress3.ZipCode) && string.IsNullOrEmpty(NewAddress3.Street) && string.IsNullOrEmpty(NewAddress3.Province)))
                {
                    NewAddress3 = AddressService.AddAddress(NewAddress3);

                    AddressCandidateService.AddAddressToCandidate(new Address_Candidate()
                    {
                        Address   = NewAddress3,
                        Candidate = NewCandidate
                    });
                }

                //remove old address
                AddressCandidateService.RemoveAddressFromCandidate(OldAddress3.Id, NewCandidate.Id);
            }
            //if (Address2 != OldAddress2)
            //{
            //    var newAddress = AddressService.AddAddress(new Address()
            //    {
            //        ZipCode = Address2
            //        //TODO make way to parse Address object from strings
            //    });

            //    AddressCandidateService.AddAddressToCandidate(new Address_Candidate()
            //    {
            //        Address = newAddress,
            //        Candidate = NewCandidate
            //    });
            //    //remove old address
            //    AddressCandidateService.RemoveAddressFromCandidate(OldCandidate.Addresses.Where(d => d.CandidateId == OldCandidate.Id).ToList()[1].AddressId, OldCandidate.Id);
            //}

            //if (Address3 != OldAddress3)
            //{
            //    var newAddress = AddressService.AddAddress(new Address()
            //    {
            //        ZipCode = Address3
            //        //TODO make way to parse Address object from strings
            //    });

            //    AddressCandidateService.AddAddressToCandidate(new Address_Candidate()
            //    {
            //        Address = newAddress,
            //        Candidate = NewCandidate
            //    });

            //    //remove old address
            //    AddressCandidateService.RemoveAddressFromCandidate(OldCandidate.Addresses.Where(d => d.CandidateId == OldCandidate.Id).ToList()[2].AddressId, OldCandidate.Id);
            //}



            //if (string.IsNullOrEmpty(Address1))
            //{
            //    //remove old address
            //    AddressCandidateService.RemoveAddressFromCandidate(OldCandidate.Addresses.Where(d => d.CandidateId == OldCandidate.Id).ToList()[0].AddressId, OldCandidate.Id);
            //}

            //if (string.IsNullOrEmpty(Address2))
            //{
            //    //remove old address
            //    AddressCandidateService.RemoveAddressFromCandidate(OldCandidate.Addresses.Where(d => d.CandidateId == OldCandidate.Id).ToList()[1].AddressId, OldCandidate.Id);
            //}

            //if (string.IsNullOrEmpty(Address3))
            //{
            //    //remove old address
            //    AddressCandidateService.RemoveAddressFromCandidate(OldCandidate.Addresses.Where(d => d.CandidateId == OldCandidate.Id).ToList()[2].AddressId, OldCandidate.Id);
            //}
        }