コード例 #1
0
        public void Save(ServiceMarriage pmarriage, List<Guid> sources, List<MarriageWitness> witnesses, IValidator marriageValidation)
        {
            if (!marriageValidation.ValidEntry()) return;

            if (!_security.IsValidEdit()) return;

            if (pmarriage.MarriageId == Guid.Empty)
            {
                Insert(pmarriage,sources, witnesses);
            }
            else
            {
                Edit(pmarriage,sources, witnesses);
            }
        }
コード例 #2
0
        public void Save(ServicePerson servicePerson,List<Guid> sourceIds,  IValidator validator = null)
        {
            if (validator != null && !validator.ValidEntry()) throw new InvalidDataException(validator.GetErrors());

            if (servicePerson.PersonId == Guid.Empty)
            {
                InsertNewRecord(servicePerson, sourceIds);
            }
            else
            {
                EditSelectedRecord(servicePerson, sourceIds);
            }
        }
コード例 #3
0
        public ServiceMarriageObject Search(MarriageFilterTypes filterMode, MarriageSearchFilter marriageSearchFilter, DataShaping shaping, IValidator validator = null)
        {
            var serviceMarriageObject = new ServiceMarriageObject();

            if (!_security.IsvalidSelect())  serviceMarriageObject.ErrorStatus = "Invalid permission to select";

            if (validator != null && !validator.ValidEntry())  serviceMarriageObject.ErrorStatus += " Validation failed: " + validator.GetErrors();

            if (serviceMarriageObject.ErrorStatus.Length == 0)
            {

                if (shaping.Column.Contains("MarriageDate DESC"))
                {
                    shaping.Column = "MarriageYear DESC";
                }
                else if (shaping.Column.Contains("MarriageDate"))
                {
                    shaping.Column = "MarriageYear";
                }

                switch (filterMode)
                {
                    case MarriageFilterTypes.Duplicates:
                        serviceMarriageObject = marriageSearchFilter.ParentId != Guid.Empty
                                                    ? _marriagesDll.GetDataByUniqueRef(marriageSearchFilter.ParentId)
                                                                   .ToServiceMarriageObject(shaping.Column, shaping.RecordPageSize,
                                                                                            shaping.RecordStart)
                                                    : new ServiceMarriageObject();
                        break;
                    case MarriageFilterTypes.Standard:
                        serviceMarriageObject =
                            _marriagesDll.GetFilteredMarriages(marriageSearchFilter)
                                         .ToServiceMarriageObject(shaping.Column, shaping.RecordPageSize, shaping.RecordStart);
                        break;

                    case MarriageFilterTypes.IdList:
                        serviceMarriageObject = _marriagesDll.GetByListId(marriageSearchFilter.Ids).ToServiceMarriageObject(shaping.Column, shaping.RecordPageSize, shaping.RecordStart);
                        break;

                }

            }
            return serviceMarriageObject;
        }
コード例 #4
0
        public ServicePersonObject Search(PersonSearchTypes filterMode, PersonSearchFilter personSearchFilter, DataShaping shaper, IValidator validator = null)
        {
            if (validator != null && !validator.ValidEntry()) throw new InvalidDataException(validator.GetErrors());

            if (!_security.IsvalidSelect()) throw new SecurityException("Missing select permission");

            IList<ServicePerson> tpServicePerson = new List<ServicePerson>();

            switch (filterMode)
            {

                case PersonSearchTypes.Duplicates:
                    if (personSearchFilter.ParentId != Guid.Empty)
                    {
                        tpServicePerson = _personDal.GetByDupeRef(personSearchFilter.ParentId);
                    }

                    break;

                case PersonSearchTypes.Simple:
                    tpServicePerson = _personDal.GetByFilter(personSearchFilter).OrderBy(o => o.BirthYear).ToList();
                    break;

                case PersonSearchTypes.IdList:
                    tpServicePerson = _personDal.GetByIdList(personSearchFilter).OrderBy(o => o.BirthYear).ToList();
                    break;
            }

               return tpServicePerson.ToServicePersonObject(shaper.Column, shaper.RecordPageSize,shaper.RecordStart);
        }