Esempio n. 1
0
 private void populateComboNarative()
 {
     if (comboNarrativeIdClicked == false)
     {
         LogAsTXT      lat           = new LogAsTXT();
         List <String> lstNarratives = lat.GetNarratives(32);
         foreach (var narrative in lstNarratives)
         {
             comboBoxNarrative.Items.Add(narrative);
         }
         comboBoxNarrative.SelectedIndex = 0;
     }
     comboNarrativeIdClicked = true;
 }
Esempio n. 2
0
 private void populateComboBoxCustomerID()
 {
     if (comboCustomerIdClicked == false)
     {
         customerNamesList.Clear();
         LogAsTXT      lat      = new LogAsTXT();
         List <String> lstCusts = lat.GetCustomerList();
         foreach (var customer in lstCusts)
         {
             //Only take the part of the string before the ~ character. This is used for the Azure query.
             //The other part is the actual client name.
             custIDNumber = customer.Split('~')[0];
             comboBoxCustomerID.Items.Add(custIDNumber);
             customerIDName = customer.Split('~')[1];
             customerNamesList.Add(customer);
         }
         comboBoxCustomerID.SelectedIndex = 0;
     }
     comboCustomerIdClicked = true;
 }
Esempio n. 3
0
        private void btnGetDatabaseFile(object sender, EventArgs e)
        {
            browseForFile = false;
            DefaultFileName();
            LogAsTXT lat = new LogAsTXT();

            //List<String> lstProbCusts = lat.GetProblemCustomerRefs(new List<String>() { "1234567", "1234568", "1234569" });
            int maxLogs   = Convert.ToInt32(maxLogsNumericUpDown.Value);
            int numofDays = Convert.ToInt32(NumOfDaysNumericUpDown.Value);
            int maxLines  = Convert.ToInt32(maxLinesNumericUpDown.Value);

            string narrative = "";

            if (comboBoxNarrative.SelectedItem != null)
            {
                narrative = comboBoxNarrative.SelectedItem.ToString();
            }

            string outputFile = tbxOutputFileName.Text;
            string custID     = "";

            if (comboBoxCustomerID.SelectedItem != null)
            {
                custID = comboBoxCustomerID.SelectedItem.ToString();
            }
            else
            {
                userInputCustomerID = comboBoxCustomerID.Text;
                List <String> lstCusts = lat.GetCustomerList();
                foreach (var customer in lstCusts)
                {
                    if (!lstCusts.Contains(custID))
                    {
                        lstCusts.Add(custID);
                        break;
                    }
                }
            }
            SaveFileDialog sfdSaveSPTXT = new SaveFileDialog
            {
                Filter   = "TXT (*.txt)|*.txt",
                FileName = outputFile
            };

            if (sfdSaveSPTXT.ShowDialog(this).Equals(DialogResult.OK))
            {
                outputFile = sfdSaveSPTXT.FileName;

                textBoxFilePath.Text = "Working...";
                Application.DoEvents();

                if (lat.GetLogAsTXT(maxLogs, numofDays, narrative, custID, maxLines, outputFile))
                {
                    textBoxFilePath.Text = outputFile;
                }
                else
                {
                    MessageBox.Show("CallSP Error:" + lat.GetLastError());
                    textBoxFilePath.Text = "Call SP Error..." + lat.GetLastError();
                }
            }
        }
Esempio n. 4
0
        private void AddDataToLogList(DataTable logFileDataTable, string probId)
        {
            int           minLines         = Convert.ToInt32(linesNumericUpDown.Value);
            string        rowSignature     = "";
            string        tillNumber       = "";
            string        version          = "";
            LogAsTXT      lat              = new LogAsTXT();
            List <String> lstCusts         = lat.GetCustomerList();
            List <string> problemCustomers = new List <string>();

            lat.GetProblemCustomerRefs(problemCustomers);

            if (comboBoxCustomerID.Text != "")
            {
                foreach (var name in lstCusts)
                {
                    if (comboBoxCustomerID.Text == name.Split('~')[0])
                    {
                        customerIDNumberAndName = name;
                        customerIDName          = name.Split('~')[0];
                        break;
                    }
                    else
                    {
                        customerIDNumberAndName = comboBoxCustomerID.Text;
                        customerIDName          = comboBoxCustomerID.Text;
                    }
                }
            }
            foreach (var CustID in lstCusts)
            {
                foreach (var problemCustID in problemCustomers)
                {
                    if (problemCustID.Split(',')[0] != CustID)
                    {
                        lstCusts.Add(problemCustID.Split(',')[0]);
                    }
                    break;
                }
            }
            foreach (var problemCustID in problemCustomers)
            {
                if (customerIDNumberAndName == problemCustID.Split('~')[0])
                {
                    tillNumber = problemCustID.Split(',')[3];
                    version    = problemCustID.Split(',')[4];
                    break;
                }
            }
            //custIDNumber = comboBoxCustomerID.Text;

            //foreach (var problemCustID in problemCustomers)
            //{
            //    if (!lstCusts.Contains(problemCustID.Split(',')[0]))
            //    {
            //        lstCusts.Add(problemCustID.Split(',')[0]);
            //    }
            //    if (custIDNumber == problemCustID.Split('~')[0])
            //    {
            //        customerIDNumberAndName = problemCustID.Split(',')[0];
            //        tillNumber = problemCustID.Split(',')[3];
            //        version = problemCustID.Split(',')[4];
            //        break;
            //    }
            //    foreach (var name in lstCusts)
            //    {
            //        if (custIDNumber == name.Split('~')[0])
            //        {
            //            if (name.Split(',')[0] == problemCustID.Split(',')[0])
            //            {
            //                customerIDNumberAndName = problemCustID.Split(',')[0];
            //                tillNumber = problemCustID.Split(',')[3];
            //                version = problemCustID.Split(',')[4];
            //                break;
            //            }

            //        }

            //    }
            //}
            var results = from myRow in logFileDataTable.AsEnumerable()
                          select myRow[0];
            var topRows = results.Reverse().Take(minLines);
            int count   = results.Count();

            foreach (var item in topRows)
            {
                rowSignature += item.ToString();
            }
            if (rowSignature != "")
            {
                LogList.Add(new LogFile
                {
                    ProblemID  = probId,
                    Signature  = rowSignature,
                    LDvalue    = 100,
                    NumOfLines = count,
                    CustomerID = customerIDNumberAndName,
                    Narrative  = narrative
                });
            }
        }