Example #1
0
        /// <summary>
        /// Creates a status history for a claim. Note that if you pass 'null' for newRevisit, it will
        /// use the old value for the revisit date.
        /// </summary>
        /// <param name="newStatus"></param>
        /// <param name="newRevisit"></param>
        /// <param name="as_is_flag"></param>
        internal void CreateStatusHistory(claim_status newStatus, DateTime?newRevisit, bool as_is_flag)
        {
            string noteText          = string.Empty;
            claim_status_history csh = new claim_status_history();

            csh.claim_id       = id;
            csh.order_id       = csh.GetNextOrderID();
            csh.user_id        = ActiveUser.UserObject.id;
            csh.date_of_change = DateTime.Now;

            csh.old_status_id = status_id;

            if (newStatus == null)
            {
                csh.new_status_id = status_id;
            }
            else
            {
                csh.new_status_id = newStatus.id;
            }

            csh.old_revisit_date = revisit_date;
            if (newRevisit != null)
            {
                csh.new_revisit_date = newRevisit;
            }

            csh.as_is_flag = as_is_flag;
            csh.Save();
        }
        private void SetLastUserText()
        {
            if (LinkedClaim.status_last_user_id > 0)
            {
                user u = new user(LinkedClaim.status_last_user_id);

                claim_status cs       = LinkedClaim.LinkedStatus;
                string       lastDate = LinkedClaim.status_last_date.Value.ToShortDateString();
                string       nameDate = " " + u.username + ", " + lastDate + "";
                string       lastText;

                if (cs == null)
                {
                    lastText = "No status - " + nameDate;
                }
                else
                {
                    lastText = cs.name + " - " + nameDate;
                }

                if (LinkedClaim.revisit_date.HasValue)
                {
                    lastText += "\nRevisit " +
                                LinkedClaim.revisit_date.Value.ToShortDateString() + " - " + nameDate;
                }

                lblLastStatus.Text = lastText;
            }
            else
            {
                lblLastStatus.Text = "No status/revisit";
            }
        }
        private void cmdAdd_Click(object sender, EventArgs e)
        {
            claim_status cs = new claim_status();

            cs.name         = "Enter name here...";
            cs.orderid      = lstStatusList.Items.Count;
            cs.user_visible = true;
            cs.Save();

            lstStatusList.Items.Add(cs);
        }
        public void InitializeStatusDropdown()
        {
            claim_status cs    = new claim_status();
            DataTable    allcs = cs.GetVisibleStatus();

            foreach (DataRow aRow in allcs.Rows)
            {
                cs = new claim_status();
                cs.Load(aRow);

                cmbStatus.Items.Add(cs);
            }
        }
        private void InitializeStatus()
        {
            claim_status cs = new claim_status();

            cmbStatus.Items.Clear();
            cmbStatus.Items.Add("Show All");

            foreach (DataRow aStatus in cs.GetAllData("orderid").Rows)
            {
                cs = new claim_status();
                cs.Load(aStatus);
                cmbStatus.Items.Add(cs);
            }
        }
        private void InitializeStatusDropdown()
        {
            claim_status cs    = new claim_status();
            DataTable    allcs = cs.GetAllData("orderid");

            foreach (DataRow aRow in allcs.Rows)
            {
                cs = new claim_status();
                cs.Load(aRow);

                cmbResendStatus.Items.Add(cs);
                cmbStatusOnApex.Items.Add(cs);
                cmbStatusOnApexResend.Items.Add(cs);
            }
        }
        private void lstStatusList_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lstStatusList.SelectedIndex > -1)
            {
                selectedStatus = (claim_status)lstStatusList.SelectedItem;

                txtName.Text            = selectedStatus.name;
                txtDescription.Text     = selectedStatus.description;
                txtClassifications.Text = GetClassifications();
                chkVisible.Checked      = selectedStatus.user_visible;

                txtName.Enabled        = true;
                txtDescription.Enabled = true;
                chkVisible.Enabled     = true;
            }
        }
        private void InitializeStatusDropdown()
        {
            cmbStatusDropdown.Items.Add("No linked status");

            claim_status cs    = new claim_status();
            DataTable    allcs = cs.GetAllData("orderid");

            foreach (DataRow aRow in allcs.Rows)
            {
                cs = new claim_status();

                cs.Load(aRow);

                cmbStatusDropdown.Items.Add(cs);
            }
        }
        private void RefreshStatusList()
        {
            claim_status cs = new claim_status();

            foreach (DataRow aRow in cs.GetAllData("orderid").Rows)
            {
                cs = new claim_status();
                cs.Load(aRow);

                lstStatusList.Items.Add(cs);
            }

            if (lstStatusList.Items.Count > 0)
            {
                lstStatusList.SelectedIndex = 0;
            }
        }
        private void cmdMoveDown_Click(object sender, EventArgs e)
        {
            if (lstStatusList.SelectedIndex < lstStatusList.Items.Count - 1 && lstStatusList.SelectedIndex >= 0)
            {
                int i = lstStatusList.SelectedIndex;

                selectedStatus.orderid = i + 1;
                selectedStatus.Save();

                claim_status switchStatus = (claim_status)lstStatusList.Items[lstStatusList.SelectedIndex + 1];
                switchStatus.orderid = i;
                switchStatus.Save();

                lstStatusList.Items.Remove(lstStatusList.SelectedItem);
                lstStatusList.Items.Insert(i + 1, selectedStatus);

                lstStatusList.SelectedIndex = i + 1;
            }
        }
        private void cmdMoveUp_Click(object sender, EventArgs e)
        {
            if (lstStatusList.SelectedIndex > 0)
            {
                // Switch the indexes of these two items
                int i = lstStatusList.SelectedIndex;

                selectedStatus.orderid = i - 1;
                selectedStatus.Save();

                claim_status switchStatus = (claim_status)lstStatusList.Items[lstStatusList.SelectedIndex - 1];
                switchStatus.orderid = i;
                switchStatus.Save();

                lstStatusList.Items.Remove(lstStatusList.SelectedItem);
                lstStatusList.Items.Insert(i - 1, selectedStatus);

                lstStatusList.SelectedIndex = i - 1;
            }
        }
Example #12
0
        internal void SetApexStatus()
        {
            if (system_options.ApexSendStatus > 0 || system_options.ApexRevisitDateEnabled)
            {
                try
                {
                    claim_status cs         = null;
                    DateTime?    newRevisit = null;
                    if (system_options.ApexSendStatus > 0)
                    {
                        cs = new claim_status(system_options.ApexSendStatus);
                    }
                    if (system_options.ApexRevisitDateEnabled)
                    {
                        newRevisit = DateTime.Today.AddDays(system_options.ApexRevisitDate);
                    }

                    SetStatusAndRevisitDate(cs, newRevisit);
                }
                catch (Exception e) { LoggingHelper.Log("Error in SetApexStatus\n" + e.Message, LogSeverity.Critical, e, false); }
            }
        }
Example #13
0
        private void SetLastUserText()
        {
            if (_formClaim.status_last_user_id > 0)
            {
                user u = new user(_formClaim.status_last_user_id);

                claim_status cs       = _formClaim.LinkedStatus;
                string       lastDate = _formClaim.status_last_date.Value.ToShortDateString();
                string       nameDate = " (" + u.username + ", " + lastDate + ")";


                if (cs == null)
                {
                    lblLastStatus.Text = "Last status left empty." + nameDate;
                }
                else
                {
                    lblLastStatus.Text = "Last status set to " + cs.name + ". " + nameDate;
                }

                if (_formClaim.revisit_date.HasValue)
                {
                    lblLasRevisitDate.Text = "Last revisit date set to " +
                                             _formClaim.revisit_date.Value.ToShortDateString() + ". " + nameDate;
                }
                else
                {
                    lblLasRevisitDate.Text = "Last revisit date not set. " + nameDate;
                }
            }
            else
            {
                lblLastStatus.Text     = "No previous status set.";
                lblLasRevisitDate.Text = "No previous revisit date set.";
            }
        }
Example #14
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);
            }
        }