示例#1
0
        private void btnFind_Click(object sender, RoutedEventArgs e)
        {
            int intRecordsReturned;

            gstrBillingCode = txtEnterBillingCode.Text;
            if (gstrBillingCode == "")
            {
                TheMessagesClass.ErrorMessage("The Billing Code Was Not Entered");
                return;
            }

            TheFindWOVBillingCodesByBillingCodesDataSet = TheWOVInvoicingClass.FindWOVBillingCodesByBillingCodes(gstrBillingCode);

            intRecordsReturned = TheFindWOVBillingCodesByBillingCodesDataSet.FindWOVBillingCodeByBillingCode.Rows.Count;

            if (intRecordsReturned == 0)
            {
                TheMessagesClass.ErrorMessage("The Billing Code Was Not Found");
                return;
            }

            txtBillingDescription.Text = TheFindWOVBillingCodesByBillingCodesDataSet.FindWOVBillingCodeByBillingCode[0].BillingDescription;
            txtBillingID.Text          = Convert.ToString(TheFindWOVBillingCodesByBillingCodesDataSet.FindWOVBillingCodeByBillingCode[0].BillingID);
            gintBillingID = TheFindWOVBillingCodesByBillingCodesDataSet.FindWOVBillingCodeByBillingCode[0].BillingID;
        }
        private void MitSave_Click(object sender, RoutedEventArgs e)
        {
            //setting up the variables
            string strBillingCode;
            string strBillingDescription;
            string strErrorMessage = "";
            bool   blnFatalError   = false;
            int    intRecordsReturned;

            strBillingCode = txtBillingCode.Text;
            if (strBillingCode == "")
            {
                blnFatalError    = true;
                strErrorMessage += "The Billing Code was not Entered\n";
            }
            strBillingDescription = txtBillingDescription.Text;
            if (strBillingDescription == "")
            {
                blnFatalError    = true;
                strErrorMessage += "The Billing Description was not Entered\n";
            }
            if (blnFatalError == true)
            {
                TheMessagesClass.ErrorMessage(strErrorMessage);
                return;
            }

            TheFindWOVBillingCodesByBillingCodesDataSet = TheWOVInvoicingClass.FindWOVBillingCodesByBillingCodes(strBillingCode);

            intRecordsReturned = TheFindWOVBillingCodesByBillingCodesDataSet.FindWOVBillingCodeByBillingCode.Rows.Count;

            if (intRecordsReturned > 0)
            {
                TheMessagesClass.ErrorMessage("The Billing Code Has Already Been Entered");
                return;
            }

            TheFindWOVBillingCodeByDescriptionDataSet = TheWOVInvoicingClass.FindWOVBillingCodesByDescription(strBillingDescription);

            intRecordsReturned = TheFindWOVBillingCodeByDescriptionDataSet.FindWOVBillingCodeByDescription.Rows.Count;

            if (intRecordsReturned > 0)
            {
                return;
            }

            try
            {
                blnFatalError = TheWOVInvoicingClass.InsertWOVBillingCodes(strBillingDescription, strBillingCode);

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

                TheMessagesClass.InformationMessage("The Billing Code has been Entered");

                ResetControls();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Add WOV Billing Codes // Save Menu Item " + Ex.Message);

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