private void ImportData()
 {
     //Retreive document details from database
     try
     {
         using (var dc = new DBAuditDataContext())
         {
             if (ComboDocNo.SelectedIndex != -1 && ComboName.SelectedIndex != -1)
             {
                 DateTime?varDatePay     = null;
                 int?     intLocationId  = null;
                 string   strLocation    = null;
                 string   strDestination = null;
                 string   strPeriod      = null;
                 decimal? doubleTrans    = null;
                 decimal? doubleTravel   = null;
                 string   strNotes       = null;
                 dc.ProSelectTransFee(ComboDocNo.SelectedValue.ToString(), ref varDatePay, ref intLocationId,
                                      int.Parse(ComboName.SelectedValue.ToString()), ref strDestination, ref strPeriod,
                                      ref doubleTrans, ref doubleTravel, ref strNotes);
                 if (varDatePay != null)
                 {
                     DatePay.Value = varDatePay.Value;
                 }
                 dc.ProGetLocationByID(intLocationId, ref strLocation);
                 ComboLocation.Text  = strLocation;
                 TxtDestination.Text = strDestination;
                 TxtPeriod.Text      = strPeriod;
                 TxtTrans.Text       = doubleTrans.ToString();
                 TxtTravel.Text      = doubleTravel.ToString();
                 TxtNotes.Text       = strNotes;
             }
             else
             {
                 DatePay.Text = null;
                 ComboLocation.SelectedIndex = -1;
                 TxtDestination.Clear();
                 TxtPeriod.Clear();
                 TxtTrans.Clear();
                 TxtTravel.Clear();
                 TxtNotes.Clear();
             }
         }
     }
     catch (InvalidOperationException)
     {
         DatePay.Value       = DateTime.Now;
         ComboLocation.Text  = "";
         TxtDestination.Text = "";
         TxtPeriod.Text      = "";
         TxtTrans.Text       = "";
         TxtTravel.Text      = "";
         TxtNotes.Text       = "";
         BtnDelete.Enabled   = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 private void ImportData()
 {
     try
     {
         //Loading data into the form:
         using (DBAuditDataContext dc = new DBAuditDataContext())
         {
             if (ComboName.Text != "")
             {
                 string strName  = null;
                 string strNotes = null;
                 dc.ProSelectContractor(int.Parse(ComboName.SelectedValue.ToString()), ref strName,
                                        ref strNotes);
                 TxtName.Text  = strName;
                 TxtNotes.Text = strNotes;
             }
             else
             {
                 TxtName.Clear();
                 TxtNotes.Clear();
             }
         }
     }
     catch (NullReferenceException)
     {
     }
     catch (InvalidOperationException)
     {
         TxtName.Clear();
         TxtNotes.Clear();
         BtnDelete.Enabled = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }