示例#1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            m   = new MDB();
            exl = new Excel();
            SheetPicker _sp = new SheetPicker(exl);

            _sp.ShowDialog();
            //m.openFileDialog();
            listaExcel   = exl.ReadColumn("A");
            bio          = Enumerable.Repeat(false, listaExcel.Count).ToList();
            posebnaImena = getSpecialNames(exl);
            opisKolona   = getColumnDescription(exl);
            imenaKolona  = getColumnNames(exl);
        }
示例#2
0
        private void btnAddFamily_Click(object sender, EventArgs e)
        {
            string     dir = Path.GetDirectoryName(@"C:\NOVO\") + Path.DirectorySeparatorChar;
            TextWriter tw  = null;

            if (!File.Exists(dir + "data.log"))
            {
                File.Create(dir + "data.log").Dispose();
                tw = new StreamWriter(dir + "data.log");
            }
            else if (File.Exists(dir + "data.log"))
            {
                tw = new StreamWriter(dir + "data.log", true);
            }
            string sep = "";

            for (int x = 0; x < 30; x++)
            {
                sep += '-';
            }
            tw.WriteLine(sep);
            tw.WriteLine("Part Number " + " ------  " + " Path");
            tw.WriteLine(sep);
            // exl.updateExcelRow();
            //string path = @"C:\NOVO\";
            excelDataZeros = new List <string>();
            excelDataOne   = new List <string>();
            listofMatches  = new List <string>();
            paths          = exl.ReadColumn("B");
            partnumbers    = exl.ReadColumn("C");
            listzeroOne    = exl.ReadColumn("A");
            done           = Enumerable.Repeat(false, listzeroOne.Count).ToList();
            groupingData   = exl.ReadRange(6, exl.getMaxRowNumber(), "I", exl.getRangeParametar(imenaKolona));
            int count = exl.countColumns("I", exl.getRangeParametar(imenaKolona));

            for (int i = 0; i < listzeroOne.Count; i++)
            {
                if (listzeroOne.Contains("0"))
                {
                    if (listzeroOne[i] == "0")
                    {
                        excelDataZeros = groupingData[i];
                        for (int k = 0; k < listzeroOne.Count; k++)
                        {
                            int counter = 0;
                            if (listzeroOne[k] == "1")
                            {
                                excelDataOne = groupingData[k];
                                for (int j = 0; j < count; j++)
                                {
                                    if (excelDataOne[j] == excelDataZeros[j])
                                    {
                                        //listofMatches.Add(paths[k]);
                                        counter++;
                                    }
                                    else
                                    {
                                        continue;
                                    }
                                }

                                if (counter == count)
                                {
                                    tw.WriteLine(partnumbers[i + 1] + "  ------  " + paths[k]);
                                    break;
                                }
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("There is no part numbers to be grouped!");
                    break;
                }
            }
            MessageBox.Show("done");

            tw.Close();
        }