public Banner createBanner( string seccionId, string name, string imgMainUrl, string imgButtonUrl, string imgModalUrl, string mode, string link, string backgroundColor, string text, DateTime startDateActivation, DateTime endDateActivation, string registrationUserId, string status ) { string startDateProcess = processDateFormat(startDateActivation); string endDateProcess = processDateFormat(endDateActivation); Banner banner = new Banner(); try { string query = "SP_AdminContenido_INSUPDBANNER 0, '" + name + "','" + seccionId + "', '" + imgMainUrl + "', '" + imgButtonUrl + "'," + "'" + imgModalUrl + "', '" + mode + "', '" + link + "', '" + backgroundColor + "', '" + text + "', '" + startDateProcess + "', '" + endDateProcess + "', " + registrationUserId + ", " + registrationUserId + "," + " 0, 0, '" + status + "'"; conexion.Conectar(); conexion.CrearComando(query); DbDataReader DRConexion = conexion.EjecutarConsulta(); while (DRConexion.Read()) { banner = new Banner { id = DRConexion.GetDecimal(0).ToString(), name = DRConexion.GetString(1), seccionId = DRConexion.GetString(2), imgMainUrl = DRConexion.GetString(3), imgButtonUrl = DRConexion.GetString(4), imgModalUrl = DRConexion.GetString(5), mode = DRConexion.GetString(6), link = DRConexion.GetString(7), backgroundColor = DRConexion.GetString(8), text = DRConexion.GetString(9), startDateActivation = DRConexion.GetDateTime(10), endDateActivation = DRConexion.GetDateTime(11), registrationUserId = DRConexion.GetInt32(14).ToString(), status = DRConexion.GetString(18), registrationDate = DRConexion.GetDateTime(12), updateDate = DRConexion.GetDateTime(13) }; } conexion.Desconectar(); } catch { banner = new Banner { id = null }; } return banner; }
public List<Banner> search(string bannerId, string sectionId, string startDateActivation, string endDateActivation, string registrationUserId, string updateUserId, string activationUserId, string deactivationUserId, string status, int offset, int resultsForPage) { bannerId = validDataString(bannerId) == "" ? "0" : bannerId; sectionId = validDataString(sectionId); startDateActivation = validDataString(startDateActivation); endDateActivation = validDataString(endDateActivation); registrationUserId = validDataString(registrationUserId) == "" ? "0" : registrationUserId; updateUserId = validDataString(updateUserId) == "" ? "0" : updateUserId; activationUserId = validDataString(activationUserId) == "" ? "0" : activationUserId; deactivationUserId = validDataString(deactivationUserId) == "" ? "0" : deactivationUserId; status = validDataString(status); offset = validDataNumber(offset); resultsForPage = validDataNumber(resultsForPage) == 0 ? 20 : resultsForPage; List<Banner> banners = new List<Banner>(); banners.Clear(); Banner banner = new Banner(); try { string query = "SP_AdminContenido_GETBNNR "+bannerId+", '"+sectionId+"', '"+startDateActivation+"',"+ "'"+endDateActivation+"', "+registrationUserId+","+updateUserId+","+ " "+activationUserId+","+deactivationUserId+",'"+status+"',"+offset+","+resultsForPage; conexion.Conectar(); conexion.CrearComando(query); DbDataReader DRConexion = conexion.EjecutarConsulta(); while (DRConexion.Read()) { banner = new Banner { id = DRConexion.GetDecimal(1).ToString(), name = DRConexion.GetString(2), seccionId = DRConexion.GetString(3), imgMainUrl = DRConexion.GetString(4), imgButtonUrl = DRConexion.GetString(5), imgModalUrl = DRConexion.GetString(6), mode = DRConexion.GetString(7), link = DRConexion.GetString(8), backgroundColor = DRConexion.GetString(9), text = DRConexion.GetString(10), startDateActivation = DRConexion.GetDateTime(11), endDateActivation = DRConexion.GetDateTime(12), updateUserId = DRConexion.GetInt32(16).ToString(), registrationUserId = DRConexion.GetInt32(15).ToString(), activationUserId = DRConexion.GetInt32(17).ToString(), deactivationUserId = DRConexion.GetInt32(18).ToString(), status = DRConexion.GetString(19), registrationDate = DRConexion.GetDateTime(13), updateDate = DRConexion.GetDateTime(14) }; banners.Add(banner); } conexion.Desconectar(); } catch { banners.Clear(); } return banners; }
public Banner updateBanner(string id, string name, string imgMainUrl, string imgButtonUrl, string imgModalUrl, string mode, string link, string backgroundColor, string text, DateTime startDateActivation, DateTime endDateActivation, string updateUserId, string status) { Banner banner = new Banner(); banner.id = id; banner.name = name; banner.imgMainUrl = imgMainUrl; banner.imgButtonUrl = imgButtonUrl; banner.imgModalUrl = imgModalUrl; banner.mode = mode; banner.link = link; banner.backgroundColor = backgroundColor; banner.text = text; banner.startDateActivation = startDateActivation; banner.endDateActivation = endDateActivation; banner.updateUserId = updateUserId; banner.status = status; banner.registrationDate = DateTime.Now; banner.updateDate = DateTime.Now; return banner; }
private void getBannerActive() { try { Banner banner = new Banner(); string query = " SP_AdminContenido_GETCONTENIDOACTIVO "; conexion.Conectar(); conexion.CrearComando(query); DbDataReader DRConexion = conexion.EjecutarConsulta(); while (DRConexion.Read()) { banner = new Banner { id = DRConexion.GetDecimal(0).ToString(), //name = DRConexion.GetString(2), seccionId = DRConexion.GetString(1), imgMainUrl = DRConexion.GetString(2), imgButtonUrl = DRConexion.GetString(3), imgModalUrl = DRConexion.GetString(4), mode = DRConexion.GetString(5), link = DRConexion.GetString(6), backgroundColor = DRConexion.GetString(7), text = DRConexion.GetString(8) /*startDateActivation = DRConexion.GetDateTime(11), endDateActivation = DRConexion.GetDateTime(12), updateUserId = DRConexion.GetInt32(16).ToString(), registrationUserId = DRConexion.GetInt32(15).ToString(), activationUserId = DRConexion.GetInt32(17).ToString(), deactivationUserId = DRConexion.GetInt32(18).ToString(), status = DRConexion.GetString(19), registrationDate = DRConexion.GetDateTime(13), updateDate = DRConexion.GetDateTime(14)*/ }; switch (banner.seccionId) { case "A-Slider" : bannerSliderList.Add(banner); break; case "B-Banner": bannerBannerList.Add(banner); break; case "C-Noticias-A": bannerNewsListA.Add(banner); break; case "C-Noticias-B": bannerNewsListB.Add(banner); break; case "C-Noticias-C": bannerNewsListC.Add(banner); break; case "D-Takeover": bannerTakeoverList.Add(banner); break; default: bannerOtherList.Add(banner); break; } } conexion.Desconectar(); } catch { clearBannerList(); } }