Exemple #1
0
        private void frmclientes_Load(object sender, EventArgs e)
        {
            IntPtr hmenu = GetSystemMenu(this.Handle, 0);
            int    cnt   = GetMenuItemCount(hmenu);

            // remove 'close' action
            RemoveMenu(hmenu, cnt - 1, MF_DISABLED | MF_BYPOSITION);
            // remove extra menu line
            RemoveMenu(hmenu, cnt - 2, MF_DISABLED | MF_BYPOSITION);
            DrawMenuBar(this.Handle);

            conf c = opconf.GellIdConf("clientes");

            if (c != null)
            {
                if (c.cargar == true)
                {
                    status fr = new status();
                    fr.Show("Cargando Datos");
                    dataGridView1.AutoGenerateColumns = false;
                    dataGridView1.DataSource          = op_clientes.GellAllClientes();
                    this.toolStripStatusLabel1.Text   = dataGridView1.RowCount.ToString();
                }
            }
        }
Exemple #2
0
        private static Entity.conf LoadConf(IDataReader reader)
        {
            conf item = new conf();

            item.tabla  = Convert.ToString(reader["tabla"]);
            item.campo  = Convert.ToString(reader["campo"]);
            item.valor  = Convert.ToString(reader["valor"]);
            item.cargar = Convert.ToBoolean(reader["cform"]);
            return(item);
        }
Exemple #3
0
        //protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
        //{
        //    if ((!this.listView1.Focused)) return base.ProcessCmdKey(ref msg, keyData);
        //    if (keyData != Keys.Enter) return base.ProcessCmdKey(ref msg, keyData);
        //    int i = listView1.SelectedIndices[0];
        //    frmtipoequipos frm = new frmtipoequipos(this.listView1.Items[i].Text);
        //    frm.MdiParent = this.MdiParent;
        //    frm.Show();
        //    return true;
        //}

        private void frmequipos_Load(object sender, EventArgs e)
        {
            IntPtr hmenu = GetSystemMenu(this.Handle, 0);
            int    cnt   = GetMenuItemCount(hmenu);

            // remove 'close' action
            RemoveMenu(hmenu, cnt - 1, MF_DISABLED | MF_BYPOSITION);
            // remove extra menu line
            RemoveMenu(hmenu, cnt - 2, MF_DISABLED | MF_BYPOSITION);
            DrawMenuBar(this.Handle);



            try
            {
                conf c = opconf.GellIdConf("equipos");
                if (c != null)
                {
                    if (c.cargar == true)
                    {
                        status fr = new status();
                        fr.Show("Cargando Datos");
                        dataGridView1.AutoGenerateColumns = false;
                        dataGridView1.DataSource          = op_equipos.GellAllequipos();
                        this.toolStripStatusLabel1.Text   = dataGridView1.RowCount.ToString();
                    }
                }

                splitContainer1.Panel1Collapsed = true;
                string sql = @"SELECT cod FROM tipo_equipo";
                using (MySqlConnection conn = new MySqlConnection(ConfigurationManager.ConnectionStrings["default"].ToString()))
                {
                    conn.Open();
                    MySqlCommand    cmd    = new MySqlCommand(sql, conn);
                    MySqlDataReader reader = cmd.ExecuteReader();
                    if (reader.HasRows == true)
                    {
                        this.listView1.Items.Clear();
                        while (reader.Read())
                        {
                            this.listView1.Items.Add(reader["cod"].ToString(), 6);
                        }
                    }
                }
            }
            catch (MySqlException ex)
            {
                MessageBox.Show("Error de acceso a datos: " + ex.Message.ToString(), Application.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #4
0
 private void toolStripButton6_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(this.toolStripTextBox1.Text))
     {
         conf c = opconf.GellIdConf("proveedores");
         if (c != null)
         {
             if (c.campo == "CODIGO" && c.valor == "C")
             {
                 dataGridView1.DataSource = op_proveedores.GellAllproveedores2(toolStripTextBox1.Text + "%", 1);
             }
             if (c.campo == "CODIGO" && c.valor == "E")
             {
                 dataGridView1.DataSource = op_proveedores.GellAllproveedores2("%" + toolStripTextBox1.Text + "%", 1);
             }
             if (c.campo == "CODIGO" && c.valor == "T")
             {
                 dataGridView1.DataSource = op_proveedores.GellAllproveedores2("%" + toolStripTextBox1.Text, 1);
             }
             if (c.campo == "NOMBRE" && c.valor == "C")
             {
                 dataGridView1.DataSource = op_proveedores.GellAllproveedores2(toolStripTextBox1.Text + "%", 2);
             }
             if (c.campo == "NOMBRE" && c.valor == "E")
             {
                 dataGridView1.DataSource = op_proveedores.GellAllproveedores2("%" + toolStripTextBox1.Text + "%", 2);
             }
             if (c.campo == "NOMBRE" && c.valor == "T")
             {
                 dataGridView1.DataSource = op_proveedores.GellAllproveedores2("%" + toolStripTextBox1.Text, 2);
             }
             if (dataGridView1.RowCount == 0)
             {
                 MessageBox.Show("El parámetro no tiene información", Application.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
         else
         {
             MessageBox.Show("El parámetro no tiene información", Application.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     else
     {
         MessageBox.Show("Por favor digite el parámetro", Application.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
Exemple #5
0
        //функция чтения файла с конфигурациями
        public static void ReadXML()
        {
            SetCn = new ArrayList();

            XmlDocument xd = new XmlDocument();
            xd.Load("data.xml");

            //получаем список всех элементов с тегом "configurations"
            XmlNodeList xl = xd.GetElementsByTagName("configurations");
            foreach (XmlElement itm in xl)
            {
                conf UnConf = new conf();
                UnConf.name = itm.GetAttribute("name");
                UnConf.ip = itm.GetAttribute("ip");
                UnConf.mask = itm.GetAttribute("mask");
                UnConf.shluz = itm.GetAttribute("shluz");
                UnConf.dnsip = itm.GetAttribute("dns");

                SetCn.Add(UnConf);
            }
        }
Exemple #6
0
        private void frmproyectos_Load(object sender, EventArgs e)
        {
            IntPtr hmenu = GetSystemMenu(this.Handle, 0);
            int    cnt   = GetMenuItemCount(hmenu);

            // remove 'close' action
            RemoveMenu(hmenu, cnt - 1, MF_DISABLED | MF_BYPOSITION);
            // remove extra menu line
            RemoveMenu(hmenu, cnt - 2, MF_DISABLED | MF_BYPOSITION);
            DrawMenuBar(this.Handle);

            conf c = opconf.GellIdConf("PROYECTOS");

            if (c != null)
            {
                if (c.cargar == true)
                {
                    status fr = new status();
                    fr.Show("Cargando Datos");
                    dataGridView1.AutoGenerateColumns = false;
                    dataGridView1.DataSource          = op_proyectos.GellAllproyectos();
                    this.toolStripStatusLabel1.Text   = dataGridView1.RowCount.ToString();
                }
            }

            if (!string.IsNullOrEmpty(_id))
            {
                status fr = new status();
                fr.Show("Cargando Datos");
                this.toolStripButton1.Visible          = false;
                this.toolStripButton3.Visible          = false;
                this.toolStripButton6.Visible          = false;
                this.toolStripTextBox1.Visible         = false;
                this.toolStripSeparator2.Visible       = false;
                this.dataGridView1.AutoGenerateColumns = false;
                this.dataGridView1.DataSource          = op_proyectos.GellAllproyectos2(_id, 3);
                this.toolStripStatusLabel1.Text        = dataGridView1.RowCount.ToString();
            }
        }
Exemple #7
0
        public static Entity.conf GellIdConf(string Id)
        {
            conf list = null;

            using (MySqlConnection conn = new MySqlConnection(ConfigurationManager.ConnectionStrings["default"].ToString()))
            {
                conn.Open();
                MySqlCommand cmd = new MySqlCommand("configuracion_tabla", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@tabla", Id);

                MySqlDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows == true)
                {
                    while (reader.Read())
                    {
                        list = LoadConf(reader);
                    }
                }
            }
            return(list);
        }
        public Schenker(string fileNameTXT, string fileLogName)
        {
            conf Config = new conf();
            FileStream fs = new FileStream(fileNameTXT,
                                           FileMode.Open, FileAccess.ReadWrite);
            DataTable docNames = new DataTable();
            docNames.Columns.Add("WZ", typeof(string));
            string pdfName = fileNameTXT.Replace(".txt", ".pdf");

            StreamReader sr = new StreamReader(fs);
            DateTime thisTime = DateTime.Now;
            string year = (thisTime.ToString().Replace(" ", "_").Replace("-", "").Replace(":", "")).Remove(4).Replace("20", "");
            string yearBack = Convert.ToString((Convert.ToInt32(year) - 1));
            string yearNext = Convert.ToString((Convert.ToInt32(year) + 1));
            String[] documents;

            while (!sr.EndOfStream)
            {
                string text1 = sr.ReadLine().Replace(" ", "");
                compilerDocName.All allCompiler = new ocr_wz.compilerDocName.All(text1);
                string text = allCompiler.resultText;
                if (
                    text.Contains("WZ/" + yearBack + "/")
                    || text.Contains("WZ/" + year + "/")
                    || text.Contains("WZ/" + yearNext + "/")
                    || text.Contains("WW" + yearBack + "/")
                    || text.Contains("WW" + year + "/")
                    || text.Contains("WW" + yearNext + "/")
                )
                {
                    compilerDocName.Schenker SchenkerName = new ocr_wz.compilerDocName.Schenker(text);
                    documents = SchenkerName.resultSchenker.Split(',');
                    documents = SchenkerName.resultSchenker.Split(';');

                    foreach (string row in documents)
                    {
                        if (row.Contains("WZ/"))
                        {
                            compilerDocName.Wz WzName = new ocr_wz.compilerDocName.Wz(row);
                            counter.Wz licznikWz = new ocr_wz.counter.Wz(WzName.resultWZ);
                            if (licznikWz.result0 != null)
                            {
                                docNames.Rows.Add(licznikWz.result0);
                            }
                        }
                        else if (row.Contains("WW"))
                        {
                            compilerDocName.Ww WwName = new ocr_wz.compilerDocName.Ww(row);
                            counter.Ww licznikWw = new ocr_wz.counter.Ww(WwName.resultWW);
                            if (licznikWw.result0 != null)
                            {
                                docNames.Rows.Add(licznikWw.result0);
                            }
                        }
                    }
                }
            }
            if (docNames.Rows.Count == 0)
            {
                string docName = pdfName.Replace(Config.inPath + "\\!ocr\\po_ocr\\", "");
                Copy CopyNewName = new Copy(pdfName, "0", docName, fileLogName);
                CopyNewName.CopyOther();
            }
            else
            {
                var UniqueRows = docNames.AsEnumerable().Distinct(DataRowComparer.Default);
                DataTable uniqDocNames = UniqueRows.CopyToDataTable();
                StreamWriter SW;
                SW = File.AppendText(fileLogName);
                SW.WriteLine("Tablica dokumentów:");
                SW.Close();
                foreach (DataRow row in uniqDocNames.Rows)
                {
                    StreamWriter SW1;
                    SW1 = File.AppendText(fileLogName);
                    SW1.WriteLine(row.Field<string>(0));
                    SW1.Close();
                    if (row.Field<string>(0).Contains("WZ_"))
                    {
                        yearDocs WZ = new yearDocs(row.Field<string>(0));
                        WZ.yearWZ();
                        Copy CopyNewName = new Copy(pdfName, WZ.year, row.Field<string>(0), fileLogName);
                        CopyNewName.CopyWZdeliveryDoc();
                    }
                    else if (row.Field<string>(0).Contains("WW"))
                    {
                        yearDocs WW = new yearDocs(row.Field<string>(0));
                        WW.yearWW();
                        Copy CopyNewName = new Copy(pdfName, WW.year, row.Field<string>(0), fileLogName);
                        CopyNewName.CopyWWdeliveryDoc();
                    }
                }
                fs.Close();
            }
        }
Exemple #9
0
    public void save(string filename)
    {
        // Create an instance of the XmlSerializer class;
            // specify the type of object to serialize.
            XmlSerializer serializer = new XmlSerializer(typeof(conf));
            TextWriter writer = new StreamWriter(filename);
            conf po = new conf();
            po = this;

            // Serialize and close the TextWriter.
            serializer.Serialize(writer, po);
            writer.Close();
    }
Exemple #10
0
        public Wz(string fileNameTXT, string fileLogName)
        {
            conf       Config = new conf();
            FileStream fs     = new FileStream(fileNameTXT,
                                               FileMode.Open, FileAccess.ReadWrite);
            DataTable docNames = new DataTable();

            docNames.Columns.Add("WZ", typeof(string));

            StreamReader sr = new StreamReader(fs);

            while (!sr.EndOfStream)
            {
                string text1 = sr.ReadLine().Replace(" ", "");
                compilerDocName.All allCompiler = new ocr_wz.compilerDocName.All(text1);
                string text = allCompiler.resultText;
                if (
                    text.Contains("mówienie") ||
                    (text.Contains("am") && text.Contains("wi") && text.Contains("nie") && text.Contains("AS")) ||
                    text.Contains("ZAS") ||
                    (text.Contains("ze") && text.Contains("wn") && text.Contains("me")) ||
                    (text.Contains("trz") && text.Contains("num")) ||
                    text.Contains("ydanie") ||
                    text.Contains("numer:") ||
                    text.Contains("WZ/")
                    )
                {
                    if (text.Contains("WZ"))
                    {
                        compilerDocName.Wz WzName    = new ocr_wz.compilerDocName.Wz(text);
                        counter.Wz         licznikWz = new ocr_wz.counter.Wz(WzName.resultWZ);
                        if (licznikWz.result0 != null)
                        {
                            docNames.Rows.Add(licznikWz.result0);
                        }
                    }
                    else if (text.Contains("ZAS"))
                    {
                        compilerDocName.Zas ZasName    = new ocr_wz.compilerDocName.Zas(text);
                        counter.Zas         licznikZas = new ocr_wz.counter.Zas(ZasName.resultZas);
                        if (licznikZas.result0 != null)
                        {
                            docNames.Rows.Add(licznikZas.result0);
                        }
                    }
                }
            }
            if (docNames.Rows.Count == 0)
            {
                string docName     = pdfName.Replace(Config.inPath + "\\!ocr\\po_ocr\\", "");
                Copy   CopyNewName = new Copy(pdfName, "0", docName, fileLogName);
                CopyNewName.CopyOther();
            }
            else
            {
                var          UniqueRows   = docNames.AsEnumerable().Distinct(DataRowComparer.Default);
                DataTable    uniqDocNames = UniqueRows.CopyToDataTable();
                StreamWriter SW;
                SW = File.AppendText(fileLogName);
                SW.WriteLine("Tablica dokumentów:");
                SW.Close();
                int ileWZ  = 0;
                int ileZAS = 0;
                foreach (DataRow row in uniqDocNames.Rows)
                {
                    StreamWriter SW1;
                    SW1 = File.AppendText(fileLogName);
                    SW1.WriteLine(row.Field <string>(0));
                    SW1.Close();
                    if (row.Field <string>(0).Contains("WZ_"))
                    {
                        ileWZ++;
                    }
                    else if (row.Field <string>(0).Contains("ZAS_"))
                    {
                        ileZAS++;
                    }
                }
                pdfName = fileNameTXT.Replace(".txt", ".pdf");
                if (ileWZ == ileZAS || ileWZ > ileZAS)
                {
                    foreach (DataRow row in uniqDocNames.Rows)
                    {
                        if (row.Field <string>(0).Contains("WZ_"))
                        {
                            yearDocs WZ = new yearDocs(row.Field <string>(0));
                            WZ.yearWZ();
                            Copy CopyNewName = new Copy(pdfName, WZ.year, row.Field <string>(0), fileLogName);
                            CopyNewName.CopyWZ();
                        }
                    }
                }
                else
                {
                    int tableElements = uniqDocNames.Rows.Count;
                    for (int i = 0; i < tableElements; i++)
                    {
                        string docName = Convert.ToString(uniqDocNames.Rows[i]["WZ"]);
                        if (i == 0 && docName.Contains("WZ_"))
                        {
                            yearDocs readYear = new yearDocs(docName);
                            readYear.yearWZ();
                            Copy CopyNewName = new Copy(pdfName, readYear.year, docName, fileLogName);
                            CopyNewName.CopyWZ();
                        }
                        else if (i == 0 && docName.Contains("ZAS_") && tableElements < 2)
                        {
                            yearDocs readYear = new yearDocs(docName);
                            readYear.yearZas();
                            Copy CopyNewName = new Copy(pdfName, readYear.year, docName, fileLogName);
                            CopyNewName.CopyZAS();
                        }
                        else if (i > 0 && docName.Contains("ZAS_") && (Convert.ToString(uniqDocNames.Rows[i - 1]["WZ"])).Contains("ZAS_"))
                        {
                            yearDocs readYear = new yearDocs(docName);
                            readYear.yearZas();
                            Copy CopyNewName = new Copy(pdfName, readYear.year, docName, fileLogName);
                            CopyNewName.CopyZAS();
                        }
                        else if (i > 0 && docName.Contains("WZ"))
                        {
                            yearDocs readYear = new yearDocs(docName);
                            readYear.yearWZ();
                            Copy CopyNewName = new Copy(pdfName, readYear.year, docName, fileLogName);
                            CopyNewName.CopyWZ();
                        }
                    }
                }
            }
            fs.Close();
        }
Exemple #11
0
        //private Entity.cargos c { get; set; }


        private void button1_Click(object sender, EventArgs e)
        {
            conf car    = new conf();
            int  recibe = 0;

            switch (_id)
            {
            case 1:
                car.tabla  = "CARGOS";
                car.campo  = this.comboBox1.Text;
                car.valor  = criterio2();
                car.cargar = checkBox1.Checked;
                recibe     = opconf.accion(car);
                if (recibe == 1)
                {
                    this.button1.Enabled = false;
                }
                break;

            case 2:
                car.tabla  = "CLIENTES";
                car.campo  = this.comboBox1.Text;
                car.valor  = criterio2();
                car.cargar = checkBox1.Checked;
                recibe     = opconf.accion(car);
                if (recibe == 1)
                {
                    this.button1.Enabled = false;
                }
                break;

            case 3:
                car.tabla  = "EMPLEADOS";
                car.campo  = this.comboBox1.Text;
                car.valor  = criterio2();
                car.cargar = checkBox1.Checked;
                recibe     = opconf.accion(car);
                if (recibe == 1)
                {
                    this.button1.Enabled = false;
                }
                break;

            case 4:
                car.tabla  = "PROVEEDORES";
                car.campo  = this.comboBox1.Text;
                car.valor  = criterio2();
                car.cargar = checkBox1.Checked;
                recibe     = opconf.accion(car);
                if (recibe == 1)
                {
                    this.button1.Enabled = false;
                }
                break;

            case 5:
                car.tabla  = "equipos";
                car.campo  = this.comboBox1.Text;
                car.valor  = criterio2();
                car.cargar = checkBox1.Checked;
                recibe     = opconf.accion(car);
                if (recibe == 1)
                {
                    this.button1.Enabled = false;
                }
                break;

            case 6:
                car.tabla  = "MATERIALES";
                car.campo  = this.comboBox1.Text;
                car.valor  = criterio2();
                car.cargar = checkBox1.Checked;
                recibe     = opconf.accion(car);
                if (recibe == 1)
                {
                    this.button1.Enabled = false;
                }
                break;
            }
        }
Exemple #12
0
        //обновление списка конфигураций
        private void button1_Click(object sender, EventArgs e)
        {
            comboBox2.Items.Clear();
            comboBox2.Text = "";
            ReadXML();
            for (int i = 0; i < SetCn.Count; i++)
            {

                conf tmp = new conf();
                tmp = (conf)SetCn[i];
                comboBox2.Items.Add(tmp.name);
                if (i == 0)
                    comboBox2.SelectedItem = comboBox2.Items[0];
            }
        }
Exemple #13
0
        public Rw(string fileNameTXT, string fileLogName)
        {
            conf       Config = new conf();
            FileStream fs     = new FileStream(fileNameTXT,
                                               FileMode.Open, FileAccess.ReadWrite);
            DataTable docNames = new DataTable();

            docNames.Columns.Add("WZ", typeof(string));
            String[] documents;
            string   pdfName = fileNameTXT.Replace(".txt", ".pdf");

            StreamReader sr = new StreamReader(fs);

            while (!sr.EndOfStream)
            {
                string text = sr.ReadLine().Replace(" ", "");
                if (
                    text.Contains("rk") && text.Contains("us") && text.Contains("LP/") ||
                    text.Contains("Ar") && text.Contains("k") && text.Contains("s")
                    )
                {
                    compilerDocName.Rw RwName = new ocr_wz.compilerDocName.Rw();
                    RwName.RWfirst(text);
                    documents = RwName.resultRW.Split(';');
                    foreach (var document in documents)
                    {
                        if (document.Contains("LP_"))
                        {
                            RwName.LP(document);
                            if (RwName.resultRW != null)
                            {
                                docNames.Rows.Add(RwName.resultRW);
                            }
                        }
                        else if (document.Contains("RW_"))
                        {
                            RwName.RW(document);
                            if (RwName.resultRW != null)
                            {
                                docNames.Rows.Add(RwName.resultRW);
                            }
                        }
                    }
                }
            }
            if (docNames.Rows.Count == 0)
            {
                string docName     = pdfName.Replace(Config.inPath + "\\!ocr\\po_ocr\\", "");
                Copy   CopyNewName = new Copy(pdfName, "0", docName, fileLogName);
                CopyNewName.CopyOther();
            }
            else
            {
                var          UniqueRows   = docNames.AsEnumerable().Distinct(DataRowComparer.Default);
                DataTable    uniqDocNames = UniqueRows.CopyToDataTable();
                StreamWriter SW;
                SW = File.AppendText(fileLogName);
                SW.WriteLine("Tablica dokumentów:");
                SW.Close();
                int rw = 0;
                int lp = 0;

                foreach (DataRow row in uniqDocNames.Rows)
                {
                    StreamWriter SW1;
                    SW1 = File.AppendText(fileLogName);
                    SW1.WriteLine(row.Field <string>(0));
                    SW1.Close();
                    if (row.Field <string>(0).Contains("LP_"))
                    {
                        lp++;
                        yearDocs yearOut = new yearDocs(row.Field <string>(0));
                        yearOut.yearLP();
                        year = yearOut.year;
                    }
                    else if (row.Field <string>(0).Contains("RW_"))
                    {
                        rw++;
                    }
                }

                if (rw == lp || rw > lp)
                {
                    foreach (DataRow row in uniqDocNames.Rows)
                    {
                        if (row.Field <string>(0).Contains("RW_"))
                        {
                            Copy CopyNewName = new Copy(pdfName, year, row.Field <string>(0), fileLogName);
                            CopyNewName.CopyRW();
                        }
                    }
                }
                else
                {
                    foreach (DataRow row in uniqDocNames.Rows)
                    {
                        if (row.Field <string>(0).Contains("LP_"))
                        {
                            Copy CopyNewName = new Copy(pdfName, year, row.Field <string>(0), fileLogName);
                            CopyNewName.CopyRW();
                        }
                    }
                }
                fs.Close();
            }
        }
Exemple #14
0
        public Fv(string fileNameTXT, string fileLogName)
        {
            string     pdfName = fileNameTXT.Replace(".txt", ".pdf");
            conf       Config  = new conf();
            FileStream fs      = new FileStream(fileNameTXT,
                                                FileMode.Open, FileAccess.ReadWrite);
            DataTable docNames = new DataTable();

            docNames.Columns.Add("WZ", typeof(string));

            StreamReader sr = new StreamReader(fs);

            while (!sr.EndOfStream)
            {
                string text1 = sr.ReadLine().Replace(" ", "");
                compilerDocName.All allCompiler = new ocr_wz.compilerDocName.All(text1);
                string text = allCompiler.resultText;
                if (
                    text.Contains("F/") ||
                    (text.Contains("Nu") && text.Contains("dow") && text.Contains("du"))
                    )
                {
                    if (text.Contains("F/"))
                    {
                        compilerDocName.Fv FvName    = new ocr_wz.compilerDocName.Fv(text);
                        counter.Fv         licznikFv = new ocr_wz.counter.Fv(FvName.resultFV);
                        if (licznikFv.result0 != null)
                        {
                            docNames.Rows.Add(licznikFv.result0);
                        }
                    }
                    else if (text.Contains("Nu") && text.Contains("dow") && text.Contains("du"))
                    {
                        compilerDocName.Wz WzName    = new ocr_wz.compilerDocName.Wz(text);
                        counter.Wz         licznikWz = new ocr_wz.counter.Wz(WzName.resultWZ);
                        if (licznikWz.result0 != null)
                        {
                            docNames.Rows.Add(licznikWz.result0);
                        }
                    }
                }
            }
            if (docNames.Rows.Count == 0)
            {
                string docName     = pdfName.Replace(Config.inPath + "\\!ocr\\po_ocr\\", "");
                Copy   CopyNewName = new Copy(pdfName, "0", docName, fileLogName);
                CopyNewName.CopyOther();
            }
            else
            {
                var          UniqueRows   = docNames.AsEnumerable().Distinct(DataRowComparer.Default);
                DataTable    uniqDocNames = UniqueRows.CopyToDataTable();
                StreamWriter SW;
                SW = File.AppendText(fileLogName);
                SW.WriteLine("Tablica dokumentów:");
                SW.Close();
                int ileFV = 0;
                int ileWZ = 0;
                foreach (DataRow row in uniqDocNames.Rows)
                {
                    StreamWriter SW2;
                    SW2 = File.AppendText(fileLogName);
                    SW2.WriteLine(row.Field <string>(0));
                    SW2.Close();
                    string docName = row.Field <string>(0);
                    if (docName.Contains("F_"))
                    {
                        ileFV++;
                    }
                    else if (docName.Contains("WZ_"))
                    {
                        ileWZ++;
                    }
                }
                if (ileFV == ileWZ || ileWZ > ileFV)
                {
                    foreach (DataRow row in uniqDocNames.Rows)
                    {
                        if (row.Field <string>(0).Contains("WZ_"))
                        {
                            yearDocs WZ = new yearDocs(row.Field <string>(0));
                            WZ.yearWZ();
                            Copy CopyNewName = new Copy(pdfName, WZ.year, row.Field <string>(0), fileLogName);
                            CopyNewName.CopyWZFV();
                        }
                    }
                }
                else
                {
                    foreach (DataRow row in uniqDocNames.Rows)
                    {
                        string docName = row.Field <string>(0);
                        if (docName.Contains("F_"))
                        {
                            yearDocs readYear = new yearDocs(docName);
                            readYear.yearFV();
                            Copy CopyNewName = new Copy(pdfName, readYear.year, docName, fileLogName);
                            CopyNewName.CopyFV();
                        }
                    }
                }
                fs.Close();
            }
        }
Exemple #15
0
        public Zas(string fileNameTXT, string fileLogName)
        {
            conf       Config = new conf();
            FileStream fs     = new FileStream(fileNameTXT,
                                               FileMode.Open, FileAccess.ReadWrite);
            DataTable docNames = new DataTable();

            docNames.Columns.Add("WZ", typeof(string));

            try
            {
                StreamReader sr = new StreamReader(fs);
                while (!sr.EndOfStream)
                {
                    string text1 = sr.ReadLine().Replace(" ", "");
                    compilerDocName.All allCompiler = new ocr_wz.compilerDocName.All(text1);
                    string text = allCompiler.resultText;
                    if (
                        text.Contains("mówienie") ||
                        (text.Contains("za") && text.Contains("wie") && text.Contains("mer"))
                        )
                    {
                        if (text.Contains("ZAS"))
                        {
                            compilerDocName.Zas ZasName    = new ocr_wz.compilerDocName.Zas(text);
                            counter.Zas         licznikZas = new ocr_wz.counter.Zas(ZasName.resultZas);
                            if (licznikZas.result0 != null)
                            {
                                docNames.Rows.Add(licznikZas.result0);
                            }
                        }
                    }
                }
                var          UniqueRows   = docNames.AsEnumerable().Distinct(DataRowComparer.Default);
                DataTable    uniqDocNames = UniqueRows.CopyToDataTable();
                StreamWriter SW;
                SW = File.AppendText(fileLogName);
                SW.WriteLine("Tablica dokumentów:");
                SW.Close();
                int ileZAS = 0;
                foreach (DataRow row in uniqDocNames.Rows)
                {
                    StreamWriter SW1;
                    SW1 = File.AppendText(fileLogName);
                    SW1.WriteLine(row.Field <string>(0));
                    SW1.Close();
                    if (row.Field <string>(0).Contains("ZAS_"))
                    {
                        ileZAS++;
                    }
                }
                pdfName = fileNameTXT.Replace(".txt", ".pdf");
                if (ileZAS > 0)
                {
                    foreach (DataRow row in uniqDocNames.Rows)
                    {
                        if (row.Field <string>(0).Contains("ZAS_"))
                        {
                            yearDocs readYear = new yearDocs(Convert.ToString(row.Field <string>(0)));
                            readYear.yearZas();
                            Copy CopyNewName = new Copy(pdfName, readYear.year, row.Field <string>(0), fileLogName);
                            CopyNewName.CopyZAS();
                        }
                    }
                }
                else
                {
                    int    tableElements = uniqDocNames.Rows.Count;
                    string tableRow      = Convert.ToString(uniqDocNames.Rows[0]["WZ"]);
                    for (int i = 0; i < tableElements; i++)
                    {
                        yearDocs readYear = new yearDocs(Convert.ToString(uniqDocNames.Rows[i]["WZ"]));
                        readYear.yearZas();
                        Copy CopyNewName = new Copy(pdfName, readYear.year, Convert.ToString(uniqDocNames.Rows[i]["WZ"]), fileLogName);
                        CopyNewName.CopyZAS();
                    }
                }

                fs.Close();
            }
            catch
            {
                fs.Close();
                string year = "0";
                pdfName = fileNameTXT.Replace(".txt", ".pdf");
                string docName     = pdfName.Replace(Config.inPath + "\\!ocr\\po_ocr\\", "");
                Copy   CopyNewName = new Copy(pdfName, year, docName, fileLogName);
                CopyNewName.CopyOther();
            }
        }