/* * ///<summary>This button won't even be visible unless there is an email to view.</summary> * private void butEmail_Click(object sender, System.EventArgs e) { * EmailMessage message=EmailMessages.Refresh(CommlogCur.EmailMessageNum); * //If a date is entered, user will not be able to click Send * FormEmailMessageEdit FormE=new FormEmailMessageEdit(message); * FormE.ShowDialog(); * CommlogCur=Commlogs.GetOne(CommlogCur.CommlogNum); * }*/ private void butOK_Click(object sender, System.EventArgs e) { if (textDateTime.Text == "" //|| textAmount.errorProvider1.GetError(textAmount)!="" ) { MessageBox.Show(Lan.g(this, "Please enter a date first.")); return; } try{ DateTime.Parse(textDateTime.Text); } catch { MessageBox.Show(Lan.g(this, "Date and time invalid.")); return; } CommlogCur.CommDateTime = PIn.PDateT(textDateTime.Text); //there will always be a commtype selected. CommlogCur.CommType = (CommItemType)(listType.SelectedIndex + 1); CommlogCur.Mode_ = (CommItemMode)listMode.SelectedIndex; CommlogCur.SentOrReceived = (CommSentOrReceived)listSentOrReceived.SelectedIndex; CommlogCur.Note = textNote.Text; if (IsNew) { Commlogs.Insert(CommlogCur); } else { Commlogs.Update(CommlogCur); //SecurityLogs.MakeLogEntry("Adjustment Edit",Adjustments.cmd.CommandText); } DialogResult = DialogResult.OK; }
///<summary>Returns true if the commlog was able to save to the database. Otherwise returns false. ///Set showMsg to true to show a meaningful message when the commlog cannot be saved.</summary> public bool SaveCommItem(bool showMsg) { Commlog commlog; if (!_view.TryGetCommItem(showMsg, out commlog)) { return(false); } if (IsNew || IsPersistent) { _view.SetCommlogNum(Commlogs.Insert(commlog)); SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, commlog.PatNum, "Insert"); //Post insert persistent user preferences. if (IsPersistent) { if (_userOdPrefClearNote == null || PIn.Bool(_userOdPrefClearNote.ValueString)) { _view.ClearNote(); } if (_userOdPrefEndDate == null || PIn.Bool(_userOdPrefEndDate.ValueString)) { _view.ClearDateTimeEnd(); } ODException.SwallowAnyException(() => { FormOpenDental.S_RefreshCurrentModule(); }); } } else { Commlogs.Update(commlog); SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, commlog.PatNum, ""); } return(true); }
private void butOK_Click(object sender, System.EventArgs e) { //button not enabled if no permission if (textDateTime.Text == "") { MsgBox.Show(this, "Please enter a date first."); return; } try{ DateTime.Parse(textDateTime.Text); } catch { MsgBox.Show(this, "Date / Time invalid."); return; } if (textDateTimeEnd.Text != "") { try { DateTime.Parse(textDateTimeEnd.Text); } catch { MsgBox.Show(this, "End date and time invalid."); return; } CommlogCur.DateTimeEnd = PIn.DateT(textDateTimeEnd.Text); } CommlogCur.CommDateTime = PIn.DateT(textDateTime.Text); //there may not be a commtype selected. if (listType.SelectedIndex == -1) { CommlogCur.CommType = 0; } else { CommlogCur.CommType = DefC.Short[(int)DefCat.CommLogTypes][listType.SelectedIndex].DefNum; } CommlogCur.Mode_ = (CommItemMode)listMode.SelectedIndex; CommlogCur.SentOrReceived = (CommSentOrReceived)listSentOrReceived.SelectedIndex; CommlogCur.Note = textNote.Text; try { SaveSignature(); } catch (Exception ex) { MessageBox.Show(Lan.g(this, "Error saving signature.") + "\r\n" + ex.Message); return; } if (IsNew) { Commlogs.Insert(CommlogCur); SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, CommlogCur.PatNum, "Insert"); } else { Commlogs.Update(CommlogCur); SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, CommlogCur.PatNum, ""); } DialogResult = DialogResult.OK; }
public void AutoSaveCommItem(Commlog commlog) { if (IsNew) { //Insert _view.SetCommlogNum(Commlogs.Insert(commlog)); SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, commlog.PatNum, "Autosave Insert"); IsNew = false; } else { //Update Commlogs.Update(commlog); } }
private void AutoSaveCommItem() { if (_commlogOld.IsNew) { //Insert Commlogs.Insert(_commlogCur); textCommlogNum.Text = this._commlogCur.CommlogNum.ToString(); SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, _commlogCur.PatNum, "Autosave Insert"); _commlogCur.IsNew = false; } else { //Update Commlogs.Update(_commlogCur); } _commlogOld = _commlogCur.Copy(); }
private void butOK_Click(object sender, System.EventArgs e) { if (textDateTime.Text == "" //|| textAmount.errorProvider1.GetError(textAmount)!="" ) { MessageBox.Show(Lan.g(this, "Please enter a date first.")); return; } try{ DateTime.Parse(textDateTime.Text); } catch { MessageBox.Show(Lan.g(this, "Date and time invalid.")); return; } if (!checkIsStatementSent.Checked && listType.SelectedIndex == -1) { MsgBox.Show(this, "Please select a type."); return; } CommlogCur.CommDateTime = PIn.PDateT(textDateTime.Text); //there may not be a commtype selected. if (listType.SelectedIndex == -1) { CommlogCur.CommType = 0; } else { CommlogCur.CommType = DefB.Short[(int)DefCat.CommLogTypes][listType.SelectedIndex].DefNum; } CommlogCur.Mode_ = (CommItemMode)listMode.SelectedIndex; CommlogCur.SentOrReceived = (CommSentOrReceived)listSentOrReceived.SelectedIndex; CommlogCur.Note = textNote.Text; CommlogCur.IsStatementSent = checkIsStatementSent.Checked; if (IsNew) { Commlogs.Insert(CommlogCur); } else { Commlogs.Update(CommlogCur); //SecurityLogs.MakeLogEntry("Adjustment Edit",Adjustments.cmd.CommandText); } DialogResult = DialogResult.OK; }
///<summary>Returns true if the commlog was able to save to the database. Otherwise returns false. ///Set showMsg to true to show a meaningful message when the commlog cannot be saved.</summary> private bool SaveCommItem(bool showMsg) { if (!SyncCommlogWithUI(showMsg)) { return(false); } if (_isPersistent && string.IsNullOrWhiteSpace(_commlogCur.Note)) //in persistent mode, we don't want to save empty commlogs { return(false); } if (_commlogOld.IsNew || _isPersistent) { Commlogs.Insert(_commlogCur); _commlogCur.IsNew = false; _commlogOld = _commlogCur.Copy(); textCommlogNum.Text = _commlogCur.CommlogNum.ToString(); SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, _commlogCur.PatNum, "Insert"); //Post insert persistent user preferences. if (_isPersistent) { if (_userOdPrefClearNote == null || PIn.Bool(_userOdPrefClearNote.ValueString)) { ClearNote(); } if (_userOdPrefEndDate == null || PIn.Bool(_userOdPrefEndDate.ValueString)) { ClearDateTimeEnd(); } ODException.SwallowAnyException(() => { FormOpenDental.S_RefreshCurrentModule(); }); } } else { Commlogs.Update(_commlogCur); SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, _commlogCur.PatNum, ""); } return(true); }