Пример #1
0
        public List <CallIncoming> notRecallAnalyze()
        {
            List <CallIncoming> returnCalls = new List <CallIncoming>();
            var Stages = phones.Stages;

            foreach (var call in phones.getPhones())
            {
                FullCall LastCall = new FullCall(call.Value.phoneNumber,
                                                 call.Value.link,
                                                 call.Value.stages.First().Key,
                                                 call.Value.stages.First().Value.First().Date,
                                                 call.Value.stages.First().Value.First().Outgoing,
                                                 call.Value.stages.First().Value.First().comment,
                                                 call.Value.GetManager());
                DateTime datelastcallfirststage  = new DateTime();
                DateTime datelastcallsecondstage = new DateTime();
                foreach (var stage in call.Value.stages)
                {
                    foreach (var curCall in stage.Value)
                    {
                        if (curCall.Date > datelastcallfirststage && phones.Stages[stage.Key] == 1)
                        {
                            datelastcallfirststage = curCall.Date;
                            LastCall.date          = curCall.Date;
                            LastCall.stage         = stage.Key;
                            LastCall.outgoing      = curCall.Outgoing;
                            LastCall.Comment       = curCall.comment;
                        }
                        if (curCall.Date > datelastcallsecondstage && phones.Stages[stage.Key] == 2)
                        {
                            datelastcallfirststage = curCall.Date;
                        }
                    }
                }
                if (datelastcallfirststage != datelastcallsecondstage)
                {
                    var AddedCall = new ProcessedCall();
                    AddedCall.Client  = call.Value.phoneNumber;
                    AddedCall.Link    = call.Value.link;
                    AddedCall.Comment = LastCall.Comment;
                    if (!InputDoc.hasPhone(processedCalls, AddedCall))
                    {
                        returnCalls.Add(new CallIncoming(call.Value.phoneNumber, call.Value.link, String.Format("{0:dd.MM.yy}", datelastcallfirststage), LastCall.Comment + "\nДата второго звонка: " + (datelastcallsecondstage.Year > 2000 ?  datelastcallsecondstage.ToString("dd.MM.yyyy") : "отсутствует"), call.Value.GetManager(), new ProcessedCall(), call.Value.DealState, call.Value.DateDeal));
                    }
                    else
                    {
                        var samecall = InputDoc.getSamePhone(processedCalls, AddedCall);
                        if (samecall.ClientState != null && samecall.ClientState.ToUpper() == "В РАБОТЕ")
                        {
                            returnCalls.Add(new CallIncoming(call.Value.phoneNumber, call.Value.link,
                                                             String.Format("{0:dd.MM.yy}", datelastcallfirststage),
                                                             LastCall.Comment + "\nДата второго звонка: " + (datelastcallsecondstage.Year > 2000 ? datelastcallsecondstage.ToString("dd.MM.yyyy") : "отсутствует"), call.Value.GetManager(), samecall, call.Value.DealState, call.Value.DateDeal));
                        }
                    }
                }
            }
            return(returnCalls);
        }
Пример #2
0
        public void counter_should_return_correct_number_inInches()
        {
            Counter counter = new Counter();

            InputDoc[] docs = new InputDoc[] { new InputDoc(2000, 4000, 20, 40), new InputDoc(2000, 4000, 20, 40) };

            int result = counter.CountPages(docs, MeasurementUnit.Inches);

            Assert.True(result == 206);
        }
