コード例 #1
0
        public FindAssetTypeByAssetTypeDataSet FindAssetTypeByAssetType(string strAssetType)
        {
            try
            {
                aFindAssetTypeByAssetTypeDataSet      = new FindAssetTypeByAssetTypeDataSet();
                aFindAssetTypeByAssetTypeTableAdapter = new FindAssetTypeByAssetTypeDataSetTableAdapters.FindAssetTypeByAssetTypeTableAdapter();
                aFindAssetTypeByAssetTypeTableAdapter.Fill(aFindAssetTypeByAssetTypeDataSet.FindAssetTypeByAssetType, strAssetType);
            }
            catch (Exception eX)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Asset Class // Find Asset Type By Asset Type " + eX.Message);
            }

            return(aFindAssetTypeByAssetTypeDataSet);
        }
コード例 #2
0
        private void btnProcess_Click(object sender, RoutedEventArgs e)
        {
            string strAssetType;
            bool   blnFatalError   = false;
            string strErrorMessage = "";
            int    intRecordsReturned;
            int    intLength;

            try
            {
                //data validation
                strAssetType = txtEnterAssetType.Text;
                if (strAssetType == "")
                {
                    blnFatalError   = true;
                    strErrorMessage = "The Asset Type was not Entered";
                }
                else
                {
                    intLength = strAssetType.Length;

                    if (intLength < 5)
                    {
                        blnFatalError   = true;
                        strErrorMessage = "The Asset Type is not Long Enough";
                    }
                    else
                    {
                        TheFindAssetTypeByAssetTypeDataSet = TheAssetClass.FindAssetTypeByAssetType(strAssetType);

                        intRecordsReturned = TheFindAssetTypeByAssetTypeDataSet.FindAssetTypeByAssetType.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            blnFatalError   = true;
                            strErrorMessage = "The Asset Type is Already Entered";
                        }
                    }
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);

                    return;
                }

                blnFatalError = TheAssetClass.InsertAssetType(strAssetType);

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

                TheMessagesClass.InformationMessage("The Asset Type has been Entered");

                blnFatalError = TheEmployeeDataEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Create Asset Type");

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

                ResetControls();

                txtEnterAssetType.Focus();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Create Asset Type // Process Button " + Ex.Message);

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