コード例 #1
0
        //---Metodo para obtener información de la Materia Prima por medio de su ID---\\
        public static Inventario ObtenerMateriaPrimaX(Int64 X)
        {
            Conexión      Con   = new Conexión();
            SqlConnection Connn = Con.Conectar();

            Inventario PInventario = new Inventario();
            SqlCommand CmdeI       = new SqlCommand(string.Format(
                                                        "select Tipo_de_pieza, Descripcion, Valor_Proveedor,Tamaño from Inventario where Id_Pz={0}", X), Connn);

            SqlDataReader LeeerI = CmdeI.ExecuteReader();

            while (LeeerI.Read())
            {
                PInventario.Tipo_de_pieza   = LeeerI.GetString(0);
                PInventario.Descripcion     = LeeerI.GetString(1);
                PInventario.Valor_Proveedor = LeeerI.GetDecimal(2);
                PInventario.Tamaño          = LeeerI.GetString(3);
            }
            Connn.Close();
            return(PInventario);
        }
コード例 #2
0
        public static Proveedor ObtenerIDProv(string Empresa)
        {
            Conexión Con = new Conexión();

            using (SqlConnection Connn = Con.Conectar())
            {
                Proveedor  PProveedor = new Proveedor();
                SqlCommand CmdeI      = new SqlCommand(string.Format(
                                                           "select Id_Prov from Proveedor where Empresa='{0}'", Empresa), Connn);

                SqlDataReader LeeerI = CmdeI.ExecuteReader();
                while (LeeerI.Read())
                {
                    PProveedor.Id_Prov = LeeerI.GetInt64(0);
                }
                Connn.Close();
                return(PProveedor);

                {
                }
            }
        }
コード例 #3
0
        //---Metodo para obtener el ID Del empleado---\\
        public static Empleado ObtenerEmpleado(Int64 Id_em)
        {
            Conexión Con = new Conexión();

            using (SqlConnection Connn = Con.Conectar())
            {
                Empleado   PEmpleado = new Empleado();
                SqlCommand Cmdem     = new SqlCommand(string.Format(
                                                          "select Id_em,Nombre_Em,No_Documento_em,Apellido_em,Celular_em,Telefono_em,Direccion_em,Correo_em, Estado_em,Nombre_cargo from Empleado where Id_em={0}", Id_em), Connn);

                SqlDataReader Leeer = Cmdem.ExecuteReader();
                while (Leeer.Read())
                {
                    PEmpleado.Id_em           = Leeer.GetInt64(0);
                    PEmpleado.Nombre_em       = Leeer.GetString(1);
                    PEmpleado.No_Documento_em = Leeer.GetInt64(2);
                    PEmpleado.Apellido_em     = Leeer.GetString(3);
                    PEmpleado.Celular_em      = Leeer.GetInt64(4);
                    if (!Leeer.IsDBNull(5))
                    {
                        PEmpleado.Telefono_em = Leeer.GetInt64(5);
                    }
                    else
                    {
                        PEmpleado.Telefono_em = 0;
                    }
                    PEmpleado.Direccion_em = Leeer.GetString(6);
                    PEmpleado.Correo_em    = Leeer.GetString(7);
                    PEmpleado.Estado_em    = Leeer.GetString(8);
                    PEmpleado.Nombre_cargo = (TipoCargo)Enum.Parse(typeof(TipoCargo), Leeer.GetString(9));
                }
                Connn.Close();
                return(PEmpleado);

                {
                }
            }
        }
コード例 #4
0
        //---Metodo para Consultar Empleado---\\

        public static List <Empleado> ConsultarEmpleado(string Consulta)
        {
            Conexión        Con    = new Conexión();
            List <Empleado> ListaE = new List <Empleado>();

            using (SqlConnection Connn = Con.Conectar())
            {
                SqlCommand Cmdem = new SqlCommand(string.Format(
                                                      "Consultar_Empleado '{0}'", Consulta), Connn);

                SqlDataReader Leeer = Cmdem.ExecuteReader();
                while (Leeer.Read())
                {
                    Empleado PEmpleado = new Empleado();
                    PEmpleado.Id_em           = Leeer.GetInt64(0);
                    PEmpleado.Nombre_em       = Leeer.GetString(1);
                    PEmpleado.No_Documento_em = Leeer.GetInt64(2);
                    PEmpleado.Apellido_em     = Leeer.GetString(3);
                    PEmpleado.Celular_em      = Leeer.GetInt64(4);
                    if (!Leeer.IsDBNull(5))
                    {
                        PEmpleado.Telefono_em = Leeer.GetInt64(5);
                    }
                    else
                    {
                        PEmpleado.Telefono_em = 0;
                    }
                    PEmpleado.Direccion_em = Leeer.GetString(6);
                    PEmpleado.Correo_em    = Leeer.GetString(7);
                    PEmpleado.Estado_em    = Leeer.GetString(8);
                    PEmpleado.Nombre_cargo = (TipoCargo)Enum.Parse(typeof(TipoCargo), Leeer.GetString(9));
                    ListaE.Add(PEmpleado);
                }
                Connn.Close();
                return(ListaE);
            }
        }
コード例 #5
0
        public static PedidoCliente ObtenerPedidoCliente(Int64 Id_Pcli)
        {
            Conexión Con = new Conexión();

            using (SqlConnection Connn = Con.Conectar())
            {
                PedidoCliente PPedidoCliente = new PedidoCliente();
                SqlCommand    CmdeI          = new SqlCommand(string.Format(
                                                                  "select  CONVERT(VARCHAR(50),Fecha_Realizacion_Pcli,120), CONVERT(VARCHAR(50),Fecha_Entrega_Pcli,120),Id_Pcli,Observaciones,Valor_Total_Pcli,No_Documento_em,Nombre_em,Apellido_em,No_Documento_Cl,Nombre_Cl,Apellido_Cl,Abono_Pcli,Saldo_Pcli,Estado_Pcli,Subtotal_Pcli,Iva_Pcli from Pedido_Cliente where Id_Pcli={0}", Id_Pcli), Connn);

                SqlDataReader LeeerI = CmdeI.ExecuteReader();
                while (LeeerI.Read())
                {
                    PPedidoCliente.Fecha_Realizacion_Pcli = LeeerI.GetString(0);
                    PPedidoCliente.Fecha_Entrega_Pcli     = LeeerI.GetString(1);
                    PPedidoCliente.Id_Pcli          = LeeerI.GetInt64(2);
                    PPedidoCliente.Observaciones    = LeeerI.GetString(3);
                    PPedidoCliente.Valor_Total_Pcli = LeeerI.GetInt64(4);
                    PPedidoCliente.No_Documento_em  = LeeerI.GetInt64(5);
                    PPedidoCliente.Nombre_em        = LeeerI.GetString(6);
                    PPedidoCliente.Apellido_em      = LeeerI.GetString(7);
                    PPedidoCliente.No_Documento_Cl  = LeeerI.GetInt64(8);
                    PPedidoCliente.Nombre_Cl        = LeeerI.GetString(9);
                    PPedidoCliente.Apellido_Cl      = LeeerI.GetString(10);
                    PPedidoCliente.Abono_Pcli       = LeeerI.GetInt64(11);
                    PPedidoCliente.Saldo_Pcli       = LeeerI.GetInt64(12);
                    PPedidoCliente.Estado_Pcli      = LeeerI.GetString(13);
                    PPedidoCliente.Subtotal_Pcli    = LeeerI.GetInt64(14);
                    PPedidoCliente.Iva_Pcli         = LeeerI.GetInt64(15);
                }
                Connn.Close();
                return(PPedidoCliente);

                {
                }
            }
        }
コード例 #6
0
 public ControlEquipo()
 {
     mConexion = new Conexión();
     mConexion.Conectar("MySQL ODBC 5.2w Driver", "localhost", "equipos", "root", "");
 }
