private void dgvMain_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == colClaim.Index) { if (e.RowIndex >= 0) { user_action_log ual = (user_action_log)dgvMain.Rows[e.RowIndex].Tag; if (CommonFunctions.DBNullToZero(ual["call_id"]) > 0) { call toShow = new call(ual.call_id); pnlShowCall.Visible = true; ctlCallDisplay.DisplayCall(toShow); lblCallInfo.Text = toShow.operatordata + " " + toShow.created_on; pnlShowCall.Visible = true; } else if (CommonFunctions.DBNullToZero(ual["claim_id"]) > 0) { try { frmClaimManager toShow = new frmClaimManager(new claim(ual.claim_id)); toShow.Show(); } catch { MessageBox.Show(this, "An error occurred showing the selected claim."); } } } } }
/// <summary> /// Removes the most recent logged start call and end call actions for a user, then replaces "View Claim" with "Review Claim" /// Used to show a user reviewed a claim and did not take any action on a claim. /// </summary> /// <param name="claimID"></param> /// <param name="LogText"></param> internal static void LogReview(int claimID, string LogText) { // Remove the reference to "start call" and change the action log entry of view claim to "review claim" // If no view claim is found just create a new one user_action_log ual = user_action_log.FindMostRecent(claimID, UserObject.id); ual.DeleteLastCall(claimID, UserObject.id); ual.action_id = (int)ActionTypes.ReviewClaim; ual.additional_notes += "; " + LogText; ual.Save(); }
public static void LogAction(ActionTypes at, int ClaimID, int CallID, string AdditionalNotes) { user_action_log toInsert = new user_action_log(); toInsert.user_id = UserObject.id; toInsert.order_id = toInsert.GetNextOrderID(); toInsert.action_taken_time = DateTime.Now; toInsert.action_id = (int)at; toInsert.additional_notes = AdditionalNotes; if (ClaimID > 0) { toInsert.claim_id = ClaimID; } if (CallID > 0) { toInsert.call_id = CallID; } toInsert.Save(); }
/// <summary> /// Finds and returns the most recent View Claim action for a given claim id and user id /// </summary> /// <param name="claimID"></param> /// <param name="p"></param> /// <returns></returns> internal static user_action_log FindMostRecent(int claimID, int userID) { user_action_log toReturn = new user_action_log(); DataTable matches = toReturn.Search("SELECT TOP 1 * FROM user_action_log WHERE action_id = " + (int)C_DentalClaimTracker.ActiveUser.ActionTypes.ViewClaim + " AND user_id = " + userID + " AND claim_id = " + claimID + " ORDER BY order_id desc"); if (matches.Rows.Count > 0) { toReturn.Load(matches.Rows[0]); } else { toReturn.user_id = userID; toReturn.order_id = toReturn.GetNextOrderID(); toReturn.action_taken_time = DateTime.Now; toReturn.action_id = (int)C_DentalClaimTracker.ActiveUser.ActionTypes.ReviewClaim; toReturn.additional_notes = ""; toReturn.claim_id = claimID; } return(toReturn); }
/// <summary> /// Doesn't work if the form is in loading mode /// </summary> private void Search() { if (_loading == false) { string SQL = "SELECT * FROM user_action_log WHERE "; user_action_log ual = new user_action_log(); if (cmbUsers.SelectedIndex > 0) { SQL += "user_id = " + ((user)cmbUsers.SelectedItem).id; } else { SQL += "1 = 1"; } if (chkSearchDateRange.Checked) { SQL += " AND action_taken_time > '" + CommonFunctions.ToMySQLDate(dtpStartDate.Value) + "' AND action_taken_time < '" + CommonFunctions.ToMySQLDate(dtpEndDate.Value.AddDays(1)) + "'"; } if (!chkShowLogins.Checked) { SQL += " AND action_id NOT IN(" + (int)ActiveUser.ActionTypes.Login + "," + (int)ActiveUser.ActionTypes.Logout + ")"; } SQL += " ORDER BY order_id desc"; DataTable matches = ual.Search(SQL); dgvMain.Rows.Clear(); foreach (DataRow anAction in matches.Rows) { ual = new user_action_log(); ual.Load(anAction); object[] toAdd; if (((ActiveUser.ActionTypes)ual.action_id == ActiveUser.ActionTypes.ViewClaim) || ((ActiveUser.ActionTypes)ual.action_id == ActiveUser.ActionTypes.ResendClaim) || ((ActiveUser.ActionTypes)ual.action_id == ActiveUser.ActionTypes.SubmitClaim) || ((ActiveUser.ActionTypes)ual.action_id == ActiveUser.ActionTypes.ReviewClaim)) { toAdd = new object[] { ual.LinkedUser.username, ual.action_taken_time.ToString("MM-dd-yy HH:mm"), ((ActiveUser.ActionTypes)ual.action_id).ToString(), ual.additional_notes, "Claim" }; } else if ((ActiveUser.ActionTypes)ual.action_id == ActiveUser.ActionTypes.StartCall) { toAdd = new object[] { ual.LinkedUser.username, ual.action_taken_time.ToString("MM-dd-yy HH:mm"), ((ActiveUser.ActionTypes)ual.action_id).ToString(), ual.additional_notes, "Call" }; } else { toAdd = new object[] { ual.LinkedUser.username, ual.action_taken_time.ToString("MM-dd-yy HH:mm"), ((ActiveUser.ActionTypes)ual.action_id).ToString(), ual.additional_notes, "" }; } dgvMain.Rows.Add(toAdd); dgvMain.Rows[dgvMain.Rows.Count - 1].Tag = ual; } } }