public bool UpdateProvider(provider UpdatedProvider) { var before = dbs.provider.FirstOrDefault(m => m.ProviderID == UpdatedProvider.ProviderID); var rowsAffected = dbs.Database.ExecuteSqlCommand("update [dbo].[provider] " + "set FirstName = '" + UpdatedProvider.FirstName + "', LastName = '" + UpdatedProvider.LastName + "', Phone = '" + UpdatedProvider.Phone + "', email = '" + UpdatedProvider.Email + "', Address = '" + UpdatedProvider.Address + "', City = '" + UpdatedProvider.City + "', State = '" + UpdatedProvider.State + "', Zip = '" + UpdatedProvider.Zip + "' WHERE [ProviderID]={0}", UpdatedProvider.ProviderID); return(rowsAffected > 0); }
private void UpdateBtn_Click(object sender, RoutedEventArgs e) { var UpdatedProvider = new provider(); UpdatedProvider.ProviderID = Convert.ToInt32(IDTextBox.Text); UpdatedProvider.FirstName = FirstNameTextbox.Text; UpdatedProvider.LastName = LastNameTextbox.Text; UpdatedProvider.Phone = PhoneTextBox.Text; UpdatedProvider.Email = EmailTextbox.Text; UpdatedProvider.Address = AddressTextBox.Text; UpdatedProvider.City = CityTextBox.Text; UpdatedProvider.State = StateTextBox.Text; UpdatedProvider.Zip = ZipTextBox.Text; if (_providerFuncs.UpdateProvider(UpdatedProvider)) { MessageBox.Show("Provider Updated."); this.Close(); } else { MessageBox.Show("Error Updating Provider."); } }
public bool DeleteProvider(provider provider) { var rowsAffected = dbs.Database.ExecuteSqlCommand("DELETE FROM [dbo].[provider] WHERE [ProviderID]={0}", provider.ProviderID); return(rowsAffected > 0); }
public bool InsertProvider(provider newProvider) { dbs.provider.Add(newProvider); return(dbs.SaveChanges() > 0); }
private double?GetAPPeriodConsulationsPerProvider(provider singleProvider) { return(dbs.bill_info.Where(m => m.ServiceDate <= today && m.ServiceDate >= lastWeek && m.ProviderID == singleProvider.ProviderID).Count()); }
private double?GetAPPeriodBillingPerProvider(provider singleProvider) { return(dbs.bill_info.Where(m => m.ServiceDate <= today && m.ServiceDate >= lastWeek && m.ProviderID == singleProvider.ProviderID).Sum(m => m.service.ServiceCost)); }
private List <bill_info> GetAPPeriodkBill_infoByProvider(provider singleProvider) { return(dbs.bill_info.Where(m => m.ServiceDate <= today && m.ServiceDate >= lastWeek && m.ProviderID == singleProvider.ProviderID) .ToList()); }
private void Button_Click(object sender, RoutedEventArgs e) { //Check the fields if (string.IsNullOrEmpty(FirstNameTextbox.Text)) { FirstNameTextbox.BorderBrush = System.Windows.Media.Brushes.Red; return; } if (string.IsNullOrEmpty(LastNameTextbox.Text)) { LastNameTextbox.BorderBrush = System.Windows.Media.Brushes.Red; return; } if (string.IsNullOrEmpty(PhoneTextBox.Text)) { PhoneTextBox.BorderBrush = System.Windows.Media.Brushes.Red; return; } if (string.IsNullOrEmpty(EmailTextbox.Text)) { EmailTextbox.BorderBrush = System.Windows.Media.Brushes.Red; return; } if (string.IsNullOrEmpty(AddressTextBox.Text)) { AddressTextBox.BorderBrush = System.Windows.Media.Brushes.Red; return; } if (string.IsNullOrEmpty(CityTextBox.Text)) { CityTextBox.BorderBrush = System.Windows.Media.Brushes.Red; return; } if (string.IsNullOrEmpty(StateTextBox.Text)) { StateTextBox.BorderBrush = System.Windows.Media.Brushes.Red; return; } if (string.IsNullOrEmpty(ZipTextBox.Text)) { ZipTextBox.BorderBrush = System.Windows.Media.Brushes.Red; return; } //Create provider entity var newProvider = new provider(); newProvider.FirstName = FirstNameTextbox.Text; newProvider.LastName = LastNameTextbox.Text; newProvider.Phone = PhoneTextBox.Text; newProvider.Email = EmailTextbox.Text; newProvider.Address = AddressTextBox.Text; newProvider.City = CityTextBox.Text; newProvider.State = StateTextBox.Text; newProvider.Zip = ZipTextBox.Text; //Add The member to the database if (providerFuncs.InsertProvider(newProvider)) { MessageBox.Show("Provider Created."); this.Close(); } else { MessageBox.Show("Error Creating Provider."); } }