コード例 #7
0
        public static List <PedidoCliente> ConsultarPedidoCli(string PId_Pcli)
        {
            Conexión             Con     = new Conexión();
            List <PedidoCliente> ListaPC = new List <PedidoCliente>();

            using (SqlConnection Connn = Con.Conectar())
            {
                if (PId_Pcli.Contains("-") | PId_Pcli.Contains("/"))
                {
                    SqlCommand CmdemP = new SqlCommand(string.Format(
                                                           "select Id_Pcli,Fecha_Realizacion_Pcli,Fecha_Entrega_Pcli,Observaciones,Iva_Pcli,Subtotal_Pcli,Valor_Total_Pcli,No_Documento_em,Nombre_em,No_Documento_Cl,Nombre_Cl,Apellido_Cl,Abono_Pcli,Saldo_Pcli,Estado_Pcli,Apellido_em from Pedido_Cliente where Fecha_Realizacion_Pc=convert(datetime,{0}, 121) or Fecha_Entrega_Pc=convert(datetime,{0}, 121)", PId_Pcli), Connn);
                    SqlDataReader LeeerI = CmdemP.ExecuteReader();
                    while (LeeerI.Read())
                    {
                        PedidoCliente PPedidoCliente = new PedidoCliente();

                        PPedidoCliente.Id_Pcli = LeeerI.GetInt64(0);
                        PPedidoCliente.Fecha_Realizacion_Pcli = Convert.ToString(LeeerI.GetDateTime(1));
                        PPedidoCliente.Fecha_Entrega_Pcli     = Convert.ToString(LeeerI.GetDateTime(2));
                        PPedidoCliente.Observaciones          = LeeerI.GetString(3);
                        PPedidoCliente.Iva_Pcli         = LeeerI.GetInt64(4);
                        PPedidoCliente.Subtotal_Pcli    = LeeerI.GetInt64(5);
                        PPedidoCliente.Valor_Total_Pcli = LeeerI.GetInt64(6);
                        PPedidoCliente.No_Documento_em  = LeeerI.GetInt64(7);
                        PPedidoCliente.Nombre_em        = LeeerI.GetString(8);
                        PPedidoCliente.No_Documento_Cl  = LeeerI.GetInt64(9);
                        PPedidoCliente.Nombre_Cl        = LeeerI.GetString(10);
                        PPedidoCliente.Apellido_Cl      = LeeerI.GetString(11);
                        PPedidoCliente.Abono_Pcli       = LeeerI.GetInt64(12);
                        PPedidoCliente.Saldo_Pcli       = LeeerI.GetInt64(13);
                        PPedidoCliente.Estado_Pcli      = LeeerI.GetString(14);
                        PPedidoCliente.Apellido_em      = LeeerI.GetString(15);
                        ListaPC.Add(PPedidoCliente);
                    }
                    Connn.Close();
                    return(ListaPC);
                }
                else
                {
                    SqlCommand CmdemP = new SqlCommand(string.Format(
                                                           "select Id_Pcli,Fecha_Realizacion_Pcli,Fecha_Entrega_Pcli,Observaciones,Iva_Pcli,Subtotal_Pcli,Valor_Total_Pcli,No_Documento_em,Nombre_em,No_Documento_Cl,Nombre_Cl,Apellido_Cl,Abono_Pcli,Saldo_Pcli,Estado_Pcli,Apellido_em from Pedido_Cliente where Id_Pcli Like'%{0}%' or No_Documento_Cl Like'%{0}%' or Nombre_Cl Like'%{0}%'", PId_Pcli), Connn);
                    SqlDataReader LeeerI = CmdemP.ExecuteReader();
                    while (LeeerI.Read())
                    {
                        PedidoCliente PPedidoCliente = new PedidoCliente();

                        PPedidoCliente.Id_Pcli = LeeerI.GetInt64(0);
                        PPedidoCliente.Fecha_Realizacion_Pcli = Convert.ToString(LeeerI.GetDateTime(1));
                        PPedidoCliente.Fecha_Entrega_Pcli     = Convert.ToString(LeeerI.GetDateTime(2));
                        PPedidoCliente.Observaciones          = LeeerI.GetString(3);
                        PPedidoCliente.Iva_Pcli         = LeeerI.GetInt64(4);
                        PPedidoCliente.Subtotal_Pcli    = LeeerI.GetInt64(5);
                        PPedidoCliente.Valor_Total_Pcli = LeeerI.GetInt64(6);
                        PPedidoCliente.No_Documento_em  = LeeerI.GetInt64(7);
                        PPedidoCliente.Nombre_em        = LeeerI.GetString(8);
                        PPedidoCliente.No_Documento_Cl  = LeeerI.GetInt64(9);
                        PPedidoCliente.Nombre_Cl        = LeeerI.GetString(10);
                        PPedidoCliente.Apellido_Cl      = LeeerI.GetString(11);
                        PPedidoCliente.Abono_Pcli       = LeeerI.GetInt64(12);
                        PPedidoCliente.Saldo_Pcli       = LeeerI.GetInt64(13);
                        PPedidoCliente.Estado_Pcli      = LeeerI.GetString(14);
                        PPedidoCliente.Apellido_em      = LeeerI.GetString(15);
                        ListaPC.Add(PPedidoCliente);
                    }
                    Connn.Close();
                    return(ListaPC);
                }
            }
        }