// ***************************************************************************************** // Yapılan İşlemleri Logla // ***************************************************************************************** private void DashboardLogSave(string ChangingUserName) { DashboardLog objDashboardLog = new DashboardLog(); objDashboardLog.ProcessType = 2; objDashboardLog.UserName = HttpContext.Current.Session["userName"].ToString(); objDashboardLog.ActionMessage = ChangingUserName + " Kullanıcısının Yetkisi Değiştirildi"; objDashboardLog.ActionWhy = ""; objDashboardLog.ActionDate = DateTime.Now; objDashboardLog.Insert(null, GlobalSettings.OrganizationConnectionString); }
public List<DashboardLog> GetAllListProcessTypeAndToday(string connectionString, string pProcessType, string pUserName, DateTime pStartActionDate, DateTime pEndActionDate) { using (SqlConnection connection = new SqlConnection(connectionString)) { List<DashboardLog> DashboardLogList = new List<DashboardLog>(); using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand()) { cmd.CommandText = @"SELECT DashboardLogId, ProcessType, UserName, ActionMessage, ActionWhy, ActionDate FROM DashboardLog WHERE ProcessType IN (@pProcessType) AND UserName = @pUserName AND ActionDate BETWEEN @pStartActionDate AND @pEndActionDate"; cmd.Parameters.AddWithValue("@pProcessType", pProcessType); cmd.Parameters.AddWithValue("@pUserName", pUserName); cmd.Parameters.AddWithValue("@pStartActionDate", pStartActionDate); cmd.Parameters.AddWithValue("@pEndActionDate", pEndActionDate); using (DataTable dt = DB_Gateway.ExecuteDataTable(cmd, connection)) { if (dt != null) { foreach (DataRow dr in dt.Rows) { DashboardLog objDashboardLog = new DashboardLog(); objDashboardLog.TransferToClass(dr); DashboardLogList.Add(objDashboardLog); } } } } if (connection != null) connection.Close(); return DashboardLogList; } }
// ***************************************************************************************** // İşlemleri Listele // ***************************************************************************************** private void constructData(string pProcessType) { if (pProcessType == "4") { DashboardLog objDashboardLogAll = new DashboardLog(); List<DashboardLog> dtDashboardLogAll = objDashboardLogAll.GetAllList(GlobalSettings.OrganizationConnectionString); if (!Object.Equals(dtDashboardLogAll, null) && dtDashboardLogAll.Count > 0) { this.rptDocumentation.DataSource = dtDashboardLogAll; this.rptDocumentation.DataBind(); } else { this.rptDocumentation.DataSource = null; this.rptDocumentation.DataBind(); } } else { DashboardLog objDashboardLog = new DashboardLog(); List<DashboardLog> dtDashboardLog = objDashboardLog.GetAllListProcessTypeAndToday(GlobalSettings.OrganizationConnectionString, pProcessType, HttpContext.Current.Session["userName"].ToString(), DateTime.Today.AddHours(00).AddMinutes(00).AddSeconds(01), DateTime.Today.AddDays(1).AddSeconds(-1)); if (!Object.Equals(dtDashboardLog, null) && dtDashboardLog.Count > 0) { this.rptDocumentation.DataSource = dtDashboardLog; this.rptDocumentation.DataBind(); } else { this.rptDocumentation.DataSource = null; this.rptDocumentation.DataBind(); } } }
public List<DashboardLog> GetAllList(string connectionString) { using (System.Data.SqlClient.SqlConnection connection = new System.Data.SqlClient.SqlConnection(connectionString)) { List<DashboardLog> DashboardLogList = new List<DashboardLog>(); using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand()) { cmd.CommandText = @" SELECT DashboardLogId, ProcessType, UserName, ActionMessage, ActionWhy, ActionDate FROM DashboardLog"; using (DataTable dt = DB_Gateway.ExecuteDataTable(cmd, connection)) { if (dt != null) { foreach (DataRow dr in dt.Rows) { DashboardLog objDashboardLog = new DashboardLog(); objDashboardLog.TransferToClass(dr); DashboardLogList.Add(objDashboardLog); } } } } if (connection != null) connection.Close(); return DashboardLogList; } }