public ActionResult EliminarTalla(FormCollection frm) { try { if (frm["btnEliminar"] != null) { Talla t = new Talla(); t.estado = frm["txtEstado"].ToString(); t.idTalla = Convert.ToInt32(frm["txtidTalla"]); Boolean elimino = logTalla.Instancia.EliminarTalla(t); if (elimino != false) { return(RedirectToAction("ListarTalla", "Talla")); } else { return(View()); } } else { return(RedirectToAction("ListarTalla", "Talla")); } } catch (Exception e) { throw e; } }
public List <Talla> obtener_lista_tallas_summary(int summary) { List <Talla> lista = new List <Talla>(); Conexion con = new Conexion(); try{ SqlCommand com = new SqlCommand(); SqlDataReader leer = null; com.Connection = con.AbrirConexion(); com.CommandText = "SELECT TALLA_ITEM,CANTIDAD,EXTRAS,EJEMPLOS FROM ITEM_SIZE WHERE ID_SUMMARY='" + summary + "' ORDER by TALLA_ITEM asc "; leer = com.ExecuteReader(); while (leer.Read()) { Talla t = new Talla(); t.id_talla = Convert.ToInt32(leer["TALLA_ITEM"]); t.talla = consultas.obtener_size_id(Convert.ToString(leer["TALLA_ITEM"])); t.total = Convert.ToInt32(leer["CANTIDAD"]); t.extras = Convert.ToInt32(leer["EXTRAS"]); t.ejemplos = Convert.ToInt32(leer["EJEMPLOS"]); lista.Add(t); } leer.Close(); }finally { con.CerrarConexion(); con.Dispose(); } return(lista); }
public ActionResult NuevaTalla(FormCollection frm) { try { if (frm["btnRegistrar"] != null) { Talla t = new Talla(); t.Nombre = frm["txtNombre"].ToString(); t.Descripcion = frm["txtDescripcion"].ToString(); Boolean inserta = logTalla.Instancia.InsertarTalla(t); if (inserta != false) { return(RedirectToAction("ListarTalla")); } else { return(View()); } } else { return(RedirectToAction("ListarTalla")); } } catch (Exception e) { throw e; } }
public ActionResult EditarTalla(FormCollection frm) { try { if (frm["btnActualizar"] != null) { Talla t = new Talla(); t.Nombre = frm["txtNombre"].ToString(); t.Descripcion = frm["txtDescripcion"].ToString(); t.idTalla = Convert.ToInt16(frm["txtidDiseño"]); Boolean edito = logTalla.Instancia.EditarTalla(t); if (edito != false) { return(RedirectToAction("ListarTalla")); } else { return(View()); } } else { return(RedirectToAction("ListarTalla")); } } catch (Exception e) { throw e; } }
public Boolean EliminarTalla(Talla t) { try { return(datTalla.Instancia.EliminarTalla(t)); } catch (Exception e) { throw e; } }
/* * Autor: Luis Carlos Pedroza Pineda * Método que trae las talla y el genero de una camiseta */ public TallaGenero GetTallaGenero(Talla talla, Genero genero) { var consulta = from tg in db.TallasGenero where tg.TallaId == talla.Id && tg.GeneroId == genero.Id select tg; return(consulta.SingleOrDefault()); }
public static Talla rowToDto(TallaDS.TallasRow row) { Talla objTalla = new Talla(); objTalla.pkTalla = row.pkTalla; objTalla.txtNombre = row.txtNombre; return(objTalla); }
public ActionResult DeleteConfirmed(int id) { Talla talla = db.Talla.Find(id); db.Talla.Remove(talla); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult NuevoProducto(FormCollection frm, HttpPostedFileBase archivo) { int idCategoria = Convert.ToInt32(frm["categorias"].Equals("") ? "0" : frm["categorias"]); int idtalla = Convert.ToInt32(frm["tallas"].Equals("") ? "0" : frm["tallas"]); int idDiseño = Convert.ToInt32(frm["diseños"].Equals("") ? "0" : frm["diseños"]); int idColor = Convert.ToInt32(frm["colores"].Equals("") ? "0" : frm["colores"]); Producto p = new Producto(); try { if (frm["btnRegistrar"] != null) { p.Nombre = frm["txtNombre"].ToString(); p.Serie = frm["txtSerie"].ToString(); p.Precio = Convert.ToDecimal(frm["txtPrecio"]); p.Stock = Convert.ToInt16(frm["txtStock"]); p.Descripcion = frm["txtDescripcion"].ToString(); if (archivo != null && archivo.ContentLength > 0) { p.Imagen = Path.GetFileName(archivo.FileName); } Categoria c = new Categoria(); c.idCategoria = idCategoria; p.categoria = c; Talla t = new Talla(); t.idTalla = idtalla; p.talla = t; Diseño d = new Diseño(); d.idDiseño = idDiseño; p.diseño = d; Color co = new Color(); co.idColor = idColor; p.color = co; Boolean inserto = logProducto.Instancia.InsertarProducto(p); if (inserto != false) { if (archivo != null && archivo.ContentLength > 0) { var namearchivo = Path.GetFileName(archivo.FileName); var ruta = Path.Combine(Server.MapPath("~/Recursos/Imagenes/Productos"), namearchivo); archivo.SaveAs(ruta); } return(RedirectToAction("ListarProducto")); } else { return(View()); } } else { return(RedirectToAction("ListarProducto")); } } catch (Exception e) { throw e; } }
public ActionResult EditarTalla(String id) { try { Talla t = logTalla.Instancia.BuscarTalla(Convert.ToInt16(id)); return(View(t)); } catch (Exception e) { throw e; } }
public ActionResult Edit([Bind(Include = "Id,Talla1,Num_Talla")] Talla talla) { if (ModelState.IsValid) { db.Entry(talla).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(talla)); }
public static Talla Obtener(int idTalla) { List <Talla> lista = new List <Talla>(); lista = TallaLN.ObtenerTodos(); Talla tP = new Talla(); tP = (lista.Find(elemento => elemento.id == idTalla)); return(tP); }
public ActionResult Create([Bind(Include = "Id,Talla1,Num_Talla")] Talla talla) { if (ModelState.IsValid) { db.Talla.Add(talla); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(talla)); }
public ActionResult Edit([Bind(Include = "IdTalla,Nombre,Descripcion")] Talla talla) { try { db.sp_GestionarTalla(talla.IdTalla, talla.Nombre, talla.Descripcion, clsReferencias.UPDATE); return(Json(new { Message = clsReferencias.Exito })); } catch (Exception ex) { return(Json(new { Message = new clsException(ex).Message() })); } }
public bool AgregarTalla(Talla talla) { bool resul = false; using (AlmacenEntities context = new AlmacenEntities()) { context.Tallas.Add(talla); context.SaveChanges(); resul = true; } return(resul); }
public ActionResult Create([Bind(Include = "Nombre,Descripcion")] Talla talla) { try { db.sp_GestionarTalla(0, talla.Nombre, talla.Descripcion, clsReferencias.INSERT); return(Json(new { Message = clsReferencias.Exito })); } catch (Exception ex) { return(Json(new { Message = new clsException(ex).Message() })); } }
public bool EliminarTalla(short id) { bool resul = false; using (AlmacenEntities context = new AlmacenEntities()) { Talla talla = context.Tallas.Where(e => e.Id == id).FirstOrDefault(); context.Tallas.Remove(talla); context.SaveChanges(); resul = true; } return(resul); }
public List <Producto> ListarProductonombre(String Nombre) { SqlCommand cmd = null; List <Producto> lista = new List <Producto>(); try { SqlConnection cn = Conexion.Instancia.conectar(); cmd = new SqlCommand("listarproductopornombre", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Nombre", Nombre); cn.Open(); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { Producto p = new Producto(); p.idProducto = Convert.ToInt16(dr["idProducto"]); p.Nombre = dr["Nombre"].ToString(); p.Precio = Convert.ToDecimal(dr["Precio"]); p.Stock = Convert.ToInt16(dr["Stock"]); p.Serie = dr["Serie"].ToString(); p.Descripcion = dr["Descripcion"].ToString(); p.Imagen = dr["Imagen"].ToString(); p.estado = dr["estado"].ToString(); Categoria c = new Categoria(); c.idCategoria = Convert.ToInt16(dr["idCategoria"]); c.Nombre = dr["DNombre"].ToString(); c.Descripcion = dr["DCategoria"].ToString(); p.categoria = c; Talla t = new Talla(); t.idTalla = Convert.ToInt16(dr["idTalla"]); t.Nombre = dr["TNombre"].ToString(); t.Descripcion = dr["TDescripcion"].ToString(); p.talla = t; Diseño d = new Diseño(); d.idDiseño = Convert.ToInt16(dr["idDiseño"]); d.Nombre = dr["DINombre"].ToString(); d.Descripcion = dr["DIDescripcion"].ToString(); p.diseño = d; Color co = new Color(); co.idColor = Convert.ToInt16(dr["idColor"]); co.Nombre = dr["CONombre"].ToString(); co.Descripcion = dr["CODescripcion"].ToString(); p.color = co; lista.Add(p); } } catch (Exception e) { throw e; } finally { cmd.Connection.Close(); } return(lista); }
public static List <Talla> SelectAll() { List <Talla> listadeTallas = new List <Talla>(); AppSales.DAL.TallaDSTableAdapters.TallasTableAdapter objDataSet = new AppSales.DAL.TallaDSTableAdapters.TallasTableAdapter(); TallaDS.TallasDataTable dtTallas = objDataSet.GetAllSizes(); foreach (TallaDS.TallasRow row in dtTallas) { Talla objTallas = rowToDto(row); listadeTallas.Add(objTallas); } return(listadeTallas); }
// GET: Tallas/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Talla talla = db.Talla.Find(id); if (talla == null) { return(HttpNotFound()); } return(View(talla)); }
public static List <Talla> ObtenerTodos() { List <Talla> lista = new List <Talla>(); DataSet ds = TallaDatos.SeleccionarTodos(); foreach (DataRow fila in ds.Tables[0].Rows) { Talla registro = new Talla(); registro.id = Convert.ToInt16(fila["ID"]); registro.tipoTalla = Convert.ToString(fila["TIPOTALLA"]); registro.estado = Convert.ToInt16(fila["ESTADO"]); lista.Add(registro); } return(lista); }
public bool ActualizarTalla(Talla talla) { bool resul = false; using (AlmacenEntities context = new AlmacenEntities()) { Talla tallaAct = context.Tallas.Where(e => e.Id == talla.Id).FirstOrDefault(); tallaAct.Talla1 = talla.Talla1; tallaAct.activo = talla.activo; context.Tallas.Attach(tallaAct); context.Entry(tallaAct).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); resul = true; } return(resul); }
public bool AgregarActualizarTalla(Talla Talla) { try { TallaDLA dla = new TallaDLA(); if (Talla.Id > 0) { return(dla.ActualizarTalla(Talla)); } else { return(dla.AgregarTalla(Talla)); } } catch (Exception) { throw; } }
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { int id = dataGridView1.CurrentRow.Index; _talla = new Talla(); _talla.Id = (Convert.ToInt16(dataGridView1[0, id].Value)); TallaBL bl = new TallaBL(); //AdministradorCon admin = new AdministradorCon(); _talla = bl.ObtenerTalla((short)_talla.Id); txtTallasNombre.Text = _talla.Talla1.ToString(); rbtnTallasActivo.Checked = _talla.activo; btnEliminartallas.Visible = true; }
public override bool Equals(object obj) { if (obj == null) { return(false); } TallaPrendaEN t = obj as TallaPrendaEN; if (t == null) { return(false); } if (Talla.Equals(t.Talla)) { return(true); } else { return(false); } }
public Boolean EliminarTalla(Talla t) { SqlCommand cmd = null; Boolean elimino = false; try { SqlConnection cn = Conexion.Instancia.conectar(); cmd = new SqlCommand("EliminarTalla", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@estado", t.estado); cmd.Parameters.AddWithValue("@idTalla", t.idTalla); cn.Open(); int i = cmd.ExecuteNonQuery(); if (i > 0) { elimino = true; } } catch (Exception e) { throw e; } return(elimino); }
public Boolean InsertarTalla(Talla t) { SqlCommand cmd = null; Boolean inserto = false; try { SqlConnection cn = Conexion.Instancia.conectar(); cmd = new SqlCommand("InsertarTalla", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Nombre", t.Nombre); cmd.Parameters.AddWithValue("@Descripcion", t.Descripcion); cn.Open(); int i = cmd.ExecuteNonQuery(); if (i > 0) { inserto = true; } } catch (Exception e) { throw e; } return(inserto); }
private void btnEliminartallas_Click(object sender, EventArgs e) { string message = "Desea eliminar el lugar" + _talla.Talla1 + "?"; const string caption = "Form closing"; var result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); //if the no button was pressed if (result == DialogResult.Yes) { TallaBL bl = new TallaBL(); if (bl.Eliminartallas((short)_talla.Id)) { MessageBox.Show("Eliminado correctamente"); Limpiar(); btnEliminartallas.Visible = false; CargarDatosTallas(); _talla = null; } } }
public List <Talla> ListarTalla() { SqlCommand cmd = null;; List <Talla> lista = new List <Talla>(); try { SqlConnection cn = Conexion.Instancia.conectar(); cmd = new SqlCommand("ListarTalla", cn); cn.Open(); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { Talla t = new Talla(); t.idTalla = Convert.ToInt16(dr["idTalla"]); t.Nombre = dr["Nombre"].ToString(); t.Descripcion = dr["Descripcion"].ToString(); lista.Add(t); } } catch (Exception e) { throw e; } return(lista); }
/*---Almacen End*/ /*---Tallas---*/ private void btnAceptartallas_Click(object sender, EventArgs e) { TallaBL bl = new TallaBL(); if (_talla == null) { _talla = new Talla(); } _talla.Talla1 = Convert.ToDouble(txtTallasNombre.Text); _talla.activo = rbtnTallasActivo.Checked; TallaBL blt = new TallaBL(); if (blt.AgregarActualizarTalla(_talla)) { Limpiar(); MessageBox.Show("La operacion fue exitosa"); CargarDatosTallas(); btnEliminartallas.Visible = false; _talla = null; } }