/// <summary> /// Busca fornecedor para relacionar a compra /// </summary> private void AbreTelaBuscaFornecedor() { frmBuscaFornecedor telaFornecedor = null; try { this._modelFornecedor = new mFornecedor(); if (rdbMotor.Checked == true) { telaFornecedor = new frmBuscaFornecedor(this._modelFornecedor, this._modelMotor); } else { telaFornecedor = new frmBuscaFornecedor(this._modelFornecedor, this._modelPeca); } DialogResult resultado = telaFornecedor.ShowDialog(); if (resultado == DialogResult.Cancel) { this._modelFornecedor = null; } else { this.txtFornecedor.Text = this._modelFornecedor.NomeFornecedor; } } catch (Exception ex) { throw ex; } finally { telaFornecedor = null; } }
private void btnBuscaFornecedor_Click(object sender, EventArgs e) { this._modelFornecedor = new mFornecedor(); frmBuscaFornecedor objForm = new frmBuscaFornecedor(this._modelFornecedor); try { DialogResult resultado = objForm.ShowDialog(); if (resultado == DialogResult.Cancel) { this._modelFornecedor = null; this.txtFornecedor.Text = string.Empty; } else { this.txtFornecedor.Text = this._modelFornecedor.NomeFornecedor; this._idForn = this._modelFornecedor.IdFornecedor; } } catch (Exception ex) { throw ex; } finally { objForm = null; } }
public frmBuscaFornecedor(mFornecedor modelFornecedor, bool Alteracao) { InitializeComponent(); _model = modelFornecedor; _alteracao = Alteracao; this._filtroBusca = false; }
public frmBuscaFornecedor(mFornecedor modelFornecedor, mPeca modelPeca) { InitializeComponent(); _model = modelFornecedor; _alteracao = false; this._modelPeca = modelPeca; this._filtroBusca = true; }
public frmCadfornecedorDepto(mFornecedor modelForn, List<mFornecedorDepto> listaFornecedorDepto) { InitializeComponent(); this.btnBuscaFornecedor.Visible = false; this._modelFornecedor = modelForn; this._listaModelFornecedorDepto = listaFornecedorDepto; this.txtFornecedor.Text = modelForn.NomeFornecedor; this._telaFornecedor = true; }
private void btnLimpar_Click(object sender, EventArgs e) { base.LimpaDadosTela(this); this._modelPeca = null; this._modelFornecedor = null; }
/// <summary> /// Limpa a parte da tela de Ordem Compra /// </summary> private void LimpaGrupoOrdemCompra() { try { foreach (Control controle in this.gpbOrdemCompra.Controls) { Type tipo = controle.GetType(); if (tipo.Equals(typeof(TextBox)) == true || tipo.Equals(typeof(TCC.Controle.MegaTextBox)) == true) { controle.Text = string.Empty; } } this._modelFornecedor = null; this._modelMotor = null; this._modelPeca = null; this.rdbPeca.Checked = true; this.rdbMotor.Checked = false; } catch (Exception e) { throw e; } }
public void ValidaDados(mFornecedor model, bool alteracao) { if (model.CodPostal != null && model.Nom_pais == "Brasil") { Util.Validacoes.ValidaMasked(model.CodPostal, TCC.Regra.Util.TipoMasked.cep); } if (model.Cnpj != null) { Util.Validacoes.ValidaMasked(model.Cnpj, TCC.Regra.Util.TipoMasked.cnpj); } if (model.Ddi != null) { string ddi = Convert.ToString(model.Ddi); Util.Validacoes.ValidaMasked(ddi, TCC.Regra.Util.TipoMasked.ddd); } if (model.Ddd != null && model.Nom_pais == "Brasil") { string ddd = Convert.ToString(model.Ddd); Util.Validacoes.ValidaMasked(ddd, TCC.Regra.Util.TipoMasked.ddd); } if (model.Telefone != null && model.Nom_pais == "Brasil") { string tel = Convert.ToString(model.Telefone); Util.Validacoes.ValidaMasked(tel, TCC.Regra.Util.TipoMasked.tel); } if (model.Email != null) { string email = Convert.ToString(model.Email); Util.Validacoes.ValidaEmail(email); } if (alteracao == false) { if (model.Cnpj != null) { if (this.ExisteCnpj(model.Cnpj) == true) { throw new Regra.Exceptions.Fornecedor.CNPJFornecedorExistente(); } } if (model.IdentInter != null) { if (this.ExisteIdentInter(model.IdentInter) == true) { throw new Regra.Exceptions.Fornecedor.IdentInterExistenteException(); } } } }
/// <summary> /// Pega os dados da tela e popula o model /// </summary> /// <returns>Model populado</returns> private mFornecedor PegaDadosTela() { mFornecedor model = new mFornecedor(); rFornecedor regra = new rFornecedor(); try { if (base.Alteracao == true) { model.IdFornecedor = this._modelFornecedor.IdFornecedor; } else { model.IdFornecedor = regra.BuscaIdMaximo(); } model.NomeFornecedor = this.txtNomeFornecedor.Text; model.RuaFornecedor = this.txtRua.Text; if (string.IsNullOrEmpty(this.txtNumeroEndereco.Text) == true) { model.NroFornecedor = null; } else { model.NroFornecedor = Convert.ToInt32(this.txtNumeroEndereco.Text); } model.Complemento = this.txtComplemento.Text; if (this.txtCep.Visible == true) { string cep = this.txtCep.Text.Replace("-", string.Empty); cep = cep.Replace(" ", string.Empty); if (string.IsNullOrEmpty(cep) == true) { model.CodPostal = null; } else { model.CodPostal = cep; } } else { string codPost = this.txtCodPostal.Text; if (string.IsNullOrEmpty(codPost) == true) { model.CodPostal = null; } else { model.CodPostal = codPost; } } if (string.IsNullOrEmpty(this.txtDDI.Text) == true) { model.Ddi = null; } else { model.Ddi = this.txtDDI.Text; } if (string.IsNullOrEmpty(this.txtDDD.Text) == true) { model.Ddd = null; } else { model.Ddd = Convert.ToInt32(this.txtDDD.Text); } if (this.txtTelefone.Visible == true) { string tel = this.txtTelefone.Text.Replace("-", string.Empty).Replace(" ", string.Empty); if (string.IsNullOrEmpty(tel) == true) { model.Telefone = null; } else { model.Telefone = Convert.ToInt32(tel); } } else { if (string.IsNullOrEmpty(this.txtTelefoneInter.Text) == true) { model.Telefone = null; } else { model.Telefone = Convert.ToInt32(this.txtTelefoneInter.Text); } } model.Bairro = this.txtBairro.Text; model.Cidade = this.txtCidade.Text; if (string.IsNullOrEmpty(this.txtEmail.Text) == true) { model.Email = null; } else { model.Email = this.txtEmail.Text; } string cnpj = this.txtCnpj.Text.Replace(".", string.Empty); cnpj = cnpj.Replace("/", string.Empty); cnpj = cnpj.Replace("-", string.Empty); cnpj = cnpj.Replace(" ", string.Empty); if (string.IsNullOrEmpty(cnpj) == true) { model.Cnpj = null; } else { model.Cnpj = cnpj; } model.DatAtl = DateTime.Now; model.FlgAtivo = true; if (this.cboEstado.Enabled == true) { model.SlgEstado = this.cboEstado.GetItemText(this.cboEstado.SelectedItem); } else { model.SlgEstado = null; } if (this.rdbBrasil.Checked == true) { model.Nom_pais = "Brasil"; model.Nom_est_inter = null; model.IdentInter = null; } else { model.Nom_pais = this.txtPais.Text; model.Nom_est_inter = this.txtEstado.Text; model.IdentInter = this.txtIdentInter.Text; } return model; } catch (Exception ex) { throw ex; } finally { model = null; } }
private void btnlimpar_Click(object sender, EventArgs e) { base.LimpaDadosTela(this); this.rdbBrasil.Checked = true; this.txtDDI.Text = "55"; this._listaModelFornecedorDepto = null; this._modelFornecedor = null; base.Alteracao = false; }
private void btnBuscaAlteracaoDelecao_Click(object sender, EventArgs e) { this.btnlimpar_Click(null, null); this._modelFornecedor = new mFornecedor(); frmBuscaFornecedor objFornecedor = new frmBuscaFornecedor(this._modelFornecedor, true); try { DialogResult resultado = objFornecedor.ShowDialog(); if (resultado == DialogResult.Cancel) { this._modelFornecedor = null; } else { this.PopulaTelaComModelAlteracao(); } } catch (Exception ex) { throw ex; } finally { objFornecedor = null; } }