Пример #3
0
        public List <CallPreAgreement> getCallsPreAgreement()
        {
            List <CallPreAgreement> returnCalls = new List <CallPreAgreement>();
            var Stages = phones.Stages;

            foreach (var phone in phones.getPhones())
            {
                string lastStage = getLastStage(phone.Value, phones.Stages);
                if (lastStage == PreAgreementStage)
                {
                    OneCall FirstCall = phone.Value.stages[lastStage].First();
                    foreach (var call in phone.Value.stages[lastStage])
                    {
                        if (call.Date < FirstCall.Date)
                        {
                            FirstCall = call;
                        }
                    }
                    OneCall LastCall = FirstCall;
                    foreach (var stage in phone.Value.stages)
                    {
                        foreach (var call in stage.Value)
                        {
                            if (LastCall.Date < call.Date)
                            {
                                LastCall = (OneCall)call.Clone();
                                if (stage.Key != lastStage)
                                {
                                    LastCall.comment = LastCall.comment + " (" + stage.Key + ") ";
                                }
                            }
                        }
                    }
                    var AddedCall = new ProcessedCall();
                    AddedCall.Client  = phone.Value.phoneNumber;
                    AddedCall.Comment = LastCall.comment;
                    if (!InputDoc.hasPhone(processedCalls, AddedCall))
                    {
                        returnCalls.Add(new CallPreAgreement(phone.Value.phoneNumber, phone.Value.link, String.Format("{0:dd.MM.yy}", LastCall.Date), LastCall.comment, lastStage, phone.Value.GetManager(), new ProcessedCall(), phone.Value.DealState, phone.Value.DateDeal));
                    }
                    else
                    {
                        var samecall = InputDoc.getSamePhone(processedCalls, AddedCall);
                        if (samecall.ClientState != null && samecall.ClientState.ToUpper() == "В РАБОТЕ")
                        {
                            returnCalls.Add(new CallPreAgreement(phone.Value.phoneNumber, phone.Value.link,
                                                                 String.Format("{0:dd.MM.yy}", LastCall.Date),
                                                                 LastCall.comment, lastStage, phone.Value.GetManager(), samecall, phone.Value.DealState, phone.Value.DateDeal));
                        }
                    }
                }
            }
            return(returnCalls);
        }
Пример #4
0
        public List <CallIncoming> getIncomeWithoutOutGoing()
        {
            List <CallIncoming> returnCalls = new List <CallIncoming>();
            var Stages = phones.Stages;

            foreach (var call in phones.getPhones())
            {
                FullCall LastCall = new FullCall(call.Value.phoneNumber,
                                                 call.Value.link,
                                                 call.Value.stages.First().Key,
                                                 call.Value.stages.First().Value.First().Date,
                                                 call.Value.stages.First().Value.First().Outgoing,
                                                 call.Value.stages.First().Value.First().comment,
                                                 call.Value.GetManager());
                foreach (var stage in call.Value.stages)
                {
                    foreach (var curCall in stage.Value)
                    {
                        if (curCall.Date > LastCall.date || (curCall.Date == LastCall.date && curCall.Outgoing))
                        {
                            LastCall.date     = curCall.Date;
                            LastCall.stage    = stage.Key;
                            LastCall.outgoing = curCall.Outgoing;
                            LastCall.Comment  = curCall.comment;
                        }
                    }
                }
                // !LastCall.outgoing && убрали, так как захотели, чтоб анализировали не только входящие
                if (!call.Value.stages.ContainsKey(AgreementStage))
                {
                    var AddedCall = new ProcessedCall();
                    AddedCall.Client  = call.Value.phoneNumber;
                    AddedCall.Link    = call.Value.link;
                    AddedCall.Comment = LastCall.Comment;
                    if (!InputDoc.hasPhone(processedCalls, AddedCall))
                    {
                        returnCalls.Add(new CallIncoming(call.Value.phoneNumber, call.Value.link, String.Format("{0:dd.MM.yy}", LastCall.date), LastCall.Comment, call.Value.GetManager(), new ProcessedCall(), call.Value.DealState, call.Value.DateDeal));
                    }
                    else
                    {
                        var samecall = InputDoc.getSamePhone(processedCalls, AddedCall);
                        if (samecall.ClientState != null && samecall.ClientState.ToUpper() == "В РАБОТЕ")
                        {
                            returnCalls.Add(new CallIncoming(call.Value.phoneNumber, call.Value.link,
                                                             String.Format("{0:dd.MM.yy}", LastCall.date),
                                                             LastCall.Comment, call.Value.GetManager(), samecall, call.Value.DealState, call.Value.DateDeal));
                        }
                    }
                }
            }


            return(returnCalls);
        }
