示例#1
0
 private void ImportData()
 {
     try
     {
         // Loading data into the form:
         using (DBAuditDataContext dc = new DBAuditDataContext())
         {
             if (ComboName.Text == "")
             {
                 return;
             }
             string strName       = null;
             int?   intLocationId = null;
             string strLocation   = null;
             string strDegree     = null;
             string strPosition   = null;
             string strAdress     = null;
             string strTelephone  = null;
             string strNotes      = null;
             dc.ProSelectEmployee(int.Parse(ComboName.SelectedValue.ToString()), ref strName,
                                  ref intLocationId, ref strDegree, ref strPosition, ref strAdress, ref strTelephone,
                                  ref strNotes);
             dc.ProGetLocationByID(intLocationId, ref strLocation);
             TxtName.Text       = strName;
             ComboLocation.Text = strLocation;
             ComboDegree.Text   = strDegree;
             ComboPosition.Text = strPosition;
             TxtAddress.Text    = strAdress;
             TxtTelephone.Text  = strTelephone;
             TxtNotes.Text      = strNotes;
         }
     }
     catch (NullReferenceException)
     {
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }