private void BtnFind_Click(object sender, RoutedEventArgs e) { int intRecordsReturned; string strItem; try { strItem = txtEnterItem.Text; if (strItem == "") { TheMessagesClass.ErrorMessage("The Item Or Serial Number Were\nNot Entered"); return; } TheFindITAssetBySerialNumber = TheITAssetClass.FindITAssetBySerialNumber(strItem); intRecordsReturned = TheFindITAssetBySerialNumber.FindITAssetBySerialNumber.Rows.Count; if (intRecordsReturned == 1) { txtHomeOffice.Text = TheFindITAssetBySerialNumber.FindITAssetBySerialNumber[0].HomeOffice; txtItem.Text = TheFindITAssetBySerialNumber.FindITAssetBySerialNumber[0].Item; txtManufacturer.Text = TheFindITAssetBySerialNumber.FindITAssetBySerialNumber[0].Manufacturer; txtModel.Text = TheFindITAssetBySerialNumber.FindITAssetBySerialNumber[0].Model; txtSerialNumber.Text = TheFindITAssetBySerialNumber.FindITAssetBySerialNumber[0].SerialNumber; gintItemID = TheFindITAssetBySerialNumber.FindITAssetBySerialNumber[0].ItemID; } else { TheFindITAssetsByItemDataSet = TheITAssetClass.FindITAssetsByItem(strItem); intRecordsReturned = TheFindITAssetsByItemDataSet.FindITAssetByItem.Rows.Count; if (intRecordsReturned == 1) { txtHomeOffice.Text = TheFindITAssetsByItemDataSet.FindITAssetByItem[0].HomeOffice; txtItem.Text = TheFindITAssetsByItemDataSet.FindITAssetByItem[0].Item; txtManufacturer.Text = TheFindITAssetsByItemDataSet.FindITAssetByItem[0].Manufacturer; txtModel.Text = TheFindITAssetsByItemDataSet.FindITAssetByItem[0].Model; txtSerialNumber.Text = TheFindITAssetsByItemDataSet.FindITAssetByItem[0].SerialNumber; gintItemID = TheFindITAssetsByItemDataSet.FindITAssetByItem[0].ItemID; } else { TheMessagesClass.ErrorMessage("Asset not Found or Be More specific"); return; } } } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Sign Out IT Asset // Find Button " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
public FindITAssetsByItemDataSet FindITAssetsByItem(string strItem) { try { aFindITAssetsByItemDataSet = new FindITAssetsByItemDataSet(); aFindITAssetsByItemTableAdapter = new FindITAssetsByItemDataSetTableAdapters.FindITAssetByItemTableAdapter(); aFindITAssetsByItemTableAdapter.Fill(aFindITAssetsByItemDataSet.FindITAssetByItem, strItem); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "IT Assets Class // Find IT Assets By Item " + Ex.Message); } return(aFindITAssetsByItemDataSet); }
private void TxtEnterItem_TextChanged(object sender, TextChangedEventArgs e) { string strSerialNumber; int intLength; int intRecordsReturned; strSerialNumber = txtEnterItem.Text; intLength = strSerialNumber.Length; if (intLength > 4) { TheFindITAssetBySerialNumberDataSet = TheITAssetsClass.FindITAssetBySerialNumber(strSerialNumber); intRecordsReturned = TheFindITAssetBySerialNumberDataSet.FindITAssetBySerialNumber.Rows.Count; if (intRecordsReturned == 0) { TheFindITAssetsByItemDataSet = TheITAssetsClass.FindITAssetsByItem(strSerialNumber); intRecordsReturned = TheFindITAssetsByItemDataSet.FindITAssetByItem.Rows.Count; if (intRecordsReturned < 1) { TheMessagesClass.ErrorMessage("No Records Found"); return; } dgrResults.ItemsSource = TheFindITAssetsByItemDataSet.FindITAssetByItem; } else { dgrResults.ItemsSource = TheFindITAssetBySerialNumberDataSet.FindITAssetBySerialNumber; } } }