Пример #1
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            LabCase lab = new LabCase();

            lab.PatNum = PatNum;
            Patient pat = Patients.GetPat(PatNum);

            lab.ProvNum         = Patients.GetProvNum(pat);
            lab.DateTimeCreated = MiscData.GetNowDateTime();
            LabCases.Insert(lab);
            FormLabCaseEdit FormL = new FormLabCaseEdit();

            FormL.CaseCur = lab;
            FormL.IsNew   = true;
            FormL.ShowDialog();
            if (FormL.DialogResult != DialogResult.OK)
            {
                return;
            }
            SelectedLabCaseNum = FormL.CaseCur.LabCaseNum;
            DialogResult       = DialogResult.OK;
        }
Пример #2
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (listLab.SelectedIndex == -1)
     {
         MsgBox.Show(this, "Please select a lab first.");
         return;
     }
     if (comboProv.SelectedIndex == -1)
     {
         MsgBox.Show(this, "Please select a provider first.");
         return;
     }
     if (textDateCreated.Text != "")
     {
         try{
             DateTime.Parse(textDateCreated.Text);
         }
         catch {
             MsgBox.Show(this, "Date Time Created is invalid.");
             return;
         }
     }
     if (textDateSent.Text != "")
     {
         try {
             DateTime.Parse(textDateSent.Text);
         }
         catch {
             MsgBox.Show(this, "Date Time Sent is invalid.");
             return;
         }
     }
     if (textDateRecd.Text != "")
     {
         try {
             DateTime.Parse(textDateRecd.Text);
         }
         catch {
             MsgBox.Show(this, "Date Time Received is invalid.");
             return;
         }
     }
     if (textDateChecked.Text != "")
     {
         try {
             DateTime.Parse(textDateChecked.Text);
         }
         catch {
             MsgBox.Show(this, "Date Time Checked is invalid.");
             return;
         }
     }
     if (textDateDue.Text != "")
     {
         try {
             DateTime.Parse(textDateDue.Text);
         }
         catch {
             MsgBox.Show(this, "Date Time Due is invalid.");
             return;
         }
     }
     CaseCur.LaboratoryNum = ListLabs[listLab.SelectedIndex].LaboratoryNum;
     //AptNum
     //PlannedAptNum
     CaseCur.ProvNum = Providers.List[comboProv.SelectedIndex].ProvNum;
     if (textDateCreated.Text == "")
     {
         CaseCur.DateTimeCreated = DateTime.MinValue;
     }
     else
     {
         CaseCur.DateTimeCreated = DateTime.Parse(textDateCreated.Text);
     }
     if (textDateSent.Text == "")
     {
         CaseCur.DateTimeSent = DateTime.MinValue;
     }
     else
     {
         CaseCur.DateTimeSent = DateTime.Parse(textDateSent.Text);
     }
     if (textDateRecd.Text == "")
     {
         CaseCur.DateTimeRecd = DateTime.MinValue;
     }
     else
     {
         CaseCur.DateTimeRecd = DateTime.Parse(textDateRecd.Text);
     }
     if (textDateChecked.Text == "")
     {
         CaseCur.DateTimeChecked = DateTime.MinValue;
     }
     else
     {
         CaseCur.DateTimeChecked = DateTime.Parse(textDateChecked.Text);
     }
     if (textDateDue.Text == "")
     {
         CaseCur.DateTimeDue = DateTime.MinValue;
     }
     else
     {
         CaseCur.DateTimeDue = DateTime.Parse(textDateDue.Text);
     }
     CaseCur.Instructions = textInstructions.Text;
     try{
         if (IsNew)
         {
             LabCases.Insert(CaseCur);
         }
         else
         {
             LabCases.Update(CaseCur);
         }
     }
     catch (ApplicationException ex) {
         MessageBox.Show(ex.Message);
         return;
     }
     DialogResult = DialogResult.OK;
 }