Пример #1
0
        private void btnProcess_Click(object sender, RoutedEventArgs e)
        {
            bool blnFatalError = false;

            try
            {
                blnFatalError = TheAssetClass.UpdateWaspAssetLocation(MainWindow.gintAssetID, gstrSite, gstrLocation);

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

                TheMessagesClass.InformationMessage("The Asset Location has been Changed");

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

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        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());
            }
        }