public AnuncioFacade() { dao = new SqlServerDao(); anuncioBo = new AnuncioBO(dao); usuarioBO = new UsuarioBO(dao); categoriaBO = new CategoriaBO(dao); }
private void btnGuardar_Click(object sender, EventArgs e) { try { if (txtCateg.Text == "") { MessageBox.Show(" No ingreso la Categoría, favor revise la información", "Registro Categoría fallo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { cbo = new CategoriaBO(); Categoria mc = new Categoria() { NombreCategoria = txtCateg.Text, }; cbo.IngresarCategoria(mc); dataGridCateg.DataSource = cbo.GetCateg(); this.dataGridCateg.Columns[0].Visible = false; } } catch (Exception) { MessageBox.Show(" Faltan datos, favor revise la informacion", "Registro Categoría fallo", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void frmCategoria_Load(object sender, EventArgs e) { cbo = new CategoriaBO(); dataGridCateg.DataSource = cbo.GetCateg(); this.dataGridCateg.Columns[0].Visible = false; dataGridCateg.Columns[1].Width = 150; }
private void btnSalvar_Click(object sender, EventArgs e) { categoriaBo = new CategoriaBO(); categoria = new Categoria(); if (txtCategoria.Text.Trim() == string.Empty) { txtCategoria.Focus(); MessageBox.Show("Informe a categoria do produto !!!", "Atenção - campo vazio", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } categoria._Nome = txtCategoria.Text; novaCategoria = txtCategoria.Text; categoriaBo.GravarCategoria(categoria); MessageBox.Show("Categoria do produto foi gravado com sucesso", "Gravação OK", MessageBoxButtons.OK, MessageBoxIcon.Information); txtCategoria.Text = string.Empty; NovaCategoria(false); this.Close(); }
public ActionResult AgregarVotacion(string Nombre, string TiempoPreparacion, HttpPostedFileBase Portada, string IDC, string Precio, string Descrip) { VotacionBo ObjBO = new VotacionBo(); CategoriaBO objC = new CategoriaBO(); Galeria obJGa = new Galeria(); ObjBO.Nombre = Nombre; ObjBO.FechaCreacion = DateTime.Now; ObjBO.Preparacion = TiempoPreparacion; ObjBO.Estado = false; if (Portada != null && Portada.ContentLength > 0) { string imgfile = Portada.FileName; ObjBO.Portada = new byte[Portada.ContentLength]; Portada.InputStream.Read(ObjBO.Portada, 0, Portada.ContentLength); } ObjBO.Precio = Precio; ObjBO.Descripcion = Descrip; ObjBO.IDCategoria = int.Parse(IDC); ObjBO.IDusuario = int.Parse(Session["Usuario"].ToString()); ObjModel.AgregarPlatilloTem(ObjBO); return(RedirectToAction("VotacionPlatillo")); }
public int EstatusCategoria(CategoriaBO ObjBO) { SqlCommand cmd = new SqlCommand("UPDATE CATEGORIA SET ESTADO = @ESTADO WHERE ID = @ID"); cmd.Parameters.Add("@ID", SqlDbType.Int).Value = ObjBO.IDCT; cmd.Parameters.Add("@ESTADO", SqlDbType.Bit).Value = ObjBO.Estado; return(ObjConexion.EjecutarComando(cmd)); }
private void FrmDepartamento_Load(object sender, EventArgs e) { cbo = new CategoriaBO(); dataGridCateg.DataSource = cbo.GetCateg(); this.dataGridCateg.Columns[0].Visible = false; dataGridCateg.Columns[1].Width = 210; dataGridCateg.Columns[1].HeaderText = "Descripción Departamento"; }
public int EliminarCat(CategoriaBO ObjBO) { SqlCommand cmd = new SqlCommand("Update CATEGORIA SET ESTADO=@ESTADO Where ID=@id"); cmd.Parameters.Add("@id", SqlDbType.Int).Value = ObjBO.IDCT; cmd.Parameters.Add("@ESTADO", SqlDbType.Bit).Value = ObjBO.Estado; cmd.CommandType = CommandType.Text; return(ObjConexion.EjecutarComando(cmd)); }
public int Agregar(CategoriaBO ObjBO) { SqlCommand cmd = new SqlCommand("insert into CATEGORIA (NOMBRE, FECHACREACION, ESTADO) values (@NOMBRE, @FECHACREACION, @ESTADO)"); cmd.Parameters.Add("@NOMBRE", SqlDbType.VarChar).Value = ObjBO.Nombre; cmd.Parameters.Add("@FECHACREACION", SqlDbType.Date).Value = ObjBO.FechaCreacion; cmd.Parameters.Add("@ESTADO", SqlDbType.Bit).Value = ObjBO.Estado; cmd.CommandType = CommandType.Text; return(ObjConexion.EjecutarComando(cmd)); }
public ActionResult Eliminarcat(string ID) { CategoriaBO objBO = new CategoriaBO(); objBO.IDCT = int.Parse(ID); objBO.Estado = false; Objcat.EliminarCat(objBO); RegistarCategorias(); return(View("RegistarCategorias")); }
public ActionResult Agregar(string Nombre) { CategoriaBO ObjBO = new CategoriaBO(); ObjBO.Nombre = Nombre; ObjBO.FechaCreacion = DateTime.Now; ObjBO.Estado = true; Objcat.Agregar(ObjBO); RegistarCategorias(); return(RedirectToAction("RegistarCategorias")); }
void CargarCategorias() { /* * //Cargando las categorías * * */ _listaCategorias = CategoriaBO.DevolverTodos(); cboCategoria.DataSource = _listaCategorias; cboCategoria.ValueMember = "Descripcion"; cboCategoria.DisplayMember = "Descripcion"; }
private void frmArticulo_Load_1(object sender, EventArgs e) { this.Size = new Size(437, 431); cbo = new CategoriaBO(); mbo = new MarcaBO(); List <Categoria> dims = cbo.GetCateg(); cmbDepartamento.Items.AddRange(dims.ToArray <Categoria>()); List <Marca> marc = mbo.GetMarcas(); cmbMarca.Items.AddRange(marc.ToArray <Marca>()); rdbImpSi.Checked = true; }
private void frmArticulos_Load(object sender, EventArgs e) { cbo = new CategoriaBO(); mbo = new MarcaBO(); List <Categoria> dims = cbo.GetCateg(); cmbDepartamento.Items.AddRange(dims.ToArray <Categoria>()); List <Marca> marc = mbo.GetMarcas(); cmbMarca.Items.AddRange(marc.ToArray <Marca>()); rdbImpSi.Checked = true; radBCodigo.Checked = true; this.cargarArtInv(); }
public void PopulaCategoria() { CategoriaBO categoriaBO = new CategoriaBO(); DataTable dt = new DataTable(); dt = categoriaBO.CriaDataTableCategoria(); txtCategoriaProduto.Items.Clear(); foreach (DataRow item in dt.Rows) { txtCategoriaProduto.Items.Add(item["nome"].ToString()); } }
public DataSet devuelveCategoria(object obj) { string cadenaWhere = ""; bool edo = false; CategoriaBO data = (CategoriaBO)obj; cmd = new SqlCommand(); da = new SqlDataAdapter(); con = new Conexion(); cmd.Connection = con.estableserconexion(); con.Abrirconexion(); if (data.Idcategoria > 0) { cadenaWhere = cadenaWhere + " IDcategoria=@IDcategoria and"; cmd.Parameters.Add("@IDcategoria", SqlDbType.Int); cmd.Parameters["@IDcategoria"].Value = data.Idcategoria; edo = true; } if (data.Nombre != null) { cadenaWhere = cadenaWhere + " Tipo=@Tipo and"; cmd.Parameters.Add("@Tipo", SqlDbType.VarChar); cmd.Parameters["@Tipo"].Value = data.Nombre; edo = true; } if (data.Liga != null) { cadenaWhere = cadenaWhere + " IDliga=@IDliga and"; cmd.Parameters.Add("@IDliga", SqlDbType.Int); cmd.Parameters["@IDliga"].Value = data.Liga; edo = true; } if (edo == true) { cadenaWhere = " WHERE " + cadenaWhere.Remove(cadenaWhere.Length - 3, 3); } sql = " SELECT * FROM Categoria"; //cmd = new SqlCommand(sql, cmd.Connection); cmd.CommandText = sql; da.SelectCommand = cmd; da.Fill(dsCategoria); con.Cerrarconexion(); return(dsCategoria); }
public List <CategoriaBO> listaCat() { string query = ("select ID, NOMBRE from CATEGORIA WHERE ESTADO=1"); var result = ObjConex.TablaConsulta(query); List <CategoriaBO> ListaCat = new List <CategoriaBO>(); foreach (DataRow Medida in result.Rows) { var catbo = new CategoriaBO(); catbo.IDCT = int.Parse(Medida[0].ToString()); catbo.Nombre = Medida[1].ToString(); ListaCat.Add(catbo); } return(ListaCat); }
private void FrmRegistro_Load(object sender, EventArgs e) { try { lblMensaje.Text = ""; pbo = new ParticipanteBO(); dbo = new DimensionBO(); cbo = new CategoriaBO(); cbxDimension.DataSource = dbo.CargarDimensiones(); chbCategorias.Items.AddRange(cbo.CargarCategorias().ToArray <Categoria>()); } catch (Exception ex) { lblMensaje.Text = ex.Message.Replace("[0-9]*", ""); } }
public ActionResult AgregarPlatillo(HttpPostedFileBase algo, string Nombre, string TiempoPreparacion, string IDC, HttpPostedFileBase Portada, string Precio /*HttpPostedFileBase[] Imagen*/) { PlatilloBO ObjBO = new PlatilloBO(); CategoriaBO objC = new CategoriaBO(); Galeria obJGa = new Galeria(); ObjBO.Nombre = Nombre; if (algo != null && algo.ContentLength > 0) { string namefile = algo.FileName; ObjBO.Recetario = new byte[algo.ContentLength]; algo.InputStream.Read(ObjBO.Recetario, 0, algo.ContentLength); } ObjBO.TiempoPreparacion = TiempoPreparacion; ObjBO.FechaCreacion = DateTime.Now; ObjBO.IDC = int.Parse(IDC); ObjBO.Estado = true; if (Portada != null && Portada.ContentLength > 0) { string imgfile = Portada.FileName; ObjBO.Portada = new byte[Portada.ContentLength]; Portada.InputStream.Read(ObjBO.Portada, 0, Portada.ContentLength); } ObjBO.Precio = Precio; ObjBO.IDUSUARIO = int.Parse(Session["Usuario"].ToString()); //if (Imagen != null && Imagen.Length > 0) //{ // for (int i = 0; i < Imagen.Length; i++) // { // string imgfile = Imagen[i].FileName; // obJGa.Imagen = new byte[Imagen[i].ContentLength]; // Imagen[i].InputStream.Read(obJGa.Imagen, 0, Imagen[i].ContentLength); // } //} //obJGa.Estado = true; //obJGa.Fecha = DateTime.Now; //obJGa.Id_platillo = ObjModel.AgregarPlatillo(ObjBO); //ObjModel.AgregarGaleria(obJGa); return(RedirectToAction("RegistroPlatillo")); }
public int ActualizarCategoria(object obj) { CategoriaBO data = (CategoriaBO)obj; cmd.Connection = con.estableserconexion(); con.Abrirconexion(); sql = "update Categoria set Tipo = '" + data.Nombre + "', IDliga = '" + data.Liga2 + "' where IDcategoria = '" + data.Idcategoria + "'"; cmd.CommandText = sql; int valor = cmd.ExecuteNonQuery(); con.Cerrarconexion(); if (valor <= 0) { return(0); } return(1); }
public int NuevaCategoria(object obj) { CategoriaBO data = (CategoriaBO)obj; cmd.Connection = con.estableserconexion(); con.Abrirconexion(); sql = "insert into Categoria (Tipo, IDliga) values('" + data.Nombre.Trim() + "', '" + data.Liga2 + "')"; cmd.CommandText = sql; int valor = cmd.ExecuteNonQuery(); con.Cerrarconexion(); if (valor <= 0) { return(0); } return(1); }
public int EliminarCategoria(object obj) { CategoriaBO data = (CategoriaBO)obj; cmd.Connection = con.estableserconexion(); con.Abrirconexion(); sql = "delete from Categoria where IDcategoria = '" + data.Idcategoria + "'"; cmd.CommandText = sql; int valor = cmd.ExecuteNonQuery(); con.Cerrarconexion(); if (valor <= 0) { return(0); } return(1); }
private void btnOk_Click(object sender, EventArgs e) { if (Comprobar()) { Categoria _categoria = new Categoria(); _categoria.Descripcion = txtDescripcion.Text; //Comprobando si existe la categoría if (CategoriaBO.Existe(_categoria)) { DialogResult resultado = MessageBox.Show("La descripción de la categoría concuerda \n con una que existe, escriba otra"); } else { DialogResult resultado = MessageBox.Show("¿Está seguro?", "Guardar categoría", MessageBoxButtons.YesNo); if (resultado == DialogResult.No) { txtDescripcion.Focus(); } else { _categoria.IdCategoria = CategoriaBO.Crear(_categoria); CategoriaCreada = _categoria; MessageBox.Show(string.Format("Categoría creada: {0} Id: ({1})", _categoria.Descripcion, _categoria.IdCategoria)); if (Hecho != null) { Hecho(true); } this.DialogResult = DialogResult.OK; this.Close(); } } } }
public DataSet devuelveCategorias(object obj) { string cadenaWhere = ""; bool edo = false; CategoriaBO data = (CategoriaBO)obj; cmd.Connection = con.estableserconexion(); con.Abrirconexion(); //select * from alumno where matricula=@matricula if (data.Id > 0) { cadenaWhere = cadenaWhere + " IDcategoria=@IDcategoria and"; cmd.Parameters.Add("@IDcategoria", SqlDbType.Int); cmd.Parameters["@IDcategoria"].Value = data.Id; edo = true; } if (data.Tipo != null) { cadenaWhere = " Tipo=@Tipo and"; cmd.Parameters.Add("@Tipo", SqlDbType.VarChar); cmd.Parameters["@Tipo"].Value = data.Tipo; edo = true; } if (edo == true) { cadenaWhere = " WHERE " + cadenaWhere.Remove(cadenaWhere.Length - 3, 3); } sql = "select * from Categoria" + cadenaWhere; cmd.CommandText = sql; da.SelectCommand = cmd; da.Fill(dscategoria); con.Cerrarconexion(); return(dscategoria); }
private void btnEliminar_Click(object sender, EventArgs e) { cbo = new CategoriaBO(); if (MessageBox.Show("Realmente desea Eliminar la Marca?", " Eliminar Marca", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (lblID.Text != " ") { if (cbo.EliminaCategoria(Int32.Parse(lblID.Text)) == true) { MessageBox.Show("Se ha eliminado la Marca", "Eliminar Marca Exitoso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); dataGridCateg.DataSource = cbo.GetCateg(); this.dataGridCateg.Columns[0].Visible = false; } else { MessageBox.Show(" No ha seleccionado ningúna Marca", "Eliminar Marca Fallo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
public CategoriaFacade() { dao = new SqlServerDao(); categoriaBo = new CategoriaBO(dao); }