Пример #1
0
        public List <ServPeca> Carregar()
        {
            List <ServPeca> lista = new List <ServPeca>();
            ServPeca        s     = new ServPeca();
            DataBase        bd    = DataBase.GetInstance();

            bd.GetConnection();
            SQLiteConnection conn = new SQLiteConnection(Data);

            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            SQLiteCommand    cmd = new SQLiteCommand("SELECT * FROM SERVPECA", conn);
            SQLiteDataReader dr  = cmd.ExecuteReader();

            while (dr.Read())
            {
                s.CodPeca1   = int.Parse(dr["codPeca"].ToString());
                s.CodServ1   = int.Parse(dr["codSev"].ToString());
                s.Quantidade = int.Parse(dr["quantidade"].ToString());

                lista.Add(new ServPeca(s.CodServ1, s.CodPeca1, s.Quantidade));
            }

            return(lista);
        }
Пример #2
0
        public List <Servico> test()
        {
            List <Stage>    stages    = new List <Stage>();
            List <Servico>  lista     = new List <Servico>();
            List <ServPeca> servPecas = new List <ServPeca>();

            Servico  s  = new Servico();
            Stage    st = new Stage();
            ServPeca sp = new ServPeca();

            DataBase bd = DataBase.GetInstance();

            bd.GetConnection();
            SQLiteConnection conn = new SQLiteConnection(Data);

            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }


            SQLiteCommand    cmd = new SQLiteCommand("SELECT * FROM SERVICO", conn);
            SQLiteDataReader dr  = cmd.ExecuteReader();

            while (dr.Read())
            {
                s.Codigo          = Int32.Parse(dr["codigo"].ToString());
                s.CpfCliente1     = dr["cpfcliente"].ToString();
                s.CpfFuncionario1 = dr["cpfFunc"].ToString();
                s.PlacaCarro1     = dr["placaCarro"].ToString();
                s.ValorTotal      = double.Parse(dr["valorTotal"].ToString());
                lista.Add(new Servico(s.Codigo, s.CpfCliente1, s.CpfFuncionario1, s.PlacaCarro1, s.ValorTotal));
            }
            return(lista);
        }
Пример #3
0
        public void Salvar(ServPeca sv)
        {
            DataBase bd = DataBase.GetInstance();

            bd.GetConnection();
            String sql = string.Format("INSERT INTO SERVPECA(codSev,codPeca,quantidade) VALUES ('{0}','{1}','{2}')", sv.CodServ1, sv.CodPeca1, sv.Quantidade);

            bd.ExecuteSQL(sql);
        }