Пример #5
0
        public List <CallPreAgreement> getCallsPreAgreement()
        {
            List <CallPreAgreement> returnCalls = new List <CallPreAgreement>();
            var Stages = phones.Stages;

            foreach (var call in phones.getPhones())
            {
                int    NumMaxStage = Stages.Values.Max();
                string maxStage    = call.Value.stages.First().Key;
                foreach (var stage in call.Value.stages)
                {
                    if (Stages[maxStage] < Stages[stage.Key])
                    {
                        maxStage = stage.Key;
                    }
                }


                if (Stages[maxStage] == NumMaxStage - 3)
                {
                    OneCall compcall = call.Value.stages[maxStage].First();
                    foreach (var date in call.Value.stages[maxStage])
                    {
                        if (compcall.Date < date.Date)
                        {
                            compcall = date;
                        }
                    }
                    var AddedCall = new ProcessedCall();
                    AddedCall.Client  = call.Key;
                    AddedCall.Link    = "";
                    AddedCall.Comment = compcall.comment;
                    if (!InputDoc.hasPhone(processedCalls, AddedCall))
                    {
                        returnCalls.Add(new CallPreAgreement(call.Value.phoneNumber, call.Value.link, String.Format("{0:dd.MM.yy}", compcall.Date), compcall.comment, maxStage, call.Value.GetManager(), new ProcessedCall(), call.Value.DealState, call.Value.DateDeal));
                    }
                    else
                    {
                        var samecall = InputDoc.getSamePhone(processedCalls, AddedCall);
                        if (samecall.ClientState != null && samecall.ClientState.ToUpper() == "В РАБОТЕ")
                        {
                            returnCalls.Add(new CallPreAgreement(call.Value.phoneNumber, call.Value.link, String.Format("{0:dd.MM.yy}", compcall.Date), compcall.comment, maxStage, call.Value.GetManager(),
                                                                 samecall, call.Value.DealState, call.Value.DateDeal));
                        }
                    }
                }
            }
            return(returnCalls);
        }
Пример #6
0
        public List <CallPerWeek> getCallsPerWeek()
        {
            List <CallPerWeek> returnCalls = new List <CallPerWeek>();

            var Stages = phones.Stages;


            foreach (var call in phones.getPhones())
            {
                FullCall LastCall = new FullCall(call.Value.phoneNumber,
                                                 call.Value.link,
                                                 call.Value.stages.First().Key,
                                                 call.Value.stages.First().Value.First().Date,
                                                 call.Value.stages.First().Value.First().Outgoing,
                                                 call.Value.stages.First().Value.First().comment,
                                                 call.Value.GetManager());
                foreach (var stage in call.Value.stages)
                {
                    foreach (var curCall in stage.Value)
                    {
                        if (curCall.Date > LastCall.date)
                        {
                            LastCall.date     = curCall.Date;
                            LastCall.stage    = stage.Key;
                            LastCall.outgoing = curCall.Outgoing;
                            LastCall.Comment  = curCall.comment;
                        }
                    }
                }

                TimeSpan t1 = DateTime.Now.Subtract(LastCall.date);

                if (((t1.TotalDays >= 23 && !DS) || (DS && t1.TotalDays > 61)) && !call.Value.stages.ContainsKey(AgreementStage))
                {
                    CallPerWeek curCall = new CallPerWeek();
                    curCall.FirstWeek   = "-";
                    curCall.phoneNumber = call.Value.phoneNumber;
                    curCall.Manager     = call.Value.GetManager();
                    if (call.Value.link != "")
                    {
                        curCall.Link = new XLHyperlink(new Uri(call.Value.link));
                    }
                    curCall.comment = LastCall.Comment;
                    if (!LastCall.outgoing)
                    {
                        curCall.comment = curCall.comment + " (Входящий)";
                    }
                    if (t1.TotalDays >= 30 && !DS)
                    {
                        curCall.SecondWeek = "-";
                    }
                    else
                    {
                        curCall.SecondWeek = "+";
                    }
                    //if (t1.TotalDays >= 22)
                    //{
                    //    curCall.ThirdWeek = "-";
                    //}
                    //else
                    //{
                    //    curCall.ThirdWeek = "+";
                    //}
                    var AddedCall = new ProcessedCall();
                    AddedCall.Client  = curCall.phoneNumber;
                    AddedCall.Link    = call.Value.link;
                    AddedCall.Comment = curCall.comment;
                    curCall.DateDeal  = "";
                    if (call.Value.DealState.ToUpper() != "В РАБОТЕ" && call.Value.DealState != "")
                    {
                        curCall.DealState = "Закрыт";
                        curCall.NoticeCRM = call.Value.DealState;
                        curCall.DateDeal  = call.Value.DateDeal.ToString("dd.MM.yyyy");
                    }
                    if (call.Value.DealState.ToUpper() == "В РАБОТЕ")
                    {
                        curCall.DealState = call.Value.DealState;
                        if (call.Value.DateDeal.Year > 2000)
                        {
                            curCall.DateDeal = call.Value.DateDeal.ToString("dd.MM.yyyy");
                        }
                    }

                    if (!InputDoc.hasPhone(processedCalls, AddedCall))
                    {
                        returnCalls.Add(curCall);
                    }
                    else
                    {
                        var samecall = InputDoc.getSamePhone(processedCalls, AddedCall);
                        if (samecall.ClientState != null && samecall.ClientState.ToUpper() == "В РАБОТЕ")
                        {
                            curCall.call = samecall;
                            returnCalls.Add(curCall);
                        }
                    }
                }
            }

            return(returnCalls);
        }
