Beispiel #1
0
 public Afiliado(string nAfiliado, Operacion estadoM)
 {
     InitializeComponent();
     this.numeroAfiliado = nAfiliado;
     this.estado = estadoM; ;
     alterarCamposParaEstado();
     //MESSI            cargarDatosDeAfiliado();
 }
Beispiel #2
0
 public Afiliado(bool esConyugue)
 {
     InitializeComponent();
     this.esConyugue = esConyugue;
     this.esRelativo = true;
     this.estado = Operacion.ALTA;
     button_AgregarMiembro.Hide();
     comboBox_planMedico.Enabled = false;
 }
        public IHttpActionResult Post(Operacion op)
        {
            if (op.TipoOperacion == null)
            {
                return(NotFound());
            }

            double resultado = op.Procesar(op);

            return(Content(HttpStatusCode.OK, resultado));
        }
Beispiel #4
0
        private void btn_Click(object sender, RoutedEventArgs e)
        {
            int resultado = Operacion.ExecuteNonQuery(conexionActual, comandoEnviar);

            if (resultado != Operacion.ERROR)
            {
                Msj.Info("Tabla \"" + Comprueba.EliminarResto(cmbTablas.SelectedItem.ToString())
                         + "\" en base de datos " + "\"" + conexionActual.BaseDatos + "\" modificada con éxito.");
                // Reestableciendo tipo operación a por defecto
                cmbTipoOperacion.SelectedIndex = 0;
            }
        }
        public void DivisionTest()
        {
            //Arrange
            var operacion = new Operacion(2, 2);

            var expected = operacion.Division();
            //Act
            var actual = 1;

            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void MultiplicacionTest()
        {
            //Arrange
            var operacion = new Operacion(1, 2);

            var expected = operacion.Multiplicacion();
            //Act
            var actual = 2;

            //Assert
            Assert.AreEqual(expected, actual);
        }
Beispiel #7
0
        public Operacion Add(Operacion operacion)
        {
            _context.Operacion.Add(operacion);
            int filas = _context.SaveChanges();

            if (filas <= 0)
            {
                return(null);
            }

            return(operacion);
        }
        public void RestaTest()
        {
            //Arrange
            var operacion = new Operacion(1, 2);

            var expected = operacion.Resta();
            //Act
            var actual = -1;

            //Assert
            Assert.AreEqual(expected, actual);
        }
 public ActionResult Guardar(Operacion model)
 {
     if (ModelState.IsValid)
     {
         model.Guardar();
         return(Redirect("~/Ejercicio1"));
     }
     else
     {
         return(View("~/Views/Ejercicio1/AgregarModificar.cshtml", model));
     }
 }
        public ActionResult Form(int?id, Operacion operacion)
        {
            var materia = new Materia();

            if (id.HasValue)
            {
                materia = servicio.obtenerPorID(id.Value);
            }

            ViewData["Operacion"] = operacion;
            return(View(materia));
        }
Beispiel #11
0
        private bool Exec(Operacion o)
        {
            bool r = false;

            this.OperacionComienza(o);
            if (_infoOperacion)
            {
                this.OperacionInforma(o.Doc);
                r = true;
            }
            return(r);
        }
Beispiel #12
0
        public Form1()
        {
            InitializeComponent();
            calculadora = new Calculadora();
            sum         = new Operacion(calculadora.Suma);
            res         = new Operacion(calculadora.Resta);
            mul         = new Operacion(calculadora.Multiplicacion);
            div         = new Operacion(calculadora.Division);

            //Equivalent to Suma without a class. Only with Lambda Expresion.
            sumLambda = (x, y) => (x + y);
        }
Beispiel #13
0
        public ActionResult Form(int?id, Operacion operacion)
        {
            var customer = new Customer();

            if (id.HasValue)
            {
                customer = servicioCustomer.obtenerPorID(id.Value);
            }
            ViewData["Operacion"] = operacion;

            return(View(customer));
        }
        // GET: Operaciones
        public ActionResult Entrada(int operacion)
        {
            ViewBag.breadcrumb = "Catalogos/" + (operacion == 1 ? "Entrada de Inventario" : "Salida de inventario");
            ViewBag.pageheader = "Estado de Usuarios";
            ViewBag.Heading    = operacion == 1 ? "Entrada de Inventario" : "Salida de inventario";
            var model = new Operacion {
                IdTipoOperacion = operacion, Total = 0, CantProductos = 0, UsuarioCrea = Usuario.UserId, Estado = "ACT"
            };

            ViewBag.Clientes = new SelectList(clienteLogic.GetAll(), "IdCliente", "Nombre");
            return(PartialView(model));
        }
        public ActionResult Form(int?id, Operacion operacion)
        {
            var Product = new Product();

            if (id.HasValue)
            {
                Product = servicioProduct.obtenerPorID(id.Value);
            }
            ViewData["Operacion"] = operacion;

            return(View(Product));
        }
Beispiel #16
0
            public Operacion(TextoAParsear t)
            {
                VarIzquierda = null;
                OpIzquierda  = null;
                NumIzquierda = null;

                operador  = null;
                operadorv = null;

                derecha = null;

                try
                {
                    char c = t.GetChar();
                    if (c == '(')
                    {
                        t.CharProcessed();
                        OpIzquierda = new Operacion(t);
                        c           = t.GetChar();
                        if (c == ')')
                        {
                            t.CharProcessed();
                        }
                    }
                    else
                    {
                        try
                        {
                            VarIzquierda = new Variable(t);
                        } catch (NotValidObject)
                        {
                            NumIzquierda = new Numero(t);
                        }
                    }
                    if (VarIzquierda == null)
                    {
                        operador = new Operador(t);
                    }
                    else
                    {
                        operadorv = new OperadorVariable(t);
                    }
                    derecha = new Operacion(t);
                }
                catch (EndOfString eos)
                {
                    return;
                }
                catch (NotValidObject nvo)
                {
                    return;
                }
            }
Beispiel #17
0
        public void ActualizarOperacion(Operacion operacion)
        {
            var operacionAModificar = _repositorioOperacion.ObtenerObjetos(new FiltroOperacionPorId(operacion.IdOperacion)).FirstOrDefault();

            if (operacionAModificar == null)
            {
                throw new ApplicationException($"No existe operacion {operacion.IdOperacion}");
            }
            operacionAModificar.EstaActiva  = operacion.EstaActiva;
            operacionAModificar.EsAuditable = operacion.EsAuditable;
            _repositorioOperacion.Actualizar(operacionAModificar);
        }
Beispiel #18
0
        private void btnAñadir_Click(object sender, EventArgs e)
        {
            limpiar();
            desactivar();
            textMatricula.Enabled      = true;
            btnCaracteristicas.Enabled = true;
            operacion = Operacion.CREAR;
            Graphics graphic = Graphics.FromImage(FotoVehiculo.Image);

            graphic.Clear(Color.White);
            FotoVehiculo.Refresh();
        }
        private void Guardar()
        {
            if (DatosValidos())
            {
                //_infFalla.FecInicio = _txtFecHoraFalla.;
                _infFalla.Descripcion           = _txtDescripcionFalla.Text;
                _infFalla.InformacionAdicional  = _txtInfAdicional.Text;
                _infFalla.OperacionProtecciones = _txtOperacionProtecciones.Text;
                _infFalla.ProcRestitucion       = _txtProcRestitucion.Text;
                _infFalla.DCodOrigen            = (long)_cbxOrigen.SelectedValue;
                _infFalla.DCodTipoDesconexion   = (long)_cbxTipoDesconex.SelectedValue;
                _infFalla.DCodCausa             = (long)_cbxCausa.SelectedValue;
                _infFalla.NumFallaAgente        = _txtNumFallaAgente.Text;
                _infFalla.CodComponenteFallado  = (long)_ctrlComponenteComprometido.PkCodComponente;
                ModeloMgr.Instancia.InformeFallaMgr.Guardar(_infFalla);

                Operacion          opn      = new Operacion();
                DOMINIOS_OPERACION tipo_opn = DOMINIOS_OPERACION.NULL;
                if (Sesion.Instancia.RolSIN == "CNDC")
                {
                    switch (_tipoInforme)
                    {
                    case PK_D_COD_TIPOINFORME.PRELIMINAR:
                        tipo_opn = DOMINIOS_OPERACION.CNDC_ELABORA_PRELIMINAR;
                        break;

                    case PK_D_COD_TIPOINFORME.FINAL:
                        tipo_opn = DOMINIOS_OPERACION.CNDC_ELABORA_FINAL;
                        break;

                    case PK_D_COD_TIPOINFORME.RECTIFICATORIO:
                        break;
                    }
                }
                else
                {
                    switch (_tipoInforme)
                    {
                    case PK_D_COD_TIPOINFORME.PRELIMINAR:
                        tipo_opn = DOMINIOS_OPERACION.AGENTE_ELABORA_PRELIMINAR;
                        break;

                    case PK_D_COD_TIPOINFORME.FINAL:
                        tipo_opn = DOMINIOS_OPERACION.AGENTE_ELABORA_FINAL;
                        break;

                    case PK_D_COD_TIPOINFORME.RECTIFICATORIO:
                        break;
                    }
                }
                opn.RegistrarOperacion(tipo_opn, _infFalla.PkCodFalla, _persona.PkCodPersona);
            }
        }
Beispiel #20
0
        public ActionResult Form(int?id, Operacion operacion)
        {
            var estudiante = new Estudiante();

            if (id.HasValue)
            {
                estudiante = servicio.obtenerPorID(id.Value);
            }

            ViewData["Operacion"] = operacion;
            return(View(estudiante));
        }
        public ActionResult Form(int?id, Operacion operacion)
        {
            var profesor = new Profesor();

            if (id.HasValue)
            {
                profesor = servicio.obtenerPorID(id.Value);
            }

            ViewData["Operacion"] = operacion;
            return(View(profesor));
        }
        public ActionResult Form(int?Id /*puede aceptar nulos*/, Operacion operacion)
        {
            var carrera = new Carrera();

            if (Id.HasValue)
            {
                carrera = servicio.obtenerPorID(Id.Value);
            }

            ViewData["Operacion"] = operacion;
            return(View(carrera));
        }
Beispiel #23
0
 void AlComenzarOperacion(Operacion o)
 {
     strBuffer = string.Empty;
     dlg       = null;
     if (this.splitContainer1.Panel2.Controls.Count > 0)
     {
         this.splitContainer1.Panel2.Controls.RemoveAt(0);
     }
     this.tsslMsg.Text = strStatusBuffer = o.Descripcion;
     sb.AppendLine(string.Format(" [{1}] OPERACION: {0}", o.Descripcion, DateTime.Now.ToString()));
     this.txProgreso.Text = sb.ToString();
 }
Beispiel #24
0
        public ActionResult Form(int?id, Operacion operacion)
        {
            var materia = new Materia();

            if (id.HasValue)
            {
                materia = servicio.obtenerPorID(id.Value);
            }
            // Indica la operacion que estamos realizando en el formulario
            ViewData["Operacion"] = operacion;
            return(View(materia));
        }
Beispiel #25
0
        public ActionResult Form(int?id, Operacion operacion)
        {
            var grupo = new Grupo();

            if (id.HasValue)
            {
                grupo = servicio.obtenerPorID(id.Value);
            }

            ViewData["Operacion"] = operacion;
            return(View(grupo));
        }
        public bool BetweenDateTimes(Operacion operacion, DateTime fechaDesde, DateTime fechaHasta)
        {
            var rangoBusquedaEntreRangoOperacion =
                operacion.FechaHoraDesde <= fechaDesde && fechaDesde <= operacion.FechaHoraHasta ||
                operacion.FechaHoraDesde <= fechaHasta && fechaHasta <= operacion.FechaHoraHasta;

            var rangoOperacionEntreRangoBusqueda =
                fechaDesde <= operacion.FechaHoraHasta && operacion.FechaHoraHasta <= fechaHasta ||
                fechaDesde <= operacion.FechaHoraDesde && operacion.FechaHoraHasta <= fechaHasta;

            return(rangoBusquedaEntreRangoOperacion || rangoOperacionEntreRangoBusqueda);
        }
        public ActionResult Form(int?id, Operacion operacion)
        {
            var carrera = new Carrera();

            if (id.HasValue)
            {
                carrera = servicioCarrera.obtenerPorID(id.Value);
            }
            ViewData["Operacion"] = operacion;

            return(View(carrera));
        }
Beispiel #28
0
        public ActionResult Create([Bind(Include = "id,nombre,idModulo")] Operacion operacion)
        {
            if (ModelState.IsValid)
            {
                db.Operacion.Add(operacion);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.idModulo = new SelectList(db.Modelo, "id", "nombre", operacion.idModulo);
            return(View(operacion));
        }
        public ActionResult Form(int?id, Operacion operacion)
        {
            var store = new Store();

            if (id.HasValue)
            {
                store = servicioStore.obtenerPorID(id.Value);
            }
            ViewData["Operacion"] = operacion;

            return(View(store));
        }
Beispiel #30
0
        public Operacion InsertarConteoFisicoDetalle(ConteoFisicoArgumento conteoFisicoArgumento)
        {
            var op = new Operacion();

            foreach (var item in conteoFisicoArgumento.ConteoFisicoDetalle)
            {
                DbParameter[] parameters =
                {
                    new OAParameter
                    {
                        ParameterName = "@PHYSICAL_COUNT_HEADER_ID",
                        Value         = item.PHYSICAL_COUNT_HEADER_ID
                    },
                    new OAParameter
                    {
                        ParameterName = "@WAREHOUSE_ID",
                        Value         = item.CODE_WAREHOUSE
                    },
                    new OAParameter
                    {
                        ParameterName = "@ZONE",
                        Value         = item.ZONE
                    },
                    new OAParameter
                    {
                        ParameterName = "@LOCATION",
                        Value         = item.LOCATION_SPOT
                    },
                    new OAParameter
                    {
                        ParameterName = "@CLIENT_CODE",
                        Value         = item.CLIENT_CODE
                    },
                    new OAParameter
                    {
                        ParameterName = "@MATERIAL_ID",
                        Value         = item.MATERIAL_ID
                    },
                    new OAParameter
                    {
                        ParameterName = "@ASSIGNED_TO",
                        Value         = item.ASSIGNED_TO
                    }
                };
                op = BaseDeDatosServicio.ExecuteQuery <Operacion>(BaseDeDatosServicio.Esquema + ".OP_WMS_SP_INSERT_PHYSICAL_COUNTS_DETAIL", CommandType.StoredProcedure, false, parameters)[0];
                if (op.Resultado == ResultadoOperacionTipo.Error)
                {
                    throw new Exception("Ocurrió un error al crear detalle: " + op.Mensaje);
                }
            }
            return(op);
        }
Beispiel #31
0
        public object ejecutar(Contexto ctx, Stuff stuff)
        {
            object resOp1 = Operacion.Validar(op1.ejecutar(ctx, stuff), ctx, stuff, fila, columna);

            if (resOp1 == null)
            {
                return(null);
            }
            if (!(resOp1 is string))
            {
                stuff.error("Semántico", "'GRAPH', el parámetro 1 es del tipo incorrecto. Encontrado: " + Operacion.getTipo(resOp1) + ", Esperado: 'CADENA'.", fila, columna, ctx);
                return(null);
            }

            object resOp2 = Operacion.Validar(op2.ejecutar(ctx, stuff), ctx, stuff, fila, columna);

            if (resOp2 == null)
            {
                return(null);
            }
            if (!(resOp2 is string))
            {
                stuff.error("Semántico", "'GRAPH', el parámetro 2 es del tipo incorrecto. Encontrado: " + Operacion.getTipo(resOp2) + ", Esperado: 'CADENA'.", fila, columna, ctx);
                return(null);
            }

            StreamWriter archivo = new StreamWriter(resOp1.ToString() + ".nothing", false);

            archivo.Write(resOp2.ToString().Replace("\\\"", "\""));
            archivo.Close();

            Process p = new Process();

            p.StartInfo.FileName    = @"C:\Program Files (x86)\Graphviz2.38\bin\dot.exe";
            p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            p.StartInfo.Arguments   = "-Tpng " + resOp1.ToString() + ".nothing " + "-o " + resOp1.ToString();
            p.EnableRaisingEvents   = true;
            p.Exited += (sender1, e1) =>
            {
                Thread.Sleep(100);
                if (File.Exists(resOp1.ToString()))
                {
                    Process.Start(resOp1.ToString());
                }
                else
                {
                    stuff.error("Advertencia", "'GRAPH', Revise el archivo '" + resOp1.ToString() + ".nothing', puede contener errores para GraphViz.", fila, columna, ctx);
                }
            };
            p.Start();
            return(null);
        }
Beispiel #32
0
        public Operacion GuardarBodegaConAccesoPorUsuario(BodegaConAccesoPorUsuario bodegasConAccesoPorUsuario)
        {
            try
            {
                var op = new Operacion
                {
                    Resultado = ResultadoOperacionTipo.Exito,
                    Codigo    = 1
                };
                DbParameter[] parameters =
                {
                    new OAParameter
                    {
                        ParameterName = "@USER_CORRELATIVE",
                        Value         = bodegasConAccesoPorUsuario.USER_CORRELATIVE
                    }
                    ,
                    new OAParameter
                    {
                        ParameterName = "@CODE_WAREHOUSE",
                        Value         = bodegasConAccesoPorUsuario.CODE_WAREHOUSE
                    }
                };


                BaseDeDatosServicio.ExecuteNonQuery("SWIFT_SP_INSERT_WAREHOUSE_ACCESS_TO_USER", CommandType.StoredProcedure,
                                                    parameters);
                BaseDeDatosServicio.Commit();

                return(op);
            }
            catch (DbException e)
            {
                BaseDeDatosServicio.Rollback();
                return(new Operacion
                {
                    Codigo = e.ErrorCode,
                    Mensaje = e.HumanReadMessage(),
                    Resultado = Tipos.ResultadoOperacionTipo.Error
                });
            }
            catch (Exception ex)
            {
                BaseDeDatosServicio.Rollback();
                return(new Operacion
                {
                    Codigo = -1,
                    Mensaje = ex.Message,
                    Resultado = Tipos.ResultadoOperacionTipo.Error
                });
            }
        }
        public void RealizaOperacion(Operacion op)
        {
            if (op == Operacion.Suma)
            {
                resultado = primerNumero + segundoNumero + acarreo;

                if (resultado > 9)
                {
                    acarreo = resultado / 10;
                    resultado = resultado % 10;
                }
                else
                {
                    acarreo = 0;
                }
            }

            else if (op == Operacion.Resta)
            {
                primerNumero -= acarreo;
                if (primerNumero < segundoNumero)
                {
                    primerNumero += 10;
                    acarreo = 1;
                }
                else
                {
                    acarreo = 0;
                }
                resultado = primerNumero - segundoNumero;
            }
            else
            {
                resultado = (primerNumero * segundoNumero) + acarreo;
                if (resultado > 9)
                {
                    acarreo = resultado / 10;
                    resultado = resultado % 10;
                }
                else
                {
                    acarreo = 0;
                }
            }
        }
Beispiel #34
0
        private static void Main(string[] args)
        {
            double num1 = 8;
            double num2 = 6;

            #region Delegados

            Operacion operacionSuma = new Operacion(Sumar);
            double resultSuma = RealizarOperacion(num1, num2, operacionSuma);

            Operacion operacionResta = new Operacion(Restar);
            double resultResta = RealizarOperacion(num1, num2, operacionResta);

            Console.WriteLine(string.Format("Suma: {0}", resultSuma));
            Console.WriteLine(string.Format("Resta: {0}", resultResta));

            #endregion

            #region Action<t1,t2>

            Action<double, double> dividir = Dividir;
            dividir(num1, num2);

            #endregion

            #region Func<t1,t2>

            Func<double, double, double> operacionMultipl = Multiplicar;
            double resultMultipl = operacionMultipl(num1, num2);
            Console.WriteLine(string.Format("Multiplicacion: {0}", resultMultipl));

            #endregion

            double resultSumaLambda = RealizarOperacion(num1, num2, (x, y) => (x*y));
            Console.ReadKey();
        }
        private List<int> RalizaOperacion(List<int> list, List<int> libre, Operacion operacion, Operador op)
        {
            IgualaArreglos(list, libre);
            List<int> respuesta = new List<int>();
            int Count = libre.Count - 1;

            for (int inicio = 0; inicio < list.Count; inicio++)
            {

                op.PrimerNumero = list[Count - inicio];
                op.SegundoNumero = libre[Count - inicio];
                op.RealizaOperacion(operacion);

                respuesta.Insert(0, op.Resultado);
            }

            return respuesta;
        }
Beispiel #36
0
 public void SumarDosNumeros()
 {
     Operacion operacion = new Operacion();
     int resultado = operacion.Sumar(2, 5);
     Assert.AreEqual(7, resultado);
 }
Beispiel #37
0
 public void RestarDosNumeros()
 {
     Operacion operacion = new Operacion();
     int resultado = operacion.Restar(8, 5);
     Assert.AreEqual(3, resultado);
 }
Beispiel #38
0
 public void MultiplicarDosNumeros()
 {
     Operacion operacion = new Operacion();
     int resultado = operacion.Multiplicar(8, 5);
     Assert.AreEqual(40, resultado);
 }
Beispiel #39
0
 public void DividirDosNumerosResiduoCero()
 {
     Operacion operacion = new Operacion();
     float resultado = operacion.Dividir(24, 8);
     Assert.AreEqual(3, resultado);
 }
Beispiel #40
0
 public void DividirDosNumerosResiduoDiferenteDeCero()
 {
     Operacion operacion = new Operacion();
     float resultado = operacion.Dividir(9, 2);
     Assert.AreEqual(4.5, resultado);
 }
Beispiel #41
0
 private static double RealizarOperacion(double num1, double num2, Operacion operacion)
 {
     return operacion(num1, num2);
 }
Beispiel #42
0
 public ListadoAfiliado(Operacion estado)
 {
     this.estado = estado;
     InitializeComponent();
 }