public int update(LocalComercial_ENT datosLocalComercial) { try { using (SqlConnection sqlConn = new SqlConnection(this.ConexionPH)) { sqlConn.Open(); SqlCommand cmd = new SqlCommand(this.ConexionPH, sqlConn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "SP_UPDATE_LOCALCOMERCIAL_IDLOCALCOMERCIAL"; cmd.Parameters.AddWithValue("@id_local_comercial", datosLocalComercial.IdLocalComercial); cmd.Parameters.AddWithValue("@sitio", datosLocalComercial.Sitio); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { this.error = reader["error"].Equals(1) ? 1 : 0; } return(this.error); } } catch (Exception ex) { throw new Exception("Error al ejecutar SP_UPDATE_LOCALCOMERCIAL_IDLOCALCOMERCIAL", ex); } }
public LocalComercial_ENT getForIdLocalComercial(LocalComercial_ENT datosLocalComercial) { try { using (SqlConnection sqlConn = new SqlConnection(this.ConexionPH)) { sqlConn.Open(); SqlCommand cmd = new SqlCommand(this.ConexionPH, sqlConn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "SP_GET_LOCALCOMERCIAL_IDLOCALCOMERCIAL"; cmd.Parameters.AddWithValue("@id_local_comercial", datosLocalComercial.IdLocalComercial); SqlDataReader reader = cmd.ExecuteReader(); LocalComercial_ENT oLocalComercial = new LocalComercial_ENT(); if (reader.Read()) { oLocalComercial.IdLocalComercial = Convert.ToInt32(reader["id_local_comercial"]); oLocalComercial.Sitio = reader["sitio"].Equals(DBNull.Value) ? "" : Convert.ToString(reader["sitio"]); return(oLocalComercial); } else { return(null); } } } catch (Exception ex) { throw new Exception("Error al ejecutar SP_GET_LOCALCOMERCIAL_IDLOCALCOMERCIAL", ex); } }
public LocalComercial_ENT generaCodigo(string codigo) { string codigoProducto; LocalComercial_ENT oLocal = new LocalComercial_ENT(); oLocal = new LocalComercial_DAO().insertLocalComercial(codigo); int cantidad = oLocal.Cantidad; if (cantidad.ToString().Length == 1) { codigoProducto = codigo + "00" + cantidad; } else if (cantidad.ToString().Length == 2) { codigoProducto = codigo + "0" + cantidad; } else { codigoProducto = codigo + cantidad; } oLocal.CodigoProducto = codigoProducto; return(oLocal); }
public LocalComercial_ENT insertLocalComercial(string codigo) { try { using (SqlConnection sqlConn = new SqlConnection(this.ConexionPH)) { sqlConn.Open(); SqlCommand cmd = new SqlCommand(this.ConexionPH, sqlConn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "SP_INSERT_LOCALCOMERCIAL_VACIO"; cmd.Parameters.AddWithValue("@codigo", codigo); SqlDataReader reader = cmd.ExecuteReader(); LocalComercial_ENT oLocal = new LocalComercial_ENT(); while (reader.Read()) { oLocal.IdLocalComercial = Convert.ToInt32(reader["id_local_comercial"]); oLocal.Cantidad = Convert.ToInt32(reader["cantidad"]); } return(oLocal); } } catch (Exception ex) { throw new Exception("Error al ejecutar SP_INSERT_LOCALCOMERCIAL_VACIO", ex); } }
public LocalComercial_ENT datosLocal() { LocalComercial_ENT oLocal = new LocalComercial_ENT(); oLocal.Sitio = text_sitio.Text; return(oLocal); }
protected void btn_grabar_Click(object sender, EventArgs e) { if (this.validar()) { LocalComercial_ENT local = this.datosLocal(); local.IdLocalComercial = Convert.ToInt32(y.Text); new LocalComercial_BSS().updateLocalComercial(local); DetalleProducto_ENT oDetalleProducto = this.datosDetalleProducto(); oDetalleProducto.IdProducto = Convert.ToInt32(x.Text); oDetalleProducto.IdDetalle = Convert.ToInt32(z.Text); new DetalleProducto_BSS().updateDetalleProducto(oDetalleProducto); Response.Redirect("~/modulo/conjuntoHabitacional/Tabs/ProductoListado.aspx"); } }
protected void traeDatos(int IdProducto) { Producto_ENT oProducto = new Producto_ENT(); oProducto.IdProducto = IdProducto; productoENT = new Producto_BSS().getProductoID(oProducto); LocalComercial_ENT oLocalComercial = new LocalComercial_ENT(); oLocalComercial.IdLocalComercial = productoENT.IdReferencia; localComercialENT = new LocalComercial_BSS().getLocalComercialID(oLocalComercial); DetalleProducto_ENT oDetalleProducto = new DetalleProducto_ENT(); oDetalleProducto.IdProducto = IdProducto; detalleProductoENT = new DetalleProducto_BSS().getProductoDetalleIdProducto(oDetalleProducto); this.cargaDatosCajas(); }
protected void btn_grabar_Click(object sender, EventArgs e) { if (this.validar()) { LocalComercial_ENT oLocal = new LocalComercial_BSS().generaCodigo(codigo); LocalComercial_ENT local = this.datosLocal(); local.IdLocalComercial = oLocal.IdLocalComercial; new LocalComercial_BSS().updateLocalComercial(local); Producto_ENT oProducto = this.datosProducto(oLocal.IdLocalComercial); oProducto.CodigoProducto = oLocal.CodigoProducto; oProducto = new Producto_BSS().insert(oProducto); DetalleProducto_ENT oDetalleProducto = this.datosDetalleProducto(); oDetalleProducto.IdProducto = oProducto.IdProducto; oDetalleProducto = new DetalleProducto_BSS().insertDetalleProducto(oDetalleProducto); Response.Redirect("~/modulo/conjuntoHabitacional/Tabs/ProductoListado.aspx"); } }
public int updateLocalComercial(LocalComercial_ENT datosLocalComercial) { return(new LocalComercial_DAO().update(datosLocalComercial)); }
public LocalComercial_ENT getLocalComercialID(LocalComercial_ENT datosLocalComercial) { LocalComercial_ENT oLocalComercial = new LocalComercial_DAO().getForIdLocalComercial(datosLocalComercial); return(oLocalComercial); }
public void deleteLocalComercial(LocalComercial_ENT datosLocalComercial) { new LocalComercial_DAO().delete(datosLocalComercial); }
public LocalComercial_ENT insertLocalComercial(LocalComercial_ENT datosLocalComercial) { LocalComercial_ENT oLocalComercial = new LocalComercial_DAO().insert(datosLocalComercial); return(oLocalComercial); }