示例#1
0
        public bool ValidarParaGuardar()
        {
            bool           resultado      = false;
            IngredienteDAO ingredienteDAO = new IngredienteDAO();

            if (ValidarNombre(Nombre) &&
                ValidarNumeroDecimal(CantidadEnInventario.ToString()) &&
                ValidarNumeroDecimal(Costo.ToString()) &&
                ValidarCadena(Codigo) &&
                ValidarCadena(CodigoDeBarras) &&
                !ingredienteDAO.ValidarCodigoExistente(Codigo) &&
                !ingredienteDAO.ValidarCodigoExistente(CodigoDeBarras))
            {
                resultado = true;

                foreach (Componente componente in Componentes)
                {
                    if (!componente.Validar())
                    {
                        resultado = false;
                        break;
                    }
                }
            }
            return(resultado);
        }
示例#2
0
        public bool guardarCosto(Costo costo)
        {
            String consulta = "exec guardarCosto '" + costo.getNombre() +
                              "'," + costo.getMonto() + ";";

            return(ejecutar(consulta));
        }
示例#3
0
        public ActionResult Editar(Costo costo)
        {
            if (!costo.EsGastoGeneral && costo.CierreCajaId == null)
            {
                if (costo.TurnoId == null)
                {
                    ModelState.AddModelError("TurnoId", "Debe seleccionar un turno");
                }
                if (costo.MaxikioscoId == null)
                {
                    ModelState.AddModelError("MaxikioscoId", "Debe seleccionar un kiosco");
                }
            }
            if (!ModelState.IsValid)
            {
                return(PartialView(costo));
            }

            costo.Desincronizado = true;
            costo.Eliminado      = false;
            Uow.Costos.Modificar(costo);
            Uow.Commit();

            return(new JsonResult()
            {
                Data = new { exito = true }, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
示例#4
0
 private void FechaExpiracion_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyValue == 13)
     {
         Costo.Focus();
     }
 }
示例#5
0
        public static ConceptoPagoDetalle ConvertirACarroPago(this Costo costo)
        {
            ConceptoPagoDetalle carrop = new ConceptoPagoDetalle();

            carrop.Pago = costo.Precio;
            return(carrop);
        }
 protected void btnNuevoCosto_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(txtDescripcion.Text))
     {
         if (!String.IsNullOrEmpty(txtMonto.Text) && Convert.ToDouble(txtMonto.Text) > 0)
         {
             Costo costo = new Costo();
             costo.descripcion = txtDescripcion.Text;
             costo.monto       = Convert.ToDouble(txtMonto.Text);;
             costoDatos.insertarCosto(costo);
             ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "toastr.success('" + "Se guardo el monto correctamente" + "');", true);
             ScriptManager.RegisterStartupScript(this, this.GetType(), "activar", "cerrarModalNuevo();", true);
             Session["listaCostos"] = costoDatos.getCostos();
             cargarCostos();
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "toastr.error('" + "Debe de ingresar el monto" + "');", true);
         }
     }
     else
     {
         ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "toastr.error('" + "Debe de ingresar la descripción" + "');", true);
     }
 }