Пример #7
0
        public List <CallOneStage> getCallsOneStage()
        {
            List <CallOneStage> returnCalls = new List <CallOneStage>();
            var Stages = phones.Stages;

            foreach (var phone in phones.getPhones())
            {
                string  lastStage = getLastStage(phone.Value, phones.Stages);
                OneCall FirstCall = phone.Value.stages[lastStage].First();
                foreach (var call in phone.Value.stages[lastStage])
                {
                    if (call.Date < FirstCall.Date)
                    {
                        FirstCall = call;
                    }
                }
                List <OneCall> dt = new List <OneCall>();
                dt.Add(FirstCall);
                foreach (var stage in phone.Value.stages)
                {
                    foreach (var call in stage.Value)
                    {
                        if (call.Date > FirstCall.Date)
                        {
                            OneCall addcall = (OneCall)call.Clone();
                            if (stage.Key != lastStage)
                            {
                                addcall.comment = call.comment + " (" + stage.Key + ")";
                            }
                            dt.Add(addcall);
                        }
                    }
                }

                if (lastStage != AgreementStage && dt.Count > 2)
                {
                    CallOneStage curCall = new CallOneStage();

                    curCall.phoneNumber = phone.Value.phoneNumber;
                    curCall.Manager     = phone.Value.GetManager();
                    if (phone.Value.link != "")
                    {
                        curCall.Link = new XLHyperlink(new Uri(phone.Value.link));
                    }
                    curCall.qty   = dt.Count.ToString();
                    curCall.stage = lastStage;
                    curCall.date  = "";
                    string          comment  = "";
                    DateTime        lastDate = dt.First().Date;
                    List <DateTime> uniqDT   = new List <DateTime>();
                    foreach (var call in dt)
                    {
                        if (!uniqDT.Contains(call.Date))
                        {
                            curCall.date = curCall.date + String.Format("{0:dd.MM.yy}", call.Date) + ", ";
                            uniqDT.Add(call.Date);
                        }
                        if (lastDate < call.Date)
                        {
                            comment  = call.comment;
                            lastDate = call.Date;
                        }
                    }
                    curCall.date    = curCall.date.TrimEnd(' ').Trim(',');
                    curCall.comment = comment;
                    var AddedCall = new ProcessedCall();
                    AddedCall.Client  = phone.Value.phoneNumber;
                    AddedCall.Link    = phone.Value.link;
                    AddedCall.Comment = curCall.comment;
                    curCall.DateDeal  = "";
                    if (phone.Value.DealState.ToUpper() != "В РАБОТЕ" && phone.Value.DealState != "")
                    {
                        curCall.DealState = "Закрыт";
                        curCall.NoticeCRM = phone.Value.DealState;
                        curCall.DateDeal  = phone.Value.DateDeal.ToString("dd.MM.yyyy");
                    }
                    if (phone.Value.DealState.ToUpper() == "В РАБОТЕ")
                    {
                        curCall.DealState = phone.Value.DealState;
                        if (phone.Value.DateDeal.Year > 2000)
                        {
                            curCall.DateDeal = phone.Value.DateDeal.ToString("dd.MM.yyyy");
                        }
                    }
                    if (!InputDoc.hasPhone(processedCalls, AddedCall))
                    {
                        returnCalls.Add(curCall);
                    }
                    else
                    {
                        var samecall = InputDoc.getSamePhone(processedCalls, AddedCall);
                        if (samecall.ClientState != null && samecall.ClientState.ToUpper() == "В РАБОТЕ")
                        {
                            curCall.call = samecall;
                            returnCalls.Add(curCall);
                        }
                    }
                }
            }
            return(returnCalls);
        }
Пример #8
0
        public List <CallOneStage> getCallsOneStage()
        {
            List <CallOneStage> returnCalls = new List <CallOneStage>();
            var Stages = phones.Stages;

            foreach (var call in phones.getPhones())
            {
                string maxStage = call.Value.stages.First().Key;
                foreach (var stage in call.Value.stages)
                {
                    if (Stages[maxStage] < Stages[stage.Key])
                    {
                        maxStage = stage.Key;
                    }
                }
                if (Stages[maxStage] < Stages.Values.Max() && call.Value.stages[maxStage].Count > 2)
                {
                    CallOneStage curCall = new CallOneStage();
                    curCall.phoneNumber = call.Value.phoneNumber;
                    if (call.Value.link != "")
                    {
                        curCall.Link = new XLHyperlink(new Uri(call.Value.link));
                    }
                    curCall.qty     = call.Value.stages[maxStage].Count.ToString();
                    curCall.stage   = maxStage;
                    curCall.date    = "";
                    curCall.Manager = call.Value.GetManager();
                    string comment = "";
                    foreach (var date in call.Value.stages[maxStage])
                    {
                        curCall.date = curCall.date + String.Format("{0:dd.MM.yy}", date.Date) + ", ";
                        comment      = date.comment;
                    }
                    curCall.date    = curCall.date.TrimEnd(' ').Trim(',');
                    curCall.comment = comment;
                    var AddedCall = new ProcessedCall();
                    AddedCall.Client  = curCall.phoneNumber;
                    AddedCall.Link    = "";
                    AddedCall.Comment = curCall.comment;
                    curCall.DateDeal  = "";
                    if (call.Value.DealState.ToUpper() != "В РАБОТЕ" && call.Value.DealState != "")
                    {
                        curCall.DealState = "Закрыт";
                        curCall.NoticeCRM = call.Value.DealState;
                        curCall.DateDeal  = call.Value.DateDeal.ToString("dd.MM.yyyy");
                    }
                    if (call.Value.DealState.ToUpper() == "В РАБОТЕ")
                    {
                        curCall.DealState = call.Value.DealState;
                        if (call.Value.DateDeal.Year > 2000)
                        {
                            curCall.DateDeal = call.Value.DateDeal.ToString("dd.MM.yyyy");
                        }
                    }
                    if (!InputDoc.hasPhone(processedCalls, AddedCall))
                    {
                        returnCalls.Add(curCall);
                    }
                    else
                    {
                        var samecall = InputDoc.getSamePhone(processedCalls, AddedCall);
                        if (samecall.ClientState != null && samecall.ClientState.ToUpper() == "В РАБОТЕ")
                        {
                            curCall.call = samecall;
                            returnCalls.Add(curCall);
                        }
                    }
                }
            }
            return(returnCalls);
        }
