コード例 #1
0
        public Response <QuickRegistrationModel> Add(QuickRegistrationModel contact)
        {
            var contactDemographicsParameters = BuildQuickRegistrationSpParams(contact);
            var contactDemographicsRepository = _unitOfWork.GetRepository <QuickRegistrationModel>(SchemaName.Registration);
            var spResults = contactDemographicsRepository.ExecuteNQStoredProc("usp_AddQuickRegistration", contactDemographicsParameters);

            if (spResults.ResultCode != 0)
            {
                return(spResults);
            }


            if (contact.Addresses.Count != 0)
            {
                foreach (ContactAddressModel ad in contact.Addresses)
                {
                    ad.ContactID = 1;//spResults.DataItems[0].ContactID;
                }
                var addressResults = _addressDataProvider.AddAddresses(1, contact.Addresses);

                if (addressResults.ResultCode != 0)
                {
                    spResults.ResultCode    = addressResults.ResultCode;
                    spResults.ResultMessage = addressResults.ResultMessage;
                    return(spResults);
                }
            }
            if (contact.Emails.Count != 0)
            {
                foreach (ContactEmailModel em in contact.Emails)
                {
                    em.ContactID = 1;//spResults.DataItems[0].ContactID;
                }
                var emailResults = _emailDataProvider.AddEmails(1, contact.Emails);

                if (emailResults.ResultCode != 0)
                {
                    spResults.ResultCode    = emailResults.ResultCode;
                    spResults.ResultMessage = emailResults.ResultMessage;
                    return(spResults);
                }
            }
            if (contact.Phones.Count != 0)
            {
                foreach (ContactPhoneModel ph in contact.Phones)
                {
                    ph.ContactID = 1; //spResults.DataItems[0].ContactID;
                }
                var phoneResults = _phoneDataProvider.AddPhones(1, contact.Phones);

                //if (phoneResults.ResultCode == 0) return spResults;
                if (phoneResults.ResultCode != 0)
                {
                    spResults.ResultCode    = phoneResults.ResultCode;
                    spResults.ResultMessage = phoneResults.ResultMessage;
                    return(spResults);
                }
            }
            return(spResults);
        }
コード例 #2
0
        private static List <SqlParameter> BuildQuickRegistrationSpParams(QuickRegistrationModel contact)
        {
            var spParameters = new List <SqlParameter>
            {
                new SqlParameter("RegistrationTypeID", (object)contact.RegistrationTypeID ?? DBNull.Value),
                new SqlParameter("First", (object)contact.First ?? DBNull.Value),
                new SqlParameter("Middle", (object)contact.Middle ?? DBNull.Value),
                new SqlParameter("Last", (object)contact.Last ?? DBNull.Value),
                new SqlParameter("DOB", (object)contact.DOB ?? DBNull.Value),
                new SqlParameter("Age", (object)contact.Age ?? DBNull.Value),
                new SqlParameter("AnnualIncome", (object)contact.AnnualIncome ?? DBNull.Value),
                new SqlParameter("FamilySize", (object)contact.FamilySize ?? DBNull.Value),
                new SqlParameter("GenderID", (object)contact.GenderID ?? DBNull.Value),
                new SqlParameter("SSN", (object)contact.SSN ?? DBNull.Value),
                new SqlParameter("MrnValue", (object)contact.MrnValue ?? DBNull.Value),
                new SqlParameter("MpiValue", (object)contact.MpiValue ?? DBNull.Value),
                new SqlParameter("ModifiedOn", contact.ModifiedOn ?? DateTime.Now)
            };

            return(spParameters);
        }
コード例 #3
0
 public IHttpActionResult AddQuickRegistration(QuickRegistrationModel contact)
 {
     return(new HttpResult <Response <QuickRegistrationModel> >(_quickRegistrationRuleEngine.AddQuickRegistration(contact), Request));
 }
コード例 #4
0
        public Response <QuickRegistrationModel> Add(QuickRegistrationModel patient)
        {
            const string apiUrl = BaseRoute + "Add";

            return(_communicationManager.Post <QuickRegistrationModel, Response <QuickRegistrationModel> >(patient, apiUrl));
        }
コード例 #5
0
 public Response <QuickRegistrationModel> AddQuickRegistration(QuickRegistrationModel patient)
 {
     return(quickRegistrationService.Add(patient));
 }
コード例 #6
0
 public IHttpActionResult Add(QuickRegistrationModel contact)
 {
     return(new HttpResult <Response <QuickRegistrationModel> >(_quickRegistrationDataProvider.Add(contact), Request));
 }