Esempio n. 1
0
        public clsGuiaRemision CargaGuiaTransferencia(Int32 cod)
        {
            clsGuiaRemision GuiaRemision = null;

            try
            {
                con.conectarBD();
                cmd = new MySqlCommand("MuestraGuiaTransferencia", con.conector);
                cmd.Parameters.AddWithValue("codnota", cod);
                cmd.CommandType = CommandType.StoredProcedure;
                dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        GuiaRemision = new clsGuiaRemision();
                        GuiaRemision.FechaTraslado = dr.GetDateTime(0);
                        GuiaRemision.FechaEmision  = dr.GetDateTime(1);
                    }
                }
                return(GuiaRemision);
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); }
        }
Esempio n. 2
0
 public Boolean update(clsGuiaRemision GuiaRemision)
 {
     try
     {
         return MGuiaRemision.update(GuiaRemision);
     }
     catch (Exception ex)
     {
         DevComponents.DotNetBar.MessageBoxEx.Show("Se encontró el siguiente problema: " + ex.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return false;
     }
 }
Esempio n. 3
0
 public Boolean insert(clsGuiaRemision GuiaRemision)
 {
     try
     {
         return MGuiaRemision.insert(GuiaRemision);
     }
     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);
        
         DevComponents.DotNetBar.MessageBoxEx.Show("Se encontró el siguiente problema: " + ex.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return false;
     }
 }
Esempio n. 4
0
        public clsGuiaRemision BuscaGuiaRemision(String CodGuiaRemision, Int32 CodAlmacen)
        {
            clsGuiaRemision GuiaRemision = null;

            try
            {
                con.conectarBD();
                cmd = new MySqlCommand("BuscaGuiaRemision", con.conector);
                cmd.Parameters.AddWithValue("codguia", Convert.ToInt32(CodGuiaRemision));
                cmd.Parameters.AddWithValue("codalm", CodAlmacen);
                cmd.CommandType = CommandType.StoredProcedure;
                dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        GuiaRemision = new clsGuiaRemision();
                        GuiaRemision.CodGuiaRemision  = dr.GetString(0);
                        GuiaRemision.CodAlmacen       = Convert.ToInt32(dr.GetDecimal(1));
                        GuiaRemision.CodMotivo        = Convert.ToInt32(dr.GetDecimal(2));
                        GuiaRemision.CodTipoDocumento = Convert.ToInt32(dr.GetDecimal(3));
                        GuiaRemision.SiglaDocumento   = dr.GetString(4);
                        GuiaRemision.CodSerie         = Convert.ToInt32(dr.GetDecimal(5));
                        GuiaRemision.Serie            = dr.GetString(6);
                        GuiaRemision.NumDoc           = dr.GetString(7);
                        //GuiaRemision.TipoCliente = Convert.ToInt32(dr.GetString(2));
                        GuiaRemision.CodCliente          = Convert.ToInt32(dr.GetString(8));
                        GuiaRemision.CodigoPersonalizado = dr.GetString(9);
                        GuiaRemision.DNI                   = dr.GetString(10);
                        GuiaRemision.RUCCliente            = dr.GetString(11);
                        GuiaRemision.RazonSocialCliente    = dr.GetString(12);
                        GuiaRemision.Nombre                = dr.GetString(13);
                        GuiaRemision.Direccion             = dr.GetString(14);
                        GuiaRemision.CodVehiculoTransporte = Convert.ToInt32(dr.GetString(15));
                        GuiaRemision.CodMarca              = Convert.ToInt32(dr.GetString(16));
                        GuiaRemision.CodModelo             = Convert.ToInt32(dr.GetString(17));
                        GuiaRemision.Placa                 = dr.GetString(18);
                        GuiaRemision.Marca                 = dr.GetString(19);
                        GuiaRemision.Modelo                = dr.GetString(20);
                        GuiaRemision.ConstanciaInscripcion = dr.GetString(21);
                        GuiaRemision.CodConductor          = Convert.ToInt32(dr.GetString(22));
                        GuiaRemision.NombreConductor       = dr.GetString(23);
                        GuiaRemision.Licencia              = dr.GetString(24);
                        GuiaRemision.CodEmpresaTransporte  = Convert.ToInt32(dr.GetString(25));
                        GuiaRemision.RazonSocialTransporte = dr.GetString(26);
                        GuiaRemision.DireccionTransporte   = dr.GetString(27);
                        GuiaRemision.FechaEmision          = dr.GetDateTime(28);
                        GuiaRemision.FechaTraslado         = dr.GetDateTime(29);
                        GuiaRemision.Comentario            = dr.GetString(30);
                        GuiaRemision.Estado                = Convert.ToInt32(dr.GetDecimal(31));
                        GuiaRemision.Facturado             = Convert.ToInt32(dr.GetDecimal(32));
                        GuiaRemision.CodUser               = Convert.ToInt32(dr.GetDecimal(33));
                        GuiaRemision.FechaRegistro         = dr.GetDateTime(34);
                    }
                }
                return(GuiaRemision);
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); }
        }
