public void InjetarDados(Peças pec)
        {
            if (pec != null)
            {
                txtCodPec.Text  = pec.CDPeças.ToString();
                txtNotas.Text   = pec.Notas;
                txtQtdComp.Text = pec.QtdComponentes.ToString();

                //CARREGA A lstColecao NO CONSTRUTOR

                if (pec.Situacao == true)
                {
                    rbtAtivo.Checked   = true;
                    rbtInativo.Checked = false;
                }
                else
                {
                    rbtAtivo.Checked   = false;
                    rbtInativo.Checked = true;
                }

                if (pec.Reparo == true)
                {
                    rbtSim.Checked = true;
                    rbtNao.Checked = false;
                }
                else
                {
                    rbtSim.Checked = false;
                    rbtNao.Checked = true;
                }

                picFoto.ImageLocation = pec.AnexoCroquis;
            }
        }
        public FrmDelAltPec(Peças pec)
        {
            InitializeComponent();
            InjetarDados(pec);
            a = pec;

            var aux = db.Coleções.Where(x => x.IDColecao == pec.IDColecao).ToList();

            foreach (Coleções n in aux)
            {
                lstColecao.Items.Add(n);
            }
        }
        private void btnEditar_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Tem certeza que deseja alterar? ", "Mensagem do Sistema", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                Peças x = db.Peças.Single(s => s.CDPeças == a.CDPeças);
                if (LoadPec(x))
                {
                    db.SaveChanges();
                    MessageBox.Show("CADASTRO DE PEÇA ALTERADO COM SUCESSO", "Mensagem do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Example #4
0
        public bool LoadPec(Peças pec)
        {
            if (txtCodPec.MaskFull && lstColecao.SelectedItem != null)
            {
                pec.QtdComponentes = int.TryParse(txtQtdComp.Text, out var tempVal) ? tempVal : (int?)null;

                pec.Notas = txtNotas.Text;

                pec.IDColecao = ((Coleções)lstColecao.SelectedItem).IDColecao;

                if (txtCodPec.MaskFull)
                {
                    string semPonto = txtCodPec.Text.Replace(".", "");
                    pec.CDPeças = int.TryParse(semPonto, out tempVal) ? tempVal : default(int);
                }
                if (rbtAtivo.Checked)
                {
                    pec.Situacao = true;
                }
                else if (rbtInativo.Checked)
                {
                    pec.Situacao = false;
                }

                if (rbtSim.Checked)
                {
                    pec.Reparo = true;
                }
                else if (rbtNao.Checked)
                {
                    pec.Reparo = false;
                }

                pec.AnexoCroquis = picFoto.ImageLocation;

                return(true);
            }
            else if (!txtCodPec.MaskFull)
            {
                txtCodPec.Focus();
                MessageBox.Show("PREENCHA o campo Código Peça!!!");
                return(false);
            }
            else
            {
                MessageBox.Show("Escolha uma Coleção!!!");
                return(false);
            }
        }
Example #5
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            Peças pec = new Peças();

            if (LoadPec(pec))
            {
                var objPec = db.Peças.Where(x => x.CDPeças == pec.CDPeças).SingleOrDefault();

                if (objPec == null)
                {
                    db.Peças.Add(pec);
                    db.SaveChanges();
                    MessageBox.Show("Peça salva com sucesso!", "Mensagem do sistema");
                    limparFrmCadPec();
                }
                else
                {
                    MessageBox.Show("Código peça já existente, não aceitamos peça com codigo igual", "Mensagem do sistema");
                    txtCodPec.Focus();
                }
            }
        }
Example #6
0
        static void Main(string[] args)
        {
            Console.WriteLine("Entre com os dados");
            Console.WriteLine("Nome do estagiario");
            string nomeEst = Console.ReadLine();

            Console.WriteLine("Email");
            string emailEst = Console.ReadLine();

            Console.WriteLine("Numero (99)99999-99999");
            string numEst = Console.ReadLine();

            Console.WriteLine("Codigo do estagiario");
            int codeEst = int.Parse(Console.ReadLine());

            Console.WriteLine("Data de adimissao (dd/mm/yyyy)");
            DateTime DateTime = DateTime.Parse(Console.ReadLine());

            Console.WriteLine("Nome do requisitante");
            string nomeReq = Console.ReadLine();

            Console.WriteLine("Codigo do requisitante");
            int codeReq = int.Parse(Console.ReadLine());

            Console.WriteLine("Enter the status ->");
            Console.WriteLine("Delivered or Pending or Done");

            Enum.TryParse(Console.ReadLine(), true, out EnumServico status);


            Trainee   trainee   = new Trainee(nomeEst, emailEst, numEst, codeEst, DateTime);
            Requester requester = new Requester(nomeReq, codeReq);
            Ordem     ordem     = new Ordem(DateTime, status, trainee, requester);

            Console.WriteLine("Quantos serviços voce ira fazer? \n");
            int n = int.Parse(Console.ReadLine());

            for (int i = 1; i <= n; i++)
            {
                Console.WriteLine($"O nome do #{i}° serviço");
                string servNome = Console.ReadLine();
                Console.WriteLine($"O #{i}° codigo");
                int      servCode  = int.Parse(Console.ReadLine());
                int      servQuant = n;
                Servicos servico   = new Servicos(servNome, servCode, servQuant);
                ordem.AddService(servico);

                Console.WriteLine("Numero de peças que voce vai levar");
                int nPec = int.Parse(Console.ReadLine());
                for (int j = 1; j <= nPec; j++)
                {
                    Console.WriteLine($"O nome da #{j}° peças");
                    string pecNome = Console.ReadLine();
                    Console.WriteLine($"O #{j}° codigo");
                    int pecCode = int.Parse(Console.ReadLine());
                    Console.WriteLine("quantidade do componente");
                    int   pecQuant = int.Parse(Console.ReadLine());
                    Peças peças    = new Peças(pecNome, pecCode, pecQuant);

                    ordem.AddPecas(peças);
                }
            }
            Console.WriteLine();
            Console.WriteLine("Order sumary");
            Console.WriteLine(ordem);
            Console.ReadKey(true);
        }