Esempio n. 1
0
        public bool UpdateFraminghamValue(long customerEventScreeningTestId, decimal framinghamValue)
        {
            var testReadingId = GetListOfTestReadingAndReadingId((int)TestType.Diabetes).Find(testReadingReadingPair =>
                                                                                              (testReadingReadingPair.
                                                                                               FirstValue ==
                                                                                               (int)
                                                                                               ReadingLabels.
                                                                                               FraminghamRisk)).SecondValue;
            var customerEventReadingEntity = new CustomerEventReadingEntity
            {
                Value         = framinghamValue.ToString(),
                TestReadingId = testReadingId,
                CustomerEventScreeningTestId =
                    customerEventScreeningTestId
            };

            using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                IRelationPredicateBucket bucket = new RelationPredicateBucket(CustomerEventReadingFields.TestReadingId == testReadingId);
                bucket.PredicateExpression.AddWithAnd(CustomerEventReadingFields.CustomerEventScreeningTestId ==
                                                      customerEventScreeningTestId);
                if (myAdapter.UpdateEntitiesDirectly(customerEventReadingEntity, bucket) == 0)
                {
                    throw new PersistenceFailureException();
                }
                return(true);
            }
        }
Esempio n. 2
0
        private bool MarkTask(long taskId, bool markActivity)
        {
            using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var  linqMetaData = new LinqMetaData(myAdapter);
                long taskStatusId;
                if (markActivity)
                {
                    taskStatusId = linqMetaData.TaskStatusTypes.Where(tastStatusType => tastStatusType.Name == "Completed").Select(p => p.TaskStatusId).FirstOrDefault();
                }
                else
                {
                    taskStatusId = linqMetaData.TaskStatusTypes.Where(tastStatusType => tastStatusType.Name == "In Progress").Select(p => p.TaskStatusId).FirstOrDefault();
                }

                IRelationPredicateBucket bucket = new RelationPredicateBucket(TaskDetailsFields.TaskId == taskId);
                var taskDetailsEntity           = new TaskDetailsEntity(taskId)
                {
                    DateModified = DateTime.Now, TaskStatusId = taskStatusId
                };

                if (myAdapter.UpdateEntitiesDirectly(taskDetailsEntity, bucket) == 0)
                {
                    throw new PersistenceFailureException();
                }
            }
            return(true);
        }
Esempio n. 3
0
        private bool MarkMeeting(long meetingId, bool markActivity)
        {
            using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var  linqMetaData = new LinqMetaData(myAdapter);
                long meetingStatusId;
                if (markActivity)
                {
                    meetingStatusId = linqMetaData.ContactCallStatus.Where(callStatus => callStatus.Status == "Held").Select(p => p.ContactCallStatusId).FirstOrDefault();
                }
                else
                {
                    meetingStatusId = linqMetaData.ContactCallStatus.Where(callStatus => callStatus.Status == "Planned").Select(p => p.ContactCallStatusId).FirstOrDefault();
                }

                IRelationPredicateBucket bucket = new RelationPredicateBucket(ContactMeetingFields.ContactMeetingId == meetingId);
                var contactMeetingEntity        = new ContactMeetingEntity(meetingId)
                {
                    DateModified = DateTime.Now, ContactMeetingStatusId = meetingStatusId
                };

                if (myAdapter.UpdateEntitiesDirectly(contactMeetingEntity, bucket) == 0)
                {
                    throw new PersistenceFailureException();
                }
            }
            return(true);
        }
        public bool UpdateHostPaymentTransactionByIdAndStatus(HostPaymentTransaction hostPaymentTransaction)
        {
            var hostPaymentTransactionEntity = _mapper.Map(hostPaymentTransaction);
            IRelationPredicateBucket bucket  =
                new RelationPredicateBucket(HostPaymentTransactionFields.HostPaymentId == hostPaymentTransaction.HostPaymentId);

            bucket.PredicateExpression.AddWithAnd(HostPaymentTransactionFields.TransactionType == hostPaymentTransaction.TransactionType);
            using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                return(myAdapter.UpdateEntitiesDirectly(hostPaymentTransactionEntity, bucket) > 0);
            }
        }
Esempio n. 5
0
        public bool UpdateNeedVerficationbyAddressIds(List <long> addressIds)
        {
            var address = new AddressEntity()
            {
                NeedVerification = true
            };
            IRelationPredicateBucket relationPredicateBucket = new RelationPredicateBucket(AddressFields.AddressId == addressIds);

            using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                return(myAdapter.UpdateEntitiesDirectly(address, relationPredicateBucket) > 0);
            }
        }
