private void BuildExamPanel(Data.Examitem examItem, FlowLayoutPanel expandPanel) { //rowpanel var margin = VacinaPanel.Margin; VacinaPanel.Dock = DockStyle.Fill; margin.All = 0; Panel row = new Panel { Margin = margin, Name = examItem.Nome, Tag = examItem.Nome, Dock = DockStyle.Top, Anchor = AnchorStyles.Left, //Row.MaximumSize = new Size(MainPanel.Width, 26); Size = new Size(VacinaPanel.Width, 26), //BackColor = Color.White }; Label description = new Label { AutoSize = false, Dock = DockStyle.Fill }; description.MaximumSize = new Size(description.Size.Width, 30); description.Font = new Font("Times New Roman", 10.0f, FontStyle.Bold); description.Text = examItem.Nome; description.TextAlign = ContentAlignment.MiddleLeft; row.Controls.Add(description); //panel for open tree Panel leftseparator = new Panel { Dock = DockStyle.Left, Margin = margin, Size = new Size(26, 30) }; //deal with left arrow open PictureBox openPic = new PictureBox(); openPic.Dock = DockStyle.Left; openPic.Name = "picExame"; openPic.Size = new Size(26, 30); openPic.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; for (int i = 0; i < examItem.DataExame.Count; i++) { //row for hemograma completo Panel rowInside = new Panel(); rowInside.Margin = margin; rowInside.Name = examItem.Nome; rowInside.Tag = examItem.Nome; rowInside.Dock = DockStyle.Top; rowInside.Anchor = AnchorStyles.Left; rowInside.MaximumSize = new Size(expandPanel.Width, 30); rowInside.Size = new Size(expandPanel.Width, 30); //RowInside.BackColor = Color.Yellow; Label datasexame = new Label(); datasexame.AutoSize = false; datasexame.Dock = DockStyle.Fill; datasexame.MaximumSize = new Size(description.Size.Width, 30); datasexame.Font = new Font("Times New Roman", 10.0f, FontStyle.Bold); datasexame.Text = examItem.DataExame[i].ToString("dd/MM/yyyy") + $"Protocolo nº: {examItem.Protocolo[i]}"; datasexame.TextAlign = ContentAlignment.MiddleLeft; rowInside.Controls.Add(description); //Label Protocolo = new Label(); //Protocolo.AutoSize = false; //Protocolo.Dock = DockStyle.Fill; //Protocolo.Font = new Font("Times New Roman", 10.0f, FontStyle.Bold); //Protocolo.Text = _ExamItem.protocolo[i]; //Protocolo.TextAlign = ContentAlignment.MiddleLeft; //RowInside.Controls.Add(Description); PictureBox picBoxExamOk = new PictureBox(); picBoxExamOk.Dock = DockStyle.Right; picBoxExamOk.Name = "ExameOK"; picBoxExamOk.Size = new Size(26, 30); picBoxExamOk.Image = Image.FromFile(@"Imagens\checked.png"); picBoxExamOk.MaximumSize = new Size(openPic.Size.Width, 30); picBoxExamOk.SizeMode = PictureBoxSizeMode.CenterImage; rowInside.Controls.Add(picBoxExamOk); expandPanel.Controls.Add(rowInside); } VacinaPanel.Controls.Add(expandPanel); }
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); }