Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- InitializeComponent();
- lblHora.Text = DateTime.Now.ToString();
- }
- public static String Codigo = "";
- private void timer1_Tick(object sender, EventArgs e)
- {
- lblHora.Text = DateTime.Now.ToString();
- }
- private void btnExit_Click(object sender, EventArgs e)
- {
- if (MessageBox.Show("Do you really want to exit?", "Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
- {
- this.Close();
- }
- }
- private void btnIngresar_Click(object sender, EventArgs e)
- {
- try
- {
- string CMD = string.Format("select * from Usuarios where Username='{0}' and Password= '{1}'", txtUser.Text.Trim(), txtPass.Text.Trim());
- DataSet ds = Utilidades.Ejecutar(CMD);
- Codigo = ds.Tables[0].Rows[0]["id_usuario"].ToString().Trim();
- string cuenta = ds.Tables[0].Rows[0]["Username"].ToString().Trim();
- string contra = ds.Tables[0].Rows[0]["Password"].ToString().Trim();
- if (cuenta == txtUser.Text.Trim() && contra == txtPass.Text.Trim())
- {
- if (Convert.ToBoolean(ds.Tables[0].Rows[0]["Status_admin"]) == true)
- {
- frmMainMenuADMIN Mmenu = new frmMainMenuADMIN();
- this.Hide();
- Mmenu.Show();
- }
- else
- {
- frmMainMenuUSER Mmenu2 = new frmMainMenuUSER();
- this.Hide();
- Mmenu2.Show();
- }
- }
- }
- catch (Exception)
- {
- MessageBox.Show("Username/Password are incorrect.");
- }
- }
- private void frmLogin_FormClosed(object sender, FormClosedEventArgs e)
- {
- Application.Exit();
- }
- private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
- {
- frmPassChange pc = new frmPassChange();
- pc.Show();
- }}}
- public partial class frmMainMenuADMIN : Form
- {
- public frmMainMenuADMIN()
- {
- InitializeComponent();
- }
- private void exitToolStripMenuItem_Click(object sender, EventArgs e)
- {
- if (MessageBox.Show("Do you really want to exit?", "Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
- {
- this.Close();
- }
- }
- private void perfilToolStripMenuItem_Click(object sender, EventArgs e)
- {
- VentanaAdmin VenAdm = new VentanaAdmin();
- VenAdm.Show();
- }
- private void nuevaCapturaBWSToolStripMenuItem_Click(object sender, EventArgs e)
- {
- frmNuevaCaptura NuevaCap = new frmNuevaCaptura();
- NuevaCap.Show();
- }}}
- namespace AutoCompletarTextBox
- {
- public partial class frmNuevaCaptura : Form
- {
- SqlConnection conexion = new SqlConnection(@"DataSource= CP-PC; Initial Catalog= SisIndustrial; Integrated Security=true");
- public frmNuevaCaptura()
- {
- InitializeComponent();
- }
- private void frmNuevaCaptura_Load(object sender, EventArgs e)
- {
- Conexion c = new Conexion();
- c.autoCompletar(textBox1);
- DateTime dt = DateTime.Now;
- CultureInfo ci = new CultureInfo("de-DE");
- string fecha1 = dt.ToString("d", ci);
- String format = "MM/dd/yyyy hh:mm tt";
- // Converts the local DateTime to a string
- // using the custom format string and display.
- String str = dt.ToString(format);
- lblShowTime.Text = str;
- }
- private void btnNuevoPN_Click(object sender, EventArgs e)
- {
- conexion.Open();
- SqlCommand cmd = conexion.CreateCommand();
- cmd.CommandType = CommandType.Text;
- cmd.CommandText = "insert into Num_Parte (Part_Number) values ('" + txtArea.Text.TrimEnd() + "')";
- cmd.ExecuteNonQuery();
- conexion.Close();
- MessageBox.Show("Visteon Part Number added successfully to the database.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- private void btnGuardar_Click(object sender, EventArgs e)
- {
- if (txtArea.Text.TrimEnd() == "" || txtTipo.Text.TrimEnd() == "" || txtCliente.Text.TrimEnd() == "" || txtFamilia.Text.TrimEnd() == "" || txtProd.Text.TrimEnd() == "" || textBox1.Text.TrimEnd() == "" || txtoperador.Text.TrimEnd() == "" || txtTC.Text.TrimEnd() == "" || txtEFF.Text.TrimEnd() == "")
- {
- MessageBox.Show("Please fill all the fields to continue.","Atention", MessageBoxButtons.OK, MessageBoxIcon.Hand);
- }
- if (txtArea.Text == "")
- {
- errorProvider1.SetError(txtArea, "Add the area.");
- }
- if (txtTipo.Text == "")
- {
- errorProvider1.SetError(txtTipo, "Add a product type.");
- }
- if (txtCliente.Text == "")
- {
- errorProvider1.SetError(txtCliente, "Add a customer.");
- }
- if (txtFamilia.Text == "")
- {
- errorProvider1.SetError(txtFamilia, "Add a family.");
- }
- if (txtProd.Text == "")
- {
- errorProvider1.SetError(txtProd, "Add a Production Line.");
- }
- if (textBox1.Text == "")
- {
- errorProvider1.SetError(textBox1, "Add a VPN.");
- }
- if (txtoperador.Text == "")
- {
- errorProvider1.SetError(txtoperador, "Add the quantity.");
- }
- if (txtTC.Text == "")
- {
- errorProvider1.SetError(txtTC, "Add the CT.");
- }
- if (txtEFF.Text == "")
- {
- errorProvider1.SetError(txtEFF, "Add the eff.");
- }
- else
- {
- conexion.Open();
- SqlCommand cmd = conexion.CreateCommand();
- cmd.CommandType = CommandType.Text;
- cmd.CommandText = "insert into CWS (Area, Product_Type, Customer, Family, Production_Line, Part_Number, Quantity_Operators, Cycle_Time, Rate, Cws) values ('" + txtArea.Text.TrimEnd() + "', '" + txtTipo.Text.TrimEnd() + "' , '" + txtCliente.Text.TrimEnd() + "', '" + txtFamilia.Text.TrimEnd() + "', '" + txtProd.Text.TrimEnd() + "', '" + textBox1.Text.TrimEnd() + "', '" + txtoperador.Text.TrimEnd() + "', '" + txtTC.Text.TrimEnd() + "', '" + txtResultado.Text.TrimEnd() + "', '" + txtResultadoCWS.Text.TrimEnd() + "', '" + lblShowTime.Text.TrimEnd() + "')";
- cmd.ExecuteNonQuery();
- conexion.Close();
- DialogResult dialogResult = MessageBox.Show("New capture was added!", "Atention", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- private void btnSaveArea_Click(object sender, EventArgs e)
- {
- conexion.Open();
- SqlCommand cmd = conexion.CreateCommand();
- cmd.CommandType = CommandType.Text;
- cmd.CommandText = "insert into Area (Nombre) values ('" + txtArea.Text.TrimEnd() + "')";
- cmd.ExecuteNonQuery();
- conexion.Close();
- MessageBox.Show("Area added succesfully to the database.");
- }
- private void btnSaveType_Click(object sender, EventArgs e)
- {
- conexion.Open();
- SqlCommand cmd = conexion.CreateCommand();
- cmd.CommandType = CommandType.Text;
- cmd.CommandText = "insert into Tipo_Producto (Tipo) values ('" + txtProd.Text.TrimEnd() + "')";
- cmd.ExecuteNonQuery();
- conexion.Close();
- MessageBox.Show("Product type was added succesfully to the database.");
- }
- private void btnCalcular3_Click(object sender, EventArgs e)
- {
- int fijo = int.Parse(lblfijo.Text); //3600
- int tc = int.Parse(txtTC.Text);
- int rph = fijo / tc; //3600/tc= rate/hra (rph)
- txtResultado.Text = rph.ToString(); //el resultado que es un Rate/hora se almacenara en txtResultado [1]
- decimal eff = decimal.Parse(txtEFF.Text);
- int fijo2 = int.Parse(lblfijo2.Text); // /100
- decimal resp = eff / fijo2;
- lblresul.Text = resp.ToString();
- int resul1 = rph;
- decimal num2 = decimal.Parse(lblresul.Text);
- decimal reff = resul1 * num2;
- txtResultado2.Text = reff.ToString(); //el resultado, qe es un Rate con EFF, se almacenara en txtResultado2 [3]
- decimal operador = decimal.Parse(txtoperador.Text);
- decimal resul2 = reff;
- decimal div2 = operador / resul2; // cantidad de op / rate con eff = new CWS con EFF
- txtResultadoCWSEFF.Text = div2.ToString(); // el resultado, que es NEW CWS CON EFF, se almacenara en [4]
- decimal operador2 = decimal.Parse(txtoperador.Text);
- decimal rph2 = rph;
- decimal div3 = operador2 / rph2; // cantidad de op / Resultado1 = CWS normal
- txtResultadoCWS.Text = div3.ToString(); // el resultado, que es el CWS, se almacena en [1]
- }
- private void btnSaveCustomer_Click(object sender, EventArgs e)
- {
- conexion.Open();
- SqlCommand cmd = conexion.CreateCommand();
- cmd.CommandType = CommandType.Text;
- cmd.CommandText = "insert into Cliente values ('" + txtCliente.Text.TrimEnd() + "')";
- cmd.ExecuteNonQuery();
- conexion.Close();
- MessageBox.Show("Customer added succesfully to the database.");
- }
- private void btnSaveFam_Click(object sender, EventArgs e)
- {
- conexion.Open();
- SqlCommand cmd = conexion.CreateCommand();
- cmd.CommandType = CommandType.Text;
- cmd.CommandText = "insert into Familia (Descripcion_Linea) values ('" + txtFamilia.Text.TrimEnd() + "')";
- cmd.ExecuteNonQuery();
- conexion.Close();
- MessageBox.Show("Family added succesfully to the database.");
- }
- private void btnSaveProdLine_Click(object sender, EventArgs e)
- {
- conexion.Open();
- SqlCommand cmd = conexion.CreateCommand();
- cmd.CommandType = CommandType.Text;
- cmd.CommandText = "insert into Producto (Descripcion_Subproducto) values ('" + txtProd.Text.TrimEnd() + "')";
- cmd.ExecuteNonQuery();
- conexion.Close();
- MessageBox.Show("Production line was added succesfully to the database.");
- }
- private void button1_Click(object sender, EventArgs e)
- {
- txtArea.Clear();
- txtTipo.Clear();
- txtCliente.Clear();
- txtFamilia.Clear();
- txtProd.Clear();
- textBox1.Clear();
- txtoperador.Clear();
- txtTC.Clear();
- txtResultado.Clear();
- txtResultado2.Clear();
- txtResultadoCWS.Clear();
- txtResultadoCWSEFF.Clear();
- }
- private void txtoperador_KeyPress(object sender, KeyPressEventArgs e)
- {
- char ch = e.KeyChar;
- if (!Char.IsDigit(ch) && ch != 8)
- {
- e.Handled = true;
- }
- }
- private void txtTC_KeyPress(object sender, KeyPressEventArgs e)
- {
- char ch = e.KeyChar;
- if (!Char.IsDigit(ch) && ch != 8)
- {
- e.Handled = true;
- }
- }
- private void txtResultadoCWS_TextChanged(object sender, EventArgs e)
- {
- string v1 = txtEFF.Text;
- decimal v2 = Convert.ToDecimal(v1);
- }
- private void btnVer_Click(object sender, EventArgs e)
- {
- frmCWSTable cws = new frmCWSTable();
- cws.Show();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement