static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ApplicationExit += new EventHandler(Application_ApplicationExit);
            // Set things up.
            // Globals.Settings = (EClaimsSettings)Utilities.DeserializeFromFile(typeof(EClaimsSettings), SettingsManager.Instance.Settings["EClaims"].ConfigurationFile);
            // log4net.Config.DOMConfigurator.ConfigureAndWatch(new System.IO.FileInfo(SettingsManager.Instance.Settings["EClaims"].LogConfigurationFile));

            // Run the application.
            try
            {
                Application.Run(frmStartScreenWPFContainer.Instance());
            }
            catch (Exception ex)
            {
                LoggingHelper.Log("Unhandled exception occurred somewhere in the application.", LogSeverity.Error, ex, false);
                MessageBox.Show("There was an unhandled problem in the application. Please report the following error to an administrator. You may need to restart Claim Tracker\n\n" + ex.Message,
                                "Unexpected error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                try
                {
                    if (ActiveUser.UserObject != null)
                    {
                        ActiveUser.LogAction(ActiveUser.ActionTypes.Logout);
                        ActiveUser.UserObject.Logout();
                        ActiveUser.UserObject = null;
                    }
                }
                catch { }
            }
        }
 private void StartCall()
 {
     FormCall = GetNewCall();
     ActiveUser.LogAction(ActiveUser.ActionTypes.StartMultiClaimCall, 0, FormCall.id, "");
     callTime = new TimeSpan(0);
     callTimer.Start();
 }
        private void InitializeNewCall()
        {
            CurrentCall               = new call();
            CurrentCall.created_on    = DateTime.Now;
            CurrentCall.claim_id      = LinkedClaim.id;
            CurrentCall.OnHoldSeconds = 0;
            CurrentCall.operatordata  = ActiveUser.UserObject.username;
            CurrentCall.updated_on    = DateTime.Now;
            CurrentCall.StartTime     = DateTime.Now;
            CurrentCall.parent_id     = 0;
            CurrentCall.Save();
            ctlStatusHandler.Initialize(LinkedClaim.company_id);

            mainQuestionViewer.CurrentCall = CurrentCall;
            ngDisplay.CurrentCall          = CurrentCall;
            ActiveUser.LogAction(ActiveUser.ActionTypes.StartCall, LinkedClaim.id, CurrentCall.id, LinkedClaim.PatientName);

            callTime = new TimeSpan();
            callTimer.Start();
            lblCallTime.Visible        = true;
            ctlStatusHandler._category = null;

            ctlDataVerification.Initialize();

            if (CallStarted != null)
            {
                CallStarted(this, new EventArgs());
            }
        }
 private void EndCall()
 {
     callTimer.Stop();
     EndAllActiveCalls();
     ActiveUser.LogAction(ActiveUser.ActionTypes.EndMultiClaimCall, 0, FormCall.id, "");
     FormCall.DurationSeconds = Convert.ToInt32(callTime.TotalSeconds);
     FormCall.Save();
 }
        public void SaveNote()
        {
            if ((editNote != null) && (rtbNote.Text != ""))
            {
                bool isNew = (!editNote.created_on.HasValue);
                editNote.Note = rtbNote.Text.Trim();
                if ((editNote.CallId == 0) && (CurrentCall != null))
                {
                    editNote.CallId = CurrentCall.id;
                }
                else
                {
                    editNote.CallId = 0;
                }

                if ((editNote.claim_id == 0) && (CurrentClaim != null))
                {
                    editNote.claim_id = CurrentClaim.id;
                }
                else
                {
                    editNote.claim_id = 0;
                }

                editNote.operatorId = ActiveUser.UserObject.username;
                if (!editNote.created_on.HasValue)
                {
                    editNote.created_on = DateTime.Now;
                }
                editNote.updated_on = DateTime.Now;

                ActiveUser.LogAction(ActiveUser.ActionTypes.CreateNote, editNote.claim_id, editNote.CallId, "");
                editNote.Save();

                if (isNew)
                {
                    editNote.Note += CreateNoteAdditionalText(editNote);
                    Notes.Insert(0, editNote);
                }

                editNote     = null;
                rtbNote.Text = "";
                Mode         = NotesGridMode.GridView;
                bsNotes.ResetBindings(false);
            }
            else
            {
                CancelNote();
            }
        }
        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);
                }
            }
        }
Esempio n. 9
0
        /// <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";
        }