Beispiel #1
0
        public List <professor> Getprofessor()
        {
            SqlConnection myconnection = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myconnection"].ConnectionString);
            SqlCommand    sqlCmd       = new SqlCommand();

            sqlCmd.Connection = myconnection;
            List <professor> lstprof = new List <Models.professor>();

            sqlCmd.CommandType = CommandType.Text;
            sqlCmd.CommandText = "Select DeptID,Deptname,HODname from professor ";
            SqlDataReader reader = null;

            myconnection.Open();
            reader = sqlCmd.ExecuteReader();
            professor prof = null;

            while (reader.Read())
            {
                prof          = new professor();
                prof.DeptID   = Convert.ToInt32(reader.GetValue(0));
                prof.Deptname = reader.GetValue(1).ToString();
                prof.HODname  = reader.GetValue(2).ToString();
                lstprof.Add(prof);
            }
            myconnection.Close();
            return(lstprof);
        }
        public void professorLogin()
        {
            professor         professor     = new professor(id);
            teachingStaffMenu professorMenu = new teachingStaffMenu(professor);

            Assert.IsTrue(professor is professor && professorMenu is teachingStaffMenu);
        }
Beispiel #3
0
        public ActionResult Create(professor professors)
        {
            DAl.Irepository <professor> s = new professor_manager();

            s.add(professors);
            return(View());
        }
        static void Main(string[] args)
        {
            // professor BartSimpson = new professor();

            // Console.WriteLine("digite quantas horas foram trabalhadas: ");

            // BartSimpson.hora = float.Parse(Console.ReadLine());

            // Console.WriteLine("Digite o valor da aula dada: ");

            // BartSimpson.valorAula = float.Parse(Console.ReadLine());

            // Console.WriteLine($"O valor a receber é {BartSimpson.matematica()}");


            professor RegisLeandro = new professor();

            RegisLeandro.Professor = "Regis";

            Console.WriteLine("digite quantas horas foram trabalhadas: ");

            RegisLeandro.hora = float.Parse(Console.ReadLine());

            Console.WriteLine($"O professor {RegisLeandro.Professor} tem a receber R${RegisLeandro.matematica(RegisLeandro.hora)}");
        }
 public static void ViewProfessorCourseList(professor p)
 {
     using (var ef = new baron_project1Entities())
     {
         var course   = ef.studentCourseLists.Find(p.professorID);
         var schedule = ef.courses.Find(course.courseID);
     }
 }
        public void professorLogoff()
        {
            professor         professor     = new professor(id);
            teachingStaffMenu professorMenu = new teachingStaffMenu(professor);

            professorMenu.Close();
            Assert.IsNotNull(professorMenu);
        }
Beispiel #7
0
        public ActionResult Delete(professor professors)
        {
            DAl.Irepository <professor> s = new professor_manager();

            s.delete(professors);

            return(RedirectToAction("Index"));
        }
Beispiel #8
0
        public BaseResponse SaveProfessor(Professor prof)
        {
            BaseResponse response = new BaseResponse();

            if (prof != null)
            {
                professor professorDB = new professor();

                professorDB.Primeiro_Nome     = prof.PrimeiroNome;
                professorDB.Segundo_Nome      = prof.SegundoNome;
                professorDB.Data_Nascimento   = prof.DataNascimento;
                professorDB.Email             = prof.Email;
                professorDB.Area_Ensino       = prof.Area;
                professorDB.Telefone          = prof.Telefone;
                professorDB.TelefoneComercial = prof.TelefoneComercial;
                professorDB.Celular           = prof.Celular;
                professorDB.RG                     = prof.RG;
                professorDB.CPF                    = prof.CPF;
                professorDB.Nacao_ID               = prof.Nacionalidade;
                professorDB.CidadeNascimento       = prof.LocalNascimento;
                professorDB.Sexo                   = prof.Sexo;
                professorDB.EnderecoComercial      = prof.EnderecoComercial;
                professorDB.Profissao              = prof.Profissao;
                professorDB.Estado_Civil           = prof.EstadoCivil;
                professorDB.Estado_Civil_Antigo    = prof.EstadoCivilAntigo;
                professorDB.Filhos_Qtt             = prof.QttFilhos;
                professorDB.Conjuge_Nome           = prof.Conjuge;
                professorDB.Has_Tabaco             = prof.Tabaco;
                professorDB.Has_Toxicos            = prof.Toxicos;
                professorDB.Is_Sociedade_Secreta   = prof.SociedadeSecreta;
                professorDB.Has_Ensino_Fundamental = prof.EnsinoFundamental;
                professorDB.Has_Ensino_Medio       = prof.EnsinoMedio;
                professorDB.Has_Ensino_Superior    = prof.EnsinoSuperior;
                professorDB.Outros_Cursos          = prof.OutrosCursos;
                professorDB.Is_Ativo               = prof.IsAtivo;

                if (prof.Cursos != null && prof.Cursos.Any())
                {
                    professor_cursos cursoProfessorDB = null;

                    foreach (var curso in prof.Cursos)
                    {
                        cursoProfessorDB = new professor_cursos();

                        cursoProfessorDB.Curso_ID     = curso.CursoID;
                        cursoProfessorDB.Professor_ID = professorDB.Professor_ID;
                    }
                }

                _logosContext.SaveChanges();
            }

            return(response);
        }
Beispiel #9
0
        public void getIDTest()
        {
            int       ID       = 1;                                 // TODO: Initialize to an appropriate value
            string    fN       = "Chris";                           // TODO: Initialize to an appropriate value
            string    lN       = "Pascucci";                        // TODO: Initialize to an appropriate value
            string    classN   = "CIS3309";                         // TODO: Initialize to an appropriate value
            professor Pro      = new professor(ID, fN, lN, classN); // TODO: Initialize to an appropriate value
            int       expected = 1;                                 // TODO: Initialize to an appropriate value
            int       actual;

            Pro.getID = expected;
            actual    = Pro.getID;
            // Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method.");
        }
Beispiel #10
0
        public void getlastNameTest()
        {
            int       ID       = 1;                                 // TODO: Initialize to an appropriate value
            string    fN       = "Chris";                           // TODO: Initialize to an appropriate value
            string    lN       = "Pascucci";                        // TODO: Initialize to an appropriate value
            string    classN   = "CIS3309";                         // TODO: Initialize to an appropriate value
            professor Pro      = new professor(ID, fN, lN, classN); // TODO: Initialize to an appropriate value
            string    expected = "Pascucci";                        // TODO: Initialize to an appropriate value
            string    actual;

            Pro.getlastName = expected;
            actual          = Pro.getlastName;
            Assert.AreEqual(expected, actual);
        }
Beispiel #11
0
        public static void Main(String[] args)
        {
            aula al = new aula();

//foreach(int i as args)
            al.setNome(args[0]);
//Console.WriteLine(args.Ccount());

            Console.WriteLine("bem-vindo " + al.getNome());
            professor pr = new professor();

            pr.Nome = Console.ReadLine();
//pr.setNome("andre");
//Console.WriteLine("eu sou aluno de "+pr.getNome());
            Console.WriteLine("sou aluno de " + pr.Nome);
        }
Beispiel #12
0
        public Staff(ulong ID, string FIRSTNAME, string LASTNAME, string TYPE)
        {
            id        = ID;
            firstName = FIRSTNAME;
            lastName  = LASTNAME;
            type      = TYPE;

            if (type == "Professor")
            {
                professor prof = new professor(id);
                constList = prof.getConstraintsList();
            }
            else
            {
                instructor inst = new instructor(id);
                constList = inst.getConstraintsList();
            }

            isPublished = new dataBaseOperations().getPublishedSched(id);
        }
Beispiel #13
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            if (validaCamposObrigatorios())
            {
                lblMensagem.Text      = "Existem campos obrigatórios que não foram preenchidos";
                lblMensagem.ForeColor = Color.Red;
                lblMensagem.Font.Bold = true;
                ClientScript.RegisterStartupScript(typeof(Page), Guid.NewGuid().ToString(), "showMessage();", true);
            }
            else if (!txtEmail.Text.Contains('@'))
            {
                lblMensagem.Text      = "Email inválido";
                lblMensagem.ForeColor = Color.Red;
                lblMensagem.Font.Bold = true;
                ClientScript.RegisterStartupScript(typeof(Page), Guid.NewGuid().ToString(), "showMessage();", true);
            }
            else
            {
                try
                {
                    if (!string.IsNullOrWhiteSpace(txtId.Text))
                    {
                        int       id = int.Parse(txtId.Text);
                        professor professorResult = context.professor.First(x => x.id == id);
                        professorResult.nome     = txtNome.Text;
                        professorResult.cpf      = txtCpf.Text;
                        professorResult.telefone = txtTelefone.Text;
                        professorResult.email    = txtEmail.Text;
                        professorResult.salario  = decimal.Parse(txtSalario.Text);

                        lblMensagem.Text      = "Registro alterado com sucesso !";
                        lblMensagem.ForeColor = Color.Green;
                        lblMensagem.Font.Bold = true;
                        ClientScript.RegisterStartupScript(typeof(Page), Guid.NewGuid().ToString(), "showMessage();", true);
                        carregaGrid();
                    }
                    else
                    {
                        professor p = new professor()
                        {
                            nome     = txtNome.Text,
                            cpf      = txtCpf.Text,
                            telefone = txtTelefone.Text,
                            email    = txtEmail.Text,
                            salario  = decimal.Parse(txtSalario.Text),
                        };
                        context.professor.Add(p);

                        lblMensagem.Text      = "Registro inserido com sucesso !";
                        lblMensagem.ForeColor = Color.Green;
                        lblMensagem.Font.Bold = true;
                        ClientScript.RegisterStartupScript(typeof(Page), Guid.NewGuid().ToString(), "showMessage();", true);
                    }
                    context.SaveChanges();
                    LimparForm();
                    carregaGrid();
                }
                catch (Exception ex)
                {
                    lblMensagem.Text      = $"{"Ocorreu um erro ao efetuar a operação."} {ex.Message}";
                    lblMensagem.ForeColor = Color.Red;
                    lblMensagem.Font.Bold = true;
                    ClientScript.RegisterStartupScript(typeof(Page), Guid.NewGuid().ToString(), "showMessage();", true);
                }
            }
        }
Beispiel #14
0
        static void Main(string[] args)
        {
            Pessoa pessoa = new Pessoa();

            Estado estado = new Estado();

            Cidade cidade = new Cidade();

            Pais pais = new Pais();

            Casa casa = new Casa();

            Biarro bairro = new Biarro();

            casa.bairro = bairro;

            estado.cidade = cidade;

            Console.WriteLine("Informações da pessoa");
            pessoa.nome             = "Lucas";
            pessoa.dataDeNascimento = new DateTime(1996, 5, 9);
            Console.WriteLine(pessoa);

            Console.WriteLine("Casa");
            casa.bairro.Nome = "Santa Paula";
            casa.NomeDaRua   = "José Amador";
            casa.numeroCasa  = "12333";
            Console.WriteLine(casa);

            Console.WriteLine("Cidade/Estado");
            estado.cidade.Nome = "São Paulo";
            estado.Nome        = "São Paulo";
            Console.WriteLine(estado);
            Console.WriteLine(estado.cidade);

            Console.WriteLine("PAIS");
            pais.Nome = "Brasil";
            Console.WriteLine(pais);

            Aluno_Classe aluno_Classe = new Aluno_Classe();

            Turma_Classe turma_Classe = new Turma_Classe();

            Funcionario_Classe funcionario_Classe = new Funcionario_Classe();

            professor Professor = new professor();

            aluno_Classe.nome      = "Lucas";
            aluno_Classe.matricula = "123564";
            Console.WriteLine(aluno_Classe);
            turma_Classe.serie = "3º";
            Console.WriteLine(turma_Classe);
            funcionario_Classe.nome = "Jorge";
            funcionario_Classe.RG   = "123654";
            Console.WriteLine(funcionario_Classe);
            Professor.nome    = "Mateus";
            Professor.Materia = "Português";
            Console.WriteLine(Professor);

            Console.ReadLine();
        }
        public void buildSchedule(string type)
        {
            ulong              id;
            List <string>      courseList;
            dataBaseOperations dataOp = new dataBaseOperations();

            if (type == "Professor")
            {
                id = UInt64.Parse(comboBoxProfList.Text.Split()[comboBoxProfList.Text.Split().Length - 1]);
                professor prof = new professor(id);
                courseList = prof.getCoursesList();
            }
            else
            {
                id = UInt64.Parse(comboBoxInstList.Text.Split()[comboBoxInstList.Text.Split().Length - 1]);
                instructor inst = new instructor(id);
                courseList = inst.getCoursesList();
            }

            //build DataTable
            DataTable tempTable = new DataTable();

            tempTable.Columns.Add(" ", typeof(string));
            tempTable.Columns.Add("Sunday", typeof(string));
            tempTable.Columns.Add("Monday", typeof(string));
            tempTable.Columns.Add("Tuesday", typeof(string));
            tempTable.Columns.Add("Wednesday", typeof(string));
            tempTable.Columns.Add("Thursday", typeof(string));
            tempTable.Columns.Add("Friday", typeof(string));
            tempTable.Rows.Add("07:00", typeof(string));
            tempTable.Rows.Add("08:00", typeof(string));
            tempTable.Rows.Add("09:00", typeof(string));
            tempTable.Rows.Add("10:00", typeof(string));
            tempTable.Rows.Add("11:00", typeof(string));
            tempTable.Rows.Add("12:00", typeof(string));
            tempTable.Rows.Add("13:00", typeof(string));
            tempTable.Rows.Add("14:00", typeof(string));
            tempTable.Rows.Add("15:00", typeof(string));
            tempTable.Rows.Add("16:00", typeof(string));
            tempTable.Rows.Add("17:00", typeof(string));
            tempTable.Rows.Add("18:00", typeof(string));
            tempTable.Rows.Add("19:00", typeof(string));
            tempTable.Rows.Add("20:00", typeof(string));
            tempTable.Rows.Add("21:00", typeof(string));
            string day   = "";
            string start = "";
            string end   = "";
            string room  = "";

            //enter lectures to DataTable
            for (int i = 0; i < courseList.Count; i++)
            {
                //get the attributes of the lecture from DB
                day   = dataOp.getAttrByName(courseList[i], 5);
                start = dataOp.getAttrByName(courseList[i], 6);
                end   = dataOp.getAttrByName(courseList[i], 7);
                room  = dataOp.getAttrByName(courseList[i], 4);
                //convert to location in DataTable
                int    location_x   = publicChecksAndOperations.convDayToInt(day);
                int    location_y_s = publicChecksAndOperations.hourConvertFromStringToInt(start);
                int    location_y_e = publicChecksAndOperations.hourConvertFromStringToInt(end);
                string name         = courseList[i];
                if ((tempTable.Rows[location_y_s][location_x] != null && !tempTable.Rows[location_y_s][location_x].Equals("System.String") && !string.IsNullOrEmpty(tempTable.Rows[location_y_s][location_x].ToString())))
                {
                    tempTable.Rows[location_y_s][location_x] = "Collision courses!Contact the Secretary";
                }
                else
                {
                    tempTable.Rows[location_y_s][location_x] = courseList[i] + " ( " + room + " )";
                }
                for (int j = location_y_s + 1; j <= (location_y_e); j++)
                {
                    if ((tempTable.Rows[j][location_x] != null && !tempTable.Rows[j][location_x].Equals("System.String") && !string.IsNullOrEmpty(tempTable.Rows[j][location_x].ToString())))
                    {
                        tempTable.Rows[j][location_x] = "Collision courses!Contact the Secretary";
                    }
                    else
                    {
                        tempTable.Rows[j][location_x] = name + " ( " + room + " )";
                    }
                }
            }
            //define empty value in cells which dont have lecture
            for (int i = 0; i < 15; i++)
            {
                for (int j = 1; j < 6; j++)
                {
                    if (tempTable.Rows[i][j] == null || tempTable.Rows[i][j].Equals("System.String") || string.IsNullOrEmpty(tempTable.Rows[i][j].ToString()))
                    {
                        tempTable.Rows[i][j] = " ";
                    }
                }
            }

            dataGridSchedule.DataSource        = tempTable;
            dataGridSchedule.RowHeadersVisible = false;
        }