示例#1
0
 private void btnNovo_Click(object sender, EventArgs e)
 {
     limparCampos();
     ativarCampos();
     statusForm = statusForm.Novo;
     configForm();
 }
示例#2
0
        private void salvar()
        {
            #region VERIFICAR CAMPOS PREENCHIDOS
            if (cbTpProduto.Text == "")
            {
                MessageBox.Show("Selecione o tipo de produto!", util_msg.sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                cbTpProduto.Focus();
                return;
            }

            if (txtCodbarras.Text == "")
            {
                txtCodbarras.BackColor = Color.Yellow;
                MessageBox.Show("Informe o código do produto!", util_msg.sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtCodbarras.Focus();
                return;
            }

            if (txtNome.Text == "")
            {
                txtNome.BackColor = Color.Yellow;
                MessageBox.Show("Informe o nome do produto!", util_msg.sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtNome.Focus();
                return;
            }

            if (cbUnidade.Text == "")
            {
                cbUnidade.BackColor = Color.Yellow;
                MessageBox.Show("Selecione o tipo de unidade!", util_msg.sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                cbUnidade.Focus();
                return;
            }

            if (txtDescricao.Text == "")
            {
                txtDescricao.Text = "NC";
            }

            if (txtMarca.Text == "")
            {
                txtMarca.Text = "NC";
            }

            if (txtFabricante.Text == "")
            {
                txtFabricante.Text = "NC";
            }

            //if (cbCategoria.Text == "")
            //{
            //    MessageBox.Show("Selecione uma categoria!", util_msg.sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //    cbCategoria.Focus();
            //    return;
            //}

            //if (cbGrupo.Text == "")
            //{
            //    MessageBox.Show("Selecione um grupo!", util_msg.sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //    cbGrupo.Focus();
            //    return;
            //}

            //if (cbSubgrupo.Text == "")
            //{
            //    MessageBox.Show("Selecione um subgrupo!", util_msg.sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //    cbSubgrupo.Focus();
            //    return;
            //}

            if (txtLocalizacao.Text == "")
            {
                txtLocalizacao.Text = "NC";
            }

            if (txtQtdMinima.Text == "")
            {
                txtQtdMinima.Text = "0";
            }

            if (txtQtdMaxima.Text == "")
            {
                txtQtdMaxima.Text = "0";
            }

            if (cbUnCompra.Text == "")
            {
                MessageBox.Show("Selecione a unidade de compra!", util_msg.sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                cbUnCompra.Focus();
                return;
            }

            if (txtQtdEmb.Text == "")
            {
                txtQtdEmb.Text = "1";
            }

            if (txtAltura.Text == "")
            {
                txtAltura.Text = "0";
            }

            if (txtLargura.Text == "")
            {
                txtLargura.Text = "0";
            }

            if (txtComprimento.Text == "")
            {
                txtComprimento.Text = "0";
            }

            if (txtPesoBruto.Text == "")
            {
                txtPesoBruto.Text = "0";
            }

            if (txtPesoLiquido.Text == "")
            {
                txtPesoLiquido.Text = "0";
            }

            #endregion

            if (statusForm == statusForm.Novo)
            {
                adicionar();
            }
            else if (statusForm == statusForm.Editar)
            {
                alterar();
            }

            statusForm = statusForm.Detalhes;
            configForm();
        }
示例#3
0
        private void salvar()
        {
            #region VERIFICA SE OS CAMPOS OBRIGATÓRIOS ESTÃO COMPLETOS
            if (txtNome.Text.Trim() == string.Empty)
            {
                txtNome.BackColor = Color.Gold;
                MessageBox.Show(util_msg.msgCampoObrigatorioVazio, util_msg.sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtNome.Focus();
                return;
            }

            if (txtFantasia.Text.Trim() == string.Empty)
            {
                txtFantasia.Text = txtNome.Text;
                //if (cbTipoPessoa.Text == "Jurídica")
                //    txtFantasia.Text = txtNome.Text;
                //else
                //    txtFantasia.Text = "Não Informado";
            }

            if (txtRG_IE.Text.Trim() == string.Empty)
            {
                txtRG_IE.BackColor = Color.Gold;
                MessageBox.Show(util_msg.msgCampoObrigatorioVazio + "\nCaso seja uma pessoa jurídica e não possua IE informe ISENTO" +
                                "", util_msg.sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtRG_IE.Focus();
                return;
            }

            if (!txtCEP.MaskCompleted)
            {
                tabDetalhes.SelectedTab = tabEndereco;
                txtCEP.BackColor        = Color.Gold;
                MessageBox.Show(util_msg.msgCampoObrigatorioVazio, util_msg.sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtCEP.Focus();
                return;
            }

            if (txtBairro.Text.Trim() == string.Empty)
            {
                tabDetalhes.SelectedTab = tabEndereco;
                txtBairro.BackColor     = Color.Gold;
                MessageBox.Show(util_msg.msgCampoObrigatorioVazio, util_msg.sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtBairro.Focus();
                return;
            }

            if (txtLogradouro.Text.Trim() == string.Empty)
            {
                tabDetalhes.SelectedTab = tabEndereco;
                txtLogradouro.BackColor = Color.Gold;
                MessageBox.Show(util_msg.msgCampoObrigatorioVazio, util_msg.sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtLogradouro.Focus();
                return;
            }

            if (txtNumero.Text.Trim() == string.Empty)
            {
                tabDetalhes.SelectedTab = tabEndereco;
                txtNumero.BackColor     = Color.Gold;
                MessageBox.Show(util_msg.msgCampoObrigatorioVazio + "\nCaso não tenha número, informe 0", util_msg.sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtNumero.Focus();
                return;
            }

            if (!txtTelefone.MaskCompleted)
            {
                tabDetalhes.SelectedTab = tabContato;
                txtTelefone.BackColor   = Color.Gold;
                MessageBox.Show(util_msg.msgCampoObrigatorioVazio, util_msg.sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtTelefone.Focus();
                return;
            }

            if (!txtCelular.MaskCompleted)
            {
                tabDetalhes.SelectedTab = tabContato;
                txtCelular.BackColor    = Color.Gold;
                MessageBox.Show(util_msg.msgCampoObrigatorioVazio, util_msg.sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtCelular.Focus();
                return;
            }

            if (txtContato.Text.Trim() == string.Empty)
            {
                //tabDetalhes.SelectedTab = tabContato;
                //txtContato.BackColor = Color.Gold;
                //MessageBox.Show(util_msg.msg_CampoObrigatorioVazio, util_msg.sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //txtContato.Focus();
                //return;
                txtContato.Text = "NC";
            }

            if (txtEmail.Text.Trim() == string.Empty)
            {
                tabDetalhes.SelectedTab = tabContato;
                txtEmail.BackColor      = Color.Gold;
                MessageBox.Show(util_msg.msgCampoObrigatorioVazio, util_msg.sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtEmail.Focus();
                return;
            }

            #endregion

            if (statusForm == statusForm.Novo)
            {
                adicionar();
            }
            else if (statusForm == statusForm.Editar)
            {
                alterar();
            }

            statusForm = statusForm.Detalhes;
            configForm();
        }