protected void loadGridHotel(int npageIndex = 0) { ICompras IService = new ICompras(); IHotels IServiceHotel = new IHotels(); BEHotel BEHotel = new BEHotel(); BEHotel.codLocal = ddlLocales.SelectedValue; BEHotel.codPeriodo = ddlPeriodos.SelectedValue; BECompras BE = new BECompras(); BE.codLocal = ddlLocales.SelectedValue; BE.codPeriodo = ddlPeriodos.SelectedValue; BE.tipoPrmSearch = Convert.ToInt32(ddlTipoPrm.SelectedValue); BE.textPrmSearch = txtPrmSearch.Text.Trim(); if (chkRangeDate.Checked) { BE.prmDesde = txtDesde.Text; BE.prmHasta = txtHasta.Text; } gvHotels.DataSource = IService.IGetCompras(BE); gvHotels.PageIndex = npageIndex; gvHotels.DataBind(); txtBaseImponible.Text = IServiceHotel.IGetImponible(BEHotel, "2"); txtCantDoc.Text = IServiceHotel.IGeNumeroDocumentos(BEHotel, "C"); txtIGVTot.Text = IServiceHotel.IGeIGVCompras(BEHotel); }
/*Delete*/ public string DelCompras(BECompras BE) { string respuesta = string.Empty; try { using (DbCommand dbCmd = dbSQL.GetStoredProcCommand("SP_MANT_COMPRAS_DEL")) { dbSQL.AddInParameter(dbCmd, "@idCompras", DbType.String, BE.idCompras); using (IDataReader dataReader = dbSQL.ExecuteReader(dbCmd)) { int index1 = dataReader.GetOrdinal("respuesta"); object[] values = new object[dataReader.FieldCount]; while (dataReader.Read()) { dataReader.GetValues(values); respuesta = values[index1] == DBNull.Value ? string.Empty : values[index1].ToString(); } } return(respuesta.Substring(0, 1)); } } catch (Exception ex) { ExceptionManager.SaveError("Ocurrio un error en el logo", string.Empty, string.Empty, ex, "validateLoginUser", true, false); return("0"); } finally { } }
//private String cCodLocal //{ // get { return (String)ViewState["cCodLocal"]; } // set { ViewState.Add("cCodLocal", value); } //} protected void loadGridHotel(int npageIndex = 0) { ICompras IService = new ICompras(); BECompras BE = new BECompras(); BE.codPeriodo = ddlPeriodos.SelectedValue; gvHotels.DataSource = IService.IGetCompras(BE); gvHotels.PageIndex = npageIndex; gvHotels.DataBind(); }
public string UpdCompras(BECompras BE) { string respuesta = string.Empty; try { BEHotel User = new BEHotel(); using (DbCommand dbCmd = dbSQL.GetStoredProcCommand("SP_MANT_COMPRAS_UPD")) { dbSQL.AddInParameter(dbCmd, "@idCompras", DbType.String, BE.idCompras.ToUpper()); dbSQL.AddInParameter(dbCmd, "@tipoVenta", DbType.String, BE.tipoVenta.ToUpper()); dbSQL.AddInParameter(dbCmd, "@tipo", DbType.String, BE.tipo.ToUpper()); dbSQL.AddInParameter(dbCmd, "@fechaEmision", DbType.String, BE.fechaEmision.ToUpper()); dbSQL.AddInParameter(dbCmd, "@serie", DbType.String, BE.serie.ToUpper()); dbSQL.AddInParameter(dbCmd, "@numero", DbType.String, BE.numero.ToUpper()); dbSQL.AddInParameter(dbCmd, "@tipoPersona", DbType.String, BE.tipoPersona.ToUpper()); dbSQL.AddInParameter(dbCmd, "@tipoDocPersona", DbType.String, BE.tipoDocPersona.ToUpper()); dbSQL.AddInParameter(dbCmd, "@numDocumento", DbType.String, BE.numDocumento.ToUpper()); dbSQL.AddInParameter(dbCmd, "@razonSocialCliente", DbType.String, BE.razonSocialCliente.ToUpper()); dbSQL.AddInParameter(dbCmd, "@apePaterno", DbType.String, BE.apePaterno.ToUpper()); dbSQL.AddInParameter(dbCmd, "@apeMaterno", DbType.String, BE.apeMaterno.ToUpper()); dbSQL.AddInParameter(dbCmd, "@nombre1", DbType.String, BE.nombre1.ToUpper()); dbSQL.AddInParameter(dbCmd, "@nombre2", DbType.String, BE.nombre2.ToUpper()); dbSQL.AddInParameter(dbCmd, "@tipoMoneda", DbType.String, BE.tipoMoneda.ToUpper()); dbSQL.AddInParameter(dbCmd, "@codDestino", DbType.String, BE.codDestino.ToUpper()); dbSQL.AddInParameter(dbCmd, "@numeroDestino", DbType.String, BE.numeroDestino.ToUpper()); dbSQL.AddInParameter(dbCmd, "@baseImponibleOperGravada", DbType.String, BE.baseImponibleOperGravada.ToUpper()); dbSQL.AddInParameter(dbCmd, "@isc", DbType.String, BE.isc.ToUpper()); dbSQL.AddInParameter(dbCmd, "@igv", DbType.String, BE.igv.ToUpper()); dbSQL.AddInParameter(dbCmd, "@otros", DbType.String, BE.otros); dbSQL.AddInParameter(dbCmd, "@indicePercepcion", DbType.String, BE.indicePercepcion.ToUpper()); dbSQL.AddInParameter(dbCmd, "@tasaPercepcion", DbType.String, BE.tasaPercepcion.ToUpper()); dbSQL.AddInParameter(dbCmd, "@seriePercepcion", DbType.String, BE.seriePercepcion.ToUpper()); dbSQL.AddInParameter(dbCmd, "@numDocPercepcion", DbType.String, BE.numDocPercepcion.ToUpper()); dbSQL.AddInParameter(dbCmd, "@tipoTabla10", DbType.String, BE.tipoTabla10.ToUpper()); dbSQL.AddInParameter(dbCmd, "@serieDocOriginal", DbType.String, BE.serieDocOriginal.ToUpper()); dbSQL.AddInParameter(dbCmd, "@numDocOriginal", DbType.String, BE.numDocOriginal.ToUpper()); dbSQL.AddInParameter(dbCmd, "@fechaDocOriginal", DbType.String, BE.fechaDocOriginal.ToUpper()); dbSQL.AddInParameter(dbCmd, "@baseImponibleOperGravadaNC", DbType.String, BE.baseImponibleOperGravadaNC.ToUpper()); dbSQL.AddInParameter(dbCmd, "@IGVNC", DbType.String, BE.IGVNC.ToUpper()); dbSQL.AddInParameter(dbCmd, "@codLocal", DbType.String, BE.codLocal.ToUpper()); //dbSQL.AddInParameter(dbCmd, "@Num_Correlativo", DbType.String, BE.Num_Correlativo.ToUpper()); //dbSQL.AddInParameter(dbCmd, "@Fec_Contabilizacion", DbType.String, BE.Fec_Contabilizacion.ToUpper()); //dbSQL.AddInParameter(dbCmd, "@Uni_Negocio", DbType.String, BE.Uni_Negocio.ToUpper()); using (IDataReader dataReader = dbSQL.ExecuteReader(dbCmd)) { int index1 = dataReader.GetOrdinal("respuesta"); object[] values = new object[dataReader.FieldCount]; while (dataReader.Read()) { dataReader.GetValues(values); respuesta = values[index1] == DBNull.Value ? string.Empty : values[index1].ToString(); } } return(respuesta); } } catch (Exception ex) { ExceptionManager.SaveError("Ocurrio un error en el logo", string.Empty, string.Empty, ex, "validateLoginUser", true, false); return("0|" + ex.Message); } finally { } }
/*Select*/ public List <BECompras> GetCompras(BECompras prmBE) { string respuesta = string.Empty; try { List <BECompras> lstBE = new List <BECompras>(); BECompras BE = new BECompras(); using (DbCommand dbCmd = dbSQL.GetStoredProcCommand("SP_GET_COMPRAS_PERIODO")) { if (string.IsNullOrEmpty(prmBE.codLocal)) { dbSQL.AddInParameter(dbCmd, "@codLocal", DbType.String, DBNull.Value); } else { dbSQL.AddInParameter(dbCmd, "@codLocal", DbType.String, prmBE.codLocal); } dbSQL.AddInParameter(dbCmd, "@codPeriodo", DbType.String, prmBE.codPeriodo); dbSQL.AddInParameter(dbCmd, "@tipo", DbType.String, prmBE.tipoPrmSearch); if (string.IsNullOrEmpty(prmBE.textPrmSearch)) { dbSQL.AddInParameter(dbCmd, "@PrmBuscado", DbType.String, DBNull.Value); } else { dbSQL.AddInParameter(dbCmd, "@PrmBuscado", DbType.String, prmBE.textPrmSearch); } if (string.IsNullOrEmpty(prmBE.prmDesde)) { dbSQL.AddInParameter(dbCmd, "@fDesde", DbType.String, DBNull.Value); } else { dbSQL.AddInParameter(dbCmd, "@fDesde", DbType.String, prmBE.prmDesde); } if (string.IsNullOrEmpty(prmBE.prmHasta)) { dbSQL.AddInParameter(dbCmd, "@fHasta", DbType.String, DBNull.Value); } else { dbSQL.AddInParameter(dbCmd, "@fHasta", DbType.String, prmBE.prmHasta); } using (IDataReader dataReader = dbSQL.ExecuteReader(dbCmd)) { int tipoVenta = dataReader.GetOrdinal("tipoVenta"); int tipo = dataReader.GetOrdinal("tipo"); int fechaEmision = dataReader.GetOrdinal("fechaEmision"); int serie = dataReader.GetOrdinal("serie"); int numero = dataReader.GetOrdinal("numero"); int tipoPersona = dataReader.GetOrdinal("tipoPersona"); int tipoDocPersona = dataReader.GetOrdinal("tipoDocPersona"); int numDocumento = dataReader.GetOrdinal("numDocumento"); int razonSocialCliente = dataReader.GetOrdinal("razonSocialCliente"); int apePaterno = dataReader.GetOrdinal("apePaterno"); int apeMaterno = dataReader.GetOrdinal("apeMaterno"); int nombre1 = dataReader.GetOrdinal("nombre1"); int nombre2 = dataReader.GetOrdinal("nombre2"); int tipoMoneda = dataReader.GetOrdinal("tipoMoneda"); int codDestino = dataReader.GetOrdinal("codDestino"); int numeroDestino = dataReader.GetOrdinal("numeroDestino"); int baseImponibleOperGravada = dataReader.GetOrdinal("baseImponibleOperGravada"); int isc = dataReader.GetOrdinal("isc"); int igv = dataReader.GetOrdinal("igv"); int otros = dataReader.GetOrdinal("otros"); int indicePercepcion = dataReader.GetOrdinal("indicePercepcion"); int tasaPercepcion = dataReader.GetOrdinal("tasaPercepcion"); int seriePercepcion = dataReader.GetOrdinal("seriePercepcion"); int numDocPercepcion = dataReader.GetOrdinal("numDocPercepcion"); int tipoTabla10 = dataReader.GetOrdinal("tipoTabla10"); int serieDocOriginal = dataReader.GetOrdinal("serieDocOriginal"); int numDocOriginal = dataReader.GetOrdinal("numDocOriginal"); int fechaDocOriginal = dataReader.GetOrdinal("fechaDocOriginal"); int baseImponibleOperGravadaNC = dataReader.GetOrdinal("baseImponibleOperGravadaNC"); int IGVNC = dataReader.GetOrdinal("IGVNC"); int idCompras = dataReader.GetOrdinal("idCompras"); int codLocal = dataReader.GetOrdinal("codLocal"); int Num_Correlativo = dataReader.GetOrdinal("Num_Correlativo"); int Fec_Contabilizacion = dataReader.GetOrdinal("Fec_Contabilizacion"); int Uni_Negocio = dataReader.GetOrdinal("Uni_Negocio"); object[] values = new object[dataReader.FieldCount]; while (dataReader.Read()) { dataReader.GetValues(values); BE = new BECompras(); BE.tipoVenta = values[tipoVenta] == DBNull.Value ? string.Empty : values[tipoVenta].ToString(); BE.tipo = values[tipo] == DBNull.Value ? string.Empty : values[tipo].ToString(); BE.fechaEmision = values[fechaEmision] == DBNull.Value ? string.Empty : values[fechaEmision].ToString(); BE.serie = values[serie] == DBNull.Value ? string.Empty : values[serie].ToString(); BE.numero = values[numero] == DBNull.Value ? string.Empty : values[numero].ToString(); BE.tipoPersona = values[tipoPersona] == DBNull.Value ? string.Empty : values[tipoPersona].ToString(); BE.tipoDocPersona = values[tipoDocPersona] == DBNull.Value ? string.Empty : values[tipoDocPersona].ToString(); BE.numDocumento = values[numDocumento] == DBNull.Value ? string.Empty : values[numDocumento].ToString(); BE.razonSocialCliente = values[razonSocialCliente] == DBNull.Value ? string.Empty : values[razonSocialCliente].ToString(); BE.apePaterno = values[apePaterno] == DBNull.Value ? string.Empty : values[apePaterno].ToString(); BE.apeMaterno = values[apeMaterno] == DBNull.Value ? string.Empty : values[apeMaterno].ToString(); BE.nombre1 = values[nombre1] == DBNull.Value ? string.Empty : values[nombre1].ToString(); BE.nombre2 = values[nombre2] == DBNull.Value ? string.Empty : values[nombre2].ToString(); BE.tipoMoneda = values[tipoMoneda] == DBNull.Value ? string.Empty : values[tipoMoneda].ToString(); BE.codDestino = values[codDestino] == DBNull.Value ? string.Empty : values[codDestino].ToString(); BE.numeroDestino = values[numeroDestino] == DBNull.Value ? string.Empty : values[numeroDestino].ToString(); BE.baseImponibleOperGravada = values[baseImponibleOperGravada] == DBNull.Value ? string.Empty : values[baseImponibleOperGravada].ToString(); BE.isc = values[isc] == DBNull.Value ? string.Empty : values[isc].ToString(); BE.igv = values[igv] == DBNull.Value ? string.Empty : values[igv].ToString(); BE.otros = values[otros] == DBNull.Value ? string.Empty : values[otros].ToString(); BE.indicePercepcion = values[indicePercepcion] == DBNull.Value ? string.Empty : values[indicePercepcion].ToString(); BE.tasaPercepcion = values[tasaPercepcion] == DBNull.Value ? string.Empty : values[tasaPercepcion].ToString(); BE.seriePercepcion = values[seriePercepcion] == DBNull.Value ? string.Empty : values[seriePercepcion].ToString(); BE.numDocPercepcion = values[numDocPercepcion] == DBNull.Value ? string.Empty : values[numDocPercepcion].ToString(); BE.tipoTabla10 = values[tipoTabla10] == DBNull.Value ? string.Empty : values[tipoTabla10].ToString(); BE.serieDocOriginal = values[serieDocOriginal] == DBNull.Value ? string.Empty : values[serieDocOriginal].ToString(); BE.numDocOriginal = values[numDocOriginal] == DBNull.Value ? string.Empty : values[numDocOriginal].ToString(); BE.fechaDocOriginal = values[fechaDocOriginal] == DBNull.Value ? string.Empty : values[fechaDocOriginal].ToString(); BE.baseImponibleOperGravadaNC = values[baseImponibleOperGravadaNC] == DBNull.Value ? string.Empty : values[baseImponibleOperGravadaNC].ToString(); BE.IGVNC = values[IGVNC] == DBNull.Value ? string.Empty : values[IGVNC].ToString(); BE.idCompras = values[idCompras] == DBNull.Value ? string.Empty : values[idCompras].ToString(); BE.codLocal = values[codLocal] == DBNull.Value ? string.Empty : values[codLocal].ToString(); BE.Num_Correlativo = values[Num_Correlativo] == DBNull.Value ? string.Empty : values[Num_Correlativo].ToString(); BE.Fec_Contabilizacion = values[Fec_Contabilizacion] == DBNull.Value ? string.Empty : values[Fec_Contabilizacion].ToString(); BE.Uni_Negocio = values[Uni_Negocio] == DBNull.Value ? string.Empty : values[Uni_Negocio].ToString(); lstBE.Add(BE); } } return(lstBE); } } catch (Exception ex) { ExceptionManager.SaveError("Ocurrio un error en el logo", string.Empty, string.Empty, ex, "validateLoginUser", true, false); return(null); } finally { } }
public static string DelCompras(BECompras obj) { ICompras IService = new ICompras(); return(IService.IDelCompras(obj)); }
public static string InsUpdCompras(BECompras obj) { ICompras IService = new ICompras(); return(obj.idCompras == "0" ? IService.IInsCompras(obj) : IService.IUpdCompras(obj)); }
/*Delete*/ public string IDelCompras(BECompras BEVenta) { return(BL.DelComprasBL(BEVenta)); }
/*Insert*/ public string IInsCompras(BECompras BECompra) { return(BL.InsComprasBL(BECompra)); }
/*Update*/ public string IUpdCompras(BECompras BECompra) { return(BL.UpdComprasBL(BECompra)); }
/*Select*/ public List <BECompras> IGetCompras(BECompras BECompra) { return(BL.GetComprasBL(BECompra)); }
public string ComprasImportBL(string filename, string delimiter, BEUser userLocal) { // Create the new table List <BECompras> lstCompras = new List <BECompras>(); BECompras beCompra = new BECompras(); HotelsDA DAAR = new HotelsDA(); string[] nombreArchivo = filename.Split('\\'); int index = nombreArchivo.Length - 1; string resp; string idarchivo = ""; try { if (DAAR.ValidarArchivosCargados(nombreArchivo[index]) == "0") { //if (DA.InsArchivoCaragado(filename) == "1") resp = DAAR.InsArchivoCaragado(nombreArchivo[index], ref idarchivo); if (resp == "1") { List <string> lista = new List <string>(); //obtengo los datos del fichero. using (StreamReader fic = new StreamReader(filename)) { string linea = null; linea = fic.ReadLine(); while ((linea != null)) { lista.Add(linea); linea = fic.ReadLine(); } fic.Close(); } foreach (string registro in lista) { string[] columnNames = null; beCompra = new BECompras(); columnNames = registro.Split('|'); if (columnNames.Length <= 1) { throw new Exception("Existe una linea no valida"); } beCompra.Num_Correlativo = columnNames[0].Trim().ToUpper(); beCompra.Fec_Contabilizacion = columnNames[1].Trim().ToUpper(); beCompra.Uni_Negocio = columnNames[2].Trim().ToUpper(); beCompra.tipoVenta = columnNames[3].Trim().ToUpper(); beCompra.fechaEmision = columnNames[5].Trim().ToUpper(); beCompra.tipo = columnNames[4].Trim().ToUpper(); beCompra.serie = columnNames[6].Trim().ToUpper(); beCompra.numero = columnNames[7].Trim().ToUpper(); beCompra.tipoPersona = columnNames[8].Trim().ToUpper(); beCompra.tipoDocPersona = columnNames[9].Trim().ToUpper(); beCompra.numDocumento = columnNames[10].Trim().ToUpper(); beCompra.razonSocialCliente = columnNames[11].Trim().ToUpper(); beCompra.apePaterno = columnNames[12].Trim().ToUpper(); beCompra.apeMaterno = columnNames[13].Trim().ToUpper(); beCompra.nombre1 = columnNames[14].Trim().ToUpper(); beCompra.nombre2 = columnNames[15].Trim().ToUpper(); beCompra.tipoMoneda = columnNames[16].Trim().ToUpper(); beCompra.codDestino = columnNames[17].Trim().ToUpper(); beCompra.numeroDestino = columnNames[18].Trim().ToUpper(); beCompra.baseImponibleOperGravada = columnNames[19].Trim().ToUpper(); beCompra.isc = columnNames[20].Trim().ToUpper(); beCompra.igv = columnNames[21].Trim().ToUpper(); beCompra.otros = columnNames[22].Trim().ToUpper(); beCompra.indicePercepcion = columnNames[23].Trim().ToUpper(); beCompra.tasaPercepcion = columnNames[24].Trim().ToUpper(); beCompra.seriePercepcion = columnNames[25].Trim().ToUpper(); beCompra.numDocPercepcion = columnNames[26].Trim().ToUpper(); beCompra.tipoTabla10 = columnNames[27].Trim().ToUpper(); beCompra.serieDocOriginal = columnNames[28].Trim().ToUpper(); beCompra.numDocOriginal = columnNames[29].Trim().ToUpper(); beCompra.fechaDocOriginal = columnNames[30].Trim().ToUpper(); beCompra.baseImponibleOperGravadaNC = columnNames[31].Trim().ToUpper(); beCompra.IGVNC = columnNames[32].Trim().ToUpper(); lstCompras.Add(beCompra); } //Log_ImportarDA LOGIDA = new Log_ImportarDA(); //LOGIDA.Limpiar_Log(); ComprasDA DA = new ComprasDA(); return(DA.INSListCompras(lstCompras, userLocal, idarchivo)); } else { throw new Exception(resp); } } else { throw new Exception("El archivo ya se cargo anteriormente"); } } catch (Exception ex) { return("0| " + ex.Message); } // } // else // { // return resp; // } //} //else //{ // return "0:El archivo ya se cargo anteriormente"; //} }
/*Delete*/ public string DelComprasBL(BECompras BE) { return(DA.DelCompras(BE)); }
/*Insert*/ public string InsComprasBL(BECompras BE) { return(DA.InsCompras(BE)); }
/*Update*/ public string UpdComprasBL(BECompras BE) { return(DA.UpdCompras(BE)); }
/*Select*/ public List <BECompras> GetComprasBL(BECompras BE) { return(DA.GetCompras(BE)); }