Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            var    nombre = nombre1.Text;
            int    año    = Convert.ToInt32(año1.Text);
            string sitio  = sitio1.Text;

            try
            {
                string conexion = "mongodb://localhost";
                var    mc       = new MongoClient(conexion);
                var    server   = mc.GetServer();
                var    database = server.GetDatabase("MongoDB_Lab");
                server.Connect();
                var coleccion  = database.GetCollection <Productora>("Productora");
                var productora = new Productora
                {
                    nombre   = nombre,
                    anho     = año,
                    sitioWeb = sitio,
                };
                coleccion.Insert(productora);
                MessageBox.Show("Se registró la compañía");
                this.Hide();
            }
            catch (Exception error)
            {
                MessageBox.Show("Sucedió un error: " + error);
            }
        }
Example #2
0
        private void Crear_Click(object sender, EventArgs e)
        {
            Productora p = new Productora(Nombre_CP.Text, System.Convert.ToSingle(AñoCP.Text), WebCP.Text);

            CreateOneProductora(p);
        }
Example #3
0
 //Productoras
 public static void CreateOneProductora(Productora productora)
 {
     Coll_Productoras.InsertOne(productora);
 }