예제 #1
0
        static void Main(string[] args)
        {
            operacion square = x => x * x;

            Console.WriteLine(square(3));
            Console.ReadLine();
        }
예제 #2
0
        static void Main(string[] args)
        {
            int mod5, mod2, a, b, inicio, fin;

            for (index = 0; index > 1; index++)
            {

                Console.Write("DIgite inicio");
                a = int.Parse((Console.ReadLine()));

                Console.Write("Digite el fin");
                b = int.Parse((Console.ReadLine()));

                operacion m = new operacion();
                Program g = new Program();

                if ((a > -1) && (b > -1))
                {
                    m.Condicion(a, b);
                }

                else
                {
                    Console.WriteLine("Digite valores postivos n");
                    index--;
                }
    }
}
예제 #3
0
        static void Main(string[] args)
        {
            operacion mul = new operacion(Mult);

            mul += Divi;

            int N1;
            int N2;
            int op;

            Console.WriteLine("Hola!!!");
            Console.WriteLine("Escribe el primer numero");
            N1 = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Escribe el segundo numero");
            N2 = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Escribe el numero de la operacion \n 1.suma y resta \n 2.multiplicacion y division");
            op = Convert.ToInt32(Console.ReadLine());

            switch (op)
            {
            case 1:
                mas(N1, N2);
                break;

            case 2:
                mul(N1, N2);
                break;
            }
        }
예제 #4
0
        private void btnGenerar_Click(object sender, EventArgs e)
        {
            operacion        oper = new operacion();
            SQLiteConnection cnx  = new SQLiteConnection("Data Source=C:\\sistema\\tarea2.db;Version=3;");
            SQLiteCommand    su1  = new SQLiteCommand("SELECT SUM(sueldo_emple) FROM empleados;", cnx);
            SQLiteCommand    su2  = new SQLiteCommand("SELECT SUM(sueldo_emple*0.08) FROM empleados;", cnx);
            SQLiteCommand    su3  = new SQLiteCommand("SELECT SUM(sueldo_emple*0.04) FROM empleados;", cnx);
            SQLiteCommand    su4  = new SQLiteCommand("SELECT SUM(sueldo_emple)-SUM(sueldo*0.14) FROM empleados;", cnx);
            SQLiteCommand    su5  = new SQLiteCommand("SELECT SUM(sueldo_empleo*0.02) FROM empleados;", cnx);
            SQLiteCommand    su6  = new SQLiteCommand("SELECT SUM(sueldo_emple*0.14) FROM empleados;", cnx);

            cnx.Open();
            string            generaciondenomina = ("SELECT idempleado, nombre, apellido, sueldo,*0.08 AS ISR, sueldo*0.04 AS ss, sueldo*0.02 AS otros_desceunto, sueldo*0.14 AS total_descuentos, sueldo-(sueldo*0.14) AS total_sueldo_Neto FROM empleados");
            SQLiteDataAdapter db = new SQLiteDataAdapter(generarnomina, cnx);
            DataSet           ds = new DataSet();

            ds.Reset();
            DataTable dt = new DataTable();

            db.Fill(ds);
            dt = ds.Tables[0];
            dataGridView1.DataSource = dt;
            sueldoTotal.Text         = cmd1.ExecuteScalar().ToString();
            isrTotal.Text            = cmd2.ExecuteScalar().ToString();
            ssTotal.Text             = cmd3.ExecuteScalar().ToString();
            netoTotal.Text           = cmd4.ExecuteScalar().ToString();
            otrosDesc.Text           = cmd5.ExecuteScalar().ToString();
            deduccTotal.Text         = cmd6.ExecuteScalar().ToString();
            idNomina.Enabled         = true;

            cnx.Close();
        }
예제 #5
0
 public void procesar(operacion op)
 {
     for (int i = 0; i < lista.Count; i++)
     {
         lista[i] = op(lista[i]);
     }
 }
예제 #6
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            operacion op = new operacion();
            string    nombre, apellido, usu, contra, contra2, fecha_nac, correo;
            int       pais;

            nombre    = Tnombre.Text;
            apellido  = Tapellido.Text;
            usu       = Tusu.Text;
            contra    = Tcontra.Text;
            contra2   = Tcontra2.Text;
            fecha_nac = TfechaNac.Text;
            correo    = Tcorreo.Text;
            pais      = 55;
            if (contra.Equals(contra2))
            {
                if (op.registrar(nombre, apellido, usu, contra, fecha_nac, correo, pais))
                {
                    Response.Write("<script>window.alert('Guardado Correctamente')</script>");
                }
                else
                {
                    Response.Write("<script>window.alert('Error al Guardar')</script>");
                }
            }
            else
            {
                Response.Write("<script>window.alert('Contrasenas no Coinsiden')</script>");
            }
        }
예제 #7
0
        public ActionResult Nuevo(TablaViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (CrudEntities db = new CrudEntities())
                    {
                        var oTabla = new operacion();

                        oTabla.concepto = model.concepto;
                        oTabla.monto    = model.monto;
                        oTabla.fecha_op = model.fecha_op;
                        oTabla.tipo     = model.tipo;

                        db.operacion.Add(oTabla);
                        db.SaveChanges();
                    }

                    return(Redirect("~/Tabla/"));
                }

                return(View(model));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
