private void QueryMaterial() { lock (lockObj) { try { StringBuilder queryStrbd = new StringBuilder(); queryStrbd.Append("select * from Material order by OID desc"); //_packageSetTable.Rows.Clear();//清除行数据,但是行保留 DataTable dt = new DataTable(); dt = new SQLiteHelper().ExecuteQuery(queryStrbd.ToString()); List <Material> materialList = new List <Material>(); foreach (DataRow row in dt.Rows) { Material print = new Material(); print.OID = row["OID"] == DBNull.Value ? 0 : Convert.ToInt32(row["OID"]); print.Name = row["Name"] == DBNull.Value ? "" : (string)row["Name"]; print.Code = row["Code"] == DBNull.Value ? "" : (string)row["Code"]; materialList.Add(print); } _materialList = materialList; QueryMaterialCallbackDel del = QueryMaterialCallback; comboBox1.BeginInvoke(del, materialList); return; } catch (Exception ex) { LogHelper.WriteLog("QueryPrint", ex); } } }
private void QueryMaterial() { try { DataTable dt = new ExtractInventoryTool_MaterialBLL().QueryMaterialExtension(); _materialList = new List <ExtractInventoryTool_MaterialExtension>(); foreach (DataRow row in dt.Rows) { ExtractInventoryTool_MaterialExtension material = new ExtractInventoryTool_MaterialExtension(); material.Oid = row["Oid"] == DBNull.Value ? 0 : Convert.ToInt32(row["Oid"]); material.Name = row["Name"] == DBNull.Value ? "" : (string)row["Name"]; material.Code = row["Code"] == DBNull.Value ? "" : (string)row["Code"]; material.Supplier = row["Supplier"] == DBNull.Value ? "" : (string)row["Supplier"]; material.SupplierCode = row["SupplierCode"] == DBNull.Value ? "" : (string)row["SupplierCode"]; material.Client = row["Client"] == DBNull.Value ? 0 : Convert.ToInt32(row["Client"]); material.ClientName = row["ClientName"] == DBNull.Value ? "" : (string)row["ClientName"]; material.ClientCode = row["ClientCode"] == DBNull.Value ? "" : (string)row["ClientCode"]; material.UniqueCode = row["UniqueCode"] == DBNull.Value ? "" : (string)row["UniqueCode"]; _materialList.Add(material); } QueryMaterialCallbackDel del = QueryMaterialCallback; comboBox1.BeginInvoke(del, _materialList); return; } catch (Exception ex) { LogHelper.WriteLog("QueryClient", ex); } }
/// <summary> /// 查询当前客户的物料 /// </summary> public void QueryMaterialByClientID(string clientID) { DataTable dt = new ExtractInventoryTool_MaterialBLL().QueryMaterialByClientID(clientID); QueryMaterialCallbackDel del = QueryMaterialCallback; dataGridView2.BeginInvoke(del, dt); return; }