示例#1
0
        /// <summary>
        /// Populate patient details
        /// </summary>
        private void PopulatePatientDetails(FormTZ02.Tz02RowData rowData)
        {
            Child child = null;

            if (!String.IsNullOrEmpty(rowData.Barcode))
            {
                var childData = this.m_restUtil.Get <List <FormTZ01.ChildEntity> >("ChildManagement.svc/SearchByBarcode", new KeyValuePair <string, object>("barcodeId", rowData.Barcode));
                if (childData.Count == 0)
                {
                    return;
                }
                child = childData[0].childEntity;
            }
            else
            {
                var childData = this.m_restUtil.Get <List <FormTZ01.ChildEntity> >("ChildManagement.svc/GetChildById", new KeyValuePair <string, object>("childid", rowData.ChildId));
                if (childData.Count == 0)
                {
                    return;
                }
                child = childData[0].childEntity;
            }

            this.txtBarcode.Text      = child.BarcodeId;
            this.txtFamily.Text       = child.Lastname1;
            this.txtGiven.Text        = child.Firstname1;
            this.txtMotherFamily.Text = child.MotherLastname;
            this.txtMotherGiven.Text  = child.MotherFirstname;
            this.txtTelephone.Text    = child.Phone;

            if (!this.m_rowData.DateOfBirth.HasValue)
            {
                this.dtpDob.Value = child.Birthdate;
            }

            this.cbxGender.SelectedIndex = child.Gender ? 1 : 0;
            this.cbxVillage.SelectedItem = this.cbxVillage.Items.OfType <PlaceListItem>().SingleOrDefault(o => o.Place.Id == child.DomicileId);
        }
示例#2
0
        public ChildSearch(FormTZ02.Tz02RowData rowData)
        {
            this.m_page = rowData.Page;
            InitializeComponent();

            // Crop the image
            String tPath = Path.GetTempFileName();

            using (Bitmap bmp = new Bitmap((int)rowData.Page.BottomRight.Y / 3, (int)rowData.RowBounds.Width / 3))
                using (Graphics g = Graphics.FromImage(bmp))
                    using (Image img = Image.FromFile(rowData.Page.AnalyzedImage))
                        using (Image scaled = (Image) new AForge.Imaging.Filters.ResizeNearestNeighbor(img.Width / 3, img.Height / 3).Apply((Bitmap)img))
                            using (Image rotated = (Image) new AForge.Imaging.Filters.RotateBilinear(-90).Apply((Bitmap)scaled))
                            {
                                g.DrawImage(rotated, 0, 0, new Rectangle(0, (int)rowData.RowBounds.X / 3, (int)rowData.Page.BottomRight.Y / 3, (int)rowData.RowBounds.Width / 3), GraphicsUnit.Pixel);
                                bmp.Save(tPath);
                                this.pbBarcode.ImageLocation = tPath;
                            }

            cbxVillage.Items.AddRange(ReferenceData.Current.Places.Select(o => new Registration.PlaceListItem()
            {
                Place = o as Place
            }).OfType <Object>().ToArray());
        }
示例#3
0
        public Registration(FormTZ02.Tz02RowData rowData)
        {
            InitializeComponent();

            // Crop the image
            String tPath = Path.GetTempFileName();

            using (Bitmap bmp = new Bitmap((int)rowData.Page.BottomRight.Y / 3, (int)rowData.RowBounds.Width / 3))
                using (Graphics g = Graphics.FromImage(bmp))
                    using (Image img = Image.FromFile(rowData.Page.AnalyzedImage))
                        using (Image scaled = (Image) new ResizeNearestNeighbor(img.Width / 3, img.Height / 3).Apply((Bitmap)img))
                            using (Image rotated = (Image) new RotateBilinear(-90).Apply((Bitmap)scaled))
                            {
                                g.DrawImage(rotated, 0, 0, new Rectangle(0, (int)rowData.RowBounds.X / 3, (int)rowData.Page.BottomRight.Y / 3, (int)rowData.RowBounds.Width / 3), GraphicsUnit.Pixel);
                                bmp.Save(tPath);
                                pbScan.ImageLocation = tPath;
                            }

            this.m_rowData = rowData;

            cbxVillage.Items.AddRange(ReferenceData.Current.Places.Select(o => new PlaceListItem()
            {
                Place = o as Place
            }).OfType <Object>().ToArray());



            dtpDob.MaxDate = dtpVaccDate.MaxDate = DateTime.Now;

            txtBarcode.Text = rowData.Barcode;
            try
            {
                if (rowData.DateOfBirth.HasValue)
                {
                    dtpDob.Value = rowData.DateOfBirth.Value;
                }
            }
            catch (Exception e) {
                errBarcode.SetError(dtpDob, e.Message);
            }
            cbxGender.SelectedIndex = rowData.Gender ? 1 : 0;

            try
            {
                dtpVaccDate.Value   = rowData.VaccineDate;
                dtpVaccDate.MinDate = dtpDob.Value;
            }
            catch (Exception e)
            {
                errBarcode.SetError(dtpVaccDate, e.Message);
            }

            chkOutreach.Checked = rowData.Outreach;

            // Selected antigens
            foreach (var itm in rowData.VaccineGiven)
            {
                String antigenName = itm.Name;
                if (antigenName == "ROTA")
                {
                    antigenName = ReferenceData.Current.Vaccines
                                  .Single(d => d.Name.ToLower().Contains("rota")).Name;
                }
                else if (antigenName == "PENTA")
                {
                    antigenName = ReferenceData.Current.Vaccines
                                  .Single(d => (d.Name.ToLower().Contains("dtp") || d.Name.ToLower().Contains("penta")))
                                  .Name;
                }
                else if (antigenName == "MR")
                {
                    antigenName = ReferenceData.Current.Vaccines
                                  .Single(d => (d.Name.ToLower().Contains("mr")))
                                  .Name;
                }
                else if (antigenName == "PCV")
                {
                    antigenName = ReferenceData.Current.Vaccines
                                  .Single(d => d.Name.ToLower().Contains("pcv")).Name;
                }
                else if (antigenName == "OPV")
                {
                    antigenName = ReferenceData.Current.Vaccines
                                  .Single(d => d.Name.ToLower().Contains("opv")).Name;
                }

                var ctl = this.grpVaccine.Controls.Find(String.Format("chk{0}", antigenName.ToUpper()), false).FirstOrDefault() as CheckBox;
                if (ctl != null)
                {
                    ctl.Checked = true;
                }
            }

            // Selected vaccination doses
            foreach (var itm in rowData.Doses)
            {
                String doseName = itm.Fullname.Replace(" ", "").Replace("-", "");
                if (doseName == "BCG")
                {
                    doseName = "BCG0";
                }

                var ctl = this.grpHistoricalVacc.Controls.Find(String.Format("chk{0}", doseName), false).FirstOrDefault() as CheckBox;

                if (ctl != null)
                {
                    ctl.Checked = true;
                }
            }

            // Get existing data?
            if (this.m_rowData.Barcode != null || this.m_rowData.ChildId != 0)
            {
                this.PopulatePatientDetails(this.m_rowData);
            }

            this.ValidateForm();
        }