public ClientResponse UpdateSegundopaso(Tbl_anuncio objeto) { try { using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("sp_upd_anuncio_segundopaso", conexion)) { comando.CommandType = CommandType.StoredProcedure; comando.Parameters.Add("@int_edad", SqlDbType.Int).Value = objeto.int_edad; comando.Parameters.Add("@int_pais_origen", SqlDbType.Int).Value = objeto.int_pais_origen; comando.Parameters.Add("@int_estudios", SqlDbType.Int).Value = objeto.int_estudios; comando.Parameters.Add("@txt_presentacion", SqlDbType.Text).Value = objeto.txt_presentacion; comando.Parameters.Add("@id", SqlDbType.Int).Value = objeto.id; conexion.Open(); comando.ExecuteNonQuery(); Tbl_anuncio entidad = GetAnucionXId(objeto.id); clientResponse.Data = JsonConvert.SerializeObject(entidad).ToString(); } } } catch (Exception ex) { clientResponse.Mensaje = ex.Message; clientResponse.Status = "ERROR"; } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); reader.Dispose(); } return(clientResponse); }
public Tbl_anuncio GetAnucionXId(int id_anucion) { try { using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("sp_sel_tbl_anuncio_x_id", conexion)) { comando.CommandType = CommandType.StoredProcedure; comando.Parameters.Add("@id", SqlDbType.Int).Value = id_anucion; conexion.Open(); using (reader = comando.ExecuteReader()) { if (reader.Read()) { entidad = reader.ReadFields <Tbl_anuncio>(); } } } } } catch (Exception ex) { clientResponse.Mensaje = ex.Message; clientResponse.Status = "ERROR"; } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); reader.Dispose(); } return(entidad); }
public Tbl_anuncio GetAnucion_x_tokens(string token_anuncio) { try { using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("sp_sel_tbl_anuncio_x_tokens", conexion)) { comando.CommandType = CommandType.StoredProcedure; comando.Parameters.Add("@cod_anuncio_encryptado", SqlDbType.VarChar, 500).Value = token_anuncio; conexion.Open(); using (reader = comando.ExecuteReader()) { while (reader.Read()) { entidad = reader.ReadFields <Tbl_anuncio>(); } } } } } catch (Exception ex) { clientResponse.Mensaje = ex.Message; clientResponse.Status = "ERROR"; } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); reader.Dispose(); } return(entidad); }
public IEnumerable <Tbl_galeria_anuncio> Get_video_x_id_anuncio(Tbl_galeria_anuncio objeto) { try { using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("sp_sel_videos_x_id_anuncion", conexion)) { comando.CommandType = CommandType.StoredProcedure; comando.Parameters.Add("@id_anuncio", SqlDbType.Int).Value = objeto.id_anuncio; conexion.Open(); using (reader = comando.ExecuteReader()) { lstGaleria = reader.ReadRows <Tbl_galeria_anuncio>(); } } } } catch (Exception ex) { clientResponse.Mensaje = ex.Message; clientResponse.Status = "ERROR"; } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); reader.Dispose(); } return(lstGaleria); }
public ClientResponse MisAnuncio(string usuario_token) { try { using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("sp_sel_tbl_anuncio_x_usuario", conexion)) { comando.CommandType = CommandType.StoredProcedure; comando.Parameters.Add("@token_usuario", SqlDbType.VarChar, 255).Value = usuario_token; conexion.Open(); using (reader = comando.ExecuteReader()) { lstAnuncio = reader.ReadRows <Tbl_anuncio>(); } clientResponse.DataJson = JsonConvert.SerializeObject(lstAnuncio).ToString(); } } } catch (Exception ex) { clientResponse.Mensaje = ex.Message; clientResponse.Status = "ERROR"; } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); reader.Dispose(); } return(clientResponse); }
public ClientResponse DarBajarAnuncio(Tbl_anuncio entidad) { try { using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("sp_upd_dar_baja_tbl_anuncio", conexion)) { comando.CommandType = CommandType.StoredProcedure; comando.Parameters.Add("@cod_anuncio_encryptado", SqlDbType.VarChar, 500).Value = entidad.cod_anuncio_encryptado; conexion.Open(); comando.ExecuteNonQuery(); clientResponse.Status = "OK"; } } } catch (Exception ex) { clientResponse.Mensaje = ex.Message; clientResponse.Status = "ERROR"; } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); } return(clientResponse); }
public ClientResponse GetUsuario_X_password(Tbl_usuario entidad) { try { using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("sp_sel_usuario_login", conexion)) { comando.CommandType = CommandType.StoredProcedure; comando.Parameters.Add("@tx_email", SqlDbType.VarChar, 45).Value = entidad.tx_email; comando.Parameters.Add("@tx_pass", SqlDbType.VarChar, 500).Value = entidad.tx_pass; conexion.Open(); using (reader = comando.ExecuteReader()) { lstUsuario = reader.ReadRows <Tbl_usuario>(); } clientResponse.DataJson = JsonConvert.SerializeObject(lstUsuario).ToString(); } } } catch (Exception ex) { clientResponse.Mensaje = ex.Message; clientResponse.Status = "ERROR"; } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); reader.Dispose(); } return(clientResponse); }
public IEnumerable <Tbl_usuario> GetUsuario_X_Id(int id) { try { using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("sp_sel_usuario_x_id", conexion)) { comando.CommandType = CommandType.StoredProcedure; comando.Parameters.Add("@id", SqlDbType.Int).Value = id; conexion.Open(); using (reader = comando.ExecuteReader()) { lstUsuario = reader.ReadRows <Tbl_usuario>(); } } } } catch (Exception) { } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); reader.Dispose(); } return(lstUsuario); }
public ClientResponse ListarAnuncio() { try { using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("sp_sel_fichas_anuncio", conexion)) { comando.CommandType = CommandType.StoredProcedure; conexion.Open(); using (reader = comando.ExecuteReader()) { lstAnuncio = reader.ReadRows <Tbl_anuncio>(); } clientResponse.DataJson = JsonConvert.SerializeObject(lstAnuncio).ToString(); } } } catch (Exception ex) { clientResponse.Mensaje = ex.Message; clientResponse.Status = "ERROR"; } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); reader.Dispose(); } return(clientResponse); }
public IEnumerable <Tbl_parameter_det> GetParameter_skey(Tbl_parameter_det det) { try { using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("sp_sel_parameter_skey", conexion)) { comando.CommandType = CommandType.StoredProcedure; comando.Parameters.Add("@skey_cab", SqlDbType.VarChar, 45).Value = det.paramter_cab.skey_cab; conexion.Open(); using (reader = comando.ExecuteReader()) { lstParamaterDet = reader.ReadRows <Tbl_parameter_det>(); } } } } catch (Exception ex) { Utilidades.WriteLog(ex.Message); clientResponse.Mensaje = ex.Message; clientResponse.Status = "ERROR"; } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); reader.Dispose(); } return(lstParamaterDet); }
public ClientResponse Eliminar_video_x_id(Tbl_galeria_anuncio objeto) { try { using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("sp_del_galeria_x_id", conexion)) { comando.CommandType = CommandType.StoredProcedure; comando.Parameters.Add("@id", SqlDbType.Int).Value = objeto.id; conexion.Open(); comando.ExecuteNonQuery(); IEnumerable <Tbl_galeria_anuncio> lst = Get_video_x_id_anuncio(objeto); clientResponse.DataJson = JsonConvert.SerializeObject(lst).ToString(); } } } catch (Exception ex) { clientResponse.Mensaje = ex.Message; clientResponse.Status = "ERROR"; } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); reader.Dispose(); } return(clientResponse); }
public ClientResponse Insert_GaleriaObject(Tbl_galeria_anuncio objeto) { try { using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("usp_ins_galeria_object", conexion)) { comando.Parameters.AddWithValue("@id_anuncio", objeto.id_anuncio); comando.Parameters.AddWithValue("@tx_filename", objeto.tx_filename); comando.Parameters.AddWithValue("@Base64ContentFicha", objeto.Base64ContentFicha); comando.Parameters.AddWithValue("@Base64ContentFichaCort", objeto.Base64ContentFichaCort); comando.Parameters.AddWithValue("@size_file", objeto.size_file); comando.Parameters.Add("@Ind", SqlDbType.Int).Direction = ParameterDirection.Output; comando.Parameters.Add("@Mensaje", SqlDbType.VarChar, 200).Direction = ParameterDirection.Output; comando.CommandType = CommandType.StoredProcedure; conexion.Open(); comando.ExecuteNonQuery(); int ind = Convert.ToInt32(comando.Parameters["@Ind"].Value); string mensaje = Convert.ToString(comando.Parameters["@Mensaje"].Value); if (ind > 0) { Tbl_galeria_anuncio entidad = new Tbl_galeria_anuncio() { id = ind }; clientResponse = Get_galeria_x_id(entidad); clientResponse.Mensaje = mensaje; clientResponse.Status = "OK"; } else { clientResponse.Mensaje = mensaje; clientResponse.Status = "ERROR"; } } } } catch (Exception ex) { clientResponse.Mensaje = ex.Message; clientResponse.Status = "ERROR"; } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); } return(clientResponse); }
public ClientResponse UpdateCuartopaso(Tbl_anuncio objeto) { try { using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("sp_upd_anuncio_cuartopaso", conexion)) { comando.CommandType = CommandType.StoredProcedure; comando.Parameters.Add("@dbl_costo_x_tiempo_30min", SqlDbType.Decimal).Value = objeto.dbl_costo_x_tiempo_30min; comando.Parameters.Add("@dbl_costo_x_tiempo_45min", SqlDbType.Decimal).Value = objeto.dbl_costo_x_tiempo_45min; comando.Parameters.Add("@dbl_costo_x_tiempo_1hora", SqlDbType.Decimal).Value = objeto.dbl_costo_x_tiempo_1hora; comando.Parameters.Add("@dbl_costo_x_tiempo_1hora_media", SqlDbType.Decimal).Value = objeto.dbl_costo_x_tiempo_1hora_media; comando.Parameters.Add("@dbl_costo_x_tiempo_2hora", SqlDbType.Decimal).Value = objeto.dbl_costo_x_tiempo_2hora; comando.Parameters.Add("@dbl_costo_x_tiempo_3hora", SqlDbType.Decimal).Value = objeto.dbl_costo_x_tiempo_3hora; comando.Parameters.Add("@dbl_costo_x_tiempo_salidas", SqlDbType.Decimal).Value = objeto.dbl_costo_x_tiempo_salidas; comando.Parameters.Add("@dbl_costo_x_tiempo_toda_noche", SqlDbType.Decimal).Value = objeto.dbl_costo_x_tiempo_toda_noche; comando.Parameters.Add("@dbl_costo_x_viaje", SqlDbType.Decimal).Value = objeto.dbl_costo_x_viaje; comando.Parameters.Add("@txt_forma_pago", SqlDbType.VarChar, 400).Value = objeto.txt_forma_pago; comando.Parameters.Add("@txt_descripcion_extra_tarifa", SqlDbType.VarChar, 255).Value = objeto.txt_descripcion_extra_tarifa == null ? "" : objeto.txt_descripcion_extra_tarifa; //comando.Parameters.Add("@txt_lugar_servicio_distrito", SqlDbType.VarChar, 255).Value = objeto.txt_lugar_servicio_distrito; //comando.Parameters.Add("@fl_atencion_24horas", SqlDbType.Int).Value = objeto.fl_atencion_24horas; //comando.Parameters.Add("@tx_descripcion_extra_horario", SqlDbType.VarChar, 200).Value = objeto.tx_descripcion_extra_horario == null ? "" : objeto.tx_descripcion_extra_horario; //comando.Parameters.Add("@tx_lugar_atencion", SqlDbType.VarChar, 255).Value = objeto.tx_lugar_atencion; //comando.Parameters.Add("@tx_servicios_ofrece", SqlDbType.VarChar, 400).Value = objeto.tx_servicios_ofrece; //comando.Parameters.Add("@tx_descripcion_extra_servicio", SqlDbType.VarChar, 255).Value = objeto.tx_descripcion_extra_servicio == null ? "" : objeto.tx_descripcion_extra_servicio; comando.Parameters.Add("@id", SqlDbType.Int).Value = objeto.id; conexion.Open(); comando.ExecuteNonQuery(); Tbl_anuncio entidad = GetAnucionXId(objeto.id); clientResponse.Data = JsonConvert.SerializeObject(entidad).ToString(); } } } catch (Exception ex) { clientResponse.Mensaje = ex.Message; clientResponse.Status = "ERROR"; } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); reader.Dispose(); } return(clientResponse); }
public ClientResponse InsertPrimerpaso(Tbl_anuncio objeto) { int id = 0; try { using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("sp_ins_anuncio_primerpaso", conexion)) { comando.CommandType = CommandType.StoredProcedure; comando.Parameters.Add("@txt_nombre_ficha", SqlDbType.VarChar, 60).Value = objeto.txt_nombre_ficha == null ? "" : objeto.txt_nombre_ficha; comando.Parameters.Add("@txt_telefono_1", SqlDbType.VarChar, 50).Value = objeto.txt_telefono_1 == null ? "" : objeto.txt_telefono_1; comando.Parameters.Add("@txt_telefono_2", SqlDbType.VarChar, 50).Value = objeto.txt_telefono_2 == null ? "" : objeto.txt_telefono_2; comando.Parameters.Add("@txt_email", SqlDbType.VarChar, 40).Value = objeto.txt_email == null ? "" : objeto.txt_email; comando.Parameters.Add("@txt_web", SqlDbType.VarChar, 500).Value = objeto.txt_web == null ? "" : objeto.txt_web; comando.Parameters.Add("@id_usuario", SqlDbType.Int).Value = objeto.id_usuario; comando.Parameters.Add("@id", SqlDbType.Int).Direction = ParameterDirection.Output; conexion.Open(); comando.ExecuteNonQuery(); if (comando.Parameters["@id"] != null) { //dante gay medio weon //chiv //mike id = Convert.ToInt32(comando.Parameters["@id"].Value); clientResponse.Id = id; Tbl_anuncio entidad = GetAnucionXId(id); clientResponse.Data = JsonConvert.SerializeObject(entidad).ToString(); } } } } catch (Exception ex) { clientResponse.Mensaje = ex.Message; clientResponse.Status = "ERROR"; } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); } return(clientResponse); }
public ClientResponse listarPaginado(Pagination objeto) { int recordCount = 0; try { using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("sp_listar_anuncio", conexion)) { comando.CommandType = CommandType.StoredProcedure; comando.Parameters.Add("@vi_pagina", SqlDbType.Int).Value = objeto.CurrentPage; comando.Parameters.Add("@vi_registrosporpagina", SqlDbType.Int).Value = objeto.ItemsPerPage; comando.Parameters.Add("@vi_RecordCount", SqlDbType.Int).Direction = ParameterDirection.Output; conexion.Open(); using (reader = comando.ExecuteReader()) { lstAnuncio = reader.ReadRows <Tbl_anuncio>(); } recordCount = Convert.ToInt32(comando.Parameters["@vi_RecordCount"].Value); } } } catch (Exception ex) { clientResponse.Mensaje = ex.Message; clientResponse.Status = "ERROR"; } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); reader.Dispose(); } Pagination responsepaginacion = new Pagination() { TotalItems = recordCount, TotalPages = (int)Math.Ceiling((double)recordCount / objeto.ItemsPerPage) }; clientResponse.DataJson = JsonConvert.SerializeObject(lstAnuncio).ToString(); clientResponse.paginacion = JsonConvert.SerializeObject(responsepaginacion).ToString(); return(clientResponse); }
public ClientResponse GetParameter_skey_x_det_Id(Tbl_parameter_det det) { try { using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("sp_sel_parameter_skey_x_det_id", conexion)) { comando.CommandType = CommandType.StoredProcedure; comando.Parameters.Add("@skey_cab", SqlDbType.VarChar, 45).Value = det.paramter_cab.skey_cab; comando.Parameters.Add("@skey_det", SqlDbType.VarChar, 45).Value = det.skey_det; conexion.Open(); using (reader = comando.ExecuteReader()) { //entidad = reader.ReadFields<tbl_parameter_det>(); if (reader.Read()) { entidad = new Tbl_parameter_det(); entidad.val_valor = Convert.ToInt32(reader["val_valor"] == DBNull.Value ? 0 : reader["val_valor"]); entidad.tx_descripcion = Convert.ToString(reader["tx_descripcion"] == DBNull.Value ? "" : reader["tx_descripcion"]); } } clientResponse.DataJson = JsonConvert.SerializeObject(entidad).ToString(); } } } catch (Exception ex) { clientResponse.Mensaje = ex.Message; clientResponse.Status = "ERROR"; } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); reader.Dispose(); } //clientResponse.DataJson = JsonConvert.SerializeObject(lstContacto).ToString(); return(clientResponse); //return lstParamaterDet; }
public ClientResponse InsertUsuario(Tbl_usuario objeto) { int id = 0; try { using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("sp_ins_usuario", conexion)) { comando.CommandType = CommandType.StoredProcedure; comando.Parameters.Add("@tx_email", SqlDbType.VarChar, 60).Value = objeto.tx_email; comando.Parameters.Add("@tx_pass", SqlDbType.VarChar, 50).Value = objeto.tx_pass; comando.Parameters.Add("@tx_telefono", SqlDbType.VarChar, 50).Value = objeto.tx_telefono; comando.Parameters.Add("@id", SqlDbType.Int).Direction = ParameterDirection.Output; conexion.Open(); comando.ExecuteNonQuery(); if (comando.Parameters["@id"] != null) { id = Convert.ToInt32(comando.Parameters["@id"].Value); IEnumerable <Tbl_usuario> lst = GetUsuario_X_Id(id); clientResponse.DataJson = JsonConvert.SerializeObject(lst).ToString(); } } } } catch (Exception ex) { clientResponse.Mensaje = ex.Message; clientResponse.Status = "ERROR"; } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); reader.Dispose(); } return(clientResponse); }
public ClientResponse ListarAnuncioPaginate(Tbl_anuncio tblAnuncio) { try { using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("sp_sel_anuncio_paginada", conexion)) { comando.CommandType = CommandType.StoredProcedure; comando.Parameters.Add("@PageIndex", SqlDbType.Int).Value = tblAnuncio.beanPaginate.pageIndex; comando.Parameters.Add("@pageSize", SqlDbType.Int).Value = tblAnuncio.beanPaginate.pageSize; conexion.Open(); using (reader = comando.ExecuteReader()) { lstAnuncio = reader.ReadRows <Tbl_anuncio>(); reader.NextResult(); while (reader.Read()) { clientResponse.totalCount = reader["totalCount"].ToString(); } } clientResponse.DataJson = JsonConvert.SerializeObject(lstAnuncio).ToString(); } } } catch (Exception ex) { clientResponse.Mensaje = ex.Message; clientResponse.Status = "ERROR"; } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); reader.Dispose(); } return(clientResponse); }
public ClientResponse UpdateTercerpaso(Tbl_anuncio objeto) { try { using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("sp_upd_anuncio_tercerpaso", conexion)) { comando.CommandType = CommandType.StoredProcedure; comando.Parameters.Add("@int_color_cabello", SqlDbType.Int).Value = objeto.int_color_cabello; comando.Parameters.Add("@int_color_ojos", SqlDbType.Int).Value = objeto.int_color_ojos; comando.Parameters.Add("@int_estatura", SqlDbType.Int).Value = objeto.int_estatura; comando.Parameters.Add("@int_peso", SqlDbType.Int).Value = objeto.int_peso; comando.Parameters.Add("@txt_medidas_busto_cintura_cadera", SqlDbType.VarChar, 45).Value = objeto.txt_medidas_busto_cintura_cadera; comando.Parameters.Add("@txt_descripcion_extra_apariencia", SqlDbType.VarChar, 200).Value = objeto.txt_descripcion_extra_apariencia == null ? "" : objeto.txt_descripcion_extra_apariencia; comando.Parameters.Add("@id", SqlDbType.Int).Value = objeto.id; conexion.Open(); comando.ExecuteNonQuery(); Tbl_anuncio entidad = GetAnucionXId(objeto.id); clientResponse.Data = JsonConvert.SerializeObject(entidad).ToString(); } } } catch (Exception ex) { clientResponse.Mensaje = ex.Message; clientResponse.Status = "ERROR"; } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); reader.Dispose(); } return(clientResponse); }
public ClientResponse Get_galeria_x_id(Tbl_galeria_anuncio objeto) { try { using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("sp_sel_galeria_x_id", conexion)) { comando.CommandType = CommandType.StoredProcedure; comando.Parameters.Add("@id", SqlDbType.Int).Value = objeto.id; conexion.Open(); using (reader = comando.ExecuteReader()) { while (reader.Read()) { entidad = reader.ReadFields <Tbl_galeria_anuncio>(); } } clientResponse.DataJson = JsonConvert.SerializeObject(entidad).ToString(); } } } catch (Exception ex) { clientResponse.Mensaje = ex.Message; clientResponse.Status = "ERROR"; } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); reader.Dispose(); } return(clientResponse); }
public ClientResponse Listar_usuario() { try { using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("sp_sel_tbl_usuario", conexion)) { comando.CommandType = CommandType.StoredProcedure; // comando.Parameters.Add("@id", SqlDbType.Int).Value = id; // comando.Parameters.Add("@id_sede", SqlDbType.Int).Value = idSede; // comando.Parameters.Add("@numero_documento", SqlDbType.VarChar, 15).Value = numeroDocumento; conexion.Open(); using (reader = comando.ExecuteReader()) { lstUsuario = reader.ReadRows <Tbl_usuario>(); } } } } catch (Exception ex) { clientResponse.Mensaje = ex.Message; clientResponse.Status = "ERROR"; } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); reader.Dispose(); } clientResponse.DataJson = JsonConvert.SerializeObject(lstUsuario).ToString(); return(clientResponse); }
public ClientResponse ActualizarPrimerpaso(Tbl_anuncio objeto) { try { using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("sp_up_anuncio_primerpaso", conexion)) { comando.CommandType = CommandType.StoredProcedure; comando.Parameters.Add("@txt_nombre_ficha", SqlDbType.VarChar, 60).Value = objeto.txt_nombre_ficha == null ? "" : objeto.txt_nombre_ficha; comando.Parameters.Add("@txt_telefono_1", SqlDbType.VarChar, 50).Value = objeto.txt_telefono_1 == null ? "" : objeto.txt_telefono_1; comando.Parameters.Add("@txt_telefono_2", SqlDbType.VarChar, 50).Value = objeto.txt_telefono_2 == null ? "" : objeto.txt_telefono_2; comando.Parameters.Add("@txt_email", SqlDbType.VarChar, 40).Value = objeto.txt_email == null ? "" : objeto.txt_email; comando.Parameters.Add("@txt_web", SqlDbType.VarChar, 500).Value = objeto.txt_web == null ? "" : objeto.txt_web; comando.Parameters.Add("@id", SqlDbType.Int).Value = objeto.id; conexion.Open(); comando.ExecuteNonQuery(); Tbl_anuncio entidad = GetAnucionXId(objeto.id); clientResponse.Data = JsonConvert.SerializeObject(entidad).ToString(); } } } catch (Exception ex) { clientResponse.Mensaje = ex.Message; clientResponse.Status = "ERROR"; } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); reader.Dispose(); } return(clientResponse); }
public ClientResponse Insert_Galeria(List <Tbl_galeria_anuncio> list, int id_anuncio) { try { XElement root = new XElement("ROOT"); foreach (Tbl_galeria_anuncio detalle in list) { XElement address = new XElement("Detalle", new XElement("tx_filename", detalle.tx_filename), new XElement("tx_ruta_file", detalle.tx_ruta_file), new XElement("tx_ruta_file_cort", detalle.tx_ruta_file_cort), new XElement("size_file", detalle.size_file), new XElement("id_tipo_archivo", detalle.id_tipo_archivo), new XElement("txt_ruta_virtuales", detalle.txt_ruta_virtuales), new XElement("txt_ruta_virtuales_cortada", detalle.txt_ruta_virtuales_cortada) ); root.Add(address); } string xml = root.ToString(); using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("usp_ins_galeria", conexion)) { comando.Parameters.AddWithValue("@xml", xml); comando.Parameters.AddWithValue("@id_anuncio", id_anuncio); comando.Parameters.Add("@Ind", SqlDbType.Int).Direction = ParameterDirection.Output; comando.Parameters.Add("@Mensaje", SqlDbType.VarChar, 200).Direction = ParameterDirection.Output; comando.CommandType = CommandType.StoredProcedure; conexion.Open(); comando.ExecuteNonQuery(); int ind = Convert.ToInt32(comando.Parameters["@Ind"].Value); string mensaje = Convert.ToString(comando.Parameters["@Mensaje"].Value); if (ind > 0) { Tbl_galeria_anuncio entidad = new Tbl_galeria_anuncio() { id_anuncio = id_anuncio }; IEnumerable <Tbl_galeria_anuncio> lst = Get_galeria_x_id_anuncio(entidad); clientResponse.DataJson = JsonConvert.SerializeObject(lst).ToString(); clientResponse.Mensaje = mensaje; clientResponse.Status = "Ok"; } else { clientResponse.Mensaje = mensaje; clientResponse.Status = "ERROR"; } } } } catch (Exception ex) { clientResponse.Mensaje = ex.Message; clientResponse.Status = "ERROR"; } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); } return(clientResponse); }
public ClientResponse UpdateTodopaso(Tbl_anuncio objeto) { try { using (conexion = new SqlConnection(ConnectionBaseSql.ConexionBDSQL().ToString())) { using (comando = new SqlCommand("sp_upd_anuncio_todos_paso", conexion)) { comando.CommandType = CommandType.StoredProcedure; comando.Parameters.Add("@txt_nombre_ficha", SqlDbType.VarChar, 60).Value = objeto.txt_nombre_ficha == null ? "" : objeto.txt_nombre_ficha; comando.Parameters.Add("@txt_telefono_1", SqlDbType.VarChar, 50).Value = objeto.txt_telefono_1 == null ? "" : objeto.txt_telefono_1; comando.Parameters.Add("@txt_telefono_2", SqlDbType.VarChar, 50).Value = objeto.txt_telefono_2 == null ? "" : objeto.txt_telefono_2; comando.Parameters.Add("@txt_email", SqlDbType.VarChar, 40).Value = objeto.txt_email == null ? "" : objeto.txt_email; comando.Parameters.Add("@txt_web", SqlDbType.VarChar, 500).Value = objeto.txt_web == null ? "" : objeto.txt_web; comando.Parameters.Add("@int_edad", SqlDbType.Int).Value = objeto.int_edad; comando.Parameters.Add("@int_pais_origen", SqlDbType.Int).Value = objeto.int_pais_origen; comando.Parameters.Add("@int_estudios", SqlDbType.Int).Value = objeto.int_estudios; comando.Parameters.Add("@txt_presentacion", SqlDbType.Text).Value = objeto.txt_presentacion == null ? "" : objeto.txt_presentacion; comando.Parameters.Add("@int_color_cabello", SqlDbType.Int).Value = objeto.int_color_cabello; comando.Parameters.Add("@int_color_ojos", SqlDbType.Int).Value = objeto.int_color_ojos; comando.Parameters.Add("@int_estatura", SqlDbType.Int).Value = objeto.int_estatura; comando.Parameters.Add("@int_peso", SqlDbType.Int).Value = objeto.int_peso; comando.Parameters.Add("@txt_medidas_busto_cintura_cadera", SqlDbType.VarChar, 45).Value = objeto.txt_medidas_busto_cintura_cadera; comando.Parameters.Add("@txt_descripcion_extra_apariencia", SqlDbType.VarChar, 200).Value = objeto.txt_descripcion_extra_apariencia == null ? "" : objeto.txt_descripcion_extra_apariencia; comando.Parameters.Add("@dbl_costo_x_tiempo_30min", SqlDbType.Decimal).Value = objeto.dbl_costo_x_tiempo_30min; comando.Parameters.Add("@dbl_costo_x_tiempo_45min", SqlDbType.Decimal).Value = objeto.dbl_costo_x_tiempo_45min; comando.Parameters.Add("@dbl_costo_x_tiempo_1hora", SqlDbType.Decimal).Value = objeto.dbl_costo_x_tiempo_1hora; comando.Parameters.Add("@dbl_costo_x_tiempo_1hora_media", SqlDbType.Decimal).Value = objeto.dbl_costo_x_tiempo_1hora_media; comando.Parameters.Add("@dbl_costo_x_tiempo_2hora", SqlDbType.Decimal).Value = objeto.dbl_costo_x_tiempo_2hora; comando.Parameters.Add("@dbl_costo_x_tiempo_3hora", SqlDbType.Decimal).Value = objeto.dbl_costo_x_tiempo_3hora; comando.Parameters.Add("@dbl_costo_x_tiempo_salidas", SqlDbType.Decimal).Value = objeto.dbl_costo_x_tiempo_salidas; comando.Parameters.Add("@dbl_costo_x_tiempo_toda_noche", SqlDbType.Decimal).Value = objeto.dbl_costo_x_tiempo_toda_noche; comando.Parameters.Add("@dbl_costo_x_viaje", SqlDbType.Decimal).Value = objeto.dbl_costo_x_viaje; comando.Parameters.Add("@txt_forma_pago", SqlDbType.VarChar, 400).Value = objeto.txt_forma_pago; comando.Parameters.Add("@txt_descripcion_extra_tarifa", SqlDbType.VarChar, 255).Value = objeto.txt_descripcion_extra_tarifa == null ? "" : objeto.txt_descripcion_extra_tarifa; comando.Parameters.Add("@txt_lugar_servicio_distrito", SqlDbType.VarChar, 255).Value = objeto.txt_lugar_servicio_distrito == null ? "" : objeto.txt_lugar_servicio_distrito; comando.Parameters.Add("@fl_atencion_24horas", SqlDbType.Int).Value = objeto.fl_atencion_24horas; comando.Parameters.Add("@tx_descripcion_extra_horario", SqlDbType.VarChar, 200).Value = objeto.tx_descripcion_extra_horario == null ? "" : objeto.tx_descripcion_extra_horario; comando.Parameters.Add("@tx_lugar_atencion", SqlDbType.VarChar, 255).Value = objeto.tx_lugar_atencion; comando.Parameters.Add("@tx_servicios_ofrece", SqlDbType.VarChar, 400).Value = objeto.tx_servicios_ofrece; comando.Parameters.Add("@tx_descripcion_extra_servicio", SqlDbType.VarChar, 255).Value = objeto.tx_descripcion_extra_servicio == null ? "" : objeto.tx_descripcion_extra_servicio; //ssss comando.Parameters.Add("@id", SqlDbType.Int).Value = objeto.id; conexion.Open(); comando.ExecuteNonQuery(); Tbl_anuncio entidad = GetAnucionXId(objeto.id); clientResponse.Data = JsonConvert.SerializeObject(entidad).ToString(); } } } catch (Exception ex) { clientResponse.Mensaje = ex.Message; clientResponse.Status = "ERROR"; } finally { conexion.Close(); conexion.Dispose(); comando.Dispose(); reader.Dispose(); } return(clientResponse); }