Esempio n. 5
0
        public Boolean insert(clsGuiaRemision GuiaRemision)
        {
            try
            {
                con.conectarBD();

                cmd             = new MySqlCommand("GuardaGuiaRemision", con.conector);
                cmd.CommandType = CommandType.StoredProcedure;
                MySqlParameter oParam;
                oParam = cmd.Parameters.AddWithValue("codalma", GuiaRemision.CodAlmacen);
                //oParam = cmd.Parameters.AddWithValue("tipocliente", GuiaRemision.TipoCliente);
                oParam = cmd.Parameters.AddWithValue("coddoc", GuiaRemision.CodTipoDocumento);
                oParam = cmd.Parameters.AddWithValue("codserie", GuiaRemision.CodSerie);
                oParam = cmd.Parameters.AddWithValue("numdoc", GuiaRemision.NumDoc);
                oParam = cmd.Parameters.AddWithValue("codmoti", GuiaRemision.CodMotivo);
                if (GuiaRemision.CodPedido != 0)
                {
                    oParam = cmd.Parameters.AddWithValue("codped", GuiaRemision.CodPedido);
                }
                else
                {
                    oParam = cmd.Parameters.AddWithValue("codped", null);
                }
                if (GuiaRemision.CodFactura != 0)
                {
                    oParam = cmd.Parameters.AddWithValue("codfat", GuiaRemision.CodFactura);
                }
                else
                {
                    oParam = cmd.Parameters.AddWithValue("codfat", null);
                }
                if (GuiaRemision.CodTransferencia != 0)
                {
                    oParam = cmd.Parameters.AddWithValue("codtra", GuiaRemision.CodTransferencia);
                }
                else
                {
                    oParam = cmd.Parameters.AddWithValue("codtra", null);
                }
                oParam = cmd.Parameters.AddWithValue("fechaemision", GuiaRemision.FechaEmision);
                oParam = cmd.Parameters.AddWithValue("fechatraslado", GuiaRemision.FechaTraslado);
                if (GuiaRemision.CodCliente != 0)
                {
                    oParam = cmd.Parameters.AddWithValue("codcli", GuiaRemision.CodCliente);
                }
                else
                {
                    oParam = cmd.Parameters.AddWithValue("codcli", null);
                }
                oParam = cmd.Parameters.AddWithValue("codvehi", GuiaRemision.CodVehiculoTransporte);
                oParam = cmd.Parameters.AddWithValue("codcond", GuiaRemision.CodConductor);
                oParam = cmd.Parameters.AddWithValue("codemp", GuiaRemision.CodEmpresaTransporte);
                oParam = cmd.Parameters.AddWithValue("facturado", GuiaRemision.Facturado);
                oParam = cmd.Parameters.AddWithValue("comentario", GuiaRemision.Comentario);
                oParam = cmd.Parameters.AddWithValue("estado", GuiaRemision.Estado);
                oParam = cmd.Parameters.AddWithValue("codusu", GuiaRemision.CodUser);
                oParam = cmd.Parameters.AddWithValue("codreq", GuiaRemision.CodReq);
                if (GuiaRemision.CodProveedor == 0)
                {
                    oParam = cmd.Parameters.AddWithValue("codprov", null);
                }
                else
                {
                    oParam = cmd.Parameters.AddWithValue("codprov", GuiaRemision.CodProveedor);
                }
                oParam           = cmd.Parameters.AddWithValue("newid", 0);
                oParam.Direction = ParameterDirection.Output;
                int x = cmd.ExecuteNonQuery();

                GuiaRemision.CodGuiaRemision = Convert.ToString(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(); }
        }
Esempio n. 6
0
        public Boolean update(clsGuiaRemision GuiaRemision)
        {
            try
            {
                con.conectarBD();

                cmd             = new MySqlCommand("ActualizaGuiaRemision", con.conector);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("codguia", Convert.ToInt32(GuiaRemision.CodGuiaRemision));
                cmd.Parameters.AddWithValue("codalma", GuiaRemision.CodAlmacen);
                cmd.Parameters.AddWithValue("coddoc", GuiaRemision.CodTipoDocumento);
                cmd.Parameters.AddWithValue("codserie", GuiaRemision.CodSerie);
                cmd.Parameters.AddWithValue("numdoc", GuiaRemision.NumDoc);
                cmd.Parameters.AddWithValue("codmoti", GuiaRemision.CodMotivo);
                if (GuiaRemision.CodPedido != 0)
                {
                    cmd.Parameters.AddWithValue("codped", GuiaRemision.CodPedido);
                }
                else
                {
                    cmd.Parameters.AddWithValue("codped", null);
                }
                if (GuiaRemision.CodFactura != 0)
                {
                    cmd.Parameters.AddWithValue("codfat", GuiaRemision.CodFactura);
                }
                else
                {
                    cmd.Parameters.AddWithValue("codfat", null);
                }
                cmd.Parameters.AddWithValue("fechaemision", GuiaRemision.FechaEmision);
                cmd.Parameters.AddWithValue("fechatraslado", GuiaRemision.FechaTraslado);
                //cmd.Parameters.AddWithValue("tipocliente", GuiaRemision.TipoCliente);
                if (GuiaRemision.CodCliente != 0)
                {
                    cmd.Parameters.AddWithValue("codcli", GuiaRemision.CodCliente);
                }
                else
                {
                    cmd.Parameters.AddWithValue("codcli", null);
                }
                cmd.Parameters.AddWithValue("codvehi", GuiaRemision.CodVehiculoTransporte);
                cmd.Parameters.AddWithValue("codcond", GuiaRemision.CodConductor);
                cmd.Parameters.AddWithValue("codemp", GuiaRemision.CodEmpresaTransporte);
                cmd.Parameters.AddWithValue("facturado", GuiaRemision.Facturado);
                cmd.Parameters.AddWithValue("comentario", GuiaRemision.Comentario);

                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(); }
        }