Example #1
0
        public static bool ExcluirFuncionariosSelecao(int Terminal, ListView listFuncionarios, TextBox edLog)
        {
            bool Result = false;

            Types.Terminal TerminalDados;

            DBApp db = new DBApp();

            db.getDadosTerminal(Terminal, out TerminalDados);

            Rede rede = new Rede(TerminalDados.IP, edLog);

            if (!rede.Gertec_Conectar())
            {
                return(Result);
            }

            if (listFuncionarios.SelectedIndices.Count > 1)
            {
                rede.log.AddLog(String.Format(Consts.FUNCIONARIOS_EXCLUINDO, listFuncionarios.SelectedIndices.Count));
            }

            for (int i = 0; i <= listFuncionarios.SelectedIndices.Count - 1; i++)
            {
                int    index       = listFuncionarios.SelectedIndices[i];
                string Nome        = listFuncionarios.Items[index].SubItems[Consts.FUNC_SUBITEM_NOME].Text;
                string Pis         = listFuncionarios.Items[index].SubItems[Consts.FUNC_SUBITEM_PIS].Text;
                int    Funcionario = Convert.ToInt32(listFuncionarios.Items[index].SubItems[Consts.FUNC_SUBITEM_IND].Text);

                if (rede.Gertec_ExcluirFuncionario(Nome, Pis))
                {
                    db.MarcarFuncionarioComoNaoEnviado(Terminal, Funcionario);
                    Result = true;
                }
            }

            rede.Gertec_Desconectar();
            return(Result);
        }