Example #1
0
        public Boolean Update(clsEmpresaTransporte emp)
        {
            try
            {
                con.conectarBD();

                cmd             = new MySqlCommand("ActualizaEmpresaTransporte", con.conector);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("codemp", emp.CodEmpresaTranporte);
                cmd.Parameters.AddWithValue("ruc", emp.Ruc);
                cmd.Parameters.AddWithValue("razonsocial", emp.RazonSocial);
                cmd.Parameters.AddWithValue("direccion", emp.Direccion);
                cmd.Parameters.AddWithValue("telefono", emp.Telefono);

                int x = cmd.ExecuteNonQuery();
                if (x != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); }
        }
Example #2
0
        public Boolean Insert(clsEmpresaTransporte emp)
        {
            try
            {
                con.conectarBD();

                cmd             = new MySqlCommand("GuardaEmpresaTransporte", con.conector);
                cmd.CommandType = CommandType.StoredProcedure;
                MySqlParameter oParam;
                oParam           = cmd.Parameters.AddWithValue("ruc", emp.Ruc);
                oParam           = cmd.Parameters.AddWithValue("razonsocial", emp.RazonSocial);
                oParam           = cmd.Parameters.AddWithValue("direccion", emp.Direccion);
                oParam           = cmd.Parameters.AddWithValue("telefono", emp.Telefono);
                oParam           = cmd.Parameters.AddWithValue("codusu", emp.CodUser);
                oParam           = cmd.Parameters.AddWithValue("newid", 0);
                oParam.Direction = ParameterDirection.Output;
                int x = cmd.ExecuteNonQuery();

                emp.CodEmpresaTranporteNuevo = Convert.ToInt32(cmd.Parameters["newid"].Value);

                if (x != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); }
        }
Example #3
0
        public clsEmpresaTransporte BuscaEmpresaTransporte(String RUC)
        {
            clsEmpresaTransporte emp = null;

            try
            {
                con.conectarBD();
                cmd = new MySqlCommand("BuscaEmpresaTransporte", con.conector);
                cmd.Parameters.AddWithValue("ru", RUC);
                cmd.CommandType = CommandType.StoredProcedure;
                dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        emp = new clsEmpresaTransporte();
                        emp.CodEmpresaTranporte = Convert.ToInt32(dr.GetDecimal(0));
                        emp.Ruc         = dr.GetString(1);
                        emp.RazonSocial = dr.GetString(2);
                        emp.Direccion   = dr.GetString(3);
                    }
                }
                return(emp);
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); }
        }
Example #4
0
        public clsEmpresaTransporte CargaEmpresaTranporte(Int32 Codigo)
        {
            clsEmpresaTransporte emp = null;

            try
            {
                con.conectarBD();
                cmd = new MySqlCommand("MuestraEmpresaTransporte", con.conector);
                cmd.Parameters.AddWithValue("codemp", Codigo);
                cmd.CommandType = CommandType.StoredProcedure;
                dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        emp = new clsEmpresaTransporte();
                        emp.CodEmpresaTranporte = Convert.ToInt32(dr.GetDecimal(0));
                        emp.Ruc           = dr.GetString(1);
                        emp.RazonSocial   = dr.GetString(2);
                        emp.Direccion     = dr.GetString(3);
                        emp.Telefono      = dr.GetString(4);
                        emp.Estado        = dr.GetBoolean(5);
                        emp.CodUser       = Convert.ToInt32(dr.GetDecimal(6));
                        emp.FechaRegistro = dr.GetDateTime(7);// capturo la fecha
                    }
                }
                return(emp);
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); }
        }
Example #5
0
 public Boolean update(clsEmpresaTransporte emp)
 {
     try
     {
         return(Memp.Update(emp));
     }
     catch (Exception ex)
     {
         DevComponents.DotNetBar.MessageBoxEx.Show("Se encontró el siguiente problema: " + ex.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return(false);
     }
 }
Example #6
0
 private void cargaEmpresaTransporte()
 {
     emp = AdmET.MuestraEmpresaTranporte(emp.CodEmpresaTranporte);
     if (emp != null)
     {
         txtCodigo.Text      = emp.CodEmpresaTranporte.ToString();
         txtRuc.Text         = emp.Ruc;
         txtRazonSocial.Text = emp.RazonSocial;
         txtTelefono.Text    = emp.Telefono;
         txtDireccion.Text   = emp.Direccion;
     }
 }
Example #7
0
        public Boolean insert(clsEmpresaTransporte emp)
        {
            try
            {
                return(Memp.Insert(emp));
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("Duplicate entry"))
                {
                    DevComponents.DotNetBar.MessageBoxEx.Show("Se encontró el siguiente problema: N°- de Documento Repetido", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                else
                {
                    DevComponents.DotNetBar.MessageBoxEx.Show("Se encontró el siguiente problema: " + ex.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                return(false);
            }
        }