/// <summary>
 /// 查询本地数据 本地有数据返回true,没有则返回false
 /// </summary>
 private Boolean Search(String whereSql, String orderBySql, int type)
 {
     try
     {
         type = (whereSql.Length == 0 && orderBySql.Length == 0) ? 1 : 2;
         DataTable dataTable = WisdomCls.GetAsDataTable(whereSql, orderBySql, type);
         if (dataTable != null && dataTable.Rows.Count > 0)
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return(false);
 }
 /// <summary>
 /// 修改快检单号
 /// </summary>
 private void Update()
 {
     try
     {
         int rtn = WisdomCls.Update();
         if (rtn == 1)
         {
             if (MessageBox.Show("更新成功!是否返回上一级?", "操作提示", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
             {
                 this.Close();
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 /// <summary>
 /// 查询本地数据 本地有数据返回true,没有则返回false
 /// </summary>
 private Boolean Search(string whereSql, string orderBySql, int type)
 {
     this.DataGridRecord.ItemsSource = null;
     try
     {
         type       = (whereSql.Length == 0 && orderBySql.Length == 0) ? 1 : 2;
         _dataTable = WisdomCls.GetAsDataTable(whereSql, orderBySql, type);
         if (_dataTable != null && _dataTable.Rows.Count > 0)
         {
             this.DataGridRecord.ItemsSource = _dataTable.DefaultView;
             return(true);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(false);
     }
     return(false);
 }
        /// <summary>
        /// 新增一条快检单号
        /// </summary>
        private int Insert()
        {
            int rtn = 0;

            try
            {
                rtn = WisdomCls.Insert();
                if (rtn == 1)
                {
                    sampleId = tb_SAMPLENUM.Text.Trim();
                    string whereSql = "SAMPLENUM = '" + sampleId + "'",
                           orderBy  = string.Empty;
                    int type        = 2;
                    Search(whereSql, orderBy, type);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return(rtn);
        }