static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); string aux = ""; while (n > 0) { menorPasso = int.MaxValue; vet = new int[2000]; for (int i = 0; i < vet.Length; i++) { vet[i] = 0; } cortes = new Corte[n]; for (int i = 0; i < cortes.Length; i++) { cortes[i] = new Corte(); } string linha = Console.ReadLine(); string[] linhaSplit = linha.Split(' '); for (int i = 0; i < cortes.Length; i++) { cortes[i].qtdCabeçasCortadas = int.Parse(linhaSplit[i]); } linha = Console.ReadLine(); linhaSplit = linha.Split(' '); for (int i = 0; i < cortes.Length; i++) { cortes[i].qtdCabeçasNascidas = int.Parse(linhaSplit[i]); } Start(100, 0); if (menorPasso != int.MaxValue) { aux += Convert.ToString(menorPasso) + " "; } else { aux += "-1 "; } n = int.Parse(Console.ReadLine()); } string[] resp = aux.Split(' '); for (int i = 0; i < resp.Length; i++) { if (resp[i] == "-1") { Console.WriteLine("cavaleiro morreu"); } else { Console.WriteLine(resp[i]); } } }
private List <SqlParameter> SetParametersItemsCortes(Corte item) { List <SqlParameter> sp = new List <SqlParameter>() { new SqlParameter() { ParameterName = "@p1", SqlDbType = SqlDbType.Int, Value = item.Num }, new SqlParameter() { ParameterName = "@p2", SqlDbType = SqlDbType.Decimal, Value = item.Width }, new SqlParameter() { ParameterName = "@p3", SqlDbType = SqlDbType.Decimal, Value = item.Lenght }, new SqlParameter() { ParameterName = "@p4", SqlDbType = SqlDbType.Decimal, Value = item.Msi }, new SqlParameter() { ParameterName = "@p5", SqlDbType = SqlDbType.Decimal, Value = item.Orden }, }; return(sp); }
public async Task <IActionResult> PutCorte([FromRoute] int id, [FromBody] Corte corte) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != corte.IdCorte) { return(BadRequest()); } _context.Entry(corte).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CorteExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
private void btneliminar_Click(object sender, EventArgs e) { string message = "Desea eliminar al usuario " + _corte.IdCorte + "?"; 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) { corteBL bl = new corteBL(); if (bl.EliminarCorte(_corte.Id)) { MessageBox.Show("Se elimino correctamente"); limpiar(); CargarDatosCorte(); btnTerminado.Visible = false; btnTerminado.Visible = false; _corte = null; } } }
private void btnTerminado_Click(object sender, EventArgs e) { controller.CorteCon con = new controller.CorteCon(); try { string message = "Desea marcar el proceso como terminado?"; 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) { _corte.Estado = true; corteBL bl = new corteBL(); if (bl.AgregarActualizarCorte(_corte)) { MessageBox.Show("Laoperacion fue exitosa"); limpiar(); CargarDatosCorte(); btnTerminado.Visible = false; btneliminar.Visible = false; _corte = null; } } } catch (Exception) { throw; } }
private void pictureBox1_Click(object sender, EventArgs e) { Corte cort = new Corte(); //cort.Show(); Close(); }
public async Task <IActionResult> Edit(int id, [Bind("IDC,FechaCorte,LatasCortadas,SubTotal,IDE,IDU,IDPL")] Corte corte) { if (id != corte.IDC) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(corte); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CorteExists(corte.IDC)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["IDE"] = new SelectList(_context.Empleado, "IDE", "IDE", corte.IDE); ViewData["IDPL"] = new SelectList(_context.PrecioLata, "IDPL", "IDPL", corte.IDPL); ViewData["IDU"] = new SelectList(_context.Ubicacion, "IDU", "IDU", corte.IDU); return(View(corte)); }
private void CalcularPremio() { if (Boloes.Count != 0) { foreach (var boloes in Boloes) { foreach (var apostas in boloes.Apostas) { Premio.Total += apostas.Valor; } } Faturamento = Premio.Total * 0.05m; Premio.Total *= 0.95m; } if (Apostas.Count != 0) { foreach (var apostas in Apostas) { Premio.Total += apostas.Valor; } Faturamento += Premio.Total * 0.1m; Premio.Total *= 0.9m; } Corte = new Corte(); CalcularCortePorGanhador(); Premio.Sena = Premio.Total * Corte.Sena; Premio.Quina = Premio.Total * Corte.Quina; Premio.Quadra = Premio.Total * Corte.Quadra; }
public ActionResult DeleteConfirmed(int id) { Corte corte = db.Cortes.Find(id); db.Cortes.Remove(corte); db.SaveChanges(); return(RedirectToAction("Index")); }
public JsonResult BorrarError(int AFolio, string AFecha, string AMotivo) { string pMensaje = ""; Corte info_caja = _CajasLogica.ObtenerDatosCaja(AFolio, AFecha); int id_usuario = (int)HttpContext.Session.GetInt32("IdUsuario"); _CajasLogica.BorrarEtiqueta(info_caja.CodigoBarras, AMotivo, "", id_usuario, out pMensaje); return(Json(new { Mensaje1 = "Caja borrada con éxito", Mensaje2 = pMensaje })); }
private bool AgregarCorteCompleto(Prenda prenda) { bool resul = false; try { string message = "Desea agregar el corte?"; 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) { int total = 0; foreach (Detalle item in _detallesPrenda) { total += item.Cantidad; } //agregar prenda PrendaBL blp = new PrendaBL(); short IdPrenda = blp.AgregarActualizarPreda(prenda); for (int i = 0; i < _detallesPrenda.Count; i++) { _detallesPrenda[i].IdPrenda = IdPrenda; detallesPrendaBL bld = new detallesPrendaBL(); if (bld.AgregarActualizarDetallePrenda(_detallesPrenda[i])) { } } corteBL blc = new corteBL(); _corte.IdPrenda = IdPrenda; return(blc.AgregarActualizarCorte(_corte)); } else { _corte = null; _detallesPrenda = null; _prenda = null; return(false); } } catch (Exception ex) { resul = false; } return(resul); }
public ActionResult Edit([Bind(Include = "Id,Name,Description,Price")] Corte corte) { if (ModelState.IsValid) { db.Entry(corte).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(corte)); }
public IHttpActionResult GetCorte(int id) { Corte corte = db.Cortes.Find(id); if (corte == null) { return(NotFound()); } return(Ok(corte)); }
public ActionResult Create([Bind(Include = "Id,Name,Description,Price")] Corte corte) { if (ModelState.IsValid) { db.Cortes.Add(corte); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(corte)); }
public bool AgregarCorte(Corte corte) { bool resul = false; using (AlmacenEntities context = new AlmacenEntities()) { context.Cortes.Add(corte); context.SaveChanges(); resul = true; } return(resul); }
public async Task <IActionResult> PostCorte([FromBody] Corte corte) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Corte.Add(corte); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCorte", new { id = corte.IdCorte }, corte)); }
public bool EliminarCorte(short id) { bool resul = false; using (AlmacenEntities context = new AlmacenEntities()) { Corte corte = context.Cortes.Where(e => e.Id == id).FirstOrDefault(); context.Cortes.Remove(corte); context.SaveChanges(); resul = true; } return(resul); }
public IHttpActionResult DeleteCorte(int id) { Corte corte = db.Cortes.Find(id); if (corte == null) { return(NotFound()); } db.Cortes.Remove(corte); db.SaveChanges(); return(Ok(corte)); }
// GET: Cortes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Corte corte = db.Cortes.Find(id); if (corte == null) { return(HttpNotFound()); } return(View(corte)); }
public async Task <IActionResult> Create([Bind("IDC,FechaCorte,LatasCortadas,SubTotal,IDE,IDU,IDPL")] Corte corte) { if (ModelState.IsValid) { _context.Add(corte); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IDE"] = new SelectList(_context.Empleado, "IDE", "IDE", corte.IDE); ViewData["IDPL"] = new SelectList(_context.PrecioLata, "IDPL", "IDPL", corte.IDPL); ViewData["IDU"] = new SelectList(_context.Ubicacion, "IDU", "IDU", corte.IDU); return(View(corte)); }
public bool BorrarEtiqueta(string ACodigoBarras, string AMotivo, string ACodigoAlta, int AUsuario, out string AMensajeError) { Corte caja = _CajasPersistencia.ObtenerCaja(ACodigoBarras); if (caja.Embarcado == "Si") { AMensajeError = "Caja Embarcada"; return(false); } bool res = _CajasPersistencia.BorrarEtiqueta(ACodigoBarras, AMotivo, ACodigoAlta, AUsuario, out AMensajeError); _EliminadasPersistencia.inserta_eliminada(caja, AMotivo, ACodigoAlta, AUsuario); _CajasPersistencia.EliminaCajaDeTarima(ACodigoBarras, out AMensajeError); return(res); }
public bool ActualizarCorte(Corte corte) { bool resul = false; using (AlmacenEntities context = new AlmacenEntities()) { Corte CorteAct = context.Cortes.Where(e => e.Id == corte.Id).FirstOrDefault(); context.Cortes.Attach(CorteAct); context.SaveChanges(); resul = true; } return(resul); }
public bool InsertOne(Corte o) { try { using (var db = new DymContext()) { db.Add(o); db.SaveChanges(); return(true); } } catch (Exception ex) { Ambiente.Mensaje(Ambiente.CatalgoMensajes[-1] + "@" + GetType().Name + "\n" + ex.ToString()); } return(false); }
public bool Update(Corte o) { try { using (var db = new DymContext()) { db.Entry(o).State = Microsoft.EntityFrameworkCore.EntityState.Modified; db.SaveChanges(); return(true); } } catch (Exception ex) { Ambiente.Mensaje(Ambiente.CatalgoMensajes[-1] + "@" + GetType().Name + "\n" + ex.ToString()); } return(false); }
public JsonResult InfoCaja(int AFolio, string AFecha) { Corte caja = _CajasLogica.ObtenerDatosCaja(AFolio, AFecha); if (caja == null) { caja = new Corte(); caja.Producto = "-1"; caja.CodigoBarras = "-1"; } else { caja.Producto = caja.Producto + " " + _ProductosLogica.DameDescripcionProducto(caja.Producto); } Console.WriteLine(caja.Producto + " " + caja.CodigoBarras); return(Json(caja)); }
public bool AgregarActualizarCorte(Corte corte) { try { proCorteDLA dla = new proCorteDLA(); if (corte.Id > 0) { return(dla.ActualizarCorte(corte)); } else { return(dla.AgregarCorte(corte)); } } catch (Exception) { throw; } }
public Boolean inserta_eliminada(Corte ACaja, string AMotivo, string ACodigoAlta, int AUsuario) { string pSentencia = "INSERT INTO DRASELIM(FECHA, FOLIO, GRANJA, LOTE, PRODUCTO, BASCULA, PESO, TARA, PESONETO, EMBARCADO, CODIGOBARRAS, TARIMA, ALMACENADO, ESTATUS, MOTIVO, CODIGOALTA, USUARIO, FECHACANCELACION, ENTRADA_APLICADA, ID_ACUM) " + "VALUES(@FECHA, @FOLIO, @GRANJA, @LOTE, @PRODUCTO, @BASCULA, @PESO, @TARA, @PESONETO, @EMBARCADO, @CODIGOBARRAS, @TARIMA, @ALMACENADO, @ESTATUS, @MOTIVO, @CODIGOALTA, @USUARIO, @FECHACANCELACION, @ENTRADA_APLICADA, @ID_ACUM)"; FbConnection con = _Conexion.ObtenerConexion(); FbCommand com = new FbCommand(pSentencia, con); com.Parameters.Add("@FECHA", FbDbType.TimeStamp).Value = ACaja.Fecha; com.Parameters.Add("@FOLIO", FbDbType.Integer).Value = ACaja.Folio; com.Parameters.Add("@GRANJA", FbDbType.Integer).Value = ACaja.Granja; com.Parameters.Add("@LOTE", FbDbType.Integer).Value = ACaja.Lote; com.Parameters.Add("@PRODUCTO", FbDbType.VarChar).Value = ACaja.Producto; com.Parameters.Add("@BASCULA", FbDbType.Integer).Value = ACaja.Bascula; com.Parameters.Add("@PESO", FbDbType.Numeric).Value = ACaja.Peso; com.Parameters.Add("@TARA", FbDbType.Numeric).Value = ACaja.Tara; com.Parameters.Add("@PESONETO", FbDbType.Numeric).Value = ACaja.PesoNeto; com.Parameters.Add("@EMBARCADO", FbDbType.VarChar).Value = ACaja.Embarcado; com.Parameters.Add("@CODIGOBARRAS", FbDbType.VarChar).Value = ACaja.CodigoBarras; com.Parameters.Add("@TARIMA", FbDbType.Integer).Value = ACaja.Tarima; com.Parameters.Add("@ALMACENADO", FbDbType.VarChar).Value = ACaja.Almacenado; com.Parameters.Add("@ESTATUS", FbDbType.VarChar).Value = ACaja.Estatus; com.Parameters.Add("@MOTIVO", FbDbType.VarChar).Value = AMotivo; com.Parameters.Add("@CODIGOALTA", FbDbType.VarChar).Value = ACodigoAlta; com.Parameters.Add("@USUARIO", FbDbType.VarChar).Value = AUsuario; com.Parameters.Add("@FECHACANCELACION", FbDbType.TimeStamp).Value = ACaja.Fecha; //INGRESAR FECHA CANCELACION com.Parameters.Add("@ENTRADA_APLICADA", FbDbType.VarChar).Value = ACaja.Entrada_Aplicada; com.Parameters.Add("@ID_ACUM", FbDbType.Integer).Value = ACaja.Id_Acum; try { con.Open(); com.ExecuteNonQuery(); } finally { if (con.State == System.Data.ConnectionState.Open) { con.Close(); } } return(true); }
public CorteDTO PostCorte([FromBody] int idUsuario) { if (!ModelState.IsValid) { throw new Exception("El modelo es invalido"); } if (idUsuario == 0) { throw new Exception("idUsuario no puede ser cero"); } Corte corte = null; if (!CorteExistsByDate()) { corte = new Corte { idUsuario = idUsuario, montoInicial = 150, fechaInicio = DateTime.Now }; db.Cortes.Add(corte); db.SaveChanges(); } else { corte = db.Cortes.Where(w => DbFunctions.TruncateTime(w.fechaInicio) == DbFunctions.TruncateTime(DateTime.Now) && w.fechaFin == null).FirstOrDefault(); } CorteDTO c = new CorteDTO(); c.idCorte = corte.idCorte; c.idUsuario = corte.idUsuario; c.montoInicial = corte.montoInicial; c.fechaInicio = corte.fechaInicio; return(c); }
public void Cortar(Corte corte, string codigoPrenda) { corte.Codigo = corte.Tela.Codigo + "CRT"; corte.Tela.Cantidad -= corte.CantidadTela; // velocidad de 2000 cm/s máxima aprox. corte.Tiempo = (corte.CantidadTela * corte.Dimensiones * 1000) / 2000; // CantidadTelas * Dimensiones * 1000 (para transformar de m2 a cm2) / velocidad máquina. // TO DO: Agregar tipo de prenda (remera, pantalón) y según el tipo de prenda apareceran los talles (S, M, L) correspondientes. int prendasObtenidas = corte.CantidadTela; if (corte.Talle == "S") { prendasObtenidas = prendasObtenidas * 8; } else if (corte.Talle == "M") { prendasObtenidas = prendasObtenidas * 6; } else { prendasObtenidas = prendasObtenidas * 4; } // por ahora S = 8, M = 6, L = 4; // Podría usar un Interpreter para que el talle pueda ser ingresado de distintas maneras pero ser traducido a S, M o L. TelaGestor telaGestor = new TelaGestor(); telaGestor.Modificar(corte.Tela); PrendaGestor prendaGestor = new PrendaGestor(); List <Prenda> prendasExistentes = prendaGestor.GetListPrenda(); if (prendasExistentes.Exists(p => p.Codigo == codigoPrenda)) { Prenda existente = prendaGestor.GetPrenda(prendasExistentes.Find(p => p.Codigo == codigoPrenda)); existente.Cantidad += prendasObtenidas; prendaGestor.Modificar(existente); } else { prendaGestor.Alta(new Prenda(codigoPrenda, "Corte de " + corte.Tela.Descripcion, prendasObtenidas, corte.Talle, false)); } bd.Alta(corte); }
async private void AbrirDetalleCorte(int corteId) { var cortes = App.ActividadesSemestreBD.GetCollection <BsonDocument>("Cortes"); var corteSeleccionado = cortes.Find(Builders <BsonDocument> .Filter.Eq("Id", corteId)).FirstOrDefault(); var actividades = App.ActividadesSemestreBD.GetCollection <BsonDocument>("Actividades").Find(Builders <BsonDocument> .Filter.Eq("CorteId", corteId)).ToList(); var actividadesCorte = new ObservableCollection <Actividad>(); foreach (BsonDocument actividad in actividades) { actividadesCorte.Add(new Actividad { Id = (int)actividad["Id"], Titulo = actividad["Titulo"].ToString(), Observaciones = actividad["Observaciones"].ToString(), Nota = (double)actividad["Nota"], FechaEntrega = (DateTime)actividad["FechaEntrega"], Latitud = actividad["latitud"].ToString(), Longitud = actividad["longitud"].ToString() }); } Corte corte = new Corte { Id = (int)corteSeleccionado["Id"], Nombre = corteSeleccionado["Nombre"].ToString(), Porcentaje = (int)corteSeleccionado["Porcentaje"], FechaInicio = (DateTime)corteSeleccionado["FechaInicio"], FechaFin = (DateTime)corteSeleccionado["FechaFin"], ActividadesCorte = actividadesCorte }; await Application.Current.MainPage.Navigation.PushAsync(new CortePage(new CorteViewModel { Nombre = corte.Nombre, Porcentaje = corte.Porcentaje, FechaInicio = corte.FechaInicio.ToString("D", new System.Globalization.CultureInfo("es-CO")), FechaFin = corte.FechaFin.ToString("D", new System.Globalization.CultureInfo("es-CO")), Actividades = corte.ActividadesCorte, CorteSeleccionado = corte })); }
public void guardarOrden(ModelResumenOrden resumenOrden, ModelDetalleOrden[] listaModelDetalleOrdenes) { if (listaModelDetalleOrdenes == null) { throw new Exception("No Se Ingreso ninguna talla"); } //RESUMEN var corte= new Corte(); corte.codigoCorte = resumenOrden.codigo.ToUpper(); corte.codigoUsuario = resumenOrden.codigoUsuario; corte.proyectoCorte = resumenOrden.proyecto; IFormatProvider format = new CultureInfo("es-ES", true); corte.fechaCorte = DateTime.Parse(resumenOrden.fecha, format); corte.codigoCliente = resumenOrden.codigoCliente; corte.custPoCorte = resumenOrden.custPoCorte; corte.totalCamisasCorte = resumenOrden.cantidaTotal; corte.codigoEstilo = resumenOrden.codigoEstilo; corte.telaCorte = resumenOrden.tela; corte.pinadoCorte = (resumenOrden.pinado)?1:0; corte.consumoTela = Convert.ToDecimal(resumenOrden.consumoTela); corte.comentarioCorte = resumenOrden.comentario; //DETALLE var listaCorte = new List<CorteDetalle>(); foreach (var detalle in listaModelDetalleOrdenes) { var corteDetalle = new CorteDetalle(); corteDetalle.codigoCorte = detalle.codigoOrden; corteDetalle.tallaCuello = detalle.tallaCuello; corteDetalle.tallaManga = detalle.tallaManga; corteDetalle.tallaLetra = detalle.tallaLetra; corteDetalle.cantidad = detalle.cantidad; listaCorte.Add(corteDetalle); } try { _contexto.Cortes.InsertOnSubmit(corte); _contexto.CorteDetalles.InsertAllOnSubmit(listaCorte); } catch (Exception) { throw; } finally { _contexto.SubmitChanges(); } }