コード例 #1
0
        private void cboSelectLocation_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int intSelectedIndex;

            try
            {
                intSelectedIndex = cboSelectLocation.SelectedIndex - 1;

                if (intSelectedIndex > -1)
                {
                    MainWindow.gstrAssetLocation = TheFindSortedWaspAssetLocationsBySiteDataSet.FindSortedWaspAssetLoctionsBySite[intSelectedIndex].AssetLocation;

                    TheFindWaspAssetsByLocationDataSet = TheAssetClass.FindWaspAssetsByLocation(MainWindow.gstrAssetLocation);

                    dgrAssets.ItemsSource = TheFindWaspAssetsByLocationDataSet.FindWaspAssetsByLocation;

                    expAddAsset.IsEnabled = true;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Update Wasp Assets // Select Location Combo Box " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
コード例 #2
0
        private void btnProcess_Click(object sender, RoutedEventArgs e)
        {
            bool   blnFatalError   = false;
            string strErrorMessage = "";
            int    intCounter;
            int    intNumberOfRecords;
            int    intAssetID;

            try
            {
                if (cboSelectOldSite.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Old Site Was Not Selected\n";
                }
                if (cboSelectLocation.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Location Was Not Selected\n";
                }
                if (cboSelectNewSite.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The New Site Was Not Selected\n";
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                blnFatalError = TheAssetClass.UpdateWaspLocationSite(gintTransactionID, gstrNewSite);

                if (blnFatalError == true)
                {
                    throw new Exception();
                }

                TheFindWaspAssetsByLocationDataSet = TheAssetClass.FindWaspAssetsByLocation(gstrLocation);

                intNumberOfRecords = TheFindWaspAssetsByLocationDataSet.FindWaspAssetsByLocation.Rows.Count;

                if (intNumberOfRecords > 0)
                {
                    for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                    {
                        intAssetID = TheFindWaspAssetsByLocationDataSet.FindWaspAssetsByLocation[intCounter].AssetID;

                        blnFatalError = TheAssetClass.UpdateWaspAssetLocation(intAssetID, gstrNewSite, gstrLocation);

                        if (blnFatalError == true)
                        {
                            throw new Exception();
                        }
                    }
                }

                TheMessagesClass.InformationMessage("The Location Site Has Been Changed");

                ResetControls();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Change Location Site // Process Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }