Esempio n. 1
0
 public LedgerChange(LedgerModule module = null)
 {
     InitializeComponent();
     Init();
     if (module != null)
     {
         InitUpdateData(module);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RowUpdateClick(object sender, DataGridViewCellEventArgs e)
        {
            LedgerModule ledger = ledgerModule[e.RowIndex];

            using (LedgerChange dialog = new LedgerChange(ledger))
            {
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    ledgerModule[e.RowIndex] = dialog.LedgerModuleChange;
                    dataGridView1.Refresh();
                }
            }
        }
Esempio n. 3
0
        private void InitUpdateData(LedgerModule data)
        {
            txt_ledgerName.Text = data.LedgerName;
            txt_nation.Text     = data.Nation;
            if (!data.Birthday.Equals(initTime))
            {
                dtp_birthday.Value = data.Birthday;
            }
            txt_IDCard.Text                  = data.IDCard;
            txt_presentAddress.Text          = data.PresentAddress;
            txt_permanentAddress.Text        = data.PermanentAddress;
            combo_maritalStatus.SelectedItem = data.MaritalStatus;
            txt_childrenNumX.Text            = data.ChildrenNumX.ToString();
            txt_childrenNumY.Text            = data.ChildrenNumY.ToString();
            combo_birthControl.SelectedItem  = data.BirthControlStr;

            if (data.HIVAntibody.Undetected)
            {
                checkBox_HIVUndetected.Checked = true;
            }
            else
            {
                if (!data.HIVAntibody.DetectionTime.Equals(initTime))
                {
                    dtp_HIVTime.Value = data.HIVAntibody.DetectionTime;
                    combo_HIVPreliminaryResult.SelectedItem   = data.HIVPreliminaryResultStr;
                    combo_HIVSupplementaryResult.SelectedItem = data.HIVSupplementaryResultStr;
                }
            }

            if (data.Syphilis.Undetected)
            {
                checkBox_SypUndetected.Checked = true;
            }
            else
            {
                if (!data.Syphilis.DetectionTime.Equals(initTime))
                {
                    dtp_SypTime.Value = data.Syphilis.DetectionTime;
                    combo_SyphilisResult.SelectedItem   = data.Syphilis.SyphilisResult;
                    combo_UnSyphilisResult.SelectedItem = data.Syphilis.UnSyphilisResult;
                }
            }

            if (data.HepatitisB.Undetected)
            {
                checkBox_HBUndetected.Checked = true;
            }
            else
            {
                if (!data.HepatitisB.DetectionTime.Equals(initTime))
                {
                    dtp_HBTime.Value            = data.HepatitisB.DetectionTime;
                    combo_HBResult.SelectedItem = data.HepatitisB.DetectionResult;
                }
            }

            //one
            if (data.PMOne.Undetected)
            {
                checkBox_pregUndetected1.Checked = true;
            }
            else
            {
                if (!data.PMOne.DetectionTime.Equals(initTime))
                {
                    dtp_pregTime1.Value            = data.PMOne.DetectionTime;
                    combo_pregResult1.SelectedItem = data.PMOne.DetectionResult;

                    //two
                    if (data.PMTwo.Undetected)
                    {
                        checkBox_pregUndetected2.Checked = true;
                    }
                    else
                    {
                        if (!data.PMTwo.DetectionTime.Equals(initTime))
                        {
                            dtp_pregTime2.Value            = data.PMTwo.DetectionTime;
                            combo_pregResult2.SelectedItem = data.PMTwo.DetectionResult;

                            //three
                            if (data.PMThree.Undetected)
                            {
                                checkBox_pregUndetected3.Checked = true;
                            }
                            else
                            {
                                if (!data.PMThree.DetectionTime.Equals(initTime))
                                {
                                    dtp_pregTime3.Value            = data.PMThree.DetectionTime;
                                    combo_pregResult3.SelectedItem = data.PMThree.DetectionResult;

                                    //four
                                    if (data.PMFour.Undetected)
                                    {
                                        checkBox_pregUndetected4.Checked = true;
                                    }
                                    else
                                    {
                                        dtp_pregTime4.Value            = data.PMFour.DetectionTime;
                                        combo_pregResult4.SelectedItem = data.PMFour.DetectionResult;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            txt_PhoneNum.Text   = data.PhoneNum;
            txt_SpouseName.Text = data.SpouseName;

            if (data.SpouseHIVAntibody.Undetected)
            {
                checkBox_SHIVUndetected.Checked = true;
            }
            else
            {
                combo_SHIVResult.SelectedItem = data.SpouseHIVAntibody.DetectionResult;
            }

            txt_remark.Text = data.Remark;
        }
Esempio n. 4
0
        private void ReadData(IWorkbook workbook, ISheet sheet)
        {
            IRow row = null;

            ledgerModule = new List <LedgerModule>();
            for (int i = 7; i < sheet.LastRowNum - 1; i++)
            {
                row = sheet.GetRow(i);
                LedgerModule ledger = new LedgerModule();
                ledger.LedgerName       = row.GetCell(1).StringCellValue;
                ledger.Nation           = row.GetCell(2).StringCellValue;
                ledger.Birthday         = GetDate(row.GetCell(3).StringCellValue);
                ledger.IDCard           = row.GetCell(4).StringCellValue;
                ledger.PresentAddress   = row.GetCell(5).StringCellValue;
                ledger.PermanentAddress = row.GetCell(6).StringCellValue;
                ledger.MaritalStatus    = row.GetCell(7).StringCellValue;

                if (row.GetCell(8).CellType == CellType.Numeric)
                {
                    ledger.ChildrenNumY = (int)row.GetCell(8).NumericCellValue;
                }
                else
                {
                    if (!string.IsNullOrEmpty(row.GetCell(8).StringCellValue))
                    {
                        ledger.ChildrenNumY = int.Parse(row.GetCell(8).StringCellValue);
                    }
                }

                if (row.GetCell(9).CellType == CellType.Numeric)
                {
                    ledger.ChildrenNumX = (int)row.GetCell(9).NumericCellValue;
                }
                else
                {
                    if (!string.IsNullOrEmpty(row.GetCell(9).StringCellValue))
                    {
                        ledger.ChildrenNumX = int.Parse(row.GetCell(9).StringCellValue);
                    }
                }

                int index = -1;
                if (row.GetCell(10).CellType == CellType.Numeric)
                {
                    index = (int)row.GetCell(10).NumericCellValue;
                }
                else
                {
                    index = int.Parse(row.GetCell(10).StringCellValue);
                }
                if (index < 0)
                {
                    ledger.BirthControl = BirthControlEnum.Null;
                }
                else
                {
                    ledger.BirthControl = (BirthControlEnum)(index + 1);
                }

                string temp = string.Empty;
                if (string.IsNullOrEmpty(row.GetCell(11).StringCellValue))
                {
                    ledger.HIVAntibody.Undetected        = false;
                    ledger.HIVAntibody.DetectionTime     = GetDate(row.GetCell(12).StringCellValue);
                    ledger.HIVAntibody.PreliminaryResult = GetDetectionResult(row.GetCell(13).StringCellValue);
                    if (ledger.HIVAntibody.PreliminaryResult == MedicalConstant.DetectionResult[1])
                    {
                        ledger.HIVAntibody.SupplementaryResult = row.GetCell(14).StringCellValue;
                    }
                }
                else
                {
                    ledger.HIVAntibody.Undetected = true;
                }

                if (string.IsNullOrEmpty(row.GetCell(15).StringCellValue))
                {
                    ledger.Syphilis.Undetected       = false;
                    ledger.Syphilis.DetectionTime    = GetDate(row.GetCell(16).StringCellValue);
                    ledger.Syphilis.SyphilisResult   = GetSypDetectionResult(row.GetCell(17).StringCellValue);
                    ledger.Syphilis.UnSyphilisResult = GetSypDetectionResult2(row.GetCell(18).StringCellValue);
                }
                else
                {
                    ledger.Syphilis.Undetected = true;
                }

                if (string.IsNullOrEmpty(row.GetCell(19).StringCellValue))
                {
                    ledger.HepatitisB.Undetected      = false;
                    ledger.HepatitisB.DetectionTime   = GetDate(row.GetCell(20).StringCellValue);
                    ledger.HepatitisB.DetectionResult = GetDetectionResult(row.GetCell(21).StringCellValue);
                }
                else
                {
                    ledger.HepatitisB.Undetected = true;
                }

                if (string.IsNullOrEmpty(row.GetCell(22).StringCellValue))
                {
                    ledger.PMOne.Undetected      = false;
                    ledger.PMOne.DetectionTime   = GetDate(row.GetCell(23).StringCellValue);
                    ledger.PMOne.DetectionResult = row.GetCell(24).StringCellValue;

                    if (ledger.PMOne.DetectionTime > new DateTime() && !string.IsNullOrEmpty(ledger.PMOne.DetectionResult))
                    {
                        if (string.IsNullOrEmpty(row.GetCell(25).StringCellValue))
                        {
                            ledger.PMTwo.Undetected      = false;
                            ledger.PMTwo.DetectionTime   = GetDate(row.GetCell(26).StringCellValue);
                            ledger.PMTwo.DetectionResult = row.GetCell(27).StringCellValue;

                            if (ledger.PMTwo.DetectionTime > new DateTime() && !string.IsNullOrEmpty(ledger.PMTwo.DetectionResult))
                            {
                                if (string.IsNullOrEmpty(row.GetCell(28).StringCellValue))
                                {
                                    ledger.PMThree.Undetected      = false;
                                    ledger.PMThree.DetectionTime   = GetDate(row.GetCell(29).StringCellValue);
                                    ledger.PMThree.DetectionResult = row.GetCell(30).StringCellValue;
                                }
                                else
                                {
                                    ledger.PMThree.Undetected = true;
                                }

                                if (ledger.PMThree.DetectionTime > new DateTime() && !string.IsNullOrEmpty(ledger.PMThree.DetectionResult))
                                {
                                    if (string.IsNullOrEmpty(row.GetCell(31).StringCellValue))
                                    {
                                        ledger.PMFour.Undetected      = false;
                                        ledger.PMFour.DetectionTime   = GetDate(row.GetCell(32).StringCellValue);
                                        ledger.PMFour.DetectionResult = row.GetCell(33).StringCellValue;
                                    }
                                    else
                                    {
                                        ledger.PMFour.Undetected = true;
                                    }
                                }
                            }
                        }
                        else
                        {
                            ledger.PMTwo.Undetected = true;
                        }
                    }
                }
                else
                {
                    ledger.PMOne.Undetected = true;
                }

                ledger.PhoneNum   = row.GetCell(34).StringCellValue;
                ledger.SpouseName = row.GetCell(35).StringCellValue;

                if (string.IsNullOrEmpty(row.GetCell(36).StringCellValue))
                {
                    ledger.SpouseHIVAntibody.Undetected      = false;
                    ledger.SpouseHIVAntibody.DetectionResult = GetDetectionResult(row.GetCell(37).StringCellValue);
                }
                else
                {
                    ledger.SpouseHIVAntibody.Undetected = true;
                }

                ledger.Remark = row.GetCell(38).StringCellValue;

                ledgerModule.Add(ledger);
            }
            dataGridView1.DataSource = ledgerModule;
        }