Esempio n. 6
0
        public bool UpdateHostTaxIdNumber(long hostId, string taxIdNumber)
        {
            var host = new ProspectsEntity(hostId)
            {
                TaxIdNumber = taxIdNumber
            };
            IRelationPredicateBucket relationPredicateBucket =
                new RelationPredicateBucket(ProspectsFields.ProspectId == hostId);

            using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                return(myAdapter.UpdateEntitiesDirectly(host, relationPredicateBucket) > 0);
            }
        }
        public bool ActiveDeActiveTemplate(long activityTemplateId, bool activeStatus)
        {
            var eventActivityTemplateEntity = new EventActivityTemplateEntity(activityTemplateId)
            {
                IsActive = activeStatus
            };
            IRelationPredicateBucket relationPredicateBucket =
                new RelationPredicateBucket(EventActivityTemplateFields.EventActivityTemplateId == activityTemplateId);

            using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                return(myAdapter.UpdateEntitiesDirectly(eventActivityTemplateEntity, relationPredicateBucket) > 0);
            }
        }
Esempio n. 8
0
        public bool UpdatePrintOrderItemStatus(long printOrderItemId, ItemStatus itemStatus)
        {
            var printOrderItemEntity = new MarketingPrintOrderItemEntity(printOrderItemId)
            {
                Status = (long)itemStatus
            };
            IRelationPredicateBucket relationPredicateBucket =
                new RelationPredicateBucket(MarketingPrintOrderItemFields.MarketingPrintOrderItemId == printOrderItemId);

            using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                return(myAdapter.UpdateEntitiesDirectly(printOrderItemEntity, relationPredicateBucket) > 0);
            }
        }
Esempio n. 9
0
        public bool UpdateAddressLatitudeAndLongitude(long addressId, string latitude, string longitude, long verificationOrganizationRoleUserId, bool useLatLogForMapping)
        {
            var hostAddress = new AddressEntity(addressId)
            {
                Latitude = latitude, Longitude = longitude, VerificationOrgRoleUserId = verificationOrganizationRoleUserId, UseLatLogForMapping = useLatLogForMapping
            };
            IRelationPredicateBucket relationPredicateBucket =
                new RelationPredicateBucket(AddressFields.AddressId == addressId);

            using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                return(myAdapter.UpdateEntitiesDirectly(hostAddress, relationPredicateBucket) > 0);
            }
        }
Esempio n. 10
0
        public bool UpdateHostPaymentStatusAndNotes(long hostPaymentId, decimal amount, int hostPaymentStatus)
        {
            var hostPayment = new HostPaymentEntity(hostPaymentId)
            {
                Status = hostPaymentStatus
            };
            IRelationPredicateBucket relationPredicateBucket =
                new RelationPredicateBucket(HostPaymentFields.HostPaymentId == hostPaymentId);

            using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                return(myAdapter.UpdateEntitiesDirectly(hostPayment, relationPredicateBucket) > 0);
            }
        }
Esempio n. 11
0
        public bool UpdateGoogleMapVerificatioStatus(long addressId, bool?isManuallyVerified, long verificationOrganizationRoleUserId)
        {
            var hostAddress = new AddressEntity(addressId)
            {
                IsManuallyVerified = isManuallyVerified, VerificationOrgRoleUserId = verificationOrganizationRoleUserId
            };
            IRelationPredicateBucket relationPredicateBucket =
                new RelationPredicateBucket(AddressFields.AddressId == addressId);

            using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                return(myAdapter.UpdateEntitiesDirectly(hostAddress, relationPredicateBucket) > 0);
            }
        }
Esempio n. 12
0
        private bool DeleteContactMeeting(long contactMeetingId)
        {
            using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                IRelationPredicateBucket bucket = new RelationPredicateBucket(ContactMeetingFields.ContactMeetingId == contactMeetingId);
                var contactMeetingEntity        = new ContactMeetingEntity(contactMeetingId)
                {
                    IsActive = false
                };

                if (myAdapter.UpdateEntitiesDirectly(contactMeetingEntity, bucket) == 0)
                {
                    throw new PersistenceFailureException();
                }
            }
            return(true);
        }
Esempio n. 13
0
        private bool DeleteTask(long taskId)
        {
            using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                IRelationPredicateBucket bucket = new RelationPredicateBucket(TaskDetailsFields.TaskId == taskId);
                var taskDetailsEntity           = new TaskDetailsEntity(taskId)
                {
                    IsActive = false
                };

                if (myAdapter.UpdateEntitiesDirectly(taskDetailsEntity, bucket) == 0)
                {
                    throw new PersistenceFailureException();
                }
            }
            return(true);
        }
Esempio n. 14
0
        public bool SetIsHostRatedFlagOn(long hostId, long eventId)
        {
            var hostEventDetail = new HostEventDetailsEntity()
            {
                IsHostRatedbyTechnician = true
            };

            IRelationPredicateBucket relationPredicateBucket =
                new RelationPredicateBucket(HostEventDetailsFields.HostId == hostId);

            relationPredicateBucket.PredicateExpression.AddWithAnd(HostEventDetailsFields.EventId == eventId);

            using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                return(myAdapter.UpdateEntitiesDirectly(hostEventDetail, relationPredicateBucket) > 0);
            }
        }
Esempio n. 15
0
        private bool SetIsCurrentForRoleFlagoffForRole(long roleId, long hostId)
        {
            var hostFacilityRanking = new HostFacilityRankingEntity()
            {
                IsCurrentForRole = false
            };

            IRelationPredicateBucket relationPredicateBucket =
                new RelationPredicateBucket(HostFacilityRankingFields.HostId == hostId);

            relationPredicateBucket.PredicateExpression.AddWithAnd(HostFacilityRankingFields.RankedByRole == roleId);

            using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                return(myAdapter.UpdateEntitiesDirectly(hostFacilityRanking, relationPredicateBucket) > 0);
            }
        }
Esempio n. 16
0
        public bool UpdateFraminghamValue(long customerEventScreeningTestId, decimal framinghamValue)
        {
            var testReadingId = GetListOfTestReadingAndReadingId((int)TestType.FraminghamRisk).Find(testReadingReadingPair =>
                                                                                                    (testReadingReadingPair.
                                                                                                     FirstValue ==
                                                                                                     (int)
                                                                                                     ReadingLabels.
                                                                                                     FraminghamRisk)).
                                SecondValue;
            var customerEventReadingEntity = new CustomerEventReadingEntity
            {
                Value         = framinghamValue.ToString(),
                TestReadingId = testReadingId,
                CustomerEventScreeningTestId =
                    customerEventScreeningTestId
            };

            using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var linqMetaData = new LinqMetaData(myAdapter);

                var framinghamCustomerReading = linqMetaData.CustomerEventReading.Where(customerEventReading => customerEventReading.CustomerEventScreeningTestId == customerEventScreeningTestId &&
                                                                                        customerEventReading.TestReadingId == testReadingId).SingleOrDefault();

                if (framinghamCustomerReading != null && framinghamCustomerReading.CustomerEventReadingId > 0)
                {
                    IRelationPredicateBucket bucket = new RelationPredicateBucket(CustomerEventReadingFields.TestReadingId == testReadingId);
                    bucket.PredicateExpression.AddWithAnd(CustomerEventReadingFields.CustomerEventScreeningTestId ==
                                                          customerEventScreeningTestId);

                    if (myAdapter.UpdateEntitiesDirectly(customerEventReadingEntity, bucket) == 0)
                    {
                        throw new PersistenceFailureException();
                    }
                }
                else
                {
                    if (!myAdapter.SaveEntity(customerEventReadingEntity))
                    {
                        throw new PersistenceFailureException();
                    }
                }
                return(true);
            }
        }
Esempio n. 17
0
 public bool UpdateUserName(long userLoginId, string userName)
 {
     using (IDataAccessAdapter adapter = PersistenceLayer.GetDataAccessAdapter())
     {
         var userLoginEntity = new UserLoginEntity(userLoginId)
         {
             UserName = userName
         };
         var bucket = new RelationPredicateBucket(UserLoginFields.UserLoginId == userLoginId);
         try
         {
             return((adapter.UpdateEntitiesDirectly(userLoginEntity, bucket) > 0) ? true : false);
         }
         catch (Exception exception)
         {
             throw new PersistenceFailureException(exception.Message);
         }
     }
 }
