} //user ile event arasındaki etkileşim protected void Page_Load(object sender, EventArgs e) { selectedEvent = eventBal.GetEventDetail(eventId); if (selectedEvent != null) { EventName.InnerText = selectedEvent.EventName; Description.InnerText = selectedEvent.Description; Category.InnerText = selectedEvent.Category; City.InnerText = selectedEvent.City; Date.InnerText = selectedEvent.StartDate; Person.Text = selectedEvent.PersonName; } GetCommentRequest(); GetEventOperationStatisticRequest(); GetEventOperationStatusRequest(); }
public List <EventBO> GetUserEvents(int userId) { List <EventBO> list = new List <EventBO>(); sqlCommand = new SqlCommand() { Connection = connectionHelper.connection, CommandType = CommandType.StoredProcedure, CommandText = "GetUserEventsSP", }; sqlCommand.Parameters.Add("@PersonId", SqlDbType.Int).Value = userId; connectionHelper.connection.Open(); SqlDataReader sqlReader = sqlCommand.ExecuteReader(); if (sqlReader.HasRows) { while (sqlReader.Read()) { var model = new EventBO() { Id = Convert.ToInt32(sqlReader["Id"]), EventName = sqlReader["EventName"] as string, PersonName = sqlReader["PersonName"] as string, City = sqlReader["City"] as string, StartDate = ((DateTime)sqlReader["StartDate"]).Date.ToString("dd/MM/yyyy"), Description = sqlReader["Description"] as string, Category = sqlReader["Category"] as string }; list.Add(model); } } connectionHelper.connection.Close(); return(list); }
public EventBO GetEventDetail(int eventId) { EventBO result = new EventBO(); sqlCommand = new SqlCommand() { Connection = connectionHelper.connection, CommandType = CommandType.StoredProcedure, CommandText = "GetEventDetailSP", }; sqlCommand.Parameters.Add("@EventId", SqlDbType.Int).Value = eventId; connectionHelper.connection.Open(); SqlDataReader sqlReader = sqlCommand.ExecuteReader(); if (sqlReader.HasRows) { if (sqlReader.Read()) { result = new EventBO() { Id = Convert.ToInt32(sqlReader["Id"]), EventName = sqlReader["EventName"] as string, PersonId = Convert.ToInt32(sqlReader["PersonId"]), PersonName = sqlReader["PersonName"] as string, City = sqlReader["City"] as string, StartDate = ((DateTime)sqlReader["StartDate"]).Date.ToString("dd/MM/yyyy"), Description = sqlReader["Description"] as string, Category = sqlReader["Category"] as string }; } } connectionHelper.connection.Close(); return(result); }