Beispiel #1
0
        void Submit_estabelecimento_cargoEspecialidade_inserir(object sender, EventArgs e)
        {
            Buscar.Editor.IsTrue = (sender as Control).Name.Contains("cargo");

            textBox   = Buscar.Editor.IsTrue ? cargo_input : especialidade_input;
            resultado = false;

            if (Validar.Formulario(textBox.Parent as Panel))
            {
                item  = textBox.Text.ToLower().Trim();
                table = Buscar.Editor.IsTrue ? Listar.Cargos.Todos : Listar.Especialidades.Todos;

                Preencher.List(list = new List <object>(), table, 0, "titulo");

                if (!list.Contains(item))
                {
                    resultado = Buscar.Editor.IsTrue ? Inserir.Cargo(item) : Inserir.Especialidade(item);
                    textBox.Clear();
                    titulo.Focus();
                }
            }

            Preencher_cargos_especialidades();

            Msg.Response(resultado, Msg.PreechimentoIncorreto);
        }
Beispiel #2
0
        void Submit_estabelecimento(object sender, EventArgs e)
        {
            resultado = false;

            if (Validar.Formulario(editor))
            {
                Preencher.List(list = new List <object>(), editor);

                habilitar_edicao.Checked = false;
                resultado = Buscar.Estabelecimento.Info.Rows.Count.Equals(0) ? Inserir.Estabelecimento(list) : Alterar.Estabelecimento.Info(list);
                Preencher_cargos_especialidades();
            }

            Msg.Response(resultado, Msg.PreechimentoIncorreto);
        }
Beispiel #3
0
        void Submit_estabelecimento_cargoEspecialidade(object sender, EventArgs e)
        {
            resultado = false;

            if (!Buscar.Estabelecimento.Info.Rows.Count.Equals(0))
            {
                if (Validar.Formulario(cargoEspecialidade_padrao))
                {
                    Preencher.List(list = new List <object>(), cargoEspecialidade_padrao);

                    resultado = Alterar.Estabelecimento.CargoEspecialidade(list);
                    Preencher_cargos_especialidades();
                }
            }

            Msg.Response(resultado, Msg.PreechimentoIncorreto);
        }
Beispiel #4
0
 void Submit_Login(object sender, EventArgs e)
 {
     load_pb.Visible     = true;
     AsAdmin             = modoAdministrador.Checked;
     Preencher.List(list = new List <object>(), editor);
     if (Validar.Formulario(editor))
     {
         Buscar.Usuario.Classe = AsAdmin ? "administrador" : "funcionario";
         try{
             this.backgroundWorker1.RunWorkerAsync();
         }catch (Exception ex) {
         }
     }
     else
     {
         MessageBox.Show(Msg.PreechimentoIncorreto, Msg.Title.Atencao);
         load_pb.Visible = false;
     }
     cpf_input.Focus();
     cpf_input.SelectAll();
 }
Beispiel #5
0
        void Submit_Cadastro(object sender, EventArgs e)
        {
            resultado = false;

            if (Validar.Formulario(comum_inputs))
            {
                Preencher.List(list = new List <object>(), comum_inputs);

                switch (Buscar.Editor.Type)
                {
                case "funcionario":
                    if (Validar.Formulario(funcionarios_inputs))
                    {
                        Preencher.List(list, funcionarios_inputs);

                        if (Buscar.Editor.ID.Equals(0))
                        {
                            if (Buscar.Editor.IsCadastrado(cpf_input.Text))
                            {
                                Msg.Response(resultado, Msg.JaExisteCadastro);
                                cpf_input.Focus();
                            }
                            else
                            {
                                resultado = Inserir.Funcionario(list);
                            }
                        }
                        else
                        {
                            resultado = Alterar.Funcionario.Info(list);
                        }
                    }
                    break;

                case "cliente":
                    if (Buscar.Editor.ID.Equals(0))
                    {
                        if (Buscar.Editor.IsCadastrado(list[1]))
                        {
                            Msg.Response(resultado, Msg.JaExisteCadastro);
                            cpf_input.Focus();
                        }
                        else
                        {
                            resultado = Inserir.Cliente(list);

                            if (resultado)
                            {
                                Buscar.Editor.CPF = list[1].ToString();

                                list = new List <object>
                                {
                                    Buscar.Editor.CPF,
                                    Buscar.Usuario.ID,
                                    Buscar.Usuario.Classe,
                                    Msg.BoasVindas
                                };

                                Inserir.Mensagem(list);
                            }
                        }
                    }
                    else
                    {
                        resultado = Alterar.Cliente.Info(list);
                    }
                    break;
                }

                Msg.Response(resultado, Msg.AcaoNaoRealizada);
            }
            else
            {
                Msg.Response(resultado, Msg.PreechimentoIncorreto);
            }

            if (resultado)
            {
                Dispose();
                Close();
            }
        }