Esempio n. 18
0
 public void PublishTemplate(long templateId)
 {
     using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter())
     {
         var entity = new HafTemplateEntity()
         {
             IsPublished = true
         };
         var bucket = new RelationPredicateBucket(HafTemplateFields.HaftemplateId == (long)templateId);
         try
         {
             myAdapter.UpdateEntitiesDirectly(entity, bucket);
         }
         catch (Exception exception)
         {
             throw new PersistenceFailureException(exception.Message);
         }
     }
 }
Esempio n. 19
0
 public void UpdateDefaultStatus(HealthAssessmentTemplateType type)
 {
     using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter())
     {
         var entity = new HafTemplateEntity()
         {
             IsDefault = false
         };
         var bucket = new RelationPredicateBucket(HafTemplateFields.Type == (long)type);
         try
         {
             myAdapter.UpdateEntitiesDirectly(entity, bucket);
         }
         catch (Exception exception)
         {
             throw new PersistenceFailureException(exception.Message);
         }
     }
 }
Esempio n. 20
0
 public bool UpdateResetPasswordQueryString(long userLoginId, string resetPasswordQueryString)
 {
     using (IDataAccessAdapter adapter = PersistenceLayer.GetDataAccessAdapter())
     {
         var userLoginEntity = new UserLoginEntity(userLoginId)
         {
             ResetPwdQueryString = resetPasswordQueryString, UserVerified = false
         };
         var bucket = new RelationPredicateBucket(UserLoginFields.UserLoginId == userLoginId);
         try
         {
             return((adapter.UpdateEntitiesDirectly(userLoginEntity, bucket) > 0) ? true : false);
         }
         catch (Exception exception)
         {
             throw new PersistenceFailureException(exception.Message);
         }
     }
 }
Esempio n. 21
0
        public bool AssignUserLoginLock(long userId)
        {
            using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var userLoginEntity = new UserLoginEntity(userId)
                {
                    IsLocked = true, LastLoginAttemptAt = DateTime.Now, LoginAttempts = 1
                };

                var bucket = new RelationPredicateBucket(UserLoginFields.UserLoginId == userId);
                try
                {
                    return((myAdapter.UpdateEntitiesDirectly(userLoginEntity, bucket) > 0) ? true : false);
                }
                catch (Exception exception)
                {
                    throw new PersistenceFailureException(exception.Message);
                }
            }
        }
Esempio n. 22
0
        public void UpdateVan(Van van)
        {
            if (van == null)
            {
                throw new ArgumentNullException("van", "The given van cannot be null.");
            }

            _validator.ValidateAndThrow(van);

            VanDetailsEntity vanDetailsEntity = _mapper.Map(van);

            using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                IRelationPredicateBucket bucket = new RelationPredicateBucket(VanDetailsFields.VanId == van.Id);
                if (myAdapter.UpdateEntitiesDirectly(vanDetailsEntity, bucket) == 0)
                {
                    throw new PersistenceFailureException();
                }
            }
        }
Esempio n. 23
0
        public bool ForceUserToChangeQuestion(long userId)
        {
            using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var userLoginEntity = new UserLoginEntity(userId)
                {
                    IsSecurityQuestionVerified = false
                };

                var bucket = new RelationPredicateBucket(UserLoginFields.UserLoginId == userId);
                try
                {
                    return((myAdapter.UpdateEntitiesDirectly(userLoginEntity, bucket) > 0) ? true : false);
                }
                catch (Exception exception)
                {
                    throw new PersistenceFailureException(exception.Message);
                }
            }
        }
Esempio n. 24
0
        public bool UpdateHostImages(long hostId, List <HostImage> hostImages)
        {
            bool isSucceeded = false;

            hostImages.ForEach(hostImage =>
            {
                var hostImageEntity = new HostImageEntity()
                {
                    HostImageType = hostImage.ImageType.PersistenceLayerId
                };

                IRelationPredicateBucket relationPredicateBucket =
                    new RelationPredicateBucket(HostImageFields.HostId == hostId);

                relationPredicateBucket.PredicateExpression.AddWithAnd(HostImageFields.ImageId == hostImage.Id);

                using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter())
                {
                    isSucceeded = myAdapter.UpdateEntitiesDirectly(hostImageEntity, relationPredicateBucket) > 0;
                }
            });

            return(isSucceeded);
        }
Esempio n. 25
0
 protected void ExpectUpdateEntitiesDirectly(int numberOfEntitiesUpdated)
 {
     Expect.Call(_dataAccessAdapter.UpdateEntitiesDirectly(null, null)).IgnoreArguments()
     .Return(numberOfEntitiesUpdated);
 }