Пример #1
0
        static void Main(string[] args)
        {
            var cliente = new Cliente();

            cliente.CPF = string.Empty;

            var cachorro = new Cachorro();

            cachorro.Andar();
            cachorro.Comer();
            cachorro.Latir();

            var gerencia = new GerenciamentoConta();

            gerencia.Sacar(new ContaPoupanca());
            gerencia.Sacar(new ContaCorrente());

            var programador = new Programador();

            programador.CalcularBonus();

            var gerente = new Gerente();

            gerente.CalcularBonus();

            var usbpc = new USBParaPc();

            usbpc.Conectar();

            var usbmac = new USBParaMac();

            usbmac.Conectar();

            Console.ReadKey();
        }
Пример #2
0
        public async Task <IActionResult> Post(Programador programador)
        {
            _context.Add(programador);
            await _context.SaveChangesAsync();

            return(Ok(programador.Id));
        }
Пример #3
0
        public async Task <IActionResult> put(int programadorID, Programador model)
        {
            try
            {
                var programador = await _repo.GetProgramadorAsyncById(programadorID);

                if (programador == null)
                {
                    return(NotFound());
                }

                _repo.Update(model);

                if (await _repo.SaveChangesAsync())
                {
                    return(Ok(model));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest($"Erro: {ex.Message}"));
            }

            return(BadRequest());
        }
Пример #4
0
        public async Task <ActionResult> AtualizarProgramadorAsync(Programador programador)
        {
            _context.Programadores.Update(programador);
            await _context.SaveChangesAsync();

            return(Ok());
        }
        public string DelProg(int prog)
        {
            try
            {
                using (Banco bco = new Banco())
                {
                    Programador  progr = bco.Programadores.Find(prog);
                    Conhecimento con   = bco.Conhecimentos.Find(prog);
                    Endereco     end   = bco.Enderecos.Find(prog);
                    DBancario    dban  = bco.DBancarios.Find(prog);

                    bco.Programadores.Remove(progr);
                    bco.Conhecimentos.Remove(con);
                    bco.Enderecos.Remove(end);
                    bco.DBancarios.Remove(dban);

                    bco.SaveChanges();

                    return("Ok");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #6
0
        //SE SOBRESCRIBE EL MANEJADOR DE EVENTOS
        protected override void btnAceptar_Click(object sender, EventArgs e)
        {
            this.programador = new Entidades.Programador(base.txtNombre.Text, base.txtApellido.Text,
                                                         int.Parse(base.txtLegajo.Text), double.Parse(base.txtSueldo.Text), (ECategoria)this.cboCategoria.SelectedItem);

            base.btnAceptar_Click(sender, e);
        }
        public string AddProg(Programador programers, Conhecimento conhec, DBancario dban, Endereco end)
        {
            if (programers != null && conhec != null && dban != null && end != null)
            {
                using (Banco bco = new Banco())
                {
                    try
                    {
                        bco.Enderecos.Add(end);
                        bco.DBancarios.Add(dban);
                        bco.Conhecimentos.Add(conhec);
                        bco.Programadores.Add(programers);
                        bco.SaveChanges();

                        return("Ok");
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
            else
            {
                return("Invalid");
            }
        }
Пример #8
0
        public async Task <IActionResult> Put(Programador programador)
        {
            _context.Entry(programador).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(NoContent());
        }
Пример #9
0
        public async Task <IActionResult> post(ProgramadorDTO dto)
        {
            try
            {
                var projeto = await _repo.GetProjetoAsyncById(dto.ProjetoId);

                if (projeto == null)
                {
                    return(NotFound());
                }
                if (dto.Nome == null)
                {
                    return(BadRequest());
                }
                Programador programador = new Programador();
                programador.Nome      = dto.Nome;
                programador.ProjetoId = projeto.Id;
                programador.Telefone  = dto.Telefone;

                _repo.Add(programador);

                if (await _repo.SaveChangesAsync())
                {
                    return(Ok(programador));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest($"Erro: {ex.Message}"));
            }

            return(BadRequest());
        }
Пример #10
0
 public void Add(Programador programador)
 {
     using (EasyProjectEntities db = new EasyProjectEntities())
     {
         db.Programadors.Add(programador);
         db.SaveChanges();
     }
 }
        public Programador Atualizar(Programador programador)
        {
            var entry = Db.Entry(programador);

            DbSet.Attach(programador);
            entry.State = EntityState.Modified;
            return(programador);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Programador programador = db.Programador.Find(id);

            db.Programador.Remove(programador);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #13
0
        public async Task <ActionResult <Programador> > SalvarProgramadorAsync(Programador programador)
        {
            await _context.Programadores.AddAsync(programador);

            await _context.SaveChangesAsync();

            return(Ok());
        }
Пример #14
0
 public void Update(Programador updateProgramador)
 {
     using (EasyProjectEntities db = new EasyProjectEntities())
     {
         db.Entry(updateProgramador).State = EntityState.Modified;
         db.Entry(updateProgramador.Conhecimento).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
        static void Main(string[] args)
        {
            Empresa empresa = new Empresa("Accentuna");

            //Empleado e = new Empleado("No se pude", "Instanciar", 0, 0); //ERROR!

            Administrativo a1 = new Administrativo("Juana", "Pérez", 123, 22000, ESimpatia.MuyPoca);
            Administrativo a2 = new Administrativo("Mariana", "Re", 124, 22500, ESimpatia.NiPreguntes);

            Cadete c = new Cadete("Pedro", "Alfonso", 210, 18000, "Peter");

            Programador p1 = new Programador("Álvaro", "Fernandez", 345, 32000, ECategoria.Junior);
            Programador p2 = new Programador("María", "Hernandez", 378, 42000, ECategoria.SemiSenior);

            Console.WriteLine(a1.ToString());
            Console.WriteLine(a2);// POR DEFECTO, SE INVOCA AL .TOSTRING()
            Console.WriteLine(c.ToString());
            Console.WriteLine(p1.ToString());
            Console.WriteLine(p2.ToString());

            Console.ReadLine();
            Console.Clear();

            empresa += a1;
            empresa += a2;

            empresa += c;

            empresa += p1;
            empresa += p2;

            Console.WriteLine(empresa);// POR DEFECTO, SE INVOCA AL .TOSTRING()

            Console.ReadLine();
            Console.Clear();

            if (a1.Equals(a2))
            {
                Console.WriteLine("Los 'administrativos' son iguales.");
            }
            else
            {
                Console.WriteLine("Los 'administrativos' NO son iguales.");
            }

            if (p1.Equals(new Programador("Nombre", "Apellido", 345, 0)))
            {
                Console.WriteLine("Los 'programadores' son iguales.");
            }
            else
            {
                Console.WriteLine("Los 'programadores' NO son iguales.");
            }

            Console.ReadLine();
        }
 public ActionResult Edit([Bind(Include = "ProgramadorGUID,ProgramadorID,FirstName,LastName,Email,Password,Age,PhoneNumber,Location,Category,Description,PriceHour,Foto,LinkGithub,LinkLinkedin,Certificates,Privacy")] Programador programador)
 {
     if (ModelState.IsValid)
     {
         db.Entry(programador).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("SelectLanguages"));
     }
     return(View("SelectLanguages"));
 }
Пример #17
0
 public ContentProgramador Add(Programador programador)
 {
     if (programador == null)
     {
         throw new BusinessRuleException("Atenção: Ocorreu um erro durante o cadastro de programador tente de novo mais tarde", ExceptionHandlerSeverity.ALERTA);
     }
     ValidaSalvar(programador);
     new ProgramadorRepository().Add(programador);
     return(GetProgramador(programador.IDProgramador));
 }
Пример #18
0
        public async Task <ActionResult <Programador> > PegarPeloIdAsync(int id)
        {
            Programador programador = await _context.Programadores.FindAsync(id);

            if (programador == null)
            {
                NotFound();
            }

            return(programador);
        }
        public ActionResult Create([Bind(Include = "ProgramadorGUID,ProgramadorID,FirstName,LastName,Email,Password,Age,PhoneNumber,Location,Category,Description,PriceHour,Foto,LinkGithub,LinkLinkedin,Certificates,Privacy")] Programador programador)
        {
            if (ModelState.IsValid)
            {
                db.Programador.Add(programador);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(programador));
        }
Пример #20
0
        public static void UsarSistema()
        {
            Programador matheus = new Programador("Matheus neon", "892.322.372-39", "Web");
            Diretor     marco   = new Diretor("Marco Reus", "834.422.334-13", "Geral");

            marco.Senha = "123";

            SistemaInterno.Logar(marco, "222");

            Console.WriteLine(matheus);
        }
Пример #21
0
 public JsonResult Insert(Programador programador)
 {
     try
     {
         return(Json(new { retorno = ProgramadorBLL.Add(programador), msg = "OK|Registro cadastrado com sucesso" }));
     }
     catch (Exception ex)
     {
         return(Json(new { msg = ExceptionHandler.HandleException(ex) }));
     }
 }
Пример #22
0
        public async Task <IActionResult> Delete(int id)
        {
            var programador = new Programador {
                Id = id
            };

            _context.Remove(programador);
            await _context.SaveChangesAsync();

            return(NoContent());
        }
        private void eliminarBtt_Click(object sender, EventArgs e)
        {
            Programador programadores = new Programador();

            programadores.Id_proyecto = int.Parse(textBox2.Text);
            ArbolBB.eliminar(programadores);

            MessageBox.Show("Se elimino con exito");
            textBox1.Text = " ";
            textBox2.Text = " ";
        }
Пример #24
0
 public JsonResult Update(Programador updatedProgramador)
 {
     try
     {
         ProgramadorBLL.Update(updatedProgramador);
         return(Json(new { msg = "OK|Registro alterado com sucesso" }));
     }
     catch (Exception ex)
     {
         return(Json(new { msg = ExceptionHandler.HandleException(ex) }));
     }
 }
Пример #25
0
        public async Task <ActionResult> DeletarProgramadorAsync(int Id)
        {
            Programador programador = await _context.Programadores.FindAsync(Id);

            if (programador == null)
            {
                return(NotFound());
            }
            _context.Remove(programador);
            await _context.SaveChangesAsync();

            return(Ok());
        }
Пример #26
0
        // GET: Empleados
        public ActionResult Index()
        {
            var retenciones = new List <IAporte> {
                new AporteJubilacion(), new AporteObraSocial()
            };

            var calculadorSueldo = new CalcularSalarioNeto(retenciones, new ImpuestoGanancias());

            var empleado = new Programador("Pedro", "Perez", 150, 160);

            var r = calculadorSueldo.Calcular(empleado);

            return(View());
        }
        // GET: Programadors/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Programador programador = db.Programador.Find(id);

            if (programador == null)
            {
                return(HttpNotFound());
            }
            return(View(programador));
        }
        public ActionResult Programador(Programador P)
        {
            //Empleado E = new Empleado();
            //E.Nombre = P.Nombre;
            //E.Apellido = P.Apellido;
            //E.Sueldo = P.calcularSalario();

            //ViewBag.Nombre = P.Nombre;
            //ViewBag.Apellido = P.Apellido;

            Empleado e = new Programador();

            ViewBag.sueldo = e.calcularSalario;

            return(View("Resultado", P));
        }
Пример #29
0
        public async Task <ActionResult> RegisterProgrammer(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };

                var result = await UserManager.CreateAsync(user, model.Password);

                jobEntities1 db = new jobEntities1();
                Programador  userProgramador = new Programador
                {
                    ProgramadorGUID = user.Id,
                    Email           = user.Email
                };
                db.Programador.Add(userProgramador);
                db.SaveChanges();
                if (result.Succeeded)
                {
                    //Assign Role to user Here
                    await this.UserManager.AddToRoleAsync(user.Id, "Programmer");

                    //Ends Here
                    await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                    //Company NewCompanyUser = new Company();
                    //NewCompanyUser.CompanyGUID = user.Id;



                    // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
                    // Enviar um email com este link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirmar sua conta", "Confirme sua conta clicando <a href=\"" + callbackUrl + "\">aqui</a>");

                    return(RedirectToAction("Edit", "Programadors", new { id = userProgramador.ProgramadorID }));
                }
                AddErrors(result);
            }

            // Se chegamos até aqui e houver alguma falha, exiba novamente o formulário
            return(View(model));
        }
Пример #30
0
        static void Main(string[] args)
        {
            Programador objProgramador = new Programador();
            Designer    objDesigner    = new Designer();

            objProgramador.Salario = 1300M;
            Console.WriteLine("Calculando o reajuste de Programador\n");
            objProgramador.Reajustar();

            Console.WriteLine("Novo salário é: " + objProgramador.Salario);

            objDesigner.Salario = 1100M;
            Console.WriteLine("\n Calculando Reajuste de Designer\n");
            objDesigner.Reajustar();
            Console.WriteLine("Novo salário é: " + objDesigner.Salario);

            Console.ReadKey();
        }