public void InsertFormsConsoleRecord(AppointmentInfo appointmentInfo) { OperationResult operationResult = new Models.OperationResult(); if (CheckToSeeIfRecordIsPresent(appointmentInfo.AppointmentId) == false) { if (appointmentInfo.DateOfBirth == "1/1/0001 12:00:00 AM") { appointmentInfo.DateOfBirth = string.Empty; } using (IDbConnection db = new SqlConnection(ConfigurationValues.FormsConsoleConnection)) { try { const string query = "INSERT INTO [FormsConsoleData]" + " (" + " [PersonApptDate]" + " ,[PersonApptTime]" + " ,[PersonResource]" + " ,[PersonAppointmentId]" + " ,[PersonResourceID]" + " ,[PersonLocationName]" + " ,[PersonPatientID]" + " ,[PersonTypeAbbreviation]" + " ,[PersonTypeAlternateName]" + " ,[PersonStatus]" + " ,[PersonChiefComplaint]" + " ,[PersonType]" + " ,[PersonFirstName]" + " ,[PersonMiddleName1]" + " ,[PersonLastName]" + " ,[PersonGender]" + " ,[PersonDateOfBirth]" + " ,[PersonCellPhone1]" + " ,[PersonPrimaryPhone]" + " ,[PersonPrimaryWorkPhone]" + " ,[PersonAddressLine1]" + " ,[PersonAddressLine2]" + " ,[PersonAddressCity]" + " ,[PersonAddressState]" + " ,[PersonAddressPostalCode]" + " ,[PersonAddressCounty]" + " ,[AltPatientID]" + " ,[Occupation]" + " ,[wcAddressLine1]" + " ,[wcAddressLine2]" + " ,[wcCity]" + " ,[wcCounty]" + " ,[wcEmployerID]" + " ,[wcFax]" + " ,[wcName]" + " ,[wcPhone]" + " ,[wcPostalCode]" + " ,[wcState]" + " ,[LastModifiedDate]" + " ,[CreateDate]" + " )" + " VALUES" + " (" + " @PersonApptDate,@PersonApptTime,@PersonResource,@PersonAppointmentId,@PersonResourceID,@PersonLocationName" + " ,@PersonPatientID,@PersonTypeAbbreviation,@PersonTypeAlternateName,@PersonStatus,@PersonChiefComplaint" + " ,@PersonType,@PersonFirstName,@PersonMiddleName1,@PersonLastName,@PersonGender,@PersonDateOfBirth" + " ,@PersonCellPhone1,@PersonPrimaryPhone,@PersonPrimaryWorkPhone,@PersonAddressLine1" + " ,@PersonAddressLine2,@PersonAddressCity,@PersonAddressState,@PersonAddressPostalCode,@PersonAddressCounty,@AltPatientID,@Occupation" + " ,@wcAddressLine1,@wcAddressLine2,@wcCity,@wcCounty,@wcEmployerID,@wcFax,@wcName,@wcPhone,@wcPostalCode,@wcState,@LastModifiedDate,@CreateDate" + ")"; int rowsAffectd = db.Execute(query, new { @PersonApptDate = appointmentInfo.AppointmentDate.ToShortDateString(), @PersonApptTime = appointmentInfo.AppointmentTime.ToShortTimeString(), @PersonResource = appointmentInfo.Resource, @PersonAppointmentId = appointmentInfo.AppointmentId, @PersonResourceID = appointmentInfo.ResourceId, @PersonLocationName = appointmentInfo.LocationName, @PersonPatientID = appointmentInfo.PatientID, @PersonTypeAbbreviation = appointmentInfo.TypeAbbreviation, @PersonTypeAlternateName = appointmentInfo.TypeAlternateName, @PersonStatus = appointmentInfo.Status, @PersonChiefComplaint = appointmentInfo.ChiefComplaint, @PersonType = appointmentInfo.Type, @PersonFirstName = appointmentInfo.FirstName, @PersonMiddleName1 = appointmentInfo.MiddleName1, @PersonLastName = appointmentInfo.LastName, @PersonDateOfBirth = appointmentInfo.DateOfBirth, @PersonGender = appointmentInfo.Gender, @PersonCellPhone1 = appointmentInfo.CellPhone1, @PersonPrimaryPhone = appointmentInfo.PrimaryPhone, @PersonPrimaryWorkPhone = appointmentInfo.PrimaryWorkPhone, @PersonAddressLine1 = appointmentInfo.AddressLine1, @PersonAddressLine2 = appointmentInfo.AddressLine2, @PersonAddressCity = appointmentInfo.City, @PersonAddressState = appointmentInfo.State, @PersonAddressPostalCode = appointmentInfo.PostalCode, @PersonAddressCounty = appointmentInfo.County, @AltPatientID = appointmentInfo.AltPatientID, @Occupation = appointmentInfo.Occupation, @wcAddressLine1 = appointmentInfo.wcAddressLine1, @wcAddressLine2 = appointmentInfo.wcAddressLine2, @wcCity = appointmentInfo.wcCity, @wcCounty = appointmentInfo.wcCounty, @wcEmployerID = appointmentInfo.wcEmployerID, @wcFax = appointmentInfo.wcFax, @wcName = appointmentInfo.wcName, @wcPhone = appointmentInfo.wcPhone, @wcPostalCode = appointmentInfo.wcPostalCode, @wcState = appointmentInfo.wcState, @LastModifiedDate = DateTime.Now, @CreateDate = appointmentInfo.DateCreated }); //operationResult.Success = true; } catch (Exception er) { Utility.LogErrors(ConfigurationValues.ErrorLogPath, er.ToString()); } } } }
private void CheckForGlobalPostOpData(AppointmentInfo appointmentInfo) { List<GlobalPostOp> globalPostOp = new List<GlobalPostOp>(); globalPostOp = consoleDataRepository.GetGlobalPostOpData(appointmentInfo.PatientID); for (int i = 0; i < globalPostOp.Count; i++) { if (consoleDataRepository.CheckForPreviousGlobalPostOp(globalPostOp[i]) == false) { if (consoleDataRepository.IsProvider(appointmentInfo.CareProviderId)) { if (consoleDataRepository.CheckForGlobalPostOpDataDuplicates(globalPostOp[i]) == false) { consoleDataRepository.InsertGlobalPostOp(globalPostOp[i]); } } } } }