Example #1
0
 private void butDelete_Click(object sender, EventArgs e)
 {
     //This button is only enabled if this is a custom def.
     if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Delete entire HL7Def?"))
     {
         return;
     }
     for (int m = 0; m < HL7DefCur.hl7DefMessages.Count; m++)
     {
         for (int s = 0; s < HL7DefCur.hl7DefMessages[m].hl7DefSegments.Count; s++)
         {
             for (int f = 0; f < HL7DefCur.hl7DefMessages[m].hl7DefSegments[s].hl7DefFields.Count; f++)
             {
                 HL7DefFields.Delete(HL7DefCur.hl7DefMessages[m].hl7DefSegments[s].hl7DefFields[f].HL7DefFieldNum);
             }
             HL7DefSegments.Delete(HL7DefCur.hl7DefMessages[m].hl7DefSegments[s].HL7DefSegmentNum);
         }
         HL7DefMessages.Delete(HL7DefCur.hl7DefMessages[m].HL7DefMessageNum);
     }
     HL7Defs.Delete(HL7DefCur.HL7DefNum);
     DataValid.SetInvalid(InvalidType.HL7Defs);
     DialogResult = DialogResult.OK;
 }
Example #2
0
 private void butOK_Click(object sender, EventArgs e)
 {
     //validation
     if (checkEnabled.Checked)
     {
         if (textHL7Server.Text == "")
         {
             MsgBox.Show(this, "HL7 Server may not be blank.");
             return;
         }
         if (textHL7ServiceName.Text == "")
         {
             MsgBox.Show(this, "HL7 Service Name may not be blank.");
             return;
         }
         if (comboModeTx.SelectedIndex == (int)ModeTxHL7.File)
         {
             if (textInPath.Text == "")
             {
                 MsgBox.Show(this, "The path for Incoming Folder is empty.");
                 return;
             }
             if (!Directory.Exists(textInPath.Text))
             {
                 MsgBox.Show(this, "The path for Incoming Folder is invalid.");
                 return;
             }
             if (textOutPath.Text == "")
             {
                 MsgBox.Show(this, "The path for Outgoing Folder is empty.");
                 return;
             }
             if (!Directory.Exists(textOutPath.Text))
             {
                 MsgBox.Show(this, "The path for Outgoing Folder is invalid.");
                 return;
             }
         }
         else                  //TcpIp mode
         {
             if (textInPort.Text == "")
             {
                 MsgBox.Show(this, "The Incoming Port is empty.");
                 return;
             }
             if (textOutPort.Text == "")
             {
                 MsgBox.Show(this, "The Outgoing IP:Port is empty.");
                 return;
             }
             string[] strIpPort = textOutPort.Text.Split(':');
             if (strIpPort.Length != 2)                   //there isn't a ':' in the IpPort field
             {
                 MsgBox.Show(this, "The Outgoing IP:Port field requires an IP address, followed by a colon, followed by a port number.");
                 return;
             }
             try {
                 System.Net.IPAddress.Parse(strIpPort[0]);
             }
             catch {
                 MsgBox.Show(this, "The Outgoing IP address is invalid.");
                 return;
             }
             try {
                 int.Parse(strIpPort[1]);
             }
             catch {
                 MsgBox.Show(this, "The Outgoing port must be a valid integer.");
                 return;
             }
             try {
                 int.Parse(textInPort.Text.ToString());
             }
             catch {
                 MsgBox.Show(this, "The Incoming port must be a valid integer.");
                 return;
             }
         }
     }
     HL7DefCur.HL7Server             = textHL7Server.Text;
     HL7DefCur.HL7ServiceName        = textHL7ServiceName.Text;
     HL7DefCur.IsInternal            = checkInternal.Checked;
     HL7DefCur.InternalType          = textInternalType.Text;
     HL7DefCur.InternalTypeVersion   = textInternalTypeVersion.Text;
     HL7DefCur.Description           = textDescription.Text;
     HL7DefCur.FieldSeparator        = textFieldSep.Text;
     HL7DefCur.RepetitionSeparator   = textRepSep.Text;
     HL7DefCur.ComponentSeparator    = textCompSep.Text;
     HL7DefCur.SubcomponentSeparator = textSubcompSep.Text;
     HL7DefCur.EscapeCharacter       = textEscChar.Text;
     HL7DefCur.Note   = textNote.Text;
     HL7DefCur.ModeTx = (ModeTxHL7)comboModeTx.SelectedIndex;
     if (radioHide.Checked)
     {
         HL7DefCur.ShowDemographics = HL7ShowDemographics.Hide;
     }
     else if (radioShow.Checked)
     {
         HL7DefCur.ShowDemographics = HL7ShowDemographics.Show;
     }
     else if (radioChange.Checked)
     {
         HL7DefCur.ShowDemographics = HL7ShowDemographics.Change;
     }
     else              //must be ChangeAndAdd
     {
         HL7DefCur.ShowDemographics = HL7ShowDemographics.ChangeAndAdd;
     }
     HL7DefCur.ShowAccount = checkShowAccount.Checked;
     HL7DefCur.ShowAppts   = checkShowAppts.Checked;
     if (comboModeTx.SelectedIndex == (int)ModeTxHL7.File)
     {
         HL7DefCur.IncomingFolder = textInPath.Text;
         HL7DefCur.OutgoingFolder = textOutPath.Text;
         HL7DefCur.IncomingPort   = "";
         HL7DefCur.OutgoingIpPort = "";
     }
     else              //TcpIp mode
     {
         HL7DefCur.IncomingPort   = textInPort.Text;
         HL7DefCur.OutgoingIpPort = textOutPort.Text;
         HL7DefCur.IncomingFolder = "";
         HL7DefCur.OutgoingFolder = "";
     }
     //save
     if (checkEnabled.Checked)
     {
         HL7DefCur.IsEnabled = true;
         if (checkInternal.Checked)
         {
             if (HL7Defs.GetInternalFromDb(HL7DefCur.InternalType) == null) //it's not in the database.
             {
                 HL7Defs.Insert(HL7DefCur);                                 //The user wants to enable this, so we will need to save this def to the db.
             }
             else
             {
                 HL7Defs.Update(HL7DefCur);
             }
         }
         else                  //all custom defs are already in the db.
         {
             HL7Defs.Update(HL7DefCur);
         }
     }
     else              //not enabled
     {
         if (HL7DefCur.IsInternal)
         {
             if (HL7DefCur.IsEnabled)                     //If def was enabled but user wants to disable
             {
                 if (MsgBox.Show(this, MsgBoxButtons.OKCancel, "Disable HL7Def?  Changes made will be lost.  Continue?"))
                 {
                     HL7Defs.Delete(HL7DefCur.HL7DefNum);
                 }
                 else                          //user selected Cancel
                 {
                     return;
                 }
             }
             else                      //was disabled and is still disabled
             {
                 if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Changes made will be lost.  Continue?"))
                 {
                     return;
                 }
                 //do nothing.  Changes will be lost.
             }
         }
         else                  //custom
                               //Disable the custom def
         {
             HL7DefCur.IsEnabled = false;
             HL7Defs.Update(HL7DefCur);
         }
     }
     DialogResult = DialogResult.OK;
 }
Example #3
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (!ValidateData())
     {
         return;
     }
     #region Set Values
     HL7DefCur.HL7Server      = textHL7Server.Text;
     HL7DefCur.HL7ServiceName = textHL7ServiceName.Text;
     HL7DefCur.IsInternal     = checkInternal.Checked;
     //this is read-only and cannot be changed, so no need to resave it.
     //HL7DefCur.InternalType=(HL7InternalType)Enum.Parse(typeof(HL7InternalType),textInternalType.Text);
     HL7DefCur.InternalTypeVersion   = textInternalTypeVersion.Text;
     HL7DefCur.Description           = textDescription.Text;
     HL7DefCur.FieldSeparator        = textFieldSep.Text;
     HL7DefCur.RepetitionSeparator   = textRepSep.Text;
     HL7DefCur.ComponentSeparator    = textCompSep.Text;
     HL7DefCur.SubcomponentSeparator = textSubcompSep.Text;
     HL7DefCur.EscapeCharacter       = textEscChar.Text;
     HL7DefCur.Note   = textNote.Text;
     HL7DefCur.ModeTx = (ModeTxHL7)comboModeTx.SelectedIndex;
     if (radioHide.Checked)
     {
         HL7DefCur.ShowDemographics = HL7ShowDemographics.Hide;
     }
     else if (radioShow.Checked)
     {
         HL7DefCur.ShowDemographics = HL7ShowDemographics.Show;
     }
     else if (radioChange.Checked)
     {
         HL7DefCur.ShowDemographics = HL7ShowDemographics.Change;
     }
     else              //must be ChangeAndAdd
     {
         HL7DefCur.ShowDemographics = HL7ShowDemographics.ChangeAndAdd;
     }
     HL7DefCur.ShowAccount        = checkShowAccount.Checked;
     HL7DefCur.ShowAppts          = checkShowAppts.Checked;
     HL7DefCur.IsQuadAsToothNum   = checkQuadAsToothNum.Checked;
     HL7DefCur.HasLongDCodes      = checkLongDCodes.Checked;
     HL7DefCur.IsProcApptEnforced = checkProcsAppt.Checked;
     //clear all fields in order to save the relevant data in the proper fields and clear out data that may not be relevant for the Tx mode
     HL7DefCur.IncomingFolder = "";
     HL7DefCur.OutgoingFolder = "";
     HL7DefCur.IncomingPort   = "";
     HL7DefCur.OutgoingIpPort = "";
     HL7DefCur.SftpInSocket   = "";
     HL7DefCur.SftpUsername   = "";
     HL7DefCur.SftpPassword   = "";
     if (comboModeTx.SelectedIndex == (int)ModeTxHL7.File)
     {
         HL7DefCur.IncomingFolder = textInPathOrSocket.Text.Trim();
         HL7DefCur.OutgoingFolder = textOutPathSocketOrDir.Text.Trim();
     }
     else if (comboModeTx.SelectedIndex == (int)ModeTxHL7.TcpIp)
     {
         HL7DefCur.IncomingPort   = textInPathOrSocket.Text.Trim();
         HL7DefCur.OutgoingIpPort = textOutPathSocketOrDir.Text.Trim();
     }
     else if (comboModeTx.SelectedIndex == (int)ModeTxHL7.Sftp)
     {
         HL7DefCur.SftpInSocket   = textInPathOrSocket.Text.Trim();
         HL7DefCur.IncomingFolder = textOutPathSocketOrDir.Text.Trim();
         HL7DefCur.SftpUsername   = textSftpUsername.Text.Trim();
         HL7DefCur.SftpPassword   = textSftpPassword.Text.Trim();
     }
     if (comboLabImageCat.SelectedIndex >= 0)
     {
         HL7DefCur.LabResultImageCat = _listImageCatDefs[comboLabImageCat.SelectedIndex].DefNum;
     }
     #endregion Set Values
     #region Save
     if (checkEnabled.Checked)
     {
         HL7DefCur.IsEnabled = true;
         if (checkInternal.Checked)
         {
             if (HL7Defs.GetInternalFromDb(HL7DefCur.InternalType) == null) //it's not in the database.
             {
                 HL7Defs.Insert(HL7DefCur);                                 //The user wants to enable this, so we will need to save this def to the db.
             }
             else
             {
                 HL7Defs.Update(HL7DefCur);
             }
         }
         else                  //all custom defs are already in the db.
         {
             HL7Defs.Update(HL7DefCur);
         }
     }
     else              //not enabled
     {
         if (HL7DefCur.IsInternal)
         {
             if (HL7DefCur.IsEnabled)                     //If def was enabled but user wants to disable
             {
                 if (MsgBox.Show(this, MsgBoxButtons.OKCancel, "Disable HL7Def?  Changes made will be lost.  Continue?"))
                 {
                     HL7Defs.Delete(HL7DefCur.HL7DefNum);
                 }
                 else                          //user selected Cancel
                 {
                     return;
                 }
             }
             else                      //was disabled and is still disabled
             {
                 if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Changes made will be lost.  Continue?"))
                 {
                     return;
                 }
                 //do nothing.  Changes will be lost.
             }
         }
         else                  //custom
                               //Disable the custom def
         {
             HL7DefCur.IsEnabled = false;
             HL7Defs.Update(HL7DefCur);
         }
     }
     #endregion Save
     DialogResult = DialogResult.OK;
 }