public static void Update()
        {
            projects.Clear();
            using (var cn = Database.CreateConnection())
            {
                cn.Open();
                OracleCommand    cmd    = new OracleCommand(selectSql, cn);
                OracleDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        int         id          = reader.GetInt32(0);
                        string      name        = reader.GetString(1);
                        decimal     cost        = reader.GetDecimal(2);
                        Departament?departament = null;
                        if (!reader.IsDBNull(3))
                        {
                            departament = DepartamentsDataSet.FindById(reader.GetInt32(3));
                        }
                        DateTime date_beg      = reader.GetDateTime(4);
                        DateTime date_end      = reader.GetDateTime(5);
                        DateTime?date_end_real = null;
                        if (!reader.IsDBNull(6))
                        {
                            date_end_real = reader.GetDateTime(6);
                        }

                        projects.Add(new Project(id, name, cost, departament, date_beg, date_end, date_end_real));
                    }
                }
            }
        }
Exemple #2
0
        public static void Update()
        {
            data.Clear();
            using (var cn = Database.CreateConnection())
            {
                cn.Open();
                OracleCommand    cmd    = new OracleCommand(selectSql, cn);
                OracleDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        int         id          = reader.GetInt32(0);
                        Departament departament = DepartamentsDataSet.FindById(reader.GetInt32(1));
                        Employee    employee    = EmployeesDataSet.FindById(reader.GetInt32(2));


                        data.Add(new DepartEmpl(id, departament, employee));
                    }
                }
            }
        }