public bool RemoveParticipatingProvider(ParticipatingProvider participatingProvider) { try { using (IDbConnection db = new SqlConnection(ConfigurationValues.FaxSignedNotesConnection)) { try { const string query = "delete from [CareProvider]" + " where id = @id"; int rowsAffectd = db.Execute(query, new { @id = participatingProvider.ID }); UpdateRemoveParticipatingProvider(participatingProvider); return true; } catch (Exception er) { string s1 = er.ToString(); return false; //Log.LogMessage(er.ToString()); } } } catch (Exception er) { //EmployeeDesktop.API.Exceptions.ExceptionHandling.InsertErrorMessage(er.ToString()); //EmployeeDesktop.API.Exceptions.ExceptionHandling.SendErrorEmail(er.ToString(), ConfigurationValues.EmailFromFriendly, ConfigurationValues.EmailSendToFriendly, ConfigurationValues.EmailSubject); return false; } }
public bool AddParticipatingProvider(ParticipatingProvider participatingProvider) { if (CheckToSeeIfProviderHasAlreadyBeenAdded(participatingProvider) != true) { try { using (IDbConnection db = new SqlConnection(ConfigurationValues.FaxSignedNotesConnection)) { try { const string query = "INSERT INTO [dbo].[CareProvider]" + "(" + " [FirstName]" + " ,[LastName]" + " ,[ProviderName]" + " ,[GreenwayID]" + " ,[CareProviderID]" + " ,[UserID]" + " ,[Enabled]" + ")" + "VALUES" + "(" + " @FirstName,@LastName,@ProviderName,@GreenwayID,@CareProviderID,@UserID,@Enabled" + ")"; int rowsAffectd = db.Execute(query, new { @FirstName = participatingProvider.FirstName, @LastName = participatingProvider.LastName, @ProviderName = participatingProvider.ProviderName, @GreenwayID = participatingProvider.GreenwayID, @CareProviderID = participatingProvider.CareProviderID, @UserID = participatingProvider.UserID, @Enabled = participatingProvider.Enabled }); UpdateParticipatingProvider(participatingProvider); return true; } catch (Exception er) { string s1 = er.ToString(); return false; //Log.LogMessage(er.ToString()); } } } catch (Exception er) { //EmployeeDesktop.API.Exceptions.ExceptionHandling.InsertErrorMessage(er.ToString()); //EmployeeDesktop.API.Exceptions.ExceptionHandling.SendErrorEmail(er.ToString(), ConfigurationValues.EmailFromFriendly, ConfigurationValues.EmailSendToFriendly, ConfigurationValues.EmailSubject); return false; } } else { return true; } }
private bool UpdateParticipatingProvider(ParticipatingProvider participatingProvider) { try { using (IDbConnection db = new SqlConnection(ConfigurationValues.FaxSignedNotesConnection)) { try { const string query = "UPDATE [ProviderList]" + " SET [UseAutoMatedNotes] = 'T'" + " where userid = @userid"; int rowsAffectd = db.Execute(query, new { @userid = participatingProvider.GreenwayID }); return true; } catch (Exception er) { string s1 = er.ToString(); return false; //Log.LogMessage(er.ToString()); } } } catch (Exception er) { //EmployeeDesktop.API.Exceptions.ExceptionHandling.InsertErrorMessage(er.ToString()); //EmployeeDesktop.API.Exceptions.ExceptionHandling.SendErrorEmail(er.ToString(), ConfigurationValues.EmailFromFriendly, ConfigurationValues.EmailSendToFriendly, ConfigurationValues.EmailSubject); return false; } }
private bool CheckToSeeIfProviderHasAlreadyBeenAdded(ParticipatingProvider participatingProvider) { int count = 0; try { using (IDbConnection db = new SqlConnection(ConfigurationValues.FaxSignedNotesConnection)) { const string query = "SELECT count(GreenwayID)" + " FROM [CareProvider]" + " where [CareProviderID] = @CareProviderID"; count = db.Query<int>(query, new { @CareProviderID = participatingProvider.CareProviderID }).Single(); if (count > 0) { return true; } else { return false; } } } catch (Exception er) { return false; } }
// DELETE: api/ParticipatingProvider/5 public void Delete(ParticipatingProvider participatingProvider) { ProviderData providerData = new ProviderData(); providerData.RemoveParticipatingProvider(participatingProvider); string s1 = participatingProvider.LastName; }