예제 #8
0
        public void confirmar(string usu)
        {
            try
            {
                String        dato     = "";
                String        repetido = "select * from usuario where nick = '" + usu + "'";
                SqlCommand    cm2      = new SqlCommand(repetido, con.getConexion());
                SqlDataReader consu    = cm2.ExecuteReader();
                while (consu.Read())
                {
                    dato = consu["nick"].ToString();
                }

                if (dato != "")
                {
                    Response.Write("<script>window.alert('Usuario Existente')</script>");
                }
                else
                {
                    operacion op = new operacion();
                    string    nombre, apellido, usuario, contra, contra2, fecha_nac, correo, pais;
                    nombre    = Tnombre.Text;
                    apellido  = Tapellido.Text;
                    usuario   = Tusu.Text;
                    contra    = Tcontra.Text;
                    contra2   = Tcontra2.Text;
                    fecha_nac = TfechaNac.Text;
                    correo    = Tcorreo.Text;
                    pais      = Tpais.Text;
                    if (contra.Equals(contra2))
                    {
                        if (op.registrar(nombre, apellido, usuario, contra, fecha_nac, correo, pais))
                        {
                            Response.Write("<script>window.alert('Guardado Correctamente')</script>");

                            Response.Redirect("index.aspx");
                        }
                        else
                        {
                            Response.Write("<script>window.alert('Error al Guardar')</script>");
                        }
                    }
                    else
                    {
                        Response.Write("<script>window.alert('Contrasenas no Coinsiden')</script>");
                    }
                }
            }
            catch (Exception)
            {
            }
        }
예제 #9
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            operacion op = new operacion();

            if (op.ingresar(Tusu.Text, Tcontra.Text) != "")
            {
                usuario = Tusu.Text;
                Response.Redirect("inicio.aspx");
            }
            else
            {
                Response.Write("<script>window.alert('Usuario y/o Cintraseña Erronea')</script>");
            }
        }
예제 #10
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            operacion op = new operacion();

            if (op.ingresar(Tusu.Text, Tcontra.Text) != null)
            {
                Response.Write("<script>window.alert('" + op.ingresar(Tusu.Text, Tcontra.Text) + "')</script>");

                Response.Write("<script>");
                Response.Write("window.open('inicio.aspx' ,'_blank')");
                Response.Write("</script>");
            }
            else
            {
            }
        }
예제 #11
0
        private void btir_Click(object sender, EventArgs e)
        {
            operacion        oper = new operacion();
            SQLiteConnection cnx  = new SQLiteConnection("Data Source=C:\\sistema\\tarea2.db;Version=3;");

            oper.ConsultaSinResultado("insert into cabeza_nomina (fecha_ini, fecha_fin, sueldo_total, isr, ss, otros, total_dedu, total_sueldo_neto) vALUES('" + fechaini.text + "','" + FechaFin.Text + "','" + SueldoTotal + "','" + irs.Text + "','" + ss.Text + "','" + otrosDecu.Text + "','" + totalDeduc.Text + "','" + sueldo_Neto.Text + "')");

            string  idNomina;
            DataSet ds;

            ds       = oper.ConsultaConResultado("select max(idnomina) from cabeza_nomina;");
            idNomina = ds.Tables[0].Rows[0][0].ToString();

            int    filas = dataGridView1.RowCount;
            string idempleado, sueldo, isr, ss, otros, neto;

            for (int i = 0; i < (CantidaddDeFilas - 1); i++)
            {
                idempleado = dataGridView1.Rows[i].Cells[0].Value.ToString();
                sueldo     = dataGridView1.Rows[i].Cells[3].Value.ToString();
                isr        = dataGridView1.Rows[i].Cells[4].Value.ToString();
                ss         = dataGridView1.Rows[i].Cells[5].Value.ToString();
                otros      = dataGridView1.Rows[i].Cells[6].Value.ToString();
                neto       = dataGridView1.Rows[i].Cells[8].Value.ToString();

                oper.ConsultaSinResultado("insert into detalle_nomina VALUES (" + NumNomina + "," + idempleado + "," + sueldo + "," + isr + "," + ss + "," + otros + "," + neto + ");");
            }

            DataTable dt = null;

            dataGridView1.DataSource = dt;
            dataGridView1.Refresh();


            Dedu.Clear();
            irsTotal.Clear();
            netoTotal.Clear();
            numNomina.Clear();
            otrosDesc.Clear();
            ss.Clear();
            sueldoTotal.Clear();
            fechaIni.Value = DateTime.Now;
            fechaIni.Value = DateTime.Now;
            dataGridView1  = null;
            MessageBox.Show("exitoso!");
        }
예제 #12
0
        public void consultarnomina()
        {
            //declaramos la clase operacion
            //luego nos conectamos a la db
            //hacemos un select con un where en idnominana
            operacion        oper = new operacion();
            SQLiteConnection cnx  = new SQLiteConnection("Data Source=C:\\sistema\\tarea2.db;Version=3;");

            cnx.Open();
            string            consultanomina = ("select * from detalle_nomina WHERE idnomina ='" + idnomina + "'");
            SQLiteDataAdapter co             = new SQLiteDataAdapter(consultanomina, cnx);
            DataSet           ds             = new DataSet();

            ds.Reset();
            DataTable dt = new DataTable();

            co.Fill(ds);
            dt = ds.Tables[0];
            dataGridView1.DataSource = dt;
            cnx.Close();
        }
예제 #13
0
        static void Main(string[] args)
        {
            operacion fibonaci = null;

            fibonaci = (n) => {
                if (n == 0)
                {
                    return(0);
                }
                else if (n == 1)
                {
                    return(1);
                }
                else
                {
                    return(fibonaci(n - 2) + fibonaci(n - 1));
                }
            };
            Console.WriteLine(fibonaci(6));
            Console.ReadKey();
        }
예제 #14
0
 public static double opero(double x, operacion delg)
 {
     return(x);
 }