Exemple #1
0
        private void LoadSelectedFuncionarioInfo()
        {
            var objSql     = new DataBaseHandler();
            var objHandler = new SqlToSharpHandler();

            //buscar informacoes do funcionario
            if (listBox1.SelectedIndex >= 0)
            {
                FuncionarioItem funcionario = objHandler.ConvertoFromSqlTo_1_FuncionarioItem(objSql.GetFuncionariosInfo(_previewList[listBox1.SelectedIndex].Idfuncionario.ToString()));
                objSql.GetDocuments(funcionario.IdFuncionario);
                var functesteequals     = funcionario;
                var funcionarioSelected = new FuncionarioItemEdit();

                funcionarioSelected.SetFuncionarioEdit(functesteequals);
                bool teste          = funcionario.Equals(funcionarioSelected.GetFuncionarioEdit());
                var  objInformacoes = new InformacoesControl(funcionarioSelected.GetFuncionarioEdit());
                panelInfo.Controls.Clear();
                panelInfo.Controls.Add(objInformacoes);
            }
        }
Exemple #2
0
        //loads funcionario data to permanent list of cuncionarios


        #region discontinued
        /// <summary
        /// ------------------------------------------ DISCONTINUED------------------------------
        /// deal with all information from DATATABLE(SQL) AND INSERTS INTO RIGHT FIELDS
        /// ABANDONED.
        /// </summary>
        /// <param name="_dt"></param>


        #endregion



        #region FuncionarioPreviewGenerator



        private void GetFuncPreview()
        {
            DataTable dtNomes = new DataTable();

            DataBaseHandler dbHandler = new DataBaseHandler();

            dtNomes = dbHandler.PreviewGetFuncionariosTolist();
            string nome      = "";
            int    matricula = 0;
            FuncionarioItemPreview addFuncPreview = new FuncionarioItemPreview();


            for (int x = 0; x < dtNomes.Rows.Count; x++)
            {
                for (int y = 0; y < dtNomes.Columns.Count; y++)
                {
                    if (y == 0)
                    {
                        matricula = Convert.ToInt32(dtNomes.Rows[x][y].ToString());
                    }
                    else
                    {
                        nome = dtNomes.Rows[x][y].ToString();
                    }
                }
                FuncionarioItemPreview addFuncPr = new FuncionarioItemPreview(matricula, nome);
                _previewList.Add(addFuncPr);
            }
            var realist = new FuncionarioCollectionPreview();

            //Adiciona nomes à list view
            foreach (FuncionarioItemPreview funcionario in _previewList)
            {
                listBox1.Items.Add(funcionario.Name);
            }
        }
Exemple #3
0
 private void LoadSelectedFuncDocs()
 {
     var objSql     = new DataBaseHandler();
     var objHandler = new SqlToSharpHandler();
 }
        /// <summary>
        /// CONVERT FUNCIONARIO SQL INFORMATION TO FUNCIONARIOITEM
        ///
        /// SEM INFORMACOES DE ONIBUS
        /// </summary>
        /// <param name="_dt"></param>
        /// <returns></returns>
        public FuncionarioItem ConvertoFromSqlTo_1_FuncionarioItem(DataTable dt)
        {
            List <FuncionarioItem> listFUncionarios = new List <FuncionarioItem>();
            int             aux         = 0;
            FuncionarioItem funcionario = null;

            if (dt.Rows.Count == 1)
            {
                foreach (DataRow rows in dt.Rows)
                {
                    Image picture = null;
                    //helper less conversions
                    int row = 0;
                    //matricula
                    int matricula = Convert.ToInt32(dt.Rows[row][0]);
                    if (matricula >= aux)
                    {
                        aux = matricula;
                    }
                    //deal if date is a picture
                    if (Convert.IsDBNull(dt.Rows[row][1]) == false)
                    {
                        Byte[] data = new Byte[0];
                        data = (Byte[])(dt.Rows[row][1]);
                        MemoryStream mem = new MemoryStream(data);
                        picture = Image.FromStream(mem);
                    }
                    //nome.... etc
                    string      nome        = dt.Rows[row][2].ToString();
                    string      identidade  = dt.Rows[row][3].ToString();
                    string      cpf         = dt.Rows[row][4].ToString();
                    DateTime    dn          = Convert.ToDateTime(dt.Rows[row][5]);
                    string      sexo        = dt.Rows[row][6].ToString();
                    string      rua         = dt.Rows[row][7].ToString();
                    string      numero      = dt.Rows[row][8].ToString();
                    string      bairro      = dt.Rows[row][9].ToString();
                    string      cidade      = dt.Rows[row][10].ToString();
                    string      estado      = dt.Rows[row][11].ToString();
                    string      complemento = dt.Rows[row][12].ToString();
                    string      cep         = dt.Rows[row][13].ToString();
                    string      observacao  = dt.Rows[row][14].ToString();
                    bool        inativo     = Convert.ToBoolean(dt.Rows[row][15]);
                    string      telefone    = dt.Rows[row][16].ToString();
                    DateTime    admissao    = Convert.ToDateTime(dt.Rows[row][17]);
                    CultureInfo cult        = new CultureInfo("pt-BR");
                    DateTime    inativacao;
                    if (Convert.IsDBNull(dt.Rows[row][18]) == false)
                    {
                        inativacao = Convert.ToDateTime(dt.Rows[row][18], cult);
                    }
                    else
                    {
                        inativacao = Convert.ToDateTime("01/01/1900", cult);
                    }

                    var dataBaseHandler = new DataBaseHandler();
                    var sQlDataHandler  = new SqlToSharpHandler();

                    //Get func information bus
                    OnibusItemCollection funcListOnibus = new OnibusItemCollection();
                    funcListOnibus.SetList(sQlDataHandler.ConvertSQlToBusCollectionItem(dataBaseHandler.GetBus(matricula)));

                    //get information about Vaccine
                    Vacina.FuncionarioVaccinaColletion funcVaccineList = new Vacina.FuncionarioVaccinaColletion();
                    funcVaccineList.SetList(sQlDataHandler.ConvertSqlVaccineToColletion(dataBaseHandler.GetVacinas(matricula)));

                    //get func information about ferias
                    Ferias.FeriasColletionItem listFerias = new Ferias.FeriasColletionItem();
                    listFerias.SetList(sQlDataHandler.ConvertSqLtoFeriasItem(dataBaseHandler.GetFerias(matricula)));

                    //get information about exames

                    Exames.Data.ExameItemColletion collectionExams = new Exames.Data.ExameItemColletion();

                    Exames.Data.ExameItemColletion colletion = sQlDataHandler.ConvertSqlExamToItem(dataBaseHandler.GetExames(matricula));
                    //CollectionExams.SetList(SQlDataHandler.ConvertSqlExamToItem(DataBaseHandler.GetExames(matricula)));



                    //GENERATES FUNCIONARIO ITEM WITH ALL INFO COLLECTED
                    funcionario = new FuncionarioItem(matricula, picture, nome, cpf, identidade, sexo, dn, rua, numero, complemento, bairro, observacao, cidade, estado, cep, telefone, inativo, admissao, inativacao, null, funcListOnibus, funcVaccineList, listFerias, colletion);
                    var funcionarioSelected = new FuncionarioItemEdit();
                    funcionarioSelected.SetFuncionarioEdit(funcionario);
                    row++;
                }
            }

            return(funcionario);
        }