示例#7
0
        public void updateCosto(Costo cost)
        {
            try
            {
                var costTmp = ctx.Costo
                              .Where(w => w.Id == cost.Id)
                              .SingleOrDefault();

                if (costTmp != null)
                {
                    var rec  = ctx.Recurso.Where(w => w.id == cost.recurso.id).SingleOrDefault();
                    var prod = ctx.Producto.Where(w => w.id == cost.idProducto).SingleOrDefault();
                    costTmp.recurso         = rec;
                    costTmp.producto        = prod;
                    costTmp.valor           = cost.valor;
                    costTmp.incrementoNivel = cost.incrementoNivel;

                    ctx.SaveChangesAsync().Wait();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 private void txtNombre_KeyPress_1(object sender, KeyPressEventArgs e)
 {
     if ((int)e.KeyChar == (int)Keys.Enter)
     {
         String nombre = txtNombre.Text;
         if (nombre.Length != 0)
         {
             Costo c = ctlCos.SolicitudBuscarCosto(nombre);
             if (c != null)
             {
                 txtCosto.Text = c.getMonto().ToString();
                 aux           = c.getId();
                 //habilitarCampos();
                 //btnGuardar.Enabled = false;
                 //btnEditar.Enabled = true;
                 //btnEliminar.Enabled = true;
             }
             else
             {
                 MessageBox.Show("El costo no existe, por favor adicionalo");
                 //habilitarCampos();
                 //btnGuardar.Enabled = true;
                 //btnEditar.Enabled = false;
                 //btnEliminar.Enabled = false;
             }
         }
     }
 }
示例#9
0
        public bool modificarCosto(Costo cos)
        {
            String consulta = "exec editarCosto '" + costo.getNombre() +
                              "'," + costo.getMonto() + ";";

            return(ejecutar(consulta));
        }
示例#10
0
 public override string RegistrarSalida(int cantidad)
 {
     if (cantidad > 0)
     {
         this.Cantidad -= cantidad;
         return($"Nueva salida: {Nombre}, cantidad:{cantidad}, costo_total:{Costo.ToString("C2", new CultureInfo("es-CO"))}, precio_total:{Precio.ToString("C2", new CultureInfo("es-CO"))}");
     }
     return("Salida menor o igual a 0");
 }
示例#11
0
            public Get(string _BA_PRODUKT)
            {
                ProductoAlfak pr = new ProductoAlfak();

                BA_PRODUKTE = pr.GetByCod(_BA_PRODUKT);
                Costo Cst = new Costo(_BA_PRODUKT, "3", "5");

                Costos = Cst.Lista;
            }
示例#12
0
        public ActionResult Eliminar(int id)
        {
            Costo costo = Uow.Costos.Obtener(c => c.CostoId == id, c => c.CategoriaCosto, c => c.CierreCaja,
                                             c => c.CierreCaja.Usuario, c => c.CierreCaja.MaxiKiosco,
                                             c => c.Turno, c => c.MaxiKiosco);

            costo.EsGastoGeneral = costo.CierreCaja == null && costo.MaxikioscoId == null;
            return(PartialView(costo));
        }
示例#13
0
        protected void btnNuevoCosto_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtClienteSeleccionado.Text))
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "toastr.error('" + "Debe seleccionar un cliente." + "');", true);
            }
            else
            {
                if (String.IsNullOrEmpty(txtFechaDesde.Text))
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "toastr.success('" + "Debe seleccionar el campo de Fecha desde." + "');", true);
                }
                else
                {
                    if (String.IsNullOrEmpty(txtFechaHasta.Text))
                    {
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "toastr.success('" + "Debe seleccionar el campo de Fecha hasta." + "');", true);
                    }
                    else
                    {
                        DateTime fechaDesde = Convert.ToDateTime(txtFechaDesde.Text);
                        DateTime fechaHasta = Convert.ToDateTime(txtFechaHasta.Text);
                        if (DateTime.Compare(fechaHasta, fechaDesde) < 0)
                        {
                            ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "toastr.error('" + "La fecha desde debe de ser menor que la fecha hasta." + "');", true);
                        }
                        else
                        {
                            Int32.TryParse(txtMonto.Text, out Int32 mont);

                            if (mont <= 0)
                            {
                                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "toastr.error('" + "Debe ingresar un monto." + "');", true);
                            }
                            else
                            {
                                Pago pago = new Pago();
                                pago.cliente = clienteSeleccionado;
                                Costo        costo       = new Costo();
                                List <Costo> listaCostos = (List <Costo>)Session["listaCostos"];
                                costo           = (Costo)(listaCostos.Where(costos => costos.descripcion == (ddlCostos.SelectedItem.Text)).ToList().First());
                                pago.costo      = costo;
                                pago.fechaDesde = fechaDesde;
                                pago.fechaHasta = fechaHasta;
                                pago.monto      = Convert.ToDouble(txtMonto.Text);
                                pagoDatos.insertarPago(pago);
                                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "toastr.success('" + "El pago se ingreso correctamente." + "');", true);
                                ScriptManager.RegisterStartupScript(this, this.GetType(), "activar", "cerrarModalNuevo();", true);
                                Session["listaPagos"] = pagoDatos.getPagos();
                                cargarPagos();
                            }
                        }
                    }
                }
            }
        }
