static void Application_ApplicationExit(object sender, EventArgs e) { try { if (ActiveUser.UserObject != null) { ActiveUser.LogAction(ActiveUser.ActionTypes.Logout); ActiveUser.UserObject.Logout(); ActiveUser.UserObject = null; } } catch { } try { if (Properties.Settings.Default.OpenedExclusive) { system_options.SetImportFlag(false); Properties.Settings.Default.OpenedExclusive = false; } } catch { } }
public void Save() { CurrentCall.AddClaim(LinkedClaim); if ((chkSetRevisitDate.Checked) || (cmbStatus.SelectedIndex > -1)) { DateTime? newRevisit = null; claim_status newStatus; if (chkSetRevisitDate.Checked) { newRevisit = ctlRevisitDate.CurrentDate; } else { newRevisit = null; } if (cmbStatus.SelectedIndex > -1) { newStatus = (claim_status)cmbStatus.SelectedItem; } else if (LinkedClaim.status_id > 0) { newStatus = LinkedClaim.LinkedStatus; } else { newStatus = null; } LinkedClaim.SetStatusAndRevisitDate(newStatus, newRevisit); } ActiveUser.LogAction(ActiveUser.ActionTypes.ChangeClaimMultiClaim, LinkedClaim.id, ""); }
private void cmdLogin_Click(object sender, EventArgs e) { try { if (system_options.ImportFlag) { if (MessageBox.Show(this, "The system is currently locked by an administrator. It is recommended that you " + "wait until this update is complete before logging in to the system.\n\nWould you like to wait until " + "this update is complete?", "Update in progress", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { return; } } user currentUser = ValidateLogin(); if (currentUser != null) { ActiveUser.UserObject = currentUser; if (chkOpenExclusive.Checked) { if (currentUser.is_admin) { if (ActiveUser.UserObject.LoggedInUsers.Count > 0) { string userList = string.Empty; foreach (user aUser in ActiveUser.UserObject.LoggedInUsers) { if (aUser.id != ActiveUser.UserObject.id) { userList += aUser.username + "\n"; } } if (MessageBox.Show(this, "The following users are currently logged in to the system.\n\n" + userList + "\nIf you continue, they might " + "have problems with any claims they currently have open. Would you like to continue anyway?", "Continue with import?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return; } } system_options.SetImportFlag(true); } else { MessageBox.Show(this, "You cannot open the program exclusively if you are not an administrator."); } } DialogResult = DialogResult.OK; ActiveUser.UserObject.Login(); if (chkOpenExclusive.Checked) { ActiveUser.LogAction(ActiveUser.ActionTypes.Login, "Exclusive"); } else { ActiveUser.LogAction(ActiveUser.ActionTypes.Login); } C_DentalClaimTracker.Properties.Settings.Default.LastUserName = ActiveUser.UserObject.username; C_DentalClaimTracker.Properties.Settings.Default.Save(); Close(); mdiMain.Instance().HideAdminMenu(); } else { LoggingHelper.Log("An invalid login was detected. User name: " + txtUserName.Text, LogSeverity.Information); MessageBox.Show(this, "Incorrect login.", "Incorrect login"); } } catch (Exception err) { LoggingHelper.Log(err); string errorInfo = err.Message; Exception inner = err.InnerException; while (inner != null) { errorInfo += "\n\n" + inner.Message; inner = inner.InnerException; } if (MessageBox.Show(this, "There was an error connecting to the server to validate login information. Would you like to edit " + "the current server settings?\n\nError:" + errorInfo, "No database connection", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes) { frmSettings toShow = new frmSettings(true); toShow.ShowDialog(this); } } }
/// <summary> /// Sets a new status and revisit date for the claim, and creates a status change history if the /// status changes. Pass a null object for either value to be ignored, pass an empty newDate to /// set the revisit date to "not set". If the revisit date and the status are unchanged, then nothing /// happens. /// </summary> /// <param name="p"></param> /// <param name="p_2"></param> internal void SetStatusAndRevisitDate(claim_status newStatus, DateTime?newDate) { string noteText = ""; claim_status cs = LinkedStatus; bool changesMade = false; DateTime? actualDateValue = newDate; if (newDate != null) { if (revisit_date != newDate) { if (revisit_date.HasValue) { noteText = "Revisit from '" + revisit_date.Value.ToShortDateString() + "' to "; } else { noteText = "Revisit from {empty} to '"; } if (newDate.HasValue) { noteText += "'" + newDate.Value.ToShortDateString() + "'"; } else { noteText += "{empty}"; } changesMade = true; } } else { actualDateValue = revisit_date; // This extra complication is because if they pass null, they're not setting it to null. We want to keep the // old value and when logging the change history we'll need to mark it as such } if (newStatus != null) { if (newStatus.id != status_id) { if (cs == null) { noteText += " Status from {empty} to '"; } else { noteText += " Status from '" + cs.name + "' to '"; } noteText += newStatus.name + "'"; changesMade = true; } } if (changesMade) { revisit_date = actualDateValue; status_last_date = DateTime.Now; status_last_user_id = ActiveUser.UserObject.id; CreateStatusHistory(newStatus, actualDateValue, false); if (newStatus != null) { status_id = newStatus.id; } Save(); ActiveUser.LogAction(ActiveUser.ActionTypes.ChangeStatus, id, noteText); } }
public void TerminateCall() { if (CurrentCall != null) { ngDisplay.SaveNote(); CurrentCall.OnHoldSeconds = System.Convert.ToInt32(holdTime.TotalSeconds); CurrentCall.DurationSeconds = System.Convert.ToInt32(callTime.TotalSeconds); CurrentCall.talked_to_human = chkTalkedWithPerson.Checked; if (ctlStatusHandler._category != null) { CurrentCall.call_status = ctlStatusHandler._category.id; } CurrentCall.Save(); /* Additional data tabs not currently on this form * // Remove any additional info tabs that might still have information * * foreach (VerifyDataViewer vdv in additionalDataTabs) * { * if (!tbcNewCallData.TabPages.Contains(vdv)) * { * foreach (choice aChoice in vdv.DataViewer.Choices) * { * aChoice.Delete(); * } * } * } */ ActiveUser.LogAction(ActiveUser.ActionTypes.EndCall, LinkedClaim.id, CurrentCall.id, ""); } ShowNewCallControls(true, true); CurrentCall = null; ctlDataVerification.Initialize(); mainQuestionViewer.ClearAllCategories(); /* Additional data tabs not currently on this form * additionalDataTabs.Clear(); */ callTimer.Stop(); onHold = false; UpdateHoldTimerLabel(); /* Additional data tabs not currently on this form * foreach (TabPage aTab in tbcNewCallData.TabPages) * { * if (aTab is VerifyDataViewer) * { * tbcNewCallData.TabPages.Remove(aTab); * aTab.Dispose(); * } * } */ Minimize(); lblHoldTime.Text = "0:00:00"; lblCallTime.Text = "0:00:00"; }