public bool ObjectExists(MemberAssessmentDTO facilitySubscription)
        {
            var objectExists = false;

            //var iDbContext = DbContextUtil.GetDbContextInstance();
            //try
            //{
            //    var catRepository = new Repository<MemberAssessmentDTO>(iDbContext);
            //    var catExists = catRepository.Query()
            //        .Filter(bp => (bp.SubscriptionId == facilitySubscription.SubscriptionId &&
            //            bp.FacilityId == facilitySubscription.FacilityId)
            //            && bp.Id != facilitySubscription.Id)
            //        .Get()
            //        .FirstOrDefault();

            //    if (catExists != null)
            //        objectExists = true;
            //}
            //finally
            //{
            //    iDbContext.Dispose();
            //}

            return(objectExists);
        }
        public string InsertOrUpdate(MemberAssessmentDTO facilitySubscription)
        {
            try
            {
                var validate = Validate(facilitySubscription);
                if (!string.IsNullOrEmpty(validate))
                {
                    return(validate);
                }

                if (ObjectExists(facilitySubscription))
                {
                    return(GenericMessages.DatabaseErrorRecordAlreadyExists + Environment.NewLine +
                           "With the same Name Exists");
                }

                _facilitySubscriptionRepository.InsertUpdate(facilitySubscription);
                _unitOfWork.Commit();
                return(string.Empty);
            }
            catch (Exception exception)
            {
                return(exception.Message);
            }
        }
        public string Validate(MemberAssessmentDTO facilitySubscription)
        {
            if (null == facilitySubscription)
            {
                return(GenericMessages.ObjectIsNull);
            }

            //if (String.IsNullOrEmpty(facilitySubscription.PlateNumber))
            //    return facilitySubscription.PlateNumber + " " + GenericMessages.StringIsNullOrEmpty;

            return(string.Empty);
        }
        public string Disable(MemberAssessmentDTO facilitySubscription)
        {
            if (facilitySubscription == null)
            {
                return(GenericMessages.ObjectIsNull);
            }

            string stat;

            try
            {
                _facilitySubscriptionRepository.Update(facilitySubscription);
                _unitOfWork.Commit();
                stat = string.Empty;
            }
            catch (Exception exception)
            {
                stat = exception.Message;
            }
            return(stat);
        }
Example #5
0
        private void AddNewMemberAssessment()
        {
            decimal?height = null;

            if (MemberAssessments.Any())
            {
                var memberAssessmentDto = MemberAssessments.FirstOrDefault();
                if (memberAssessmentDto != null)
                {
                    height = memberAssessmentDto.Height;
                }
            }

            if (SelectedMember != null)
            {
                SelectedMemberAssessment = new MemberAssessmentDTO
                {
                    MemberId       = SelectedMember.Id,
                    AssessmentTime = DateTime.Now,
                    Height         = height
                }
            }
            ;
        }