Пример #1
0
        public void Excluir(OrdemP oOrdemP)
        {
            odb.OrdemPSet.Remove(oOrdemP);
            //odb.Entry(oCadastroUsuario).State = System.Data.Entity.EntityState.Deleted;

            odb.SaveChanges();
        }
Пример #2
0
        public void Alterar(OrdemP oOrdemP, bool attach = false)
        {
            var local = odb.Set <OrdemP>().Local.FirstOrDefault(p => p.Id == oOrdemP.Id);

            odb.Entry(local).State   = System.Data.Entity.EntityState.Detached;
            odb.Entry(oOrdemP).State = System.Data.Entity.EntityState.Modified;
            odb.SaveChanges();
        }
Пример #3
0
        private void BtnSalvarOP_Click(object sender, EventArgs e)
        {
            if (ValidaControles())
            {
                OrdemP oOrdemP = new OrdemP();
                oOrdemP.ProdutoOP  = cbProducao.Text;
                oOrdemP.LoteOP     = txtLoteProducao.Text;
                oOrdemP.DataOP     = txtDataOP.Text;
                oOrdemP.HoraOP     = txtHoraOP.Text;
                oOrdemP.Nome1      = cbO1.Text;
                oOrdemP.Nome2      = cbO2.Text;
                oOrdemP.Nome3      = cbO3.Text;
                oOrdemP.HO1        = ho1.Text;
                oOrdemP.HO2        = ho2.Text;
                oOrdemP.HO3        = ho3.Text;
                oOrdemP.NomeA1     = cbA1.Text;
                oOrdemP.NomeA2     = cbA2.Text;
                oOrdemP.NomeA3     = cbA3.Text;
                oOrdemP.HA1        = ha1.Text;
                oOrdemP.HA2        = ha2.Text;
                oOrdemP.HA3        = ha3.Text;
                oOrdemP.Materia1   = cbM1.Text;
                oOrdemP.Materia2   = cbM2.Text;
                oOrdemP.Materia3   = cbM3.Text;
                oOrdemP.LM1        = txtLoteM1.Text;
                oOrdemP.LM2        = txtLoteM2.Text;
                oOrdemP.LM3        = txtLoteM3.Text;
                oOrdemP.Qtd1       = txtQtd1.Text;
                oOrdemP.Qtd2       = txtQtd2.Text;
                oOrdemP.Qtd3       = txtQtd3.Text;
                oOrdemP.Observacao = txtObservacao.Text;
                //if ((TxtSenhaControle == TxtConfirmarSenhaControle) && (TxtSenhaControle != null))

                if (Incluir)
                {
                    _Control.Incluir(oOrdemP);
                    Incluir = true;
                    MessageBox.Show("Cadastro de Processo de Descrição foi realizada com sucesso!");
                }
                else
                {
                    oOrdemP.Id = id;
                    _Control.Alterar(oOrdemP);
                    Incluir = true;
                    LimpaCampos();
                    MessageBox.Show("Os dados foram alterados com sucessso!", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }


            cbProducao.Text      = "";
            txtLoteProducao.Text = "";
            cbO1.Text            = "";
            cbO2.Text            = "";
            cbO3.Text            = "";
            ho1.Text             = "";
            ho2.Text             = "";
            ho3.Text             = "";
            cbA1.Text            = "";
            cbA2.Text            = "";
            cbA3.Text            = "";
            ha1.Text             = "";
            ha2.Text             = "";
            ha3.Text             = "";
            cbM1.Text            = "";
            cbM2.Text            = "";
            cbM3.Text            = "";
            txtLoteM1.Text       = "";
            txtLoteM2.Text       = "";
            txtLoteM3.Text       = "";
            txtQtd1.Text         = "";
            txtQtd2.Text         = "";
            txtQtd3.Text         = "";
            txtObservacao.Text   = "";


            CarregaGrid();
        }
Пример #4
0
        private void GrdOrdemProducao_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (GrdOrdemProducao.Rows[e.RowIndex].DataBoundItem != null)
            {
                OrdemP oOrdemP = ((OrdemP)GrdOrdemProducao.Rows[e.RowIndex].DataBoundItem);
                if (GrdOrdemProducao.Columns[e.ColumnIndex].Name == "BtnAlterar")
                {
                    Incluir              = false;
                    cbProducao.Text      = oOrdemP.ProdutoOP;
                    txtLoteProducao.Text = oOrdemP.LoteOP;
                    txtDataOP.Text       = oOrdemP.DataOP;
                    txtHoraOP.Text       = oOrdemP.HoraOP;
                    cbO1.Text            = oOrdemP.Nome1;
                    cbO2.Text            = oOrdemP.Nome2;
                    cbO3.Text            = oOrdemP.Nome3;
                    ho1.Text             = oOrdemP.HO1;
                    ho2.Text             = oOrdemP.HO2;
                    ho3.Text             = oOrdemP.HO3;
                    cbA1.Text            = oOrdemP.NomeA1;
                    cbA2.Text            = oOrdemP.NomeA2;
                    cbA3.Text            = oOrdemP.NomeA3;
                    ha1.Text             = oOrdemP.HA1;
                    ha2.Text             = oOrdemP.HA2;
                    ha3.Text             = oOrdemP.HA3;
                    cbM1.Text            = oOrdemP.Materia1;
                    cbM2.Text            = oOrdemP.Materia2;
                    cbM3.Text            = oOrdemP.Materia3;
                    txtLoteM1.Text       = oOrdemP.LM1;
                    txtLoteM2.Text       = oOrdemP.LM2;
                    txtLoteM3.Text       = oOrdemP.LM3;
                    txtQtd1.Text         = oOrdemP.Qtd1;
                    txtQtd2.Text         = oOrdemP.Qtd2;
                    txtQtd3.Text         = oOrdemP.Qtd3;
                    txtObservacao.Text   = oOrdemP.Observacao;
                    id = oOrdemP.Id;
                }
                else if (GrdOrdemProducao.Columns[e.ColumnIndex].Name == "BtnExcluir")
                {
                    if (MessageBox.Show("Se confirmar será impossível recuperar os dados. Deseja continuar?", ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        _Control.Excluir(oOrdemP);
                        cbProducao.Text      = "";
                        txtLoteProducao.Text = "";
                        txtDataOP.Text       = "";
                        txtHoraOP.Text       = "";
                        cbO1.Text            = "";
                        cbO2.Text            = "";
                        cbO3.Text            = "";
                        ho1.Text             = "";
                        ho2.Text             = "";
                        ho3.Text             = "";
                        cbA1.Text            = "";
                        cbA2.Text            = "";
                        cbA3.Text            = "";
                        ha1.Text             = "";
                        ha2.Text             = "";
                        ha3.Text             = "";
                        cbM1.Text            = "";
                        cbM2.Text            = "";
                        cbM3.Text            = "";
                        txtLoteM1.Text       = "";
                        txtLoteM2.Text       = "";
                        txtLoteM3.Text       = "";
                        txtQtd1.Text         = "";
                        txtQtd2.Text         = "";
                        txtQtd3.Text         = "";
                        txtObservacao.Text   = "";

                        CarregaGrid();
                    }
                }
            }
        }
Пример #5
0
 public void Incluir(OrdemP oOrdemP)
 {
     odb.OrdemPSet.Add(oOrdemP);
     odb.SaveChanges();
 }
Пример #6
0
 public void Excluir(OrdemP oOrdemP)
 {
     _Repository.Excluir(oOrdemP);
 }
Пример #7
0
 public void Alterar(OrdemP oOrdemP, bool attach = false)
 {
     _Repository.Alterar(oOrdemP, attach);
 }
Пример #8
0
 public void Incluir(OrdemP oOrdemP)
 {
     _Repository.Incluir(oOrdemP);
 }