Ejemplo n.º 1
0
 public void RegCli_Ins(Cli_Enc Cli)
 {
     using (SqlConnection cn = new SqlConnection(consulta))
     {
         using (SqlCommand cmInsCli = new SqlCommand("SP_InsCli", cn))
         {
             cmInsCli.Connection.Open();
             cmInsCli.CommandType = CommandType.StoredProcedure;
             cmInsCli.Parameters.Add("@Nom", SqlDbType.NVarChar, 50).Value   = Cli.Nom;
             cmInsCli.Parameters.Add("@Ape", SqlDbType.NVarChar, 50).Value   = Cli.Ape;
             cmInsCli.Parameters.Add("@Dir", SqlDbType.NVarChar, 50).Value   = Cli.Dir;
             cmInsCli.Parameters.Add("@FecNac", SqlDbType.Date).Value        = Cli.FecNac;
             cmInsCli.Parameters.Add("@Tel", SqlDbType.NVarChar, 20).Value   = Cli.Tel;
             cmInsCli.Parameters.Add("@Ema", SqlDbType.NVarChar, 50).Value   = Cli.Ema;
             cmInsCli.Parameters.Add("@IdUsu", SqlDbType.NVarChar, 50).Value = Cli.IdUsu;
             cmInsCli.ExecuteNonQuery();
         }
     }
 }
Ejemplo n.º 2
0
        private void btnGua_Click(object sender, EventArgs e)
        {
            if (txtNomCli.Text == "")
            {
                MessageBox.Show("Ingrese el nombre", "Mensaje del sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtNomCli.Focus();
            }
            else if (txtApeCli.Text == "")
            {
                MessageBox.Show("Ingrese el apellido", "Mensaje del sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtApeCli.Focus();
            }
            else if (txtDirCli.Text == "")
            {
                MessageBox.Show("Ingrese la dirección", "Mensaje del sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtApeCli.Focus();
            }
            else if (txtTelCli.Text == "")
            {
                MessageBox.Show("Ingrese el teléfono", "Mensaje del sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtTelCli.Focus();
            }
            else if (txtCorEleCli.Text == "")
            {
                MessageBox.Show("Ingrese el correo electrónico", "Mensaje del sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtTelCli.Focus();
            }
            else
            {
                bool valor = false;
                try
                {
                    new System.Net.Mail.MailAddress(txtCorEleCli.Text);
                    valor = true;
                }
                catch
                {
                    valor = false;
                }

                ///Valida el valor
                if (!valor)
                {
                    MessageBox.Show("Correo ingresado es inválido", "Mensaje del sistema", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtCorEleCli.Focus();
                    return;
                }

                Cli_Enc Cli = new Cli_Enc();
                Cli.Nom    = txtNomCli.Text;
                Cli.Ape    = txtApeCli.Text;
                Cli.Dir    = txtDirCli.Text;
                Cli.Tel    = txtTelCli.Text;
                Cli.FecNac = dtpFecNacCli.Value.Date;
                Cli.Ema    = txtCorEleCli.Text;
                Cli.IdUsu  = VarGlo.CodUsu;
                regCli.RegCli_Ins(Cli);
                MessageBox.Show("Se registro correctamente el cliente", "Mensaje del sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Cli_LimText();
            }
        }
Ejemplo n.º 3
0
 public void RegCli_Ins(Cli_Enc Cli)
 {
     regCli.RegCli_Ins(Cli);
 }