Escolar Documentos
Profissional Documentos
Cultura Documentos
NET
namespace TiendaNaturistaNaturVida
{
public partial class frmPrincipal : Form
{
public frmPrincipal()
{
InitializeComponent();
int a;
int b;
int c;
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace TiendaNaturistaNaturVida
public Clientes()
InitializeComponent();
MessageBox.Show("datos insertados");
this.Refresh();
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
textBox5.Clear();
this.Hide();
else {
MessageBox.Show("datos no insertados"); }
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace TiendaNaturistaNaturVida
public Clientes()
InitializeComponent();
MessageBox.Show("datos insertados");
this.Refresh();
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
textBox5.Clear();
this.Hide();
else {
MessageBox.Show("datos no insertados"); }
Agregar Cliente
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Sql;
using System.Data;
using System.Data.SqlClient;
using System.Windows.Forms;
namespace WindowsFormsApplication1
class agregarcliente
Catalog=facturacion;Integrated Security=True)";
conexion.Open();
values ({0}, '{1}', '{2}', '{3}', '{4}')," new string[] { idcliente, nomcliente,
dircliente, telcliente, correocliente }), conexion);
conexion.Close();
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Data;
namespace WindowsFormsApplication1
public Form3()
InitializeComponent();
combo.Seleccionar(cob:comboBox2);
cb.llenaritems(comboBox1);
{
if (sql.Insertar(idproducto.Text, desproducto.Text, valorproducto.Text,
cantidadproducto.Text) == true)
MessageBox.Show("datos insertados");
this.Refresh();
idproducto.Clear();
desproducto.Clear();
valorproducto.Clear();
cantidadproducto.Clear();
this.Hide();
}else
MessageBox.Show("datos no insertados");
cb.llenaritems(ComboProductoEliminar);
DataGridViewCellEventArgs e)
if (comboBox2.SelectedIndex > 0)
{
string[] valores = combo.captar_info(comboBox2.Text);
textBox7.Text = valores[0];
textBox6.Text = valores[1];
textBox5.Text = valores[2];
Catalog=facturacion;Integrated Security=True)";
conexen.Open();
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();
da.Fill(dt);
dgv.DataSource = dt;
conexen.Close();
if (ComboProductoEliminar.SelectedIndex > 0)
codProductoSeleccionado.Text = valores[0];
}
}
textBox5.Text))
MessageBox.Show("Datos Actualizado");
this.Hide();
if (sql.eliminar(codProductoSeleccionado.Text))
MessageBox.Show("Datos Eliminados");
this.Hide();
Agregar Producto
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Sql;
using System.Data;
using System.Data.SqlClient;
using System.Windows.Forms;
namespace WindowsFormsApplication1
class agregarproducto
Catalog=facturacion;Integrated Security=True)";
conexion.Open();
ds = new DataSet();
acdo.nFeixlilo(nd.sC,lo"stea(b)l;a");
return ds.Tables["tabla"];
conexion.Open();
conexion.Close();
conexion.Open();
SqlCommand cmd = new SqlCommand(string.Format("update producto set
conexion.Close();
conexion.Open();
ds = new DataSet();
ad.Fill(ds, "tabla");
conexion.Close();
return ds.Tables["tabla"];
conexion.Open();
conexion.Close();
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsFormsApplication1
double val;
double cant;
decimal resultado;
public Form4()
InitializeComponent();
combo.Seleccionar(cob: listaCli);
combo.SeleccionarProducto(cob: listaPro);
cb.Users(username);
Catalog=facturacion;Integrated Security=True)";
if (listaPro.SelectedIndex > 0)
{
CodPro.Text = valores[0];
Valor.Text = valores[1];
val = Convert.ToDouble(Valor.Text);
cant = Convert.ToDouble(cantidad.Text);
suma.Text = resultado.ToString();
fila.CreateCells(dgv);
fila.Cells[0].Value = fecha.Text;
fila.Cells[1].Value = documento.Text;
fila.Cells[2].Value = suma.Text;
fila.Cells[3].Value = username.Text;
ffiillaa..CCeellllss[[45]]..VVaalluuee == fCaocdtPurroa..TTeexxtt;;
fila.Cells[6].Value = cantidad.Text;
dgv.Rows.Add(fila);
fecha.Text = "";
cantidad.Text = "";
listaPro.Text = "";
CodPro.Text = "";
listaPro.ResetText();
decimal total = 0;
total += Convert.ToDecimal(Row.Cells["colum4"].Value);
valortotal.Text = Convert.ToString(total);
}
dgv.AllowUserToAddRows = false;
if (listaCli.SelectedIndex > 0)
documento.Text = valores[0];
direccion.Text = valores[1];
telefono.Text = valores[2];
correo.Text = valores[3];
factura.Text + "'");
if(string.IsNullOrWhiteSpace(factura.Text))
MessageBox.Show("error");
else
if (consultar == factura.Text)
}
else
try
conex.Open();
agregar.Parameters.Clear();
agregar.Parameters.AddWithValue("@idfactura",
Convert.ToString(factura.Text));
agregar.Parameters.AddWithValue("@fechafactura",
Convert.ToString(Row.Cells["colum2"].Value));
agregar.Parameters.AddWithValue("@idclientefactura",
Convert.ToString(Row.Cells["colum3"].Value));
agregar.Parameters.AddWithValue("@valorfactura",
Convert.ToString(valortotal.Text));
agregar.ExecuteNonQuery();
catch
finally
try
agregarPro.Parameters.Clear();
agregarPro.Parameters.AddWithValue("@idfactura",
Convert.ToString(Row.Cells["Column6"].Value));
agregarPro.Parameters.AddWithValue("@idproductoffactura",
Convert.ToInt32(Row.Cells["Column7"].Value));
Convert.ToInt32(Row.aCgerlelgsa["rCPorlou.mPna8r"a]m.eVtaelruse.)A)d;dWithValue("@fa
cCantidad",
agregarPro.ExecuteNonQuery();
MessageBox.Show("Datos agregados");
MessageBox.Show("Error al guardar"+ex);
finally
conex.Close();
dgv.Rows.Remove(dgv.CurrentRow);
}
}
Factura
using SSyysstteemm;.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Sql;
using System.Data;
using System.Data.SqlClient;
using System.Windows.Forms;
namespace WindowsFormsApplication1
class agregarfactura
Catalog=facturacion;Integrated Security=True)";
conexion.Open();
ds = new DataSet();
ad.Fill(ds, "tabla");
conexion.Close();
return ds.Tables["tabla"];
conexion.Open();
conexion.Close();
FacCantidad)
conexion.Open();
conexion);
conexion.Close();
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
namespace WindowsFormsApplication1
class conexion
{
public string cadenaconexion;
public conexion()
integrated security=true");
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Windows.Forms;
namespace WindowsFormsApplication1
class combo
SqlCommand cmd;
SqlConnection cnn;
SqlDataReader dr;
public combo()
{
try
Catalog=facturacion;Integrated Security=True)";
cnn.Open();
try
SqlDataReader dr;
dr = cmd.ExecuteReader();
while (dr.Read())
cb.Items.Add(dr["desproducto"].ToString());
try
SqlDataReader dr;
while (dr.Read())
cb.Items.Add(dr["venUsuario"].ToString());
} }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsFormsApplication1
class combobox
Catalog=facturacion;Integrated Security=True)";
cob.Items.Clear();
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
cob.Items.Add(dr[1].ToString());
con.Close();
cob.SelectedIndex = 0;
con.Open();
proDescripciSoqnl=C'o"m+manpdrocDmedsc=rinpecwioSnql+C"o'm"m,ancd(o"ns)e;lect * from
productosT where
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
string[] valores =
dr[0].ToString(),
dr[2].ToString(),
dr[3].ToString(),
};
resultado = valores;
con.Close();
return resultado;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Windows.Forms;
namespace WindowsFormsApplication1
class facturacombo
Catalog=facturacion;Integrated Security=True)";
cob.Items.Clear();
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
cob.Items.Add(dr[1].ToString());
con.Close();
cob.SelectedIndex = 0;
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
string[] valores =
{
dr[0].ToString(),
dr[2].ToString(),
dr[3].ToString(),
dr[4].ToString(),
};
resultado = valores;
}con.Close();
return resultado;
cob.Items.Clear();
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
cob.Items.Add(dr[1].ToString());
con.Close();
cob.SelectedIndex = 0;
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
string[] valores =
dr[0].ToString(),
dr[2].ToString(),
dr[3].ToString(),
};
resultado = valores;
con.Close();
return resultado;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{ /// <summary>
/// </summary>
[STAThread]
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());