Пример #9
0
        //public static Tuple<List<Phone>, List<Phone>> getPhone(IFormFileCollection files)
        //{
        //    Dictionary<string, Dictionary<string, Tuple<int, string>>> dict = new Dictionary<string, Dictionary<string, Tuple<int, string>>>();
        //    Dictionary<string, Tuple<int,string,string>> dictPhone = new Dictionary<string, Tuple<int, string, string>>();
        //    List<Phone> phones = new List<Phone>();
        //    List<Phone> OnlyOneCall = new List<Phone>();

        //    foreach (var file in files)
        //    {
        //        using (var stream = file.OpenReadStream())
        //        {
        //            XLWorkbook wb = new XLWorkbook(stream);
        //            foreach (var page in wb.Worksheets)
        //            {

        //                if (page.Name.ToUpper().Trim() != "СТАТИСТИКА" && page.Name.ToUpper().Trim() != "СВОДНАЯ" )
        //                {
        //                    if (!dict.ContainsKey(page.Name.ToUpper().Trim()))
        //                    {
        //                        dict[page.Name.ToUpper().Trim()] = new Dictionary<string, Tuple<int, string>>();
        //                    }
        //                    IXLCell cell = page.Cell(1, 5);
        //                    DateTime curDate;
        //                    DateTime.TryParse(cell.GetValue<string>(), out curDate);
        //                    string phoneNumber;
        //                    while (!(cell.IsEmpty() && cell.CellRight().IsEmpty() && !cell.IsMerged()))
        //                    {
        //                        if (cell.GetValue<string>() != "")
        //                        {
        //                            DateTime.TryParse(cell.GetValue<string>(), out curDate);
        //                        }

        //                        phoneNumber = cell.CellBelow().GetValue<string>().ToUpper();
        //                        if (phoneNumber != "")
        //                        {

        //                            if (!dict[page.Name.ToUpper().Trim()].ContainsKey(phoneNumber))
        //                            {
        //                                dict[page.Name.ToUpper().Trim()][phoneNumber] = new Tuple<int, string>(1, String.Format("{0:dd.MM.yy}", curDate));
        //                            }
        //                            else
        //                            {
        //                                int curQty = dict[page.Name.ToUpper().Trim()][phoneNumber].Item1;
        //                                string curDates = dict[page.Name.ToUpper().Trim()][phoneNumber].Item2;
        //                                curQty++;
        //                                curDates = curDates + ", " + String.Format("{0:dd.MM.yy}", curDate);
        //                                dict[page.Name.ToUpper().Trim()][phoneNumber] = new Tuple<int, string>(curQty, curDates);
        //                            }
        //                            if (!dictPhone.ContainsKey(phoneNumber))
        //                            {
        //                                var data = new Tuple<int, string, string>(1, page.Name.ToUpper().Trim(), String.Format("{0:dd.MM.yy}", curDate));
        //                                dictPhone[phoneNumber] = data;
        //                            }
        //                            else
        //                            {
        //                                dictPhone[phoneNumber] = new Tuple<int, string, string>(3, "", "");
        //                            }
        //                        }

        //                        cell = cell.CellRight();
        //                    }

        //                }
        //            }
        //        }

        //    }

        //    foreach (var dictStage in dict)
        //    {
        //        foreach (var phone in dictStage.Value)
        //        {
        //            if (phone.Value.Item1 > 1)
        //            {
        //                phones.Add(new Phone(phone.Key, phone.Value.Item1, dictStage.Key, phone.Value.Item2));
        //            }
        //        }
        //    }
        //    foreach (var phone in dictPhone)
        //    {
        //        if (phone.Value.Item1 == 1)
        //        {
        //            OnlyOneCall.Add(new Phone(phone.Key, phone.Value.Item1, phone.Value.Item2, phone.Value.Item3));
        //        }

        //    }
        //    Tuple<List<Phone>, List<Phone>> returnPhones;
        //    returnPhones = new Tuple<List<Phone>, List<Phone>>(phones, OnlyOneCall);

        //    string fileoutput = "C:\\Users\\xiaomi\\source\\repos\\MetanitAngular\\MetanitAngular\\OutputAnalitics";
        //    XLWorkbook wbout = new XLWorkbook();
        //    var worksheet =  wbout.Worksheets.Add("Вх, на которые не перезв");
        //    //создадим заголовки у столбцов
        //    worksheet.Cell("A" + 1).Value = "Имя";
        //    worksheet.Cell("B" + 1).Value = "Фамиля";
        //    worksheet.Cell("C" + 1).Value = "Возраст";

        //    //

        //    worksheet.Cell("A" + 2).Value = "Иван";
        //    worksheet.Cell("B" + 2).Value = "Иванов";
        //    worksheet.Cell("C" + 2).Value = 18;
        //    //пример изменения стиля ячейки
        //    worksheet.Cell("B" + 2).Style.Fill.BackgroundColor = XLColor.Red;

        //    // пример создания сетки в диапазоне


        //    worksheet = wbout.Worksheets.Add("Застрявшие на 1 этапе");

        //    worksheet.Cell(1, 1).Value = "Клиент";
        //    worksheet.Cell(1, 1).Style.Font.Bold = true;
        //    worksheet.Cell(1, 2).Value = "Этап";
        //    worksheet.Cell(1, 2).Style.Font.Bold = true;
        //    worksheet.Cell(1, 3).Value = "Количество повторных звонков";
        //    worksheet.Cell(1, 3).Style.Font.Bold = true;
        //    worksheet.Cell(1, 4).Value = "Даты звонков";
        //    worksheet.Cell(1, 4).Style.Font.Bold = true;


        //    int i = 1;
        //    foreach (var phone in phones)
        //    {
        //        i++;
        //        worksheet.Cell(i, 1).Value = phone.PhoneNumber;
        //        worksheet.Cell(i, 2).Value = phone.Stage;
        //        worksheet.Cell(i, 3).Value = phone.Qty;
        //        worksheet.Cell(i, 4).Value = phone.Date;

        //    }

        //    var rngTable = worksheet.Range("A1:D" + i);
        //    rngTable.Style.Border.RightBorder = XLBorderStyleValues.Thin;
        //    rngTable.Style.Border.BottomBorder = XLBorderStyleValues.Thin;
        //    rngTable.Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
        //    worksheet.Columns().AdjustToContents(); //ширина столбца
        //    wbout.SaveAs(fileoutput + "\\Деловой союз.xlsx");
        //    return returnPhones;
        //}

        public static Tuple <List <Phone>, List <Phone> > getPhoneNew(IFormFileCollection files, string nameoutput)
        {
            var FilesManagers = files.Where(c => !Regex.Match(c.FileName.ToUpper(), "ПРЕДЫДУЩАЯ АНАЛИТИКА").Success);
            //Dictionary<string, List<DataCall>> phones = new Dictionary<string, List<DataCall>>();
            Regex                rNameOut = new Regex("БЕЛФАН");
            Regex                rRNR     = new Regex("РНР");
            Regex                rAvers   = new Regex("АВЕРС");
            Regex                rDS      = new Regex("Деловой союз", RegexOptions.IgnoreCase);
            ICompany             company;
            List <ProcessedCall> processedCalls = new List <ProcessedCall>();

            try
            {
                var lastCommentsFile = files.Where(c => Regex.Match(c.FileName.ToUpper(), "ПРЕДЫДУЩАЯ АНАЛИТИКА").Success).First();
                processedCalls = InputDoc.GetProcessedCalls(lastCommentsFile, rNameOut.Match(nameoutput.ToUpper()).Success);
            }
            catch (InvalidOperationException)
            {
            }
            if (!rNameOut.Match(nameoutput.ToUpper()).Success)
            {
                if (!rRNR.Match(nameoutput.ToUpper()).Success)
                {
                    company = new DefaultCompany(ref processedCalls, rDS.Match(nameoutput).Success);
                }
                else
                {
                    company = new RNRHouse(ref processedCalls);
                }
            }
            else
            {
                company = new Belfan(ref processedCalls);
            }
            company.ParserCheckLists(FilesManagers);

            string    fileoutput    = "C:\\Users\\xiaomi\\source\\repos\\MetanitAngular\\MetanitAngular\\OutputAnalitics";
            OutputDoc wbout         = new OutputDoc();
            OutputDoc wboutForFirst = new OutputDoc();

            wbout.setProcessedCalls(processedCalls);
            //wbout.FillIncoming(company.getIncomeWithoutOutGoing());
            if (Regex.Match(nameoutput, "Анвайтис", RegexOptions.IgnoreCase).Success)
            {
                Anvaitis anv = new Anvaitis(ref processedCalls);
                anv.ParserCheckLists(FilesManagers);
                wbout.FillIncoming(anv.notRecallAnalyze(), true);
            }
            if (rNameOut.Match(nameoutput.ToUpper()).Success)
            {
                wboutForFirst.FillFirstCallToClient(company.getfirstCallForBelfan());
            }
            wbout.FillIncoming(company.getIncomeWithoutOutGoing());
            if (!rRNR.Match(nameoutput.ToUpper()).Success&& !rNameOut.Match(nameoutput.ToUpper()).Success)
            {
                wbout.FillOutGoingPerWeeks(company.getCallsPerWeek(), rDS.Match(nameoutput).Success);
            }
            wbout.FillCallsOnSameStage(company.getCallsOneStage());
            if (!rRNR.Match(nameoutput.ToUpper()).Success&& !rDS.Match(nameoutput).Success)
            {
                wbout.FillCallsWithoutAgreement(company.getCallsPreAgreement());
            }

            wbout.FillArchive();
            var wboutFile = wbout.getFile();

            string dirpath = fileoutput;

            if (nameoutput == "")
            {
                fileoutput = fileoutput + "\\" + "default" + ".xlsx";
            }
            else
            {
                fileoutput = fileoutput + "\\" + nameoutput + ".xlsx";
            }
            try
            {
                wboutFile.SaveAs(fileoutput);
            }
            catch (System.IO.IOException)
            {
                fileoutput = dirpath + "\\Копия " + nameoutput + ".xlsx";
            }
            // wboutForFirst.getFile().SaveAs(dirpath + "\\Первичные звонки.xlsx");
            Tuple <List <Phone>, List <Phone> > returnPhones = new Tuple <List <Phone>, List <Phone> >(new List <Phone>(), new List <Phone>());

            return(returnPhones);
        }