Example #1
0
        public static void TesteCreateDepartamento(string sigla, string desc)
        {
            Departamento d = new Departamento();

            d = InsertFuncions.CreateDepartamento(sigla, desc);
            Console.WriteLine("Departamento " + d.Sigla + "\t" + d.Descricao + "created");
        }
Example #2
0
        // Insert Seccao
        public static int I2()
        {
            Console.WriteLine("Create Seccao");
            Console.Write("Sigla? = ");
            var sigla = Console.ReadLine();

            Console.Write("Departamento? = ");
            var dep = Console.ReadLine();

            Console.Write("Coordenador? = ");
            var c = Console.ReadLine();

            Console.Write("Descricao? = ");
            var    desc = Console.ReadLine();
            Seccao d    = new Seccao
            {
                Sigla        = sigla,
                Departamento = dep,
                Coordenador  = c,
                Descricao    = desc
            };
            Seccao ans = InsertFuncions.CreateSeccao(d);

            if (ans.Sigla == null)
            {
                Console.WriteLine("An error has ocurred. Seccao wasn't created.");
                return(-1);
            }
            else
            {
                Console.WriteLine("Seccao {0} was created, with the following parameters : {1}, {2}, {3}.", ans.Sigla, ans.Departamento, ans.Coordenador, ans.Descricao);
                return(0);
            }
        }
Example #3
0
        public static void CreateSeccao(string sigla, string departamento, string coordenador, string descricao)
        {
            Seccao s = new Seccao();

            s.Sigla        = sigla;
            s.Departamento = departamento;
            s.Coordenador  = coordenador;
            s.Descricao    = descricao;
            s = InsertFuncions.CreateSeccao(s);
            Console.WriteLine("Seccao " + s.Sigla + "\t" + " created");
        }
Example #4
0
        public static void TesteInsertUC(string sigla, DateTime data, int creditos, string descricao, string regente)
        {
            UnidadeCurricular uc = new UnidadeCurricular();

            uc._ID.Sigla = sigla;
            uc._ID.Data  = data;
            uc.Creditos  = creditos;
            uc.Descricao = descricao;
            uc.Regente   = regente;
            uc           = InsertFuncions.CreateUnidadeCurricular(uc);
            Console.WriteLine("Unidade Curricular " + uc._ID.Sigla + "\t" + " created");
        }
Example #5
0
        // Insert Departamento
        public static int I1()
        {
            Console.WriteLine("Create Departamento");
            Console.Write("Sigla? = ");
            var sigla = Console.ReadLine();

            Console.Write("Descricao? = ");
            var          desc = Console.ReadLine();
            Departamento d    = new Departamento();
            Departamento ans  = new Departamento();

            ans = InsertFuncions.CreateDepartamento(sigla, desc);
            if (ans.Descricao == null)
            {
                Console.WriteLine("An error has ocurred. Department wasn't created.");
            }
            else
            {
                Console.WriteLine("Department {0} was created.", ans.Sigla);
            }
            return(d.Sigla != null ? 0 : -1);
        }
Example #6
0
        // Insert UC
        public static int I3()
        {
            Console.WriteLine("Create Unidade Curricular");
            Console.Write("Sigla? = ");
            var sigla = Console.ReadLine();

            Console.Write("Ano letivo? = ");
            var data = Console.ReadLine();

            Console.Write("Creditos? = ");
            var creditos = Console.ReadLine();

            Console.Write("Descricao? = ");
            var desc = Console.ReadLine();

            Console.Write("Regente? = ");
            var reg             = Console.ReadLine();
            UnidadeCurricular d = new UnidadeCurricular();

            d._ID.Sigla = sigla;
            d._ID.Data  = DateTime.Parse(data);
            d.Creditos  = int.Parse(creditos);
            d.Descricao = desc;
            d.Regente   = reg;
            UnidadeCurricular ans = InsertFuncions.CreateUnidadeCurricular(d);

            if (ans._ID.Sigla == null)
            {
                Console.WriteLine("An error has ocurred. Unidade Curricular wasn't created.");
                return(-1);
            }
            else
            {
                Console.WriteLine("Unidade Curricular {0} was created, with the following parameters : {1}, {2}, {3}.", ans._ID.Sigla, ans._ID.Data, ans.Creditos, ans.Descricao, ans.Regente);
                return(0);
            }
        }