Exemple #1
0
        private void submitData(QCDQESubmitData _submitData)
        {
            SqlConnection conn = new SqlConnection(holder.RepairConnectionString);
            SqlCommand    cmd  = new SqlCommand(_submitData.SubmitQuery, conn);

            try
            {
                var sLogString = "Attemping to submit the data with the following parameters to the TechnicianSubmission Table:\n";

                conn.Open();
                cmd.Parameters.AddWithValue("@quality", _submitData.QualityTech);
                cmd.Parameters.AddWithValue("@submissionStatus", _submitData.SubmissionStatus);
                cmd.Parameters.AddWithValue("@QCDQEComments", _submitData.QCDQEComments);
                cmd.Parameters.AddWithValue("@QCDQEDateSubmit", _submitData.QCDQEDateSubmit);
                cmd.ExecuteNonQuery();
                conn.Close();

                for (int i = 0; i < cmd.Parameters.Count; i++)
                {
                    var paramName = cmd.Parameters[i].ToString();
                    if (string.IsNullOrEmpty(cmd.Parameters[i].Value.ToString()))
                    {
                        sLogString += paramName + ": N/A\n";
                    }
                    else
                    {
                        sLogString += $"{paramName}: {cmd.Parameters[i].Value.ToString()}\n";
                    }
                }
                sVar.LogHandler.CreateLogAction(sLogString, csLogging.LogState.SUBMISSIONDETAILS);
                sVar.LogHandler.CreateLogAction("Submission Successful!", csLogging.LogState.NOTE);

                MessageBox.Show("The QC/DQE submission was successful.", "Success", MessageBoxButton.OK, MessageBoxImage.Information);

                resetForm(true);
            }
            catch (Exception ex)
            {
                if (conn != null)
                {
                    conn.Close();
                }

                MessageBox.Show("There was an issue submitting the data.\nError Message: " + ex.Message, "Submission Error", MessageBoxButton.OK, MessageBoxImage.Error);
                sVar.LogHandler.CreateLogAction($"Error attempting to submit the data.\nError Message: {ex.Message}\nStack Trace: {ex.StackTrace}", csLogging.LogState.ERROR);
            }
        }
Exemple #2
0
        private QCDQESubmitData prepDataForSubmission(string _submitStatus)
        {
            QCDQESubmitData _submitInfo = new QCDQESubmitData();

            if ((bool)cbxScanSwitch.IsChecked)
            {
                _submitInfo.SubmitQuery = "UPDATE TechnicianSubmission SET Quality = @quality, SubmissionStatus = @submissionStatus, QCDQEComments = @QCDQEComments, QCDQEDateSubmitted = @QCDQEDateSubmit " +
                                          "WHERE ID = '" + ScannedUnitInformation.ID + "'";
            }
            else
            {
                _submitInfo.SubmitQuery = "UPDATE TechnicianSubmission SET Quality = @quality, SubmissionStatus = @submissionStatus, QCDQEComments = @QCDQEComments, QCDQEDateSubmitted = @QCDQEDateSubmit " +
                                          "WHERE SaveID = '" + txtRepairBarcode.Text.TrimEnd() + "'";
            }

            _submitInfo.QualityTech      = prepTechForSubmission();
            _submitInfo.QCDQEComments    = prepareCommentsForSubmission();
            _submitInfo.SubmissionStatus = _submitStatus;
            _submitInfo.QCDQEDateSubmit  = DateTime.Now;

            return(_submitInfo);
        }
Exemple #3
0
        private void submitButtonClicks(string submissionStatus)
        {
            bool bCanSubmit = false;

            if (!string.IsNullOrEmpty(txtRepairBarcode.Text) && ScannedUnitInformation.LoadSuccessful)
            {
                if (ScannedUnitInformation.QCandDQEComments != null && !string.IsNullOrEmpty(new TextRange(rtbQCDQEComments.Document.ContentStart, rtbQCDQEComments.Document.ContentEnd).Text.ToString().Trim()))
                {
                    string _qcComments = new TextRange(rtbQCDQEComments.Document.ContentStart, rtbQCDQEComments.Document.ContentEnd).Text.ToString().Trim();
                    if (_qcComments.Length != ScannedUnitInformation.QCandDQEComments.FullTechComments.Length)
                    {
                        bCanSubmit = true;
                    }
                    else
                    {
                        MessageBox.Show("Unable to submit. No new QC/DQE comments have been entered.", "Submission Criteria Not Met", MessageBoxButton.OK, MessageBoxImage.Information);
                        bCanSubmit = false;
                    }
                }
                else if (string.IsNullOrEmpty(new TextRange(rtbQCDQEComments.Document.ContentStart, rtbQCDQEComments.Document.ContentEnd).Text.ToString().Trim()))
                {
                    MessageBox.Show("Unable to submit. No QC/DQE comments have been entered.", "Submission Criteria Not Met", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
            else
            {
                if (!ScannedUnitInformation.LoadSuccessful)
                {
                    MessageBox.Show("Unable to submit due to no unit being scanned in.", "Submission Criteria Not Met", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }

            if (bCanSubmit)
            {
                QCDQESubmitData sd = prepDataForSubmission(submissionStatus);
                submitData(sd);
            }
        }