示例#14
0
        public frmEditarValor(string indicador, LiteDatabase db, LiteCollection <Costo> costos, Costo costo)
        {
            InitializeComponent();
            this.indicador = indicador;
            this.costos    = costos;
            this.costo     = costo;
            this.db        = db;

            CargarValor();
        }
示例#15
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            Costo = await _context.Costos.FirstOrDefaultAsync(m => m.Id == id);

            if (Costo == null)
            {
                return(NotFound());
            }
            return(Page());
        }
        public Costo Get(int id)
        {
            Costo costo = blHandler.getCosto(id);

            if (costo == null)
            {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            return(costo);
        }
示例#17
0
 private void clear()
 {
     textBox1.Clear();
     Costo.Clear();
     Precio.Clear();
     Unidades.Clear();
     Kg_unidades.Clear();
     Nombre.Clear();
     textBox1.Clear();
     autocomplete();
     lista();
 }
        protected void btnEditar_Click(object sender, EventArgs e)
        {
            int idCosto = Convert.ToInt32((((LinkButton)(sender)).CommandArgument).ToString());

            List <Costo> listaCostos = (List <Costo>)Session["listaCostos"];

            costoSeleccionado = (Costo)(listaCostos.Where(costo => costo.idCosto == idCosto).ToList().First());

            ScriptManager.RegisterStartupScript(this, this.GetType(), "activar", "levantarModalEditar();", true);
            txtEditarDescripcion.Text = costoSeleccionado.descripcion;
            txtEditarMonto.Text       = costoSeleccionado.monto.ToString();
        }
        protected void btnEliminar_Click(object sender, EventArgs e)
        {
            int idCosto = Convert.ToInt32((((LinkButton)(sender)).CommandArgument).ToString());

            List <Costo> listaCostos = (List <Costo>)Session["listaCostos"];

            costoSeleccionado = (Costo)(listaCostos.Where(costo => costo.idCosto == idCosto).ToList().First());

            lblEliminar.Text = "¿Esta seguro de eliminar el costo de " + costoSeleccionado.descripcion + " de forma permanente y toda su información asociada?";

            ScriptManager.RegisterStartupScript(this, this.GetType(), "activar", "levantarModalEliminar();", true);
        }
示例#20
0
        public void eliminarCosto(Costo costo)
        {
            SqlConnection sqlConnection = conexion.conexionBoxMolina();

            SqlCommand sqlCommand = new SqlCommand(@"delete costo where id_costo = @idCosto;", sqlConnection);

            sqlCommand.Parameters.AddWithValue("@idCosto", costo.idCosto);

            sqlConnection.Open();
            sqlCommand.ExecuteReader();

            sqlConnection.Close();
        }
示例#21
0
 public bool Save(Costo entity)
 {
     try
     {
         context.Add(entity);
         context.SaveChanges();
     }
     catch (Exception)
     {
         return(false);
     }
     return(true);
 }
示例#22
0
        private void CrearDatosdePrueba()
        {
            var categoria1 = new Categoria(1, "Laptops");
            var categoria2 = new Categoria(2, "Accesorios");

            var costo1 = new Costo(1, "Laptop Dell", 7000, categoria1);
            var costo2 = new Costo(2, "Laptop Asus", 13500, categoria1);
            var costo3 = new Costo(3, "Mouse Logitech", 16000, categoria2);

            ListadeCostos.Add(costo1);
            ListadeCostos.Add(costo2);
            ListadeCostos.Add(costo3);
        }
 public static CostoServizioViewModel ToCostoServizioViewModel(this Costo costo)
 {
     return(new CostoServizioViewModel
     {
         Id = costo.Id,
         TipoServizio = costo.TipoServizio,
         CostoFisso = costo.CostoFisso,
         CostoKm = costo.CostoKm,
         SecondoTrasportato = costo.SecondoTrasportato,
         FermoMacchina = costo.FermoMacchina,
         Accompagnatore = costo.Accompagnatore,
         ScontoSoci = costo.ScontoSoci
     });
 }
示例#24
0
 public bool DeleteById(int id)
 {
     try
     {
         Costo costo = GetById(id);
         context.Costos.Remove(costo);
         context.SaveChanges();
     }
     catch (Exception)
     {
         return(false);
     }
     return(true);
 }
示例#25
0
        public void actualizarCosto(Costo costo)
        {
            SqlConnection sqlConnection = conexion.conexionBoxMolina();

            SqlCommand sqlCommand = new SqlCommand(@"update costo set descripcion = @descripcion,monto = @monto where id_costo = @idCosto;", sqlConnection);

            sqlCommand.Parameters.AddWithValue("@idCosto", costo.idCosto);
            sqlCommand.Parameters.AddWithValue("@descripcion", costo.descripcion);
            sqlCommand.Parameters.AddWithValue("@monto", costo.monto);

            sqlConnection.Open();
            sqlCommand.ExecuteReader();

            sqlConnection.Close();
        }
示例#26
0
        public override string RegistrarSalida(int cantidad)
        {
            if (cantidad > 0)
            {
                var precioTotal = cantidad * Precio;
                foreach (var item in Productos)
                {
                    item.RegistrarSalida(cantidad);
                }

                return($"Nueva salida: {Nombre}, cantidad:{cantidad}, costo_total:{Costo.ToString("C2", new CultureInfo("es-CO"))}, " +
                       $"precio_total:{precioTotal.ToString("C2", new CultureInfo("es-CO"))}");
            }
            return($"Cantidad debe ser mayor a 0");
        }
        public HttpResponseMessage Post(Costo costo)
        {
            if (ModelState.IsValid)
            {
                blHandler.createCosto(costo);

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, costo);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { controller = "Admin" }));
                return(response);
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }
        }
示例#28
0
        public Costo GetById(int id)
        {
            var result = new Costo();

            try
            {
                result = context.Costos
                         .Single(x => x.Id == id);
            }
            catch (Exception)
            {
                throw;
            }
            return(result);
        }
示例#29
0
        public int insertarCosto(Costo costoInsertar)
        {
            SqlConnection conexionSpartan = conexion.conexionBoxMolina();
            String        consulta        = @"insert costo (descripcion,monto) values(@descripcion,@monto); SELECT SCOPE_IDENTITY();";
            SqlCommand    sqlCommand      = new SqlCommand(consulta, conexionSpartan);

            sqlCommand.Parameters.AddWithValue("@descripcion", costoInsertar.descripcion);
            sqlCommand.Parameters.AddWithValue("@monto", costoInsertar.monto);

            conexionSpartan.Open();
            int idCosto = Convert.ToInt32(sqlCommand.ExecuteScalar());

            conexionSpartan.Close();

            return(idCosto);
        }
示例#30
0
 public void createCosto(Costo c)
 {
     try
     {
         Entities.Recurso rec = ctx.Recurso.Where(w => w.id == c.recurso.id).SingleOrDefault();
         var prod             = ctx.Producto.Where(w => w.id == c.idProducto).SingleOrDefault();
         var cost             = new Entities.Costo(rec, prod, c.valor, c.incrementoNivel);
         ctx.Costo.Add(cost);
         ctx.SaveChanges();
         ctx.Database.Connection.Close();
     }
     catch (Exception e)
     {
         throw e;
     }
 }