예제 #1
0
        private void fillDataLog()
        {
            string sRefDesignator = string.Empty;
            string sPartReplaced  = string.Empty;
            string query          = "SELECT * FROM TechnicianSubmission WHERE SaveID = '" + txtRepairBarcode.Text + "' ORDER BY ID DESC;";

            if (!(bool)cbxScanSwitch.IsChecked && txtRepairBarcode.Text.Length == 12 &&
                MessageBox.Show("This looks like a serial number.\nDid you mean to click the checkbox for scanning Serial Numbers?",
                                "Serial Number Format Recognized", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
            {
                cbxScanSwitch.IsChecked = true;
                cbxScanSwitch_Click(null, null);
            }

            if ((bool)cbxScanSwitch.IsChecked)
            {
                query = "SELECT * FROM TechnicianSubmission WHERE SerialNumber = '" + txtRepairBarcode.Text + "' ORDER BY ID DESC;";
            }

            SqlConnection conn = new SqlConnection(holder.RepairConnectionString);
            SqlCommand    cmd  = new SqlCommand(query, conn);

            try
            {
                sVar.LogHandler.CreateLogAction("Attempting to get the Scanned Unit Information...", csLogging.LogState.NOTE);

                ScannedUnitInformation = new QCDQEPageLoad();
                ScannedUnitInformation.LoadSuccessful = false;
                conn.Open();
                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        ScannedUnitInformation.CustomerInformation = new CustomerInformation();
                        ScannedUnitInformation.QCandDQEComments    = new QCDQETechComments();

                        ScannedUnitInformation.ID                = Convert.ToInt32(reader["ID"].ToString());
                        ScannedUnitInformation.Technician        = csCrossClassInteraction.EmptyIfNull(reader["Technician"].ToString());
                        ScannedUnitInformation.PartName          = csCrossClassInteraction.EmptyIfNull(reader["PartName"].ToString());
                        ScannedUnitInformation.PartNumber        = csCrossClassInteraction.EmptyIfNull(reader["PartNumber"].ToString());
                        ScannedUnitInformation.PartSeries        = csCrossClassInteraction.EmptyIfNull(reader["Series"].ToString());
                        ScannedUnitInformation.CommoditySubClass = csCrossClassInteraction.EmptyIfNull(reader["CommoditySubClass"].ToString());
                        ScannedUnitInformation.SoftwareVersion   = csCrossClassInteraction.EmptyIfNull(reader["SoftwareVersion"].ToString());
                        ScannedUnitInformation.Quantity          = csCrossClassInteraction.EmptyIfNull(reader["Quantity"].ToString());

                        if (!reader["DateReceived"].Equals(DBNull.Value))
                        {
                            ScannedUnitInformation.DateReceived = Convert.ToDateTime(reader["DateReceived"].ToString());
                        }

                        ScannedUnitInformation.SerialNumber       = csCrossClassInteraction.EmptyIfNull(reader["SerialNumber"].ToString());
                        ScannedUnitInformation.TypeOfReturn       = csCrossClassInteraction.EmptyIfNull(reader["TypeOfReturn"].ToString());
                        ScannedUnitInformation.TypeOfFailure      = csCrossClassInteraction.EmptyIfNull(reader["TypeOfFailure"].ToString());
                        ScannedUnitInformation.HoursOnUnit        = csCrossClassInteraction.EmptyIfNull(reader["HoursOnUnit"].ToString());
                        ScannedUnitInformation.AdditionalComments = csCrossClassInteraction.EmptyIfNull(reader["AdditionalComments"].ToString());
                        ScannedUnitInformation.TechAction1        = csCrossClassInteraction.EmptyIfNull(reader["TechAct1"].ToString());
                        ScannedUnitInformation.TechAction2        = csCrossClassInteraction.EmptyIfNull(reader["TechAct2"].ToString());
                        ScannedUnitInformation.TechAction3        = csCrossClassInteraction.EmptyIfNull(reader["TechAct3"].ToString());
                        ScannedUnitInformation.CustomerInformation.CustomerNumber = csCrossClassInteraction.EmptyIfNull(reader["CustomerNumber"].ToString());
                        ScannedUnitInformation.QCandDQEComments.FullTechList      = csCrossClassInteraction.EmptyIfNull(reader["Quality"].ToString());
                        ScannedUnitInformation.QCandDQEComments.FullTechComments  = csCrossClassInteraction.EmptyIfNull(reader["QCDQEComments"].ToString());
                        ScannedUnitInformation.LoadSuccessful = true;
                        break;
                    }
                }
                conn.Close();

                sVar.LogHandler.CreateLogAction($"The Unit Information was found for {ScannedUnitInformation.SerialNumber}. " +
                                                $"It was a {ScannedUnitInformation.PartName}. The series was {ScannedUnitInformation.PartSeries}", csLogging.LogState.NOTE);

                getUnitIssueInfo();

                if (ScannedUnitInformation.CustomerInformation != null && !string.IsNullOrEmpty(ScannedUnitInformation.CustomerInformation.CustomerNumber))
                {
                    ScannedUnitInformation.CustomerInformation = csCrossClassInteraction.CustomerInformationQuery(ScannedUnitInformation.CustomerInformation.CustomerNumber);
                }

                populateFormWithData();

                fillSoftwareVersion();

                if (!string.IsNullOrEmpty(txtSN.Text))
                {
                    QueryTechReport();
                }

                rtbQCDQEComments.Focus();
            }
            catch (Exception ex)
            {
                if (conn != null)
                {
                    conn.Close();
                }
                MessageBox.Show("There was an issue loading the unit information.\nError Message: " + ex.Message, "DataLog Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
예제 #2
0
        private void resetForm(bool bCompleteReset)
        {
            sVar.resetStaticVars();

            if (bCompleteReset)
            {
                txtRepairBarcode.Text    = string.Empty;
                cbxScanSwitch.IsChecked  = false;
                lblRepairBarcode.Content = "Scan Repair Label:";
            }

            foreach (UIElement uie in gMainGrid.Children)
            {
                if (uie.GetType().Name.Equals("TextBox"))
                {
                    TextBox txtBox = (TextBox)uie;
                    txtBox.Text = string.Empty;
                }
            }

            foreach (UIElement uie in gUI1.Children)
            {
                if (uie.GetType().Name.Equals("TextBox"))
                {
                    TextBox txtBox = (TextBox)uie;
                    txtBox.Text = string.Empty;
                }
            }

            foreach (UIElement uie in gUI2.Children)
            {
                if (uie.GetType().Name.Equals("TextBox"))
                {
                    TextBox txtBox = (TextBox)uie;
                    txtBox.Text = string.Empty;
                }
            }

            foreach (UIElement uie in gUI3.Children)
            {
                if (uie.GetType().Name.Equals("TextBox"))
                {
                    TextBox txtBox = (TextBox)uie;
                    txtBox.Text = string.Empty;
                }
            }

            dgMultipleParts.Items.Clear();
            dgMultipleParts2.Items.Clear();
            dgMultipleParts3.Items.Clear();

            tiUI2.IsEnabled = tiUI3.IsEnabled = false;
            tiUI1.Focus();

            foreach (UIElement uie in gTechAction.Children)
            {
                if (uie.GetType().Name.Equals("TextBox"))
                {
                    TextBox txtBox = (TextBox)uie;
                    txtBox.Text = string.Empty;
                }
            }

            foreach (UIElement uie in gCustInfo.Children)
            {
                if (uie.GetType().Name.Equals("TextBox"))
                {
                    TextBox txtBox = (TextBox)uie;
                    txtBox.Text = string.Empty;
                }
            }

            dtpDateReceived.SelectedDate = DateTime.Now;
            cbxScrap.IsChecked           = false;
            dgPrevRepairInfo.Items.Clear();
            rtbAdditionalComments.Document.Blocks.Clear();
            rtbQCDQEComments.Document.Blocks.Clear();

            ScannedUnitInformation = new QCDQEPageLoad();
            txtRepairBarcode.Focus();
            txtQCDQETech.Text = System.Environment.UserName;
        }