Exemplo n.º 1
0
        private void ParseLineForKdtt(string callType, double totalSeconds, ref SpRecordFileInformation.DayInfo dayInfo)
        {
            callType = callType.ToLower();

            if (callType.Contains("непринятый"))
            {
                dayInfo.TotalMissed++;
            }
            else if (callType.Contains("принятый"))
            {
                dayInfo.TotalIncoming++;

                if (totalSeconds <= 5)
                {
                    dayInfo.IncrementMissedCallCount(
                        SpRecordFileInformation.DayInfo.MissedCallType.ConditionalyLostSelf5sec);
                }
                else if (totalSeconds > 5 && totalSeconds <= 10)
                {
                    dayInfo.IncrementMissedCallCount(
                        SpRecordFileInformation.DayInfo.MissedCallType.ConditionalyLostSelf10sec);
                }
                else if (totalSeconds > 10 && totalSeconds <= 15)
                {
                    dayInfo.IncrementMissedCallCount(
                        SpRecordFileInformation.DayInfo.MissedCallType.ConditionalyLostSelf15sec);
                }
                else if (totalSeconds > 15 && totalSeconds <= 20)
                {
                    dayInfo.IncrementMissedCallCount(
                        SpRecordFileInformation.DayInfo.MissedCallType.ConditionalyLostSelf20sec);
                }
                else if (totalSeconds > 20 && totalSeconds <= 25)
                {
                    dayInfo.IncrementMissedCallCount(
                        SpRecordFileInformation.DayInfo.MissedCallType.ConditionalyLostSelf25sec);
                }
                else if (totalSeconds > 25 && totalSeconds <= 30)
                {
                    dayInfo.IncrementMissedCallCount(
                        SpRecordFileInformation.DayInfo.MissedCallType.ConditionalyLostSelf30sec);
                }
            }
        }
Exemplo n.º 2
0
        private void AnalyseFileContentAndAddToDictionary(string fileName, List <List <string> > fileContent)
        {
            if (filesInfo.ContainsKey(fileName))
            {
                UpdateTextBox("Файл уже проанализирован ранее");
                return;
            }

            if (fileContent.Count < 7)
            {
                UpdateTextBox("Файл не соответствует формату SpRecord" +
                              "(должно быть минимум 7 строк, в файле: " +
                              fileContent.Count, error: true);
                return;
            }

            List <string> lastRow = fileContent.Last();

            if (lastRow.Count < 1)
            {
                UpdateTextBox("Не соответсвует формат последней строки, " +
                              "должен быть хотя бы 1 столбец", error: true);
            }

            string lastRowText = lastRow[0];

            if (!lastRowText.StartsWith("Всего записей:"))
            {
                UpdateTextBox("В последней строке отсутствует информация об общем " +
                              "количестве записей");
                return;
            }

            SpRecordFileInformation fileInformation = ParseLastRow(lastRowText);

            for (int row = 0; row < 5; row++)
            {
                if (row >= fileContent.Count)
                {
                    break;
                }

                List <string> line = fileContent[row];

                if (line.Count == 1)
                {
                    string text = line[0];

                    if (text.StartsWith("Выбраны записи"))
                    {
                        ParseLineAccountingPeriod(text, ref fileInformation);
                    }

                    if (text.StartsWith("Рабочая станция"))
                    {
                        ParseLineWorkstation(text, ref fileInformation);
                    }

                    if (text.StartsWith("Отчет создан"))
                    {
                        ParseLineCreationDate(text, ref fileInformation);
                    }
                }
            }

            for (int row = fileContent.Count - 2; row >= 0; row--)
            {
                List <string> line = fileContent[row];

                if (line.Count < 8 && line.Count != 1)
                {
                    UpdateTextBox("Размер строки " + (row + 1) + " не совпадает с форматом SpRecord");
                    continue;
                }

                if (line.Count >= 8)
                {
                    if (line[0].Equals("Название канала"))
                    {
                        continue;
                    }

                    try {
                        DateTime dateTime = DateTime.Parse(line[1]);
                        dateTime = dateTime.AddMilliseconds(dateTime.TimeOfDay.TotalMilliseconds * -1);

                        if (!fileInformation.DaysInfo.ContainsKey(dateTime))
                        {
                            fileInformation.DaysInfo.Add(dateTime, new SpRecordFileInformation.DayInfo());
                        }

                        SpRecordFileInformation.DayInfo dayInfo = fileInformation.DaysInfo[dateTime];

                        TimeSpan duration     = ParseTimeSpan(line[2]);
                        double   totalSeconds = duration.TotalSeconds;
                        string   callType     = line[3];
                        string   phoneNumbers = line[4];

                        if (fileInformation.WorkstationName.ToLower().Contains("splp"))
                        {
                            ParseLineForSplp(phoneNumbers, totalSeconds, ref dayInfo);
                        }
                        else if (fileInformation.WorkstationName.ToLower().Contains("kdtt"))
                        {
                            ParseLineForKdtt(callType, totalSeconds, ref dayInfo);
                        }
                    } catch (Exception e) {
                        Console.WriteLine(e.Message + Environment.NewLine + e.StackTrace);
                    }

                    //TimeSpan duration = ParseTimeSpan(line[2]);
                    //string type = line[3];

                    //if (type.Contains("Принятый")) {
                    //	fileInformation.CallsAccepted++;
                    //	fileInformation.TimeAccepted = fileInformation.TimeAccepted.Add(duration);
                    //} else if (type.Contains("Набранный")) {
                    //	fileInformation.CallsDialed++;
                    //	fileInformation.TimeDialed = fileInformation.TimeDialed.Add(duration);
                    //} else if (type.Contains("Непринятый")) {
                    //	if (line.Count > 9) {
                    //		fileInformation.CallsMissedAccidentialWrongValues++;
                    //		fileInformation.TimeAccidential = fileInformation.TimeAccidential.Add(duration);
                    //		continue;
                    //	}

                    //	if (duration.TotalSeconds <= 5) {
                    //		fileInformation.CallsMissedAccidentialShort++;
                    //		fileInformation.TimeAccidential = fileInformation.TimeAccidential.Add(duration);
                    //		fileContent[row].Add("Ошибочный, длительность меньше 6 секунд");
                    //	} else {
                    //		if (IsAnalysingAMissedCallSucceed(row, ref fileInformation, ref fileContent)) {
                    //			fileInformation.CallsMissed++;
                    //			fileInformation.TimeMissed = fileInformation.TimeMissed.Add(duration);
                    //		} else {
                    //			fileInformation.CallsMissedAccidentialWrongValues++;
                    //			fileInformation.TimeAccidential = fileInformation.TimeAccidential.Add(duration);
                    //		}
                    //	}
                    //} else {
                    //	UpdateTextBox("Неизвестный тип звонка: " + type);
                    //}
                }
            }

            fileInformation.FileContent = fileContent;
            filesInfo.Add(fileName, fileInformation);
        }
Exemplo n.º 3
0
        private void ParseLineForSplp(string phoneNumbers, double totalSeconds, ref SpRecordFileInformation.DayInfo dayInfo)
        {
            if (phoneNumbers.EndsWith("-> 601") || phoneNumbers.EndsWith("-> 611"))
            {
                dayInfo.TotalIncoming++;

                if (totalSeconds <= 5)
                {
                    dayInfo.IncrementMissedCallCount(
                        SpRecordFileInformation.DayInfo.MissedCallType.ConditionalyLostSelf5sec);
                }
                else if (totalSeconds > 5 && totalSeconds <= 10)
                {
                    dayInfo.IncrementMissedCallCount(
                        SpRecordFileInformation.DayInfo.MissedCallType.ConditionalyLostSelf10sec);
                }
                else if (totalSeconds > 10 && totalSeconds <= 15)
                {
                    dayInfo.IncrementMissedCallCount(
                        SpRecordFileInformation.DayInfo.MissedCallType.ConditionalyLostSelf15sec);
                }
                else if (totalSeconds > 15 && totalSeconds <= 20)
                {
                    dayInfo.IncrementMissedCallCount(
                        SpRecordFileInformation.DayInfo.MissedCallType.ConditionalyLostSelf20sec);
                }
                else if (totalSeconds > 20 && totalSeconds <= 25)
                {
                    dayInfo.IncrementMissedCallCount(
                        SpRecordFileInformation.DayInfo.MissedCallType.ConditionalyLostSelf25sec);
                }
                else if (totalSeconds > 25 && totalSeconds <= 30)
                {
                    dayInfo.IncrementMissedCallCount(
                        SpRecordFileInformation.DayInfo.MissedCallType.ConditionalyLostSelf30sec);
                }
            }
            else if (phoneNumbers.EndsWith("-> 30400"))
            {
                dayInfo.TotalRedirected++;

                if (totalSeconds <= 5)
                {
                    dayInfo.IncrementMissedCallCount(
                        SpRecordFileInformation.DayInfo.MissedCallType.ConditionalyLostRedirected5sec);
                }
                else if (totalSeconds > 5 && totalSeconds <= 10)
                {
                    dayInfo.IncrementMissedCallCount(
                        SpRecordFileInformation.DayInfo.MissedCallType.ConditionalyLostRedirected10sec);
                }
                else if (totalSeconds > 10 && totalSeconds <= 15)
                {
                    dayInfo.IncrementMissedCallCount(
                        SpRecordFileInformation.DayInfo.MissedCallType.ConditionalyLostRedirected15sec);
                }
                else if (totalSeconds > 15 && totalSeconds <= 20)
                {
                    dayInfo.IncrementMissedCallCount(
                        SpRecordFileInformation.DayInfo.MissedCallType.ConditionalyLostRedirected20sec);
                }
                else if (totalSeconds > 20 && totalSeconds <= 25)
                {
                    dayInfo.IncrementMissedCallCount(
                        SpRecordFileInformation.DayInfo.MissedCallType.ConditionalyLostRedirected25sec);
                }
                else if (totalSeconds > 25 && totalSeconds <= 30)
                {
                    dayInfo.IncrementMissedCallCount(
                        SpRecordFileInformation.DayInfo.MissedCallType.ConditionalyLostRedirected30sec);
                }
            }
        }