public void DeleteSLAData(SLAData slaData) { SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["SLAConnection"].ConnectionString); using (SqlConnection conn = new SqlConnection()) { SqlCommand command = new SqlCommand("usp_DeleteSLAData", connection); command.CommandType = CommandType.StoredProcedure; try { command.Parameters.AddWithValue("@SLADataId", slaData.SLADataId); command.Parameters.AddWithValue("@User", LDAPUserInfo.GetUserLanId()); connection.Open(); command.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } finally { connection.Close(); } } }
public int SaveSLAData(SLAData slaData) { // int parsedInt; int result = 0; SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["SLAConnection"].ConnectionString); using (SqlConnection conn = new SqlConnection()) { SqlCommand command = new SqlCommand("usp_SaveSLAData", connection); command.CommandType = CommandType.StoredProcedure; try { command.Parameters.AddWithValue("@SLADataId", slaData.SLADataId); command.Parameters.AddWithValue("@DashboardId", slaData.DashboardId); command.Parameters.AddWithValue("@SLAId", slaData.SLAId); command.Parameters.AddWithValue("@SLATierId", slaData.SLATierId); command.Parameters.AddWithValue("@SLAYear", slaData.SLAYear); command.Parameters.AddWithValue("@SLAMonth", slaData.SLAMonth); command.Parameters.AddWithValue("@SLAMet", slaData.SLAMet); command.Parameters.AddWithValue("@SLANotMet", slaData.SLANotMet); command.Parameters.AddWithValue("@SLAComment", slaData.SLAComment); command.Parameters.AddWithValue("@User", LDAPUserInfo.GetUserLanId()); connection.Open(); command.Parameters.Add("@ReturnCode", SqlDbType.Int, 2); command.Parameters["@ReturnCode"].Direction = ParameterDirection.Output; command.ExecuteNonQuery(); int x = (int)command.Parameters["@ReturnCode"].Value; if (x == 1) { result = 1; } else { result = 0; } } catch (Exception ex) { throw ex; } finally { connection.Close(); } } return(result); }
public User GetUserData() { try { var user = new User(); var userLanId = LDAPUserInfo.GetUserLanId(); if (!string.IsNullOrWhiteSpace(userLanId)) { user = this.GetUser(userLanId); user.UserId = userLanId; user.IsAdminUser = IsAdminUser(userLanId); } return(user); } catch (Exception ex) { throw ex; } }