コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: mailstorme/analiz
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            //win.MessageBox.Show(dateinper("06.01.2017 20:25").ToString());
            //return;


            string ComisPath = new OpenExcelFile().Filenamereturn();

            if (ComisPath == "can not open file")
            {
                return;
            }


            //object[][] ali = getarray(ComisPath, 23, 56, 15,10);
            object[][] ali = getarray(ComisPath, new int[] { 27, 95, 98, 19 });

            int N = ali[0].Length;

            object[,] ins = new object[N, 4];

            win.MessageBox.Show(N.ToString());


            for (int i = 0; i < N; i++)
            {
                ins[i, 0] = ali[1][i];
                ins[i, 2] = ali[0][i];
                ins[i, 1] = ali[2][i];
                ins[i, 3] = ali[3][i];
            }


            //for (int i = 0; i < N; i++ )    МЕГА
            //{
            //    ins[i, 0] = ali[2][i];
            //    ins[i, 1] = dateinper(ali[0][i].ToString()) - 1;
            //    ins[i, 2] = (ali[1][i] == null) ? 11.11: ali[1][i];
            //    ins[i, 3] = ali[3][i];
            //}

            string resPath = new OpenExcelFile().Filenamereturn();

            if (resPath == "can not open file")
            {
                return;
            }
            insert(resPath, ins, N, 4);

            win.MessageBox.Show(ali[0][10].ToString());
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: mailstorme/analiz
        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            PdfFilePrinter.AdobeReaderPath = Textbox1.Text;


            string toch = new OpenExcelFile().Filenamereturn();

            if (toch == "can not open file")
            {
                return;
            }
            object[][] tochki = getarray(toch, new int[] { 1 });

            string wpath = DirSelect();

            string[] files = Directory.GetFiles(wpath);
            int      ad    = 0;

            foreach (object t in tochki[0])
            {
                foreach (string file in files)
                {
                    if (file.Contains(t.ToString()))
                    {
                        try
                        {
                            PdfFilePrinter printer = new PdfFilePrinter(file, "HP LaserJet Professional P1606dn");
                            printer.Print();
                        }
                        catch (Exception ex)
                        {
                            win.MessageBox.Show("Error: " + ex.Message, "HP LaserJet Professional P1606dn");
                        }
                        ad++;
                        break;
                        // Process.Start(@"winword.exe", string.Format(@"{0} /mFilePrintDefault /mFileExit", wpath));
                    }
                }
                //if (ad > 3)
                //    break;
            }

            win.MessageBox.Show("Конец  " + ad.ToString());
        }
コード例 #3
0
        // Создание Экселя Комиссии
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            string ComisPath = new OpenExcelFile().Filenamereturn();

            if (ComisPath == "can not open file")
            {
                return;
            }


            if (Combobox.Text == "MTC")
            {
                object[][] ali = getarray(ComisPath, 1, new int[] { 27, 95, 98, 19, 106, 96 }); //MTC

                int N = ali[0].Length;
                object[,] ins = new object[N, 6];

                for (int i = 0; i < N; i++)
                {
                    string TT = (ali[4][i].ToString() == null || ali[4][i].ToString() == "" || ali[4][i] == null) ? "" : ali[4][i].ToString() + " - ";
                    string DD = (ali[1][i] == null) ? " " : ali[1][i].ToString();

                    ins[i, 0] = DD;
                    ins[i, 2] = ali[0][i];
                    ins[i, 1] = ali[2][i];
                    ins[i, 3] = ali[3][i];
                    ins[i, 4] = ali[5][i];
                    ins[i, 5] = ali[1][i];
                }

                string resPath = new OpenExcelFile().Filenamereturn();
                if (resPath == "can not open file")
                {
                    return;
                }
                insert(resPath, ins, N, 5);
            }


            //МЕГА
            if (Combobox.Text == "Megafon")
            {
                object[][] ali = getarray(ComisPath, 1, new int[] { 12, 17, 51, 59, 69, 60 }); // колонки меги

                int N = ali[0].Length;
                object[,] ins = new object[N, 6];

                for (int i = 0; i < N; i++)
                {
                    string TT = "";
                    if (ali[4][i] != null)
                    {
                        TT = (ali[4][i].ToString() == "") ? "" : ali[4][i].ToString() + " - ";
                    }
                    string DD = (ali[3][i] == null) ? " " : ali[3][i].ToString();

                    ins[i, 0] = DD;
                    ins[i, 1] = dateinper(ali[1][i].ToString());
                    ins[i, 2] = (ali[2][i] == null) ? 0 : ali[2][i];
                    ins[i, 3] = ali[0][i];
                    ins[i, 4] = ali[5][i];
                    ins[i, 5] = ali[1][i];
                }

                string resPath = new OpenExcelFile().Filenamereturn();
                if (resPath == "can not open file")
                {
                    return;
                }
                insert(resPath, ins, N, 6);
            }

            win.MessageBox.Show("Конец");
        }
コード例 #4
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            TariffsCheck = 0;


            if (Combobox.SelectedIndex == -1)
            {
                win.MessageBox.Show("Укажите оператора", "Ошибка");
                return;
            }
            int period = (Period.Text != "") ? Convert.ToInt32(Period.Text) : 0;

            if (period == 0)
            {
                win.MessageBox.Show("Укажите период", "Ошибка");
                return;
            }
            string[] DatePeriod = new string[period];
            for (int i = 0; i < period; i++)
            {
                DatePeriod[i] = Date[i];
            }

            string path1 = "";
            string path2 = "";

            if (Combobox.Text == "Megafon")
            {
                path1 = @"C:\Users\Andrei\Desktop\Тарифы\Мега абонентская.txt"; // мега
                path2 = @"C:\Users\Andrei\Desktop\Тарифы\Мега регулярная.txt";  // мтс
            }
            if (Combobox.Text == "MTC")
            {
                path1 = @"C:\Users\Andrei\Desktop\Тарифы\МтсАбонент.txt";
                path2 = @"C:\Users\Andrei\Desktop\Тарифы\МтсРегуляр.txt";
            }

            win.MessageBox.Show("Укажите файл комиссии");

            string[] AbArr      = System.IO.File.ReadAllLines(path1);
            string[] RegArr     = System.IO.File.ReadAllLines(path2);
            string[] AllTariffs = AbArr.Union(RegArr).ToArray();
            string   NotFound   = "";

            string ComisPath = new OpenExcelFile().Filenamereturn();

            if (ComisPath == "can not open file")
            {
                return;
            }
            int Rows = 0;

            object[,] ComisAr = getarray(ComisPath, ref Rows);


            List <diler> dilers = ListCreate(ComisAr, period, ref NotFound, AllTariffs, AbArr.Length);


            win.MessageBox.Show("1-ый этап завершен. Укажите файл Базы  " + dilers.Count.ToString());



            string BasePath = new OpenExcelFile().Filenamereturn();

            if (BasePath == "can not open file")
            {
                return;
            }

            basaseach(ref dilers, BasePath, DatePeriod, 1, "b");

            win.MessageBox.Show("Конец 2.1-го этапа. Укажите файл Архивной базы");


            BasePath = new OpenExcelFile().Filenamereturn();
            if (BasePath == "can not open file")
            {
                return;
            }

            basaseach(ref dilers, BasePath, DatePeriod, 1, "a");

            basaseach(ref dilers, BasePath, DatePeriod, 2, "a");

            basaseach(ref dilers, BasePath, DatePeriod, 3, "a");

            win.MessageBox.Show("Конец 2.4-го этапа. Укажите файл с точками для анализа");


            string toch = new OpenExcelFile().Filenamereturn();

            if (toch == "can not open file")
            {
                return;
            }
            object[][] tochki = getarray(toch, 1, new int[] { 3, 1 });

            int columnsinresult = 26;  //////////////////////////////////////////////////////////////

            object[,] result = new object[dilers.Count, columnsinresult];

            int k = 0;
            int N = tochki[0].Length;

            int count = 0;

            for (int i = 0; i < N; i++)
            {
                string TT = "";
                //if(tochki[1][i] != null)
                //TT = (tochki[1][i].ToString() == null || tochki[1][i].ToString() == "" || tochki[1][i] == null) ? "" : tochki[1][i].ToString() + " - ";
                string DD        = (tochki[0][i].ToString() == null) ? " " : tochki[0][i].ToString();
                string dilerName = DD;


                foreach (diler d in dilers)
                {
                    if (dilerName == d.name.ToString())
                    {
                        int col            = 0;
                        int Otgruz         = d.inBase + d.inArhiv;
                        int GoodAbTariffs  = d.AllGoodAbTariffs();
                        int AllAbTarifs    = d.AllAbTariffs();
                        int GoodRegTariffs = d.AllGoodRegTariffs();
                        int AllRegTariffs  = d.AllRegTariffs();

                        result[k, col++] = d.name;
                        result[k, col++] = d.sum;
                        result[k, col++] = d.users.gfirst + d.users.gsecond + d.users.gthird + d.users.gm46 + d.users.gm79;
                        result[k, col++] = d.allincom;
                        result[k, col++] = Math.Round((d.users.gfirst / Convert.ToDouble(d.allincom)), 4);
                        result[k, col++] = Math.Round((d.users.gsecond / Convert.ToDouble(d.allincom)), 4);
                        result[k, col++] = Math.Round((d.users.gthird / Convert.ToDouble(d.allincom)), 4);
                        result[k, col++] = Math.Round((d.users.gm46 / Convert.ToDouble(d.allincom)), 4);
                        result[k, col++] = Math.Round((d.users.gm79 / Convert.ToDouble(d.allincom)), 4);
                        result[k, col++] = Math.Round((d.sum / Convert.ToDouble(d.allincom)), 0);
                        result[k, col++] = (Otgruz != 0)?Math.Round((d.sum / Convert.ToDouble(Otgruz)), 0):0;
                        result[k, col++] = (Otgruz != 0)?Math.Round((Convert.ToDouble(d.users.gfirst) / Convert.ToDouble(Otgruz)), 4) : 0;
                        result[k, col++] = (Otgruz != 0)?Math.Round(((d.users.gfirst + d.users.gsecond + d.users.gthird) / Convert.ToDouble(Otgruz)), 4): 0;

                        result[k, col++] = (d.users.first != 0) ? (Math.Round((d.users.gfirst / Convert.ToDouble(d.users.first)), 1) * 100) + "% (" + d.users.first.ToString() + ")" : 0.ToString("P") + " (0)";
                        result[k, col++] = (d.users.second != 0) ? (Math.Round((d.users.gsecond / Convert.ToDouble(d.users.second)), 1) * 100) + "% (" + d.users.second.ToString() + ")" : 0.ToString("P") + " (0)";
                        result[k, col++] = (d.users.third != 0) ? (Math.Round((d.users.gthird / Convert.ToDouble(d.users.third)), 1) * 100) + "% (" + d.users.third.ToString() + ")" : 0.ToString("P") + " (0)";

                        result[k, col++] = "";

                        result[k, col++] = (d.users.second != 0)?(Math.Round((d.users.gsecond / Convert.ToDouble(d.users.second)), 1) * 100) + "% (" + d.users.second.ToString() + ")": 0.ToString("P") + " (0)";

                        result[k, col++] = (((AllAbTarifs == 0) ? 0 : GoodAbTariffs / Convert.ToDouble(AllAbTarifs))).ToString("p") + "  (" + AllAbTarifs.ToString() + ")";
                        result[k, col++] = (((AllRegTariffs == 0) ? 0 : GoodRegTariffs / Convert.ToDouble(AllRegTariffs))).ToString("p") + "  (" + AllRegTariffs.ToString() + ")";

                        result[k, col++] = Math.Round((d.sumWithPred / Convert.ToDouble(d.allincom)), 0);

                        result[k, col++] = (Combobox.Text != "Megafon") ? d.TariffStatistic(new string[] { "Smart", "smart" }) : d.TariffStatistic(new string[] { "Всё включено", "всё включено" });

                        result[k, col++] = (Combobox.Text != "Megafon") ? d.TariffStatistic(new string[] { "Твоя страна" }) : d.TariffStatistic(new string[] { "Тёплый приём", "тёплый приём" });

                        result[k, col++] = d.users.gfirst.ToString() + ":" + d.users.gsecond.ToString() + ":" + d.users.gthird.ToString() + ":"
                                           + (d.users.gm46 + d.users.gm79).ToString() + "  (" + d.allincom.ToString() + ")";

                        result[k, col++] = d.allincom.ToString() + " | " + (Otgruz).ToString();

                        result[k, col++] = d.priznakCom;

                        count = col;
                        k++;
                        break;
                    }
                }
            }


            string resPath = new OpenExcelFile().Filenamereturn();

            if (resPath == "can not open file")
            {
                return;
            }
            insert(resPath, result, dilers.Count, count);

            win.MessageBox.Show(NotFound, "Конец программы");
        }
コード例 #5
0
ファイル: MainWindow.xaml.cs プロジェクト: mailstorme/analiz
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            string abonents = "МегаФон - Всё включено L МегаФон - Всё включено L 07.16 МегаФон - Всё включено M МегаФон - Всё включено M 07.16 МегаФон - Всё включено M+ МегаФон - Всё включено S МегаФон - Всё включено S 07.16 МегаФон - Всё включено S+ МегаФон - Всё включено VIP МегаФон - Всё включено XL МегаФон - Всё включено L 12.16 МегаФон - Всё включено M 12.16 МегаФон - Всё включено S 12.16 МегаФон - Всё включено VIP 07.16 МегаФон - Всё включено VIP 12.16 МегаФон - Всё включено XL 12.16 МегаФон - Всё включено XL 07.16 МегаФон.Безлимит МегаФон Онлайн с роутером 4G +" +
                              " МегаФон - Онлайн МегаФон - Онлайн с модемом 4G +   Связь городов   Тёплый приём   Тёплый приём +   Тёплый приём 2017 Тёплый приём M Тёплый приём M 2017 Тёплый приём M v.06.16 Тёплый приём S Тёплый приём S 2017 Тёплый приём S v.06.16";
            string regular  = "МегаФон - Умный дом Переходи на НОЛЬ Переходи на НОЛЬ 2013";
            string NotFound = "";


            //string path1 = @"C:\Users\Andrei\Desktop\абонентская.txt";  мега
            //string path2 = @"C:\Users\Andrei\Desktop\регулярная.txt";

            string path1 = @"C:\Users\Andrei\Desktop\МтсАбонент.txt";
            string path2 = @"C:\Users\Andrei\Desktop\МтсРегуляр.txt";


            abonents = System.IO.File.ReadAllText(path1).Replace("\n", " ");
            regular  = System.IO.File.ReadAllText(path2).Replace("\n", " ");

            //win.MessageBox.Show(abonents);
            //win.MessageBox.Show(regular);
            //return;

            string ComisPath = new OpenExcelFile().Filenamereturn();

            if (ComisPath == "can not open file")
            {
                return;
            }

            int Rows;
            int Columns;

            #region Открытие Excel
            var ExcelApp = new Excel.Application();
            ExcelApp.Visible = false;
            Excel.Sheets    excelsheets;
            Excel.Worksheet excelworksheet;
            //Excel.Workbooks workbooks;
            Excel.Workbook book;
            Excel.Range    range;

            book = ExcelApp.Workbooks.Open(ComisPath, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
            //book.ActiveSheet.get_Item(1);
            excelsheets    = book.Worksheets;
            excelworksheet = (Excel.Worksheet)excelsheets.get_Item(1);

            #endregion

            Rows    = excelworksheet.UsedRange.Rows.Count;
            Columns = excelworksheet.UsedRange.Columns.Count;

            object[,] ComisAr = new object[Rows, Columns + 11];

            range   = excelworksheet.get_Range(R1C1[1] + "1:" + R1C1[Columns] + Rows.ToString());
            ComisAr = (System.Object[, ])range.get_Value(Type.Missing);


            string mas = "";
            for (int i = 1; i <= 10; i++)
            {
                for (int j = 1; j <= Columns; j++)
                {
                    mas += ComisAr[i, j] + " ";
                }
                mas += "\n";
            }


            List <diler> dilers = new List <diler>();

            for (int i = 2; i <= Rows; i++)
            {
                if (ComisAr[i, 1] == null || ComisAr[i, 1].ToString() == "" || ComisAr[i, 1].ToString() == " " || ComisAr[i, 1].ToString() == null)
                {
                    continue;
                }

                bool first     = false;
                bool second    = false;
                bool third     = false;
                bool from4to6  = false;
                bool from7to12 = false;
                bool abonent   = false;
                bool regula    = false;

                bool abonentAll = false;
                bool regulaAll  = false;

                if (abonents.Contains(ComisAr[i, 4].ToString()))
                {
                    abonentAll = true;
                }
                else if (regular.Contains(ComisAr[i, 4].ToString()))
                {
                    regulaAll = true;
                }
                else
                if (!NotFound.Contains(ComisAr[i, 4].ToString()))
                {
                    NotFound += ComisAr[i, 4].ToString() + " ;   ";
                }


                double nach = Convert.ToDouble(ComisAr[i, 3]);

                if (nach >= 120)
                {
                    if (abonents.Contains(ComisAr[i, 4].ToString()))
                    {
                        abonent = true;
                    }
                    else if (regular.Contains(ComisAr[i, 4].ToString()))
                    {
                        regula = true;
                    }
                    else
                    if (!NotFound.Contains(ComisAr[i, 4].ToString()))
                    {
                        NotFound += ComisAr[i, 4].ToString() + " ;   ";
                    }



                    switch (Convert.ToInt32(ComisAr[i, 2]))
                    {
                    case 1:
                        first = true;
                        break;

                    case 2:
                        second = true;
                        break;

                    case 3:
                        third = true;
                        break;

                    case 4:
                        from4to6 = true;
                        break;

                    case 5:
                        from4to6 = true;
                        break;

                    case 6:
                        from4to6 = true;
                        break;

                    case 7:
                    case 8:
                    case 9:
                    case 10:
                    case 11:
                    case 12:
                        from7to12 = true;
                        break;
                    }
                }

                bool find = false;
                foreach (diler d in dilers)
                {
                    if (d.name.ToString() == ComisAr[i, 1].ToString())
                    {
                        d.sum += nach;

                        if (abonent)
                        {
                            d.Tab++;
                        }
                        else if (regula)
                        {
                            d.Treg++;
                        }

                        if (abonentAll)
                        {
                            d.TabAll++;
                        }
                        else if (regulaAll)
                        {
                            d.TregAll++;
                        }

                        find = true;

                        d.allincom++;
                        if (first)
                        {
                            d.count1201++;
                        }
                        if (second)
                        {
                            d.count1202++;
                        }
                        if (third)
                        {
                            d.count1203++;
                        }
                        if (from4to6)
                        {
                            d.count12046++;
                        }
                        if (from7to12)
                        {
                            d.count120712++;
                        }
                        break;
                    }
                }

                if (!find)
                {
                    dilers.Add(new diler(ComisAr[i, 1], first, second, third, from4to6, from7to12, nach, abonent, regula, abonentAll, regulaAll));
                }
            }

            win.MessageBox.Show("1-ый этап завершен");



            string BasePath = new OpenExcelFile().Filenamereturn();
            if (BasePath == "can not open file")
            {
                return;
            }

            object[][] basearr = getbasearray(BasePath);
            int        Nbase   = basearr[0].Length;

            //win.MessageBox.Show(basearr[0][1].ToString());

            for (int i = 0; i < Nbase; i++)
            {
                foreach (diler d in dilers)
                {
                    if (basearr[0][i].ToString() == d.name.ToString())
                    {
                        d.b += Convert.ToInt32(basearr[1][i]);
                    }
                }
            }

            win.MessageBox.Show("Конец 2.1-го этапа");


            BasePath = new OpenExcelFile().Filenamereturn();
            if (BasePath == "can not open file")
            {
                return;
            }

            basearr = getbasearray(BasePath);
            Nbase   = basearr[0].Length;

            //win.MessageBox.Show(basearr[0][1].ToString());

            for (int i = 0; i < Nbase; i++)
            {
                foreach (diler d in dilers)
                {
                    if (basearr[0][i].ToString() == d.name.ToString())
                    {
                        d.a += Convert.ToInt32(basearr[1][i]);
                    }
                }
            }

            win.MessageBox.Show("Конец 2.2-го этапа");


            BasePath = new OpenExcelFile().Filenamereturn();
            if (BasePath == "can not open file")
            {
                return;
            }

            basearr = getbasearray(BasePath);
            Nbase   = basearr[0].Length;

            //win.MessageBox.Show(basearr[0][1].ToString());

            for (int i = 0; i < Nbase; i++)
            {
                foreach (diler d in dilers)
                {
                    if (basearr[0][i].ToString() == d.name.ToString())
                    {
                        d.a += Convert.ToInt32(basearr[1][i]);
                    }
                }
            }

            win.MessageBox.Show("Конец 2.3-го этапа");


            BasePath = new OpenExcelFile().Filenamereturn();
            if (BasePath == "can not open file")
            {
                return;
            }

            basearr = getbasearray(BasePath);
            Nbase   = basearr[0].Length;

            //win.MessageBox.Show(basearr[0][1].ToString());

            for (int i = 0; i < Nbase; i++)
            {
                foreach (diler d in dilers)
                {
                    if (basearr[0][i].ToString() == d.name.ToString())
                    {
                        d.a += Convert.ToInt32(basearr[1][i]);
                    }
                }
            }

            win.MessageBox.Show("Конец 2.4-го этапа");


            string toch = new OpenExcelFile().Filenamereturn();
            if (toch == "can not open file")
            {
                return;
            }
            object[][] tochki = getarray(toch, new int[] { 3, 4, 5 });


            object[,] result = new object[dilers.Count, 22];

            int k = 0;
            foreach (object t in tochki[0])
            {
                foreach (diler d in dilers)
                {
                    if (t.ToString() == d.name.ToString())
                    {
                        result[k, 0]  = d.name;
                        result[k, 1]  = d.b;
                        result[k, 2]  = d.a;
                        result[k, 3]  = d.b + d.a;
                        result[k, 4]  = d.allincom;
                        result[k, 5]  = d.sum;
                        result[k, 6]  = d.count1201;
                        result[k, 7]  = d.count1202;
                        result[k, 8]  = d.count1203;
                        result[k, 9]  = d.count12046;
                        result[k, 10] = d.count120712;
                        result[k, 11] = d.count1201 / Convert.ToDouble(d.allincom);
                        result[k, 12] = d.count1202 / Convert.ToDouble(d.allincom);
                        result[k, 13] = d.count1203 / Convert.ToDouble(d.allincom);
                        result[k, 14] = d.count12046 / Convert.ToDouble(d.allincom);
                        result[k, 15] = d.count120712 / Convert.ToDouble(d.allincom);
                        result[k, 16] = d.sum / Convert.ToDouble(d.allincom);
                        result[k, 17] = d.sum / Convert.ToDouble(d.a + d.b);
                        result[k, 18] = d.count1201 / Convert.ToDouble(d.a + d.b);
                        result[k, 19] = (d.count1201 + d.count1202 + d.count1203) / Convert.ToDouble(d.a + d.b);
                        result[k, 20] = (d.TabAll == 0)? 0: d.Tab / Convert.ToDouble(d.TabAll);
                        result[k, 21] = (d.TregAll == 0)? 0:d.Treg / Convert.ToDouble(d.TregAll);
                        k++;
                        break;
                    }
                }
            }


            string resPath = new OpenExcelFile().Filenamereturn();
            if (resPath == "can not open file")
            {
                return;
            }
            insert(resPath, result, dilers.Count, 22);



            win.MessageBox.Show(NotFound, "Конец");
        }
コード例 #6
0
ファイル: MainWindow.xaml.cs プロジェクト: mailstorme/analiz
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            int _icc, _msisdn, _date;

            try
            {
                _icc    = Convert.ToInt32(icc.Text, 10);
                _msisdn = Convert.ToInt32(msisdn.Text, 10);
                _date   = Convert.ToInt32(date.Text, 10);
            }
            catch
            {
                win.MessageBox.Show("Ошибка входных данных");
                return;
            }

            string wpath = DirSelect();

            if (wpath == null || wpath == "")
            {
                win.MessageBox.Show("Выберите папку");
                return;
            }
            string[] files = Directory.GetFiles(wpath);


            string ComisPath = new OpenExcelFile().Filenamereturn();

            if (ComisPath == "can not open file")
            {
                return;
            }

            int Rows;
            int Columns;

            #region Открытие Excel
            var ExcelApp = new Excel.Application();
            ExcelApp.Visible = false;
            Excel.Sheets    excelsheets;
            Excel.Worksheet excelworksheet;
            //Excel.Workbooks workbooks;
            Excel.Workbook book;
            Excel.Range    range;

            book = ExcelApp.Workbooks.Open(ComisPath, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
            //book.ActiveSheet.get_Item(1);
            excelsheets    = book.Worksheets;
            excelworksheet = (Excel.Worksheet)excelsheets.get_Item(1);

            #endregion
            Process[] List = Process.GetProcessesByName("EXCEL");

            Rows    = excelworksheet.UsedRange.Rows.Count;
            Columns = excelworksheet.UsedRange.Columns.Count;

            object[][] ComisAr = new object[4][];
            //win.MessageBox.Show("Row=" + Rows + "  Column="+Columns);



            int icount = 0;
            for (int i = 0; i < Columns + 1; i++)
            {
                if (i == _icc || i == _msisdn || i == _date)
                {
                    object[,] massiv;
                    ComisAr[icount] = new object[Rows - 1];
                    range           = excelworksheet.get_Range(R1C1[i] + "2:" + R1C1[i] + Rows.ToString());
                    massiv          = (System.Object[, ])range.get_Value(Type.Missing);
                    ComisAr[icount] = massiv.Cast <object>().ToArray();
                    icount++;
                }
            }

            ComisAr[icount] = new object[Rows - 1];
            for (int i = 0; i < Rows - 1; i++)
            {
                ComisAr[icount][i] = (double)0;
            }

            double sum    = 0;
            int    counts = 0;
            foreach (string file in files)
            {
                object[][] refill = getarray(file, new int[] { 4, 5, 6 });
                int        N      = refill[1].Length;

                object sum1 = 0;
                for (int i = 0; i < N; i++)
                {
                    sum1 = Convert.ToDouble(sum1) + Convert.ToDouble(refill[1][i]);
                }

                win.MessageBox.Show(sum1.ToString());


                for (int i = 0; i < N; i++)
                {
                    int n = Array.BinarySearch(ComisAr[1], refill[2][i]);
                    if (n > 0)
                    {
                        counts++;
                        //double h1 = (double)ComisAr[icount][n];
                        //double h2 = (double)refill[1][i];
                        ComisAr[icount][n] = Convert.ToDouble(ComisAr[icount][n]) + Convert.ToDouble(refill[1][i]);
                        sum += (double)refill[1][i];
                    }
                }
            }

            object[,] arr = new object[Rows - 1, 1];
            //double qwe = 0;
            for (int i = 0; i < Rows - 1; i++)
            {
                arr[i, 0] = ComisAr[icount][i];
                //qwe += Convert.ToDouble(ComisAr[icount][i]);
            }

            range        = null;
            range        = excelworksheet.get_Range(R1C1[Columns + 1] + "2:" + R1C1[Columns + 1] + Rows);
            range.Value2 = arr;

            #region Закрытие Excel
            ExcelApp.Application.Quit();
            #endregion
            CloseProcess(List);


            win.MessageBox.Show("|" + sum.ToString() + "| в " + counts.ToString());
            GC.Collect();
        }