public EditProviderForm(Provider provider, AllProviders allProviders) : this() { this._provider = provider; this._allAllProviders = allProviders; if (this._provider.providerID <= 0) { this._mode = Mode.Add; } else { this._mode = Mode.Edit; } }
private void button2_Click(object sender, EventArgs e) { Provider p = new Provider(); p.firstName = SessionManager.Instance.ActiveUser.userFirstName; p.lastName = SessionManager.Instance.ActiveUser.userLastName; p.fullName = SessionManager.Instance.ActiveUser.userFullName; p.displayName = SessionManager.Instance.ActiveUser.userFullName; p.isApptProvider = "Yes"; HraModelChangedEventArgs args = new HraModelChangedEventArgs(null); p.BackgroundPersistWork(args); SessionManager.Instance.ActiveUser.User_hraProviderID = p.providerID; args.Persist = false; SessionManager.Instance.MetaData.ApptProviders.AddToList(p, args); this.Close(); }
private void SaveProvider(CoolTextBox providerEntryControl, Func<Provider, bool> providerTypeSelectorExpression, bool pcp, bool refPhys) { //always do this ProviderList providersForThisAppt = this._patient.Providers; providersForThisAppt.RemoveAll(providerTypeSelectorExpression); //break out if they set it empty string providerName = providerEntryControl.Text; int? providerId = (int?)providerEntryControl.Value; if (string.IsNullOrEmpty(providerName)) { return; } Provider selectedProvider; if (providerId.HasValue) { selectedProvider = _allProviders.Single(provider => provider.providerID == providerId); } else { //if it's a new provider, instantiate it selectedProvider = new Provider { displayName = providerName }; this._allProviders.AddToList(selectedProvider, new HraModelChangedEventArgs(null)); } selectedProvider.PCP = pcp; selectedProvider.refPhys = refPhys; //add to patient record this._patient.Providers.Add(selectedProvider); this._patient.Providers.PersistFullList(new HraModelChangedEventArgs(this)); }
private bool EditProvider(int? id, string providerName, out Provider modified) { modified = null; if (string.IsNullOrEmpty(providerName)) { MessageBox.Show(NoProviderSelected); return false; } else { if (id.HasValue) { modified = _allProviders .SingleOrDefault(p => p.providerID == id); } else { modified = new Provider(providerName); } EditProviderForm editProviderForm = new EditProviderForm(modified, this._allProviders); DialogResult result = editProviderForm.ShowDialog(this); if (result == DialogResult.OK) { return true; } else return false; } }