コード例 #1
0
        private void BuildExamsFuncionario(Data.ExameItemColletion exames)
        {
            //BuildRowColletion(_exames.Exames, "Exames");
            //expanded panel
            FlowLayoutPanel expandPanel = new FlowLayoutPanel
            {
                Name      = $"ExpandExame",
                Tag       = $"ExpandExame",
                Dock      = DockStyle.Top,
                Size      = new Size(VacinaPanel.Size.Width, 31),
                BackColor = Color.Red
            };


            foreach (Data.ExamList exameList in exames.Exames)
            {
                var objTypeExam = new Exame(false, exameList.Tipagem)
                {
                    Name = "tipo"
                };
                expandPanel.Controls.Add(objTypeExam);

                foreach (Data.Examitem exame in exameList.ExameColletion)
                {
                    FlowLayoutPanel expandPanelChildTipo = new FlowLayoutPanel
                    {
                        Name      = $"nomeExame",
                        Tag       = $"nomeExame",
                        Dock      = DockStyle.Top,
                        Size      = new Size(VacinaPanel.Size.Width, 30),
                        BackColor = Color.Yellow
                    };
                    var objExameItem = new Exame(true, exame.Nome);
                    expandPanelChildTipo.Controls.Add(objExameItem);
                    FlowLayoutPanel expandPanelChildChildExame = new FlowLayoutPanel
                    {
                        Name      = $"ChildExam",
                        Tag       = $"ChildExam",
                        Dock      = DockStyle.Top,
                        Size      = new Size(VacinaPanel.Size.Width, 30),
                        BackColor = Color.Yellow
                    };
                    //ExpandPanelChildChildExame.Name = "ChildExam";

                    for (int i = 0; i < exame.DataExame.Count; i++)
                    {
                        var objDescricaoExame = new Exame(true, string.Format($"Data: {exame.DataExame[i]} Protocolo {exame.Protocolo[i]}"));

                        expandPanelChildChildExame.Controls.Add(objExameItem);
                        expandPanelChildTipo.Controls.Add(expandPanelChildChildExame);
                    }
                    expandPanel.Controls.Add(expandPanelChildTipo);
                    expandPanel.Size        = new Size(expandPanel.Size.Width, expandPanel.Controls.Count * 34);
                    expandPanel.MaximumSize = new Size(expandPanel.Size.Width, expandPanel.Controls.Count * 34);
                }


                VacinaPanel.Controls.Add(expandPanel);
            }
        }
コード例 #2
0
 private static void DealWithTipagem(Exames.Data.ExameItemColletion colecaoFuncionario, Exames.Data.ExamList colecaoTipo)
 {
     if (colecaoTipo.Tipagem == "Exame")
     {
         colecaoFuncionario.Exames.Add(colecaoTipo);
     }
     else if (colecaoTipo.Tipagem == "Extra")
     {
         colecaoFuncionario.Exames.Add(colecaoTipo);
     }
     else
     {
         colecaoFuncionario.Exames.Add(colecaoTipo);
     }
 }
コード例 #3
0
        private void BuildList(Data.ExameItemColletion exameCollection)
        {
            //mainpanel
            VacinaPanel.AutoScroll = true;
            var margin = VacinaPanel.Margin;

            VacinaPanel.Dock      = DockStyle.Fill;
            margin.All            = 0;
            VacinaPanel.BackColor = Color.Red;
            VacinaPanel.Margin    = margin;
            string[] names = { "ASU", "Exames", "Extras" };
            for (int i = 0; i < 3; i++)
            {
                //expanded panel
                FlowLayoutPanel expandPanel = new FlowLayoutPanel();
                expandPanel.Name = $"Expand{names[i]}";
                expandPanel.Tag  = $"Expand{names[i]}";
                expandPanel.Dock = DockStyle.Top;
                expandPanel.Size = new Size(expandPanel.Size.Width, 30);

                //rowpanel
                Panel row = new Panel();
                row.Margin = margin;
                row.Name   = names[i];
                row.Tag    = names[i];
                row.Dock   = DockStyle.Top;
                row.Anchor = AnchorStyles.Left;
                //Row.MaximumSize = new Size(MainPanel.Width, 30);
                row.Size      = new Size(VacinaPanel.Width, 30);
                row.BackColor = Color.White;


                Label description = new Label();

                description.AutoSize    = false;
                description.Dock        = DockStyle.Fill;
                description.MaximumSize = new Size(description.Size.Width, 30);
                description.Font        = new Font("Times New Roman", 10.0f, FontStyle.Bold);
                description.Text        = names[i];
                description.TextAlign   = ContentAlignment.MiddleLeft;
                row.Controls.Add(description);

                //panel for open tree
                PictureBox openPic = new PictureBox
                {
                    Dock = DockStyle.Left,
                    Name = "openPic",
                    Size = new Size(26, 30),

                    Image = Image.FromFile(@"Imagens\move-to-next (1).png")
                };
                openPic.MaximumSize = new Size(openPic.Size.Width, 30);
                openPic.SizeMode    = PictureBoxSizeMode.CenterImage;
                _auxPic             = openPic;
                openPic.MouseClick += new MouseEventHandler(OpenPic_MouseClick);
                row.Controls.Add(openPic);
                expandPanel.Controls.Add(row);
                expandPanel.BackColor = Color.Black;
                VacinaPanel.Controls.Add(expandPanel);
            }
        }
コード例 #4
0
        /// <summary>
        /// trying again using desenho
        /// </summary>
        /// <param name="exames"></param>


        private void BuildExamFunc(Data.ExameItemColletion exames)
        {
            var margim = VacinaPanel.Margin;

            margim.All = 0;


            //foreach list inside exameitemcolletion from funcionario
            foreach (Data.ExamList listaTipo in exames.Exames)
            {
                //CREATES FIRST PANEL, FOR NAME "EXAME" FOR EXAMPLE
                FlowLayoutPanel expand = new FlowLayoutPanel
                {
                    Name          = $"ExpandTipo",
                    Tag           = listaTipo.Tipagem,
                    Dock          = DockStyle.Top,
                    Margin        = margim,
                    FlowDirection = FlowDirection.TopDown,
                    MaximumSize   = new Size(VacinaPanel.Width, 34),
                    Size          = new Size(VacinaPanel.Width, 34),
                    //BackColor = Color.Red
                };
                //add text for desciption of exam tipagem
                var objTipagem = new Exame(false, listaTipo.Tipagem);
                expand.Controls.Add(objTipagem);

                foreach (Data.Examitem listaExame in listaTipo.ExameColletion)
                {
                    //CREATES SECOND PANEL FOR EXAME EXPAND
                    FlowLayoutPanel exameExpandChild1 = new FlowLayoutPanel
                    {
                        Name          = $"ExameExpandChild1",
                        Tag           = listaExame.Nome,
                        Dock          = DockStyle.Top,
                        Margin        = margim,
                        FlowDirection = FlowDirection.TopDown,
                        MaximumSize   = new Size(expand.Width, 34),
                        Size          = new Size(expand.Width, 34),

                        //BackColor = Color.Yellow
                    };
                    //if (testeBool)
                    //{
                    //    ExameExpandChild1.BackColor = Color.Blue;
                    //    testeBool = false;

                    //}
                    //else
                    //{
                    //    testeBool = true;
                    //}
                    var objListaExame = new Exame(true, listaExame.Nome);
                    exameExpandChild1.Controls.Add(objListaExame);

                    for (int i = 0; i < listaExame.DataExame.Count; i++)
                    {
                        var objExameDatas = new Exame(true, listaExame.DataExame[i] + listaExame.Protocolo[i]);
                        objExameDatas.picOpen.Visible = false;
                        objExameDatas.Size            = new Size(VacinaPanel.Width, objExameDatas.Size.Height);
                        var objCheck = new ExameCheckOk();

                        PictureBox examStatus = new PictureBox();
                        examStatus.MaximumSize = new Size(30, 30);
                        examStatus.SizeMode    = PictureBoxSizeMode.StretchImage;
                        if (listaExame.DataExame.Count - 1 == i)
                        {
                            examStatus.Image = objCheck.ReturnImageExamFunc(listaExame);
                        }
                        else
                        {
                            examStatus.Image = Image.FromFile(@"Imagens\Checked.png");
                        }
                        objExameDatas.panelExansOK.Dock = DockStyle.Right;
                        objExameDatas.panelExansOK.Controls.Add(examStatus);


                        objExameDatas.panelChild.Size = new Size(60, 30);
                        exameExpandChild1.Controls.Add(objExameDatas);
                    }
                    expand.Controls.Add(exameExpandChild1);
                }
                VacinaPanel.Controls.Add(expand);
            }
        }
コード例 #5
0
        public Exames.Data.ExameItemColletion ConvertSqlExamToItem(DataTable dt)
        {
            //variaveis

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

            Exames.Data.ExamList        colecaoTipo = new Exames.Data.ExamList();
            List <Exames.Data.ExamList> listAso;
            string auxNomeExame = null;
            string tipagem      = null;

            var exame = new Exames.Data.Examitem();

            //run tru Datatable rows


            for (int i = 0; i < dt.Rows.Count; i++)
            {
                //read exam being used right now
                var currentExamName = dt.Rows[i]["descricaoexame"].ToString();

                //case first run
                //case same exam name
                if (auxNomeExame == null || auxNomeExame == currentExamName)
                {
                    //records in aux variable
                    auxNomeExame = currentExamName;
                    //deal with exam item
                    exame.Nome = auxNomeExame;
                    exame.Nome = dt.Rows[i]["descricaoexame"].ToString();

                    exame.DataExame.Add(Convert.ToDateTime(dt.Rows[i]["Data"]));
                    exame.Protocolo.Add(dt.Rows[i]["protocolo"].ToString());

                    //tells tipagem list its name
                    //for current exam

                    tipagem = dt.Rows[i]["tipagem"].ToString();
                }
                //exam is not the same as before
                else
                {
                    //store exams in list
                    //after exam change
                    if (tipagem == dt.Rows[i]["tipagem"].ToString())
                    {
                        colecaoTipo.ExameColletion.Add(exame);
                    }
                    else
                    {
                        colecaoTipo.ExameColletion.Add(exame);
                        colecaoTipo.Tipagem = tipagem;;

                        DealWithTipagem(colecaoFuncionario, colecaoTipo);
                        //create new class for new tipagem
                        colecaoTipo         = new Exames.Data.ExamList();
                        tipagem             = dt.Rows[i]["tipagem"].ToString();
                        colecaoTipo.Tipagem = tipagem;
                    }

                    //---------------------START DEALING WITH NEW EXAM---------------------
                    exame        = new Exames.Data.Examitem();
                    auxNomeExame = currentExamName;
                    //deal with exam item
                    exame.Nome = auxNomeExame;
                    exame.Nome = dt.Rows[i]["descricaoexame"].ToString();
                    exame.DataExame.Add(Convert.ToDateTime(dt.Rows[i]["Data"]));
                    exame.Protocolo.Add(dt.Rows[i]["protocolo"].ToString());


                    if (dt.Rows.Count - 1 == i)
                    {
                        colecaoTipo.ExameColletion.Add(exame);
                        DealWithTipagem(colecaoFuncionario, colecaoTipo);
                    }
                }
            }
            return(colecaoFuncionario);
        }
コード例 #6
0
        /// <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);
        }