예제 #1
0
        protected void btnRegistrarme_Click(object sender, EventArgs e)
        {
            Connexion conect = new Connexion();
            string    cadena = "Data Source=.;Initial Catalog=SpecialCoffeInternational;User ID=sa;Password=123";
            //resive el parametro de la conexion
            SqlConnection conectar = new SqlConnection(cadena);

            conectar.Open();
            Def.comando             = new SqlCommand("sp_insertar_customer", conectar);
            Def.comando.CommandType = CommandType.StoredProcedure;

            SqlParameter insertid = new SqlParameter();

            insertid.ParameterName = "@id";
            insertid.SqlDbType     = SqlDbType.BigInt;
            insertid.Value         = txtCedula.Text;

            SqlParameter insertNon = new SqlParameter();

            insertNon.ParameterName = "@userName";
            insertNon.SqlDbType     = SqlDbType.VarChar;
            insertNon.Value         = txtNombre.Text;


            SqlParameter insertAP = new SqlParameter();

            insertAP.ParameterName = "@lastName";
            insertAP.SqlDbType     = SqlDbType.VarChar;
            insertAP.Value         = txtApellido.Text;

            SqlParameter insertte = new SqlParameter();

            insertte.ParameterName = "@telefono";
            insertte.SqlDbType     = SqlDbType.BigInt;
            insertte.Value         = txtTelefono.Text;

            SqlParameter insertem = new SqlParameter();

            insertem.ParameterName = "@email";
            insertem.SqlDbType     = SqlDbType.VarChar;
            insertem.Value         = txtEmail.Text;

            SqlParameter insertpass = new SqlParameter();

            insertpass.ParameterName = "@pass";
            insertpass.SqlDbType     = SqlDbType.VarChar;
            insertpass.Value         = txtPass.Text;

            Def.comando.Parameters.Add(insertid);
            Def.comando.Parameters.Add(insertNon);
            Def.comando.Parameters.Add(insertAP);
            Def.comando.Parameters.Add(insertem);
            Def.comando.Parameters.Add(insertpass);
            Def.comando.Parameters.Add(insertte);

            Def.da = new SqlDataAdapter(Def.comando);
            Def.comando.ExecuteNonQuery();
            //logueo  vendedor
            Response.Redirect("logcustomer/index.aspx");

            conect.cerrarConexion();
        }
예제 #2
0
        protected void btnContinuar_Click(object sender, EventArgs e)
        {
            int tamanio = FileUpload1.PostedFile.ContentLength;

            byte[] imagenOriginal = new byte[tamanio];


            FileUpload1.PostedFile.InputStream.Read(imagenOriginal, 0, tamanio);

            // Bitmap imagenOriginalBinaria = new Bitmap(FileUpload1.PostedFile.InputStream);

            string ImagenDataUrl64 = "data:image/jpg;base64," + Convert.ToBase64String(imagenOriginal);

            imgPreview.ImageUrl = ImagenDataUrl64;


            Connexion conect = new Connexion();


            string cadena = "Data Source=.;Initial Catalog=SpecialCoffeInternational;User ID=sa;Password=123";
            //resive el parametro de la conexion
            SqlConnection conectar = new SqlConnection(cadena);

            conectar.Open();
            Def.comando             = new SqlCommand("sp_insertar_product", conectar);
            Def.comando.CommandType = CommandType.StoredProcedure;


            SqlParameter insertfinca = new SqlParameter();

            insertfinca.ParameterName = "@nombreFinca";
            insertfinca.SqlDbType     = SqlDbType.VarChar;
            insertfinca.Value         = txtNomFinca.Text;

            SqlParameter insertvari = new SqlParameter();

            insertvari.ParameterName = "@variedad";
            insertvari.SqlDbType     = SqlDbType.VarChar;
            insertvari.Value         = txtVariedad.Text;

            SqlParameter insertal = new SqlParameter();

            insertal.ParameterName = "@altura";
            insertal.SqlDbType     = SqlDbType.VarChar;
            insertal.Value         = txtAltura.Text;


            SqlParameter insertcar = new SqlParameter();

            insertcar.ParameterName = "@caracteristicas";
            insertcar.SqlDbType     = SqlDbType.VarChar;
            insertcar.Value         = txtCaracteristicas.Text;

            SqlParameter insertcant = new SqlParameter();

            insertcant.ParameterName = "@cantidad";
            insertcant.SqlDbType     = SqlDbType.Decimal;
            insertcant.Value         = txtCantidad.Text;

            SqlParameter insertprue = new SqlParameter();

            insertprue.ParameterName = "@pruebaTaza";
            insertprue.SqlDbType     = SqlDbType.Decimal;
            insertprue.Value         = txtPrueba.Text;

            SqlParameter insertcer = new SqlParameter();

            insertcer.ParameterName = "@certificaciones";
            insertcer.SqlDbType     = SqlDbType.VarChar;
            insertcer.Value         = txtCertificaciones.Text;

            SqlParameter inserdep = new SqlParameter();

            inserdep.ParameterName = "@departamento";
            inserdep.SqlDbType     = SqlDbType.VarChar;
            inserdep.Value         = txtDepartamento.Text;

            SqlParameter insertmun = new SqlParameter();

            insertmun.ParameterName = "@municipio";
            insertmun.SqlDbType     = SqlDbType.VarChar;
            insertmun.Value         = txtMunicipio.Text;

            SqlParameter insertcli = new SqlParameter();

            insertcli.ParameterName = "@idCustomer";
            insertcli.SqlDbType     = SqlDbType.BigInt;
            insertcli.Value         = txtCliente.Text;

            //SqlParameter insertcat = new SqlParameter();
            //insertcat.ParameterName = "@idcategorie";
            //insertcat.SqlDbType = SqlDbType.Int;
            //insertcat.Value = txtCategoria.Text;



            SqlParameter insertimg = new SqlParameter();

            insertimg.ParameterName = "@imagen";
            insertimg.SqlDbType     = SqlDbType.Image;
            insertimg.Value         = imagenOriginal;

            Def.comando.Parameters.Add(insertfinca);
            Def.comando.Parameters.Add(insertvari);
            Def.comando.Parameters.Add(insertal);
            Def.comando.Parameters.Add(insertcar);
            Def.comando.Parameters.Add(insertcant);
            Def.comando.Parameters.Add(insertprue);
            Def.comando.Parameters.Add(insertcer);
            Def.comando.Parameters.Add(inserdep);
            Def.comando.Parameters.Add(insertmun);
            Def.comando.Parameters.Add(insertcli);
            // Def.comando.Parameters.Add(insertcat);
            Def.comando.Parameters.Add(insertimg);


            Def.da = new SqlDataAdapter(Def.comando);
            Def.comando.ExecuteNonQuery();
            Response.Redirect("logcustomer/index.aspx");
            conect.cerrarConexion();
        }