private static void SetDateColumn(string colName, DateTime value)
        {
            user u = new user();

            u.ExecuteNonQuery("UPDATE system_options SET " + colName + " = '" + CommonFunctions.ToMySQLDate(value) + "'");
        }
Esempio n. 2
0
        /// <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;
                }
            }
        }