Ticket Final V.1

This commit is contained in:
Michael Robles
2024-01-16 00:31:19 -07:00
18 changed files with 281 additions and 73 deletions
File diff suppressed because one or more lines are too long
+91 -45
View File
@@ -31,21 +31,25 @@
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox(); this.txtNombre = new System.Windows.Forms.TextBox();
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox(); this.txtContra = new System.Windows.Forms.TextBox();
this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel(); this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.textBox3 = new System.Windows.Forms.TextBox(); this.txtContraConf = new System.Windows.Forms.TextBox();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.btnAceptar = new System.Windows.Forms.Button(); this.btnAceptar = new System.Windows.Forms.Button();
this.btnCancelar = new System.Windows.Forms.Button(); this.btnCancelar = new System.Windows.Forms.Button();
this.flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel();
this.label4 = new System.Windows.Forms.Label();
this.cbTipo = new System.Windows.Forms.ComboBox();
this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout();
this.flowLayoutPanel1.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout();
this.flowLayoutPanel2.SuspendLayout(); this.flowLayoutPanel2.SuspendLayout();
this.flowLayoutPanel3.SuspendLayout(); this.flowLayoutPanel3.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout();
this.flowLayoutPanel4.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// tableLayoutPanel1 // tableLayoutPanel1
@@ -53,30 +57,32 @@
this.tableLayoutPanel1.ColumnCount = 1; this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 4);
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 0); this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 0, 1); this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel3, 0, 2); this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel3, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 3); this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel4, 0, 3);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 4; this.tableLayoutPanel1.RowCount = 5;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 51.07914F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 51.07914F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 48.92086F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 48.92086F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 84F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 82F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 72F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 71F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(354, 311); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 73F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(354, 387);
this.tableLayoutPanel1.TabIndex = 0; this.tableLayoutPanel1.TabIndex = 0;
// //
// flowLayoutPanel1 // flowLayoutPanel1
// //
this.flowLayoutPanel1.Controls.Add(this.label1); this.flowLayoutPanel1.Controls.Add(this.label1);
this.flowLayoutPanel1.Controls.Add(this.textBox1); this.flowLayoutPanel1.Controls.Add(this.txtNombre);
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3); this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3);
this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(348, 73); this.flowLayoutPanel1.Size = new System.Drawing.Size(348, 76);
this.flowLayoutPanel1.TabIndex = 0; this.flowLayoutPanel1.TabIndex = 0;
// //
// label1 // label1
@@ -90,23 +96,23 @@
this.label1.TabIndex = 0; this.label1.TabIndex = 0;
this.label1.Text = "Nombre de usuario:"; this.label1.Text = "Nombre de usuario:";
// //
// textBox1 // txtNombre
// //
this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txtNombre.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textBox1.Location = new System.Drawing.Point(3, 37); this.txtNombre.Location = new System.Drawing.Point(3, 37);
this.textBox1.Name = "textBox1"; this.txtNombre.Name = "txtNombre";
this.textBox1.Size = new System.Drawing.Size(345, 26); this.txtNombre.Size = new System.Drawing.Size(345, 26);
this.textBox1.TabIndex = 1; this.txtNombre.TabIndex = 1;
// //
// flowLayoutPanel2 // flowLayoutPanel2
// //
this.flowLayoutPanel2.Controls.Add(this.label2); this.flowLayoutPanel2.Controls.Add(this.label2);
this.flowLayoutPanel2.Controls.Add(this.textBox2); this.flowLayoutPanel2.Controls.Add(this.txtContra);
this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel2.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.flowLayoutPanel2.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel2.Location = new System.Drawing.Point(3, 82); this.flowLayoutPanel2.Location = new System.Drawing.Point(3, 85);
this.flowLayoutPanel2.Name = "flowLayoutPanel2"; this.flowLayoutPanel2.Name = "flowLayoutPanel2";
this.flowLayoutPanel2.Size = new System.Drawing.Size(348, 69); this.flowLayoutPanel2.Size = new System.Drawing.Size(348, 72);
this.flowLayoutPanel2.TabIndex = 1; this.flowLayoutPanel2.TabIndex = 1;
// //
// label2 // label2
@@ -120,24 +126,24 @@
this.label2.TabIndex = 0; this.label2.TabIndex = 0;
this.label2.Text = "contraseña"; this.label2.Text = "contraseña";
// //
// textBox2 // txtContra
// //
this.textBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txtContra.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textBox2.Location = new System.Drawing.Point(3, 37); this.txtContra.Location = new System.Drawing.Point(3, 37);
this.textBox2.Name = "textBox2"; this.txtContra.Name = "txtContra";
this.textBox2.PasswordChar = '*'; this.txtContra.PasswordChar = '*';
this.textBox2.Size = new System.Drawing.Size(345, 26); this.txtContra.Size = new System.Drawing.Size(345, 26);
this.textBox2.TabIndex = 1; this.txtContra.TabIndex = 1;
// //
// flowLayoutPanel3 // flowLayoutPanel3
// //
this.flowLayoutPanel3.Controls.Add(this.label3); this.flowLayoutPanel3.Controls.Add(this.label3);
this.flowLayoutPanel3.Controls.Add(this.textBox3); this.flowLayoutPanel3.Controls.Add(this.txtContraConf);
this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel3.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.flowLayoutPanel3.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel3.Location = new System.Drawing.Point(3, 157); this.flowLayoutPanel3.Location = new System.Drawing.Point(3, 163);
this.flowLayoutPanel3.Name = "flowLayoutPanel3"; this.flowLayoutPanel3.Name = "flowLayoutPanel3";
this.flowLayoutPanel3.Size = new System.Drawing.Size(348, 78); this.flowLayoutPanel3.Size = new System.Drawing.Size(348, 76);
this.flowLayoutPanel3.TabIndex = 2; this.flowLayoutPanel3.TabIndex = 2;
// //
// label3 // label3
@@ -151,14 +157,14 @@
this.label3.TabIndex = 0; this.label3.TabIndex = 0;
this.label3.Text = "confirmar contraseña"; this.label3.Text = "confirmar contraseña";
// //
// textBox3 // txtContraConf
// //
this.textBox3.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txtContraConf.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textBox3.Location = new System.Drawing.Point(3, 37); this.txtContraConf.Location = new System.Drawing.Point(3, 37);
this.textBox3.Name = "textBox3"; this.txtContraConf.Name = "txtContraConf";
this.textBox3.PasswordChar = '*'; this.txtContraConf.PasswordChar = '*';
this.textBox3.Size = new System.Drawing.Size(342, 26); this.txtContraConf.Size = new System.Drawing.Size(342, 26);
this.textBox3.TabIndex = 1; this.txtContraConf.TabIndex = 1;
// //
// tableLayoutPanel2 // tableLayoutPanel2
// //
@@ -169,13 +175,13 @@
this.tableLayoutPanel2.Controls.Add(this.btnAceptar, 1, 0); this.tableLayoutPanel2.Controls.Add(this.btnAceptar, 1, 0);
this.tableLayoutPanel2.Controls.Add(this.btnCancelar, 2, 0); this.tableLayoutPanel2.Controls.Add(this.btnCancelar, 2, 0);
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 241); this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 316);
this.tableLayoutPanel2.Name = "tableLayoutPanel2"; this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1; this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(348, 67); this.tableLayoutPanel2.Size = new System.Drawing.Size(348, 68);
this.tableLayoutPanel2.TabIndex = 3; this.tableLayoutPanel2.TabIndex = 4;
// //
// btnAceptar // btnAceptar
// //
@@ -183,10 +189,11 @@
this.btnAceptar.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnAceptar.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnAceptar.Location = new System.Drawing.Point(165, 3); this.btnAceptar.Location = new System.Drawing.Point(165, 3);
this.btnAceptar.Name = "btnAceptar"; this.btnAceptar.Name = "btnAceptar";
this.btnAceptar.Size = new System.Drawing.Size(87, 61); this.btnAceptar.Size = new System.Drawing.Size(87, 62);
this.btnAceptar.TabIndex = 0; this.btnAceptar.TabIndex = 0;
this.btnAceptar.Text = "Aceptar"; this.btnAceptar.Text = "Aceptar";
this.btnAceptar.UseVisualStyleBackColor = true; this.btnAceptar.UseVisualStyleBackColor = true;
this.btnAceptar.Click += new System.EventHandler(this.btnAceptar_Click_1);
// //
// btnCancelar // btnCancelar
// //
@@ -194,16 +201,50 @@
this.btnCancelar.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnCancelar.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnCancelar.Location = new System.Drawing.Point(258, 3); this.btnCancelar.Location = new System.Drawing.Point(258, 3);
this.btnCancelar.Name = "btnCancelar"; this.btnCancelar.Name = "btnCancelar";
this.btnCancelar.Size = new System.Drawing.Size(87, 61); this.btnCancelar.Size = new System.Drawing.Size(87, 62);
this.btnCancelar.TabIndex = 1; this.btnCancelar.TabIndex = 1;
this.btnCancelar.Text = "Cancelar"; this.btnCancelar.Text = "Cancelar";
this.btnCancelar.UseVisualStyleBackColor = true; this.btnCancelar.UseVisualStyleBackColor = true;
// //
// flowLayoutPanel4
//
this.flowLayoutPanel4.Controls.Add(this.label4);
this.flowLayoutPanel4.Controls.Add(this.cbTipo);
this.flowLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel4.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel4.Location = new System.Drawing.Point(3, 245);
this.flowLayoutPanel4.Name = "flowLayoutPanel4";
this.flowLayoutPanel4.Size = new System.Drawing.Size(348, 65);
this.flowLayoutPanel4.TabIndex = 5;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label4.Location = new System.Drawing.Point(3, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(43, 20);
this.label4.TabIndex = 0;
this.label4.Text = "Tipo:";
//
// cbTipo
//
this.cbTipo.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cbTipo.FormattingEnabled = true;
this.cbTipo.Items.AddRange(new object[] {
"admin",
"empleado"});
this.cbTipo.Location = new System.Drawing.Point(3, 23);
this.cbTipo.Name = "cbTipo";
this.cbTipo.Size = new System.Drawing.Size(121, 28);
this.cbTipo.TabIndex = 1;
this.cbTipo.Text = "empleado";
//
// AgregarLogin // AgregarLogin
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(354, 311); this.ClientSize = new System.Drawing.Size(354, 387);
this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.tableLayoutPanel1);
this.Name = "AgregarLogin"; this.Name = "AgregarLogin";
this.Text = "Crear Login"; this.Text = "Crear Login";
@@ -215,6 +256,8 @@
this.flowLayoutPanel3.ResumeLayout(false); this.flowLayoutPanel3.ResumeLayout(false);
this.flowLayoutPanel3.PerformLayout(); this.flowLayoutPanel3.PerformLayout();
this.tableLayoutPanel2.ResumeLayout(false); this.tableLayoutPanel2.ResumeLayout(false);
this.flowLayoutPanel4.ResumeLayout(false);
this.flowLayoutPanel4.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@@ -224,15 +267,18 @@
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox txtNombre;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.TextBox txtContra;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel3; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel3;
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtContraConf;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Button btnAceptar; private System.Windows.Forms.Button btnAceptar;
private System.Windows.Forms.Button btnCancelar; private System.Windows.Forms.Button btnCancelar;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel4;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.ComboBox cbTipo;
} }
} }
+36 -2
View File
@@ -1,4 +1,6 @@
using System; using compabetov2.database;
using compabetov2.database.modelos;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
@@ -12,9 +14,41 @@ namespace compabetov2
{ {
public partial class AgregarLogin : Form public partial class AgregarLogin : Form
{ {
public AgregarLogin() personal ventanaPadre;
int idEmpleado;
public AgregarLogin(personal ventanaPadre, int idEmpleado)
{ {
InitializeComponent(); InitializeComponent();
this.ventanaPadre = ventanaPadre;
this.idEmpleado = idEmpleado;
}
private void btnAceptar_Click(object sender, EventArgs e)
{
}
private void btnAceptar_Click_1(object sender, EventArgs e)
{
string contra = txtContra.Text;
string contraConf = txtContraConf.Text;
if (contra.Equals(contraConf))
{
string tipo = cbTipo.Text;
string nombre = txtNombre.Text;
LoginModel loginModel = new LoginModel(nombre,contra,tipo, idEmpleado);
if (service.crearLogin(loginModel))
{
MessageBox.Show("Login creado");
ventanaPadre.llenarPanel();
Close();
}
}
else
{
MessageBox.Show("Las cotraseña no coinciden", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
} }
} }
} }
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
+4
View File
@@ -126,6 +126,7 @@
<Compile Include="database\modelos\Categoria.cs" /> <Compile Include="database\modelos\Categoria.cs" />
<Compile Include="database\modelos\Cliente.cs" /> <Compile Include="database\modelos\Cliente.cs" />
<Compile Include="database\modelos\Empleado.cs" /> <Compile Include="database\modelos\Empleado.cs" />
<Compile Include="database\modelos\LoginModel.cs" />
<Compile Include="database\modelos\Producto.cs" /> <Compile Include="database\modelos\Producto.cs" />
<Compile Include="database\modelos\usuario.cs" /> <Compile Include="database\modelos\usuario.cs" />
<Compile Include="database\service.cs" /> <Compile Include="database\service.cs" />
@@ -187,12 +188,15 @@
</Compile> </Compile>
<EmbeddedResource Include="AgregarEmpleado.resx"> <EmbeddedResource Include="AgregarEmpleado.resx">
<DependentUpon>AgregarEmpleado.cs</DependentUpon> <DependentUpon>AgregarEmpleado.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="AgregarLogin.resx"> <EmbeddedResource Include="AgregarLogin.resx">
<DependentUpon>AgregarLogin.cs</DependentUpon> <DependentUpon>AgregarLogin.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="cuentas.resx"> <EmbeddedResource Include="cuentas.resx">
<DependentUpon>cuentas.cs</DependentUpon> <DependentUpon>cuentas.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="EditarEmpleado.resx"> <EmbeddedResource Include="EditarEmpleado.resx">
<DependentUpon>EditarEmpleado.cs</DependentUpon> <DependentUpon>EditarEmpleado.cs</DependentUpon>
+49
View File
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Data.SQLite; using System.Data.SQLite;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Security.Policy;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
@@ -75,6 +76,54 @@ namespace compabetov2.database
} }
} }
public static bool crearLoginDAO(LoginModel login)
{
var db_conexion = new Conexion();
try
{
using (SQLiteConnection conexion = db_conexion.get_connection())
{
conexion.Open();
using (var transaccion = conexion.BeginTransaction())
{
try
{
string sqlLogin = "INSERT INTO Login (tipo, usuario, contra) VALUES(@tipo, @usuario, @contra);";
string sqlEmpleado = "UPDATE Empleado SET fk_idLogin = @fklogin WHERE idempleado = @idempleado";
SQLiteCommand commandLogin = new SQLiteCommand(sqlLogin, conexion);
commandLogin.Parameters.AddWithValue("@tipo", login.tipo);
commandLogin.Parameters.AddWithValue("@usuario", login.usuario);
commandLogin.Parameters.AddWithValue("@contra", login.contra);
SQLiteCommand commandEmpleado = new SQLiteCommand(sqlEmpleado, conexion);
commandEmpleado.Parameters.AddWithValue("@fklogin", login.fkEmpleado);
commandEmpleado.Parameters.AddWithValue("@idempleado", login.fkEmpleado);
commandLogin.ExecuteNonQuery();
commandEmpleado.ExecuteNonQuery();
transaccion.Commit();
return true;
}
catch (SQLiteException ex)
{
transaccion.Rollback();
MessageBox.Show(ex.Message);
return false;
}
}
}
}
catch (SQLiteException ex)
{
MessageBox.Show(ex.Message);
return false;
}
}
public static bool insertarEmpleadoDAO(Empleado empleado) public static bool insertarEmpleadoDAO(Empleado empleado)
{ {
var db_conexion = new Conexion(); var db_conexion = new Conexion();
+22
View File
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace compabetov2.database.modelos
{
internal class LoginModel
{
public string usuario;
public string contra;
public string tipo;
public int fkEmpleado;
public LoginModel(string usuario, string contra, string tipo, int fkEmpleado = -1) {
this.usuario = usuario;
this.contra = contra;
this.tipo = tipo;
this.fkEmpleado = fkEmpleado;
}
}
}
+5
View File
@@ -17,6 +17,11 @@ namespace compabetov2.database
return DAO.iniciarSesionDAO(usuario.nombreUsuario, usuario.contra); return DAO.iniciarSesionDAO(usuario.nombreUsuario, usuario.contra);
} }
public static bool crearLogin(LoginModel loginModel)
{
return DAO.crearLoginDAO(loginModel);
}
public static List<Producto> conseguirProductos() public static List<Producto> conseguirProductos()
{ {
List<Producto> productos = new List<Producto>(); List<Producto> productos = new List<Producto>();
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
e81505b63e90e240cb3d334138353bc4b39d1592d688dbc8cdcd7b719763abb9 53d3357e91ba943207bdb342d3e86d03592902ff7e153756cf88b283a4af2498
@@ -92,7 +92,10 @@ C:\Users\carsu\source\repos\compabetoOG\obj\Debug\compabetov2.AgregarEmpleado.re
C:\Users\carsu\source\repos\compabetoOG\obj\Debug\compabetov2.EditarEmpleado.resources C:\Users\carsu\source\repos\compabetoOG\obj\Debug\compabetov2.EditarEmpleado.resources
C:\Users\carsu\source\repos\compabetoOG\obj\Debug\compabetov2.AgregarLogin.resources C:\Users\carsu\source\repos\compabetoOG\obj\Debug\compabetov2.AgregarLogin.resources
C:\Users\carsu\source\repos\compabetoOG\obj\Debug\compabetov2.Confirmacion.resources C:\Users\carsu\source\repos\compabetoOG\obj\Debug\compabetov2.Confirmacion.resources
<<<<<<< HEAD
=======
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.AgregarEmpleado.resources C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.AgregarEmpleado.resources
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.AgregarLogin.resources C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.AgregarLogin.resources
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.EditarEmpleado.resources C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.EditarEmpleado.resources
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.Confirmacion.resources C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.Confirmacion.resources
>>>>>>> c224b1f121cf870873d6bc2414ec92b69d8a3668
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -134,7 +134,7 @@ namespace compabetov2
btnLogin.Click += new EventHandler(delegate (object sender, EventArgs e) btnLogin.Click += new EventHandler(delegate (object sender, EventArgs e)
{ {
AgregarLogin agregarLogin = new AgregarLogin(); AgregarLogin agregarLogin = new AgregarLogin(this, empleado.idempleado);
agregarLogin.Show(); agregarLogin.Show();
}); });
} }
+60 -23
View File
@@ -173,6 +173,8 @@ namespace compabetov2
// Generar ticket y agregarlo al flowLayoutPanel2 // Generar ticket y agregarlo al flowLayoutPanel2
GenerarTicket(idProducto, producto.nombre, producto.precion, int.Parse(contador.Text), total, rutaImg); GenerarTicket(idProducto, producto.nombre, producto.precion, int.Parse(contador.Text), total, rutaImg);
MessageBox.Show(crearContenidoImprimir());
}); });
@@ -413,32 +415,26 @@ namespace compabetov2
private void ImprimirContenido(PrintPageEventArgs e) private void ImprimirContenido(PrintPageEventArgs e)
{ {
// Contenido que deseas imprimir // Contenido que deseas imprimir
string contenido = "Mini Súper\n" + string contenido = " Mini Súper\n" +
"Compa BETO\n" + " Compa BETO\n" +
"Saturnino Peña #44\n" + " Saturnino Peña #44\n" +
"Lomas de la Laguna\n" + " Lomas de la Laguna\n" +
"311 169 2829\n" + " 311 169 2829\n" +
$"Fecha: {DateTime.Now.ToString("dd/MM/yyyy")}\n" + $" Fecha: {DateTime.Now.ToString("dd/MM/yyyy")}\n" +
$"Hora: {DateTime.Now.ToString("HH:mm:ss")}\n\n" + $" Hora: {DateTime.Now.ToString("hh:mm:ss")}\n\n" +
"Producto Precio Cantidad\n" + "Producto | Precio | Cantidad\n" +
"---------------------\n"; "------------------------------------\n";
// Agregar detalles de productos al contenido contenido += crearContenidoImprimir();
foreach (TableLayoutPanel carta in cartas)
{
PictureBox pic = carta.Controls[0] as PictureBox;
Label precio = pic.Controls[1] as Label;
contenido += $"{precio.Text}\n"; contenido += $"------------------------------------\n" +
} $" Total: ${total}\n" +
"------------------------------------\n" +
contenido += $"---------------------\n" + " Mini Súper\n" +
$"Total: ${total}\n" + " Compa BETO\n" +
"---------------------\n" + " ¡Gracias por su compra!";
"Mini Súper\n" +
"Compa BETO\n" +
"¡Gracias por su compra!";
// Configuración de la fuente y del área de impresión // Configuración de la fuente y del área de impresión
@@ -450,7 +446,48 @@ namespace compabetov2
} }
private string crearContenidoImprimir()
{
int contador_saltar_2_vueltas = 1;
string resultado = "";
foreach (var item in flowLayoutPanel2.Controls)
{
if (contador_saltar_2_vueltas <= 3)
{
contador_saltar_2_vueltas++;
continue;
}
TableLayoutPanel panelProducto = item as TableLayoutPanel;
TableLayoutPanel panelInfo = panelProducto.Controls[1] as TableLayoutPanel;
Label lbnombre = panelInfo.Controls[0] as Label;
Label lbPrecio = panelInfo.Controls[1] as Label;
Label Lbcantidad = panelInfo.Controls[2] as Label;
Label Lbtotal = panelInfo.Controls[3] as Label;
//nombre producto
string textoLbnombre = lbnombre.Text;
string[] cadenas = textoLbnombre.Split(':');
string productoNombre = cadenas[1].Remove(0, 1);
//precio
string textoLbPrecio = lbPrecio.Text;
cadenas = textoLbPrecio.Split('$');
string precioProducto = cadenas[1];
//cantidad
string textoLbCantidad = Lbcantidad.Text;
cadenas = textoLbCantidad.Split(':');
string cantidadProducto = cadenas[1].Remove(0, 1);
//total
string textoLbTotal = Lbtotal.Text;
cadenas = textoLbTotal.Split('$');
string totalProducto = cadenas[1];
resultado += $"{productoNombre} | ${precioProducto} | {cantidadProducto}\n";
}
return resultado;
}
} }