コード例 #1
0
        private void dgrAssets_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataGrid     dataGrid;
            DataGridRow  selectedRow;
            DataGridCell AssetID;
            string       strAssetID;

            try
            {
                if (dgrAssets.SelectedIndex > -1)
                {
                    //setting local variable
                    dataGrid    = dgrAssets;
                    selectedRow = (DataGridRow)dataGrid.ItemContainerGenerator.ContainerFromIndex(dataGrid.SelectedIndex);
                    AssetID     = (DataGridCell)dataGrid.Columns[1].GetCellContent(selectedRow).Parent;
                    strAssetID  = ((TextBlock)AssetID.Content).Text;

                    //find the record
                    MainWindow.gintAssetID = Convert.ToInt32(strAssetID);

                    EditSelectedWaspAsset EditSelectedWaspAsset = new EditSelectedWaspAsset();
                    EditSelectedWaspAsset.ShowDialog();

                    TheFindWaspAssetsByLocationDataSet = TheAssetClass.FindWaspAssetsByLocation(MainWindow.gstrAssetLocation);

                    dgrAssets.ItemsSource = TheFindWaspAssetsByLocationDataSet.FindWaspAssetsByLocation;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Select Wasp Asset // Asset Grid Selection " + Ex.Message);

                TheMessageClass.ErrorMessage(Ex.ToString());
            }
        }
コード例 #2
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());
            }
        }
コード例 #3
0
        private void expAddAsset_Expanded(object sender, RoutedEventArgs e)
        {
            expAddAsset.IsExpanded = false;

            AddWaspAsset AddWaspAsset = new AddWaspAsset();

            AddWaspAsset.ShowDialog();

            TheFindWaspAssetsByLocationDataSet = TheAssetClass.FindWaspAssetsByLocation(MainWindow.gstrAssetLocation);

            dgrAssets.ItemsSource = TheFindWaspAssetsByLocationDataSet.FindWaspAssetsByLocation;
        }
コード例 #4
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());
            }
        }