protected void btnAdd(object sender, EventArgs e) { Button btnAdd = GridView1.FooterRow.FindControl("btnAdd") as Button; if (btnAdd != null) { TextBox txtCodItem = GridView1.FooterRow.FindControl("txtCodItem") as TextBox; string CodItem = txtCodItem.Text; TextBox txtNomItem = GridView1.FooterRow.FindControl("txtNomItem") as TextBox; string NomItem = txtNomItem.Text; TextBox txtDscItem = GridView1.FooterRow.FindControl("txtDscItem") as TextBox; string DscItem = txtDscItem.Text; TextBox txtCantidad = GridView1.FooterRow.FindControl("txtCantidad") as TextBox; int Cantidad = 0; try { Cantidad = Convert.ToInt32(txtCantidad.Text); } catch (ExcepcionesPersonalizadas.Presentacion ex) { throw new ExcepcionesPersonalizadas.Presentacion("Debe indicar la cantidad de elementos del item"); } DropDownList ddlIndFact = GridView1.FooterRow.FindControl("ddlIndFact") as DropDownList; IndicadorFacturaType IndFact = LIndicadorFacturaType.BuscarIndicadorFactura(Convert.ToInt32(ddlIndFact.SelectedValue)); DropDownList ddlUniMed = GridView1.FooterRow.FindControl("ddlUniMed") as DropDownList; UnidadesDeMedida UniMed = LUnidadesDeMedida.BuscarUnidadDeMedida(Convert.ToInt32(ddlUniMed.SelectedValue)); Item_Rem Item = new Item_Rem(((List <Item_Rem>)Session["ItemsRem"]).Count + 1, CodItem, IndFact, NomItem, DscItem, Cantidad, UniMed); ((List <Item_Rem>)Session["ItemsRem"]).Add(Item); BindData(); } }
protected void Page_Load(object sender, EventArgs e) { #region Variables para Items Item_Det_Fact item = null; int NroLinDet = 0; string CodItem = ""; IndicadorFacturaType IndFact = null; string NomItem = ""; string DscItem = ""; int Cantidad = 0; UnidadesDeMedida UniMed = null; decimal PrecioUnitario = 0; decimal MontoItem = 0; #endregion #region Variables para Receptor string RutReceptor = ""; string RUCEmisor = ""; int Idemisor = 0; int CantCFE = 0; FechaType Fecha = null; string X509Certificate = ""; #endregion lblMensaje.Text = Logica.XMLAcces.buscarEnXML(""); }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { TextBox txtMonto = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtMonto"); DropDownList ddlCodRet = (DropDownList)GridView1.Rows[e.RowIndex].FindControl("ddlCodRet") as DropDownList; decimal Monto; try { Monto = Convert.ToDecimal(txtMonto.Text); } catch (ExcepcionesPersonalizadas.Presentacion ex) { throw new ExcepcionesPersonalizadas.Presentacion("Debe ingresar el monto"); } CodRetType cod = LCodRet.BuscarCodRet(ddlCodRet.SelectedItem.Text); RetencPercepType ret = new RetencPercepType(cod, Monto); DropDownList ddlIndFact = GridView1.Rows[e.RowIndex].FindControl("ddlIndFact") as DropDownList; int idInd = Convert.ToInt32(ddlIndFact.SelectedValue); IndicadorFacturaType IndFact = LIndicadorFacturaType.BuscarIndicadorFactura(idInd); List <RetencPercepType> l = new List <EntidadesCompartidas.RetencPercepType>(); l.Add(ret); Item_Resg item = new Item_Resg(((List <Item_Resg>)Session["ItemsRes"]).Count, IndFact, l); GridView1.EditIndex = -1; BindData(); }
public static void ModificarIndicadorFactura(IndicadorFacturaType i) { ValidarIndicadorFactura(i); int retorno = PIndicadorFacturaType.ModificarIndicadorFacturaType(i); if (retorno == -1) { throw new ExcepcionesPersonalizadas.Logica("No se ha podido modificar, no existe un indicador de factura con es eidentificador"); } }
//Alta public static void AltaIndicadorFactura(IndicadorFacturaType i) { ValidarIndicadorFactura(i); int retorno = PIndicadorFacturaType.AltaIndicadorFacturaType(i); if (retorno == -1) { throw new ExcepcionesPersonalizadas.Logica("Ya hay un indicador con ese identificador"); } }
//Buscar public static IndicadorFacturaType BuscarIndicadorFactura(int id) { IndicadorFacturaType retorno = PIndicadorFacturaType.BuscarIndicadorFacturaType(id); if (retorno == null) { throw new ExcepcionesPersonalizadas.Logica("No se encontró el indicador de facturación"); } return(retorno); }
public Item_Det_Fact_Exp(int NroLinDet, string CodItem, IndicadorFacturaType IndFact, string NomItem, string DscItem, int Cantidad, UnidadesDeMedida UniMed, decimal PrecioUnitario) : base(NroLinDet, CodItem, IndFact, NomItem, DscItem, Cantidad, UniMed, PrecioUnitario) { }
public static List <IndicadorFacturaType> ListarIndicadorFacturaType() { SqlConnection conexion = null; SqlDataReader lectorDatos = null; try { conexion = new SqlConnection(DatosConexion.CadenaConexion); SqlCommand comando = conexion.CreateCommand(); comando.CommandText = "ListarIndicadorFacturaType"; comando.CommandType = CommandType.StoredProcedure; conexion.Open(); lectorDatos = comando.ExecuteReader(); List <IndicadorFacturaType> cod = new List <IndicadorFacturaType>(); IndicadorFacturaType ag = null; while (lectorDatos.Read()) { ag = new IndicadorFacturaType( (int)lectorDatos["Id"], (string)lectorDatos["nombre"], (bool)lectorDatos["Habilitado"] ); cod.Add(ag); } return(cod); } catch (Exception) { throw new ExcepcionesPersonalizadas.Persistencia("No se pudo conseguir la listas de " + mensaje + "."); } finally { if (lectorDatos != null) { lectorDatos.Close(); } if (conexion != null) { conexion.Close(); } } }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { TextBox txtCodItem = GridView1.Rows[e.RowIndex].FindControl("txtCodItem") as TextBox; if (txtCodItem != null) { string CodItem = txtCodItem.Text; TextBox txtNomItem = GridView1.Rows[e.RowIndex].FindControl("txtNomItem") as TextBox; string NomItem = txtNomItem.Text; TextBox txtDscItem = GridView1.Rows[e.RowIndex].FindControl("txtDscItem") as TextBox; string DscItem = txtDscItem.Text; TextBox txtCantidad = GridView1.Rows[e.RowIndex].FindControl("txtCantidad") as TextBox; int Cantidad = 0; try { Cantidad = Convert.ToInt32(txtCantidad.Text); } catch (ExcepcionesPersonalizadas.Presentacion ex) { throw new ExcepcionesPersonalizadas.Presentacion("Debe indicar la cantidad de elementos del item"); } TextBox txtPrecioUnitario = GridView1.Rows[e.RowIndex].FindControl("txtPrecioUnitario") as TextBox; decimal PrecioUnitario = 0; try { PrecioUnitario = Convert.ToInt32(txtPrecioUnitario.Text); } catch (ExcepcionesPersonalizadas.Presentacion ex) { throw new ExcepcionesPersonalizadas.Presentacion("Debe indicar el Precio de el elemento del item"); } DropDownList ddlIndFact = GridView1.Rows[e.RowIndex].FindControl("ddlIndFact") as DropDownList; IndicadorFacturaType IndFact = LIndicadorFacturaType.BuscarIndicadorFactura(Convert.ToInt32(ddlIndFact.SelectedValue)); DropDownList ddlUniMed = GridView1.Rows[e.RowIndex].FindControl("ddlUniMed") as DropDownList; UnidadesDeMedida UniMed = LUnidadesDeMedida.BuscarUnidadDeMedida(Convert.ToInt32(ddlUniMed.SelectedValue)); Label lblNroLinDet = GridView1.Rows[e.RowIndex].FindControl("lblNroLinDet") as Label; int NroLinDet = Convert.ToInt32(lblNroLinDet.Text); Item_Det_Fact Item = new Item_Det_Fact(NroLinDet, CodItem, IndFact, NomItem, DscItem, Cantidad, UniMed, PrecioUnitario); ((List <Item_Det_Fact>)Session["ItemsFact"])[e.RowIndex] = Item; GridView1.EditIndex = -1; BindData(); } }
public static IndicadorFacturaType BuscarIndicadorFacturaType(int id) { SqlConnection conexion = null; SqlDataReader lectorDatos = null; try { conexion = new SqlConnection(DatosConexion.CadenaConexion); SqlCommand comando = conexion.CreateCommand(); comando.CommandText = "BuscarIndicadorFacturaType"; comando.CommandType = CommandType.StoredProcedure; comando.Parameters.AddWithValue("@id", id); conexion.Open(); lectorDatos = comando.ExecuteReader(); IndicadorFacturaType ret = null; if (lectorDatos.Read()) { int Id = (int)lectorDatos["Id"]; string Nombre = Convert.ToString(lectorDatos["Nombre"]); bool Habilitado = (bool)lectorDatos["Habilitado"]; ret = new IndicadorFacturaType(Id, Nombre, Habilitado); } return(ret); } catch (Exception) { throw new ExcepcionesPersonalizadas. Persistencia("No se pudo buscar " + mensaje + "."); } finally { if (lectorDatos != null) { lectorDatos.Close(); } if (conexion != null) { conexion.Close(); } } }
public Item_Rem(int NroLinDet, string CodItem, IndicadorFacturaType IndFact, string NomItem, string DscItem, int Cantidad, UnidadesDeMedida UniMed ) { this.NroLinDet = NroLinDet; this.CodItem = CodItem; this.IndFact = IndFact; this.NomItem = NomItem; this.DscItem = DscItem; this.Cantidad = Cantidad; this.UniMed = UniMed; }
public Item_Det_Fact(int NroLinDet, string CodItem, IndicadorFacturaType IndFact, string NomItem, string DscItem, int Cantidad, UnidadesDeMedida UniMed, decimal PrecioUnitario) { this.NroLinDet = NroLinDet; this.CodItem = CodItem; this.IndFact = IndFact; this.NomItem = NomItem; this.DscItem = DscItem; this.Cantidad = Cantidad; this.UniMed = UniMed; this.PrecioUnitario = PrecioUnitario; }
public static int ModificarIndicadorFacturaType(IndicadorFacturaType a) { SqlConnection conexion = null; try { conexion = new SqlConnection(DatosConexion.CadenaConexion); SqlCommand comando = conexion.CreateCommand(); comando.CommandText = "ModificarIndicadorFacturaType"; comando.CommandType = CommandType.StoredProcedure; comando.Parameters.AddWithValue("@Id", a.Id); comando.Parameters.AddWithValue("@Nombre", a.Nombre); SqlParameter valorRetorno = new SqlParameter("@valorRetorno", SqlDbType.Int); valorRetorno.Direction = ParameterDirection.ReturnValue; comando.Parameters.Add(valorRetorno); conexion.Open(); int filasAfectadas = comando.ExecuteNonQuery(); if ((int)valorRetorno.Value == -2) { throw new Exception(); } return((int)valorRetorno.Value); } catch (Exception) { throw new ExcepcionesPersonalizadas.Persistencia("No se pudo modificar " + mensaje + "."); } finally { if (conexion != null) { conexion.Close(); } } }
public static void ValidarIndicadorFactura(IndicadorFacturaType i) { if (i == null) { throw new ExcepcionesPersonalizadas.Logica("No es un indicador de facturación válido."); } if (i.Habilitado) { throw new ExcepcionesPersonalizadas.Logica("El indicador de facturación está deshabilitado"); } if (string.IsNullOrWhiteSpace(i.Nombre) || string.IsNullOrEmpty(i.Nombre)) { throw new ExcepcionesPersonalizadas.Logica("El nombre del indicador de facturación no puede quedar vacío"); } if (string.IsNullOrWhiteSpace(i.Id.ToString()) || string.IsNullOrEmpty(i.Id.ToString())) { throw new ExcepcionesPersonalizadas.Logica("El nombre del indicador de facturación no puede quedar vacío"); } }
protected void btnAdd(object sender, EventArgs e) { Button btnAdd = GridView1.FooterRow.FindControl("btnAdd") as Button; if (btnAdd != null) { TextBox txtNewMonto = GridView1.FooterRow.FindControl("txtMonto") as TextBox; if (txtNewMonto != null) { DropDownList ddlCodRetFoot = GridView1.FooterRow.FindControl("ddlCodRet") as DropDownList; if (ddlCodRetFoot != null) { string id = ddlCodRetFoot.SelectedItem.Text; decimal MontoNuevo; try { MontoNuevo = Convert.ToInt32(txtNewMonto.Text); } catch (ExcepcionesPersonalizadas.Presentacion ex) { throw new ExcepcionesPersonalizadas.Presentacion("Debe ingresar el monto nuevo"); } DropDownList ddlIndFact = GridView1.FooterRow.FindControl("ddlIndFact") as DropDownList; int idInd = Convert.ToInt32(ddlIndFact.SelectedValue); IndicadorFacturaType IndFact = LIndicadorFacturaType.BuscarIndicadorFactura(idInd); CodRetType cod = LCodRet.BuscarCodRet(id); RetencPercepType ret = new RetencPercepType(cod, MontoNuevo); List <RetencPercepType> l = new List <EntidadesCompartidas.RetencPercepType>(); l.Add(ret); Item_Resg item = new Item_Resg(((List <Item_Resg>)Session["ItemsRes"]).Count, IndFact, l); BindData(); } } } }
public Item_Resg(int NroLinDet, IndicadorFacturaType IndFact, List <RetencPercepType> retencPercep) { this.NroLinDet = NroLinDet; this.IndFact = IndFact; RetencPercep = retencPercep; }