Exemplo n.º 1
0
        void ParsensiPlacingWay(List <NsiFileCashes> nsiFileCashes)
        {
            foreach (var nsiFile in nsiFileCashes)
            {
                string zipPath     = (_nsiSettings44.WorkPath + nsiFile.Full_path);
                string extractPath = (_nsiSettings44.WorkPath + "/extract" + nsiFile.Full_path);

                if (Directory.Exists(extractPath))
                {
                    Directory.Delete(extractPath, true);
                }
                //и создаём её заново
                Directory.CreateDirectory(extractPath);

                if (File.Exists(zipPath))
                {
                    try
                    {
                        using (ZipArchive archive = ZipFile.OpenRead(zipPath))
                            foreach (ZipArchiveEntry entry in archive.Entries)
                            {
                                if (entry.FullName.EndsWith(".xml", StringComparison.OrdinalIgnoreCase))
                                {
                                    entry.ExtractToFile(Path.Combine(extractPath, entry.FullName));
                                    string xml_f_name = entry.FullName;
                                    string xmlin      = (extractPath + "/" + entry.FullName);
                                    _logger.LogInformation("xmlin parse: " + xmlin);
                                    FileInfo infoCheck = new FileInfo(xmlin);
                                    if (infoCheck.Length != 0)
                                    {
                                        using (StreamReader reader = new StreamReader(xmlin, Encoding.UTF8, false))
                                        {
                                            XmlSerializer serializer = new XmlSerializer(typeof(export));

                                            XmlSerializer xmlser  = new XmlSerializer(typeof(export));
                                            export        exportd = xmlser.Deserialize(reader) as export;
                                            //Console.WriteLine($"{exportd.ItemsElementName[0].ToString()}");
                                            //nsiPlacingWayList

                                            exportNsiPlacingWayList NsiPlacingWayList = exportd.Items[0] as exportNsiPlacingWayList;
                                            SavePlacingWay(NsiPlacingWayList.nsiPlacingWay);
                                        }
                                    }
                                }
                            }
                        nsiFile.Status = Status.Processed;
                        _dataServices.UpdateNsiCasheFiles(nsiFile);
                    }
                    catch (Exception ex)
                    {
                        _logger.LogError(ex, ex.Message);
                        nsiFile.Status = Status.Data_Error;
                        _dataServices.UpdateNsiCasheFiles(nsiFile);
                    }
                }

                Directory.Delete(extractPath, true);
            }
        }
Exemplo n.º 2
0
        internal static void Main(string[] args)
        {
            export GOOGLE_APPLICATION_CREDENTIALS = "../CharacterIndex-05b988c7f612.json";

            Character.GetCharInfo();

            Console.WriteLine(Character.PrintCharInfo);
            Console.Read();
        }
Exemplo n.º 3
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Length == 0)
            {
                MessageBox.Show("Выберите файл обмена данными для загрузки", Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            enable_controls(false);

            try
            {
                var exp = new export();

                ExchangeExportData ced = exp.Deserialize(textBox1.Text);

                string file_info = string.Empty;

                /*
                 *     file_info = textBox1.Text + "\r\n";
                 *     file_info += "Версия формата: " + ced.export_version.ToString() + "\r\n";
                 *     file_info += "Обмен из центра: " + ced.from_center.ToString() + "\r\n";
                 *     file_info += "Дата выгрузки данных: " + ced.export_data + "\r\n";
                 *     file_info += "Источник данных: " + ced.SOURCE_ARCHIVE.Rows[0]["NAME_ARCHIVE"].ToString() + "\r\n";
                 */

                if (ced.from_center == 0)
                {
                    do_export_fromlocal(ced);
                }
                else
                {
                    do_export_fromcenter(ced);
                }
            }
            catch (Exception ex)
            {
                add_log(textBox1.Text + ex.Message);
                add_log("Произошла ошибка во время загрузки данных ! Данные файла обмена не загружены" + ex.Message);
            }

            enable_controls(true);
        }
Exemplo n.º 4
0
        void do_export_fromlocal(ExchangeExportData ced)
        {
            var exp = new export();

            ced = exp.Deserialize(textBox1.Text);

            string file_info = string.Empty;

            file_info  = textBox1.Text + "\r\n";
            file_info += "Версия формата: " + ced.export_version.ToString() + "\r\n";
            file_info += "Дата выгрузки данных: " + ced.export_data + "\r\n";
            file_info += "Источник данных: " + ced.SOURCE_ARCHIVE.Rows[0]["NAME_ARCHIVE"].ToString() + "\r\n";
            file_info += "Код источника данных (ID_ARC): " + ced.SOURCE_ARCHIVE.Rows[0]["ID_ARC"].ToString() + "\r\n\r\n";

            string ID_ARC = ced.SOURCE_ARCHIVE.Rows[0]["ID_ARC"].ToString();

            string    sql_text = "";
            DataTable dt       = null;

            if (MessageBox.Show(file_info + "Загрузить файл обмена данными ?", Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }

            add_log(file_info);

            add_log("Кол-во TOWN: " + ced.TOWN.Rows.Count.ToString());
            add_log("Кол-во ORG_DOCS: " + ced.ORG_DOCS.Rows.Count.ToString());
            add_log("Кол-во ORGANIZATION: " + ced.ORGANIZATION.Rows.Count.ToString());
            add_log("Кол-во REBUILD_ORG: " + ced.REBUILD_ORG.Rows.Count.ToString());
            add_log("*****************************************************************");
            add_log("Загрузка TOWN");

            sql_text = "delete from ALL_TOWN where ID_ARC = :ID_ARC";
            sql_text = sql_text.Replace(":ID_ARC", ID_ARC);

            new work_with_oledb().ExecSQL_nonquery(sql_text);

            foreach (DataRow dr in ced.TOWN.Rows)
            {
                sql_text = "insert into ALL_TOWN (ID_REC, ID_PREF_TOWN, ID_COUNTRY, ID_REGION, ID_DISTRICT, TOWN, DT_CHANGE, ID_ARC) " +
                           "values (:ID_REC, :ID_PREF_TOWN, :ID_COUNTRY, :ID_REGION, :ID_DISTRICT, :TOWN, :DT_CHANGE, :ID_ARC)";

                sql_text = sql_text.Replace(":ID_REC", dr["ID"].ToString());
                sql_text = sql_text.Replace(":ID_PREF_TOWN", dr["ID_PREF_TOWN"].ToString().Length == 0 ? "NULL" : dr["ID_PREF_TOWN"].ToString());
                sql_text = sql_text.Replace(":ID_COUNTRY", dr["ID_COUNTRY"].ToString().Length == 0 ? "NULL" : dr["ID_COUNTRY"].ToString());
                sql_text = sql_text.Replace(":ID_REGION", dr["ID_REGION"].ToString().Length == 0 ? "NULL" : dr["ID_REGION"].ToString());
                sql_text = sql_text.Replace(":ID_DISTRICT", dr["ID_DISTRICT"].ToString().Length == 0 ? "NULL" : dr["ID_DISTRICT"].ToString());
                sql_text = sql_text.Replace(":TOWN", dr["TOWN"].ToString().Length == 0 ? "NULL" : "'" + dr["TOWN"].ToString() + "'");
                sql_text = sql_text.Replace(":DT_CHANGE", "GETDATE()");
                sql_text = sql_text.Replace(":ID_ARC", ID_ARC);

                new work_with_oledb().ExecSQL_nonquery(sql_text);
            }

            add_log("Загрузка ORG_DOCS");

            sql_text = "delete from ALL_ORG_DOCS where ID_ARC = :ID_ARC";
            sql_text = sql_text.Replace(":ID_ARC", ID_ARC);

            new work_with_oledb().ExecSQL_nonquery(sql_text);

            foreach (DataRow dr in ced.ORG_DOCS.Rows)
            {
                sql_text = "insert into ALL_ORG_DOCS (ID_ORG, ID_DOCS, ID_CHILD_ORG, BEGIN_DATE, END_DATE, DT_CHANGE, DT_IMPORT, ADD_INFO, CHAR_DATE, ID_ARC, ID_REC) " +
                           "values (:ID_ORG, :ID_DOCS, :ID_CHILD_ORG, :BEGIN_DATE, :END_DATE, :DT_CHANGE, :DT_IMPORT, :ADD_INFO, :CHAR_DATE, :ID_ARC, :ID_REC)";

                sql_text = sql_text.Replace(":ID_ORG", dr["ID_ORG"].ToString().Length == 0 ? "NULL" : dr["ID_ORG"].ToString());
                sql_text = sql_text.Replace(":ID_DOCS", dr["ID_DOCS"].ToString().Length == 0 ? "NULL" : dr["ID_DOCS"].ToString());
                sql_text = sql_text.Replace(":ID_CHILD_ORG", dr["ID_CHILD_ORG"].ToString().Length == 0 ? "NULL" : dr["ID_CHILD_ORG"].ToString());
                sql_text = sql_text.Replace(":BEGIN_DATE", dr["BEGIN_DATE"].ToString().Length == 0 ? "NULL" : "'" + dr["BEGIN_DATE"].ToString() + "'");
                sql_text = sql_text.Replace(":END_DATE", dr["END_DATE"].ToString().Length == 0 ? "NULL" : "'" + dr["END_DATE"].ToString() + "'");
                sql_text = sql_text.Replace(":DT_CHANGE", "GETDATE()");
                sql_text = sql_text.Replace(":DT_IMPORT", "GETDATE()");
                sql_text = sql_text.Replace(":ADD_INFO", dr["ADD_INFO"].ToString().Length == 0 ? "NULL" : "'" + dr["ADD_INFO"].ToString() + "'");
                sql_text = sql_text.Replace(":CHAR_DATE", dr["CHAR_DATE"].ToString().Length == 0 ? "NULL" : "'" + dr["CHAR_DATE"].ToString() + "'");
                sql_text = sql_text.Replace(":ID_ARC", ID_ARC);
                sql_text = sql_text.Replace(":ID_REC", dr["ID"].ToString());

                new work_with_oledb().ExecSQL_nonquery(sql_text);
            }

            add_log("Загрузка ORGANIZATION");

            sql_text = "delete from ALL_ORGANIZATION where ID_ARC = :ID_ARC";
            sql_text = sql_text.Replace(":ID_ARC", ID_ARC);

            new work_with_oledb().ExecSQL_nonquery(sql_text);

            foreach (DataRow dr in ced.ORGANIZATION.Rows)
            {
                sql_text = "insert into ALL_ORGANIZATION (ID_STAT_ORG, ID_DISTRICT, ID_TOWN, ID_PREF_TOWN, FL_OBJECT_NAME, SH_OBJECT_NAME, POSTINDEX, STREET, HS_NUMB, CORPUS, FLAT, PHONE, EMAIL, LEADER, LEADER_POS, DT_CHANGE, DT_IMPORT, ORG_NOTE, FOND_NUMBER, ID_ARC, ID_REC, IS_DELETED) " +
                           "values (:ID_STAT_ORG, :ID_DISTRICT, :ID_TOWN, :ID_PREF_TOWN, :FL_OBJECT_NAME, :SH_OBJECT_NAME, :POSTINDEX, :STREET, :HS_NUMB, :CORPUS, :FLAT, :PHONE, :EMAIL, :LEADER, :LEADER_POS, :DT_CHANGE, :DT_IMPORT, :ORG_NOTE, :FOND_NUMBER, :ID_ARC, :ID_REC, :IS_DELETED)";

                sql_text = sql_text.Replace(":ID_STAT_ORG", dr["ID_STAT_ORG"].ToString().Length == 0 ? "NULL" : dr["ID_STAT_ORG"].ToString());
                sql_text = sql_text.Replace(":ID_DISTRICT", dr["ID_DISTRICT"].ToString().Length == 0 ? "NULL" : dr["ID_DISTRICT"].ToString());
                sql_text = sql_text.Replace(":ID_TOWN", dr["ID_TOWN"].ToString().Length == 0 ? "NULL" : dr["ID_TOWN"].ToString());
                sql_text = sql_text.Replace(":ID_PREF_TOWN", dr["ID_PREF_TOWN"].ToString().Length == 0 ? "NULL" : dr["ID_PREF_TOWN"].ToString());
                sql_text = sql_text.Replace(":FL_OBJECT_NAME", dr["FL_OBJECT_NAME"].ToString().Length == 0 ? "NULL" : "'" + dr["FL_OBJECT_NAME"].ToString() + "'");
                sql_text = sql_text.Replace(":SH_OBJECT_NAME", dr["SH_OBJECT_NAME"].ToString().Length == 0 ? "NULL" : "'" + dr["SH_OBJECT_NAME"].ToString() + "'");
                sql_text = sql_text.Replace(":POSTINDEX", dr["POSTINDEX"].ToString().Length == 0 ? "NULL" : "'" + dr["POSTINDEX"].ToString() + "'");
                sql_text = sql_text.Replace(":STREET", dr["STREET"].ToString().Length == 0 ? "NULL" : "'" + dr["STREET"].ToString() + "'");
                sql_text = sql_text.Replace(":HS_NUMB", dr["HS_NUMB"].ToString().Length == 0 ? "NULL" : "'" + dr["HS_NUMB"].ToString() + "'");
                sql_text = sql_text.Replace(":CORPUS", dr["CORPUS"].ToString().Length == 0 ? "NULL" : "'" + dr["CORPUS"].ToString() + "'");
                sql_text = sql_text.Replace(":FLAT", dr["FLAT"].ToString().Length == 0 ? "NULL" : "'" + dr["FLAT"].ToString() + "'");
                sql_text = sql_text.Replace(":PHONE", dr["PHONE"].ToString().Length == 0 ? "NULL" : "'" + dr["PHONE"].ToString() + "'");
                sql_text = sql_text.Replace(":EMAIL", dr["EMAIL"].ToString().Length == 0 ? "NULL" : "'" + dr["EMAIL"].ToString() + "'");
                sql_text = sql_text.Replace(":LEADER_POS", dr["LEADER_POS"].ToString().Length == 0 ? "NULL" : "'" + dr["LEADER_POS"].ToString() + "'");
                sql_text = sql_text.Replace(":LEADER", dr["LEADER"].ToString().Length == 0 ? "NULL" : "'" + dr["LEADER"].ToString() + "'");
                sql_text = sql_text.Replace(":DT_CHANGE", "GETDATE()");
                sql_text = sql_text.Replace(":DT_IMPORT", "GETDATE()");
                sql_text = sql_text.Replace(":ORG_NOTE", dr["ORG_NOTE"].ToString().Length == 0 ? "NULL" : "'" + dr["ORG_NOTE"].ToString() + "'");
                sql_text = sql_text.Replace(":FOND_NUMBER", dr["FOND_NUMBER"].ToString().Length == 0 ? "NULL" : "'" + dr["FOND_NUMBER"].ToString() + "'");
                sql_text = sql_text.Replace(":ID_ARC", ID_ARC);
                sql_text = sql_text.Replace(":ID_REC", dr["ID"].ToString());
                sql_text = sql_text.Replace(":IS_DELETED", dr["IS_DELETED"].ToString().Length == 0 ? "NULL" : dr["IS_DELETED"].ToString());

                new work_with_oledb().ExecSQL_nonquery(sql_text);
            }

            add_log("Загрузка REBUILD_ORG");

            sql_text = "delete from ALL_REBUILD_ORG where ID_ARC = :ID_ARC";
            sql_text = sql_text.Replace(":ID_ARC", ID_ARC);

            new work_with_oledb().ExecSQL_nonquery(sql_text);

            foreach (DataRow dr in ced.REBUILD_ORG.Rows)
            {
                sql_text = "insert into ALL_REBUILD_ORG (ID_ORG, ID_REBUILD, DT_REBUILD, ADD_INFO, DT_CHANGE, DT_IMPORT, ID_ARC, ID_REC ) " +
                           "values (:ID_ORG, :ID_REBUILD, :DT_REBUILD, :ADD_INFO, :DT_CHANGE, :DT_IMPORT, :ID_ARC, :ID_REC)";

                sql_text = sql_text.Replace(":ID_ORG", dr["ID_ORG"].ToString().Length == 0 ? "NULL" : dr["ID_ORG"].ToString());
                sql_text = sql_text.Replace(":ID_REBUILD", dr["ID_REBUILD"].ToString().Length == 0 ? "NULL" : dr["ID_REBUILD"].ToString());
                sql_text = sql_text.Replace(":DT_REBUILD", dr["DT_REBUILD"].ToString().Length == 0 ? "NULL" : "'" + dr["DT_REBUILD"].ToString() + "'");
                sql_text = sql_text.Replace(":ADD_INFO", dr["ADD_INFO"].ToString().Length == 0 ? "NULL" : "'" + dr["ADD_INFO"].ToString() + "'");
                sql_text = sql_text.Replace(":DT_CHANGE", "GETDATE()");
                sql_text = sql_text.Replace(":DT_IMPORT", "GETDATE()");
                sql_text = sql_text.Replace(":ID_ARC", ID_ARC);
                sql_text = sql_text.Replace(":ID_REC", dr["ID"].ToString());

                new work_with_oledb().ExecSQL_nonquery(sql_text);
            }

            add_log("*****************************************************************");
            add_log("Загрузка успешно завершена !");
        }
Exemplo n.º 5
0
        private void btn_Export_Click(object sender, EventArgs e)
        {
            export ex = new export();

            ex.excel(dgvterminal, "Terminal_information");
        }
Exemplo n.º 6
0
        private void btn_Export_Click(object sender, EventArgs e)
        {
            export ex = new export();

            ex.excel(dgvclass, "Class_information");
        }
Exemplo n.º 7
0
        private void btn_Export_Click(object sender, EventArgs e)
        {
            export ex = new export();

            ex.excel(dgvsubject_teacher, "Subject_Teacher");
        }
Exemplo n.º 8
0
        private void btn_Export_Click(object sender, EventArgs e)
        {
            export ex = new export();

            ex.excel(dgvmember, "Member_Information");
        }
Exemplo n.º 9
0
        void ParseNsiOrganization(List <NsiFileCashes> nsiFileCashes)
        {
            //foreach (var nsiFile in nsiFileCashes)
            Parallel.ForEach(nsiFileCashes,
                             new ParallelOptions {
                MaxDegreeOfParallelism = _nsiSettings44.Parallels
            },
                             (nsiFile) =>
            {
                string zipPath     = (_nsiSettings44.WorkPath + nsiFile.Full_path);
                string extractPath = (_nsiSettings44.WorkPath + "/extract" + nsiFile.Full_path);
                //zipPath= @"C:\Work2\Fz44\fcs_nsi\nsiOrganization\nsiOrganizationList_all_20201227000000_174.xml.zip";
                if (Directory.Exists(extractPath))
                {
                    Directory.Delete(extractPath, true);
                }
                //и создаём её заново
                Directory.CreateDirectory(extractPath);
                if (File.Exists(zipPath))
                {
                    try
                    {
                        using (ZipArchive archive = ZipFile.OpenRead(zipPath))
                            foreach (ZipArchiveEntry entry in archive.Entries)
                            {
                                if (entry.FullName.EndsWith(".xml", StringComparison.OrdinalIgnoreCase))
                                {
                                    entry.ExtractToFile(Path.Combine(extractPath, entry.FullName));
                                    string xml_f_name = entry.FullName;
                                    string xmlin      = (extractPath + "/" + entry.FullName);
                                    _logger.LogInformation("xmlin parse: " + xmlin);

                                    FileInfo infoCheck = new FileInfo(xmlin);
                                    if (infoCheck.Length != 0)
                                    {
                                        using (StreamReader reader = new StreamReader(xmlin, Encoding.UTF8, false))
                                        {
                                            XmlSerializer serializer = new XmlSerializer(typeof(export));

                                            XmlSerializer xmlser = new XmlSerializer(typeof(export));
                                            export exportd       = xmlser.Deserialize(reader) as export;

                                            exportNsiOrganizationList nsiOrganizationList = exportd.Items[0] as exportNsiOrganizationList;

                                            _logger.LogInformation($"Поступило в обработку {nsiOrganizationList.nsiOrganization.Length} организаций");
                                            ParseNsiOrganizationList(nsiOrganizationList.nsiOrganization);
                                        }
                                    }
                                }
                            }
                        nsiFile.Status = Status.Processed;
                        _dataServices.UpdateNsiCasheFiles(nsiFile);
                    }
                    catch (Exception ex)
                    {
                        _logger.LogError(ex, ex.Message);
                        //nsiFile.Status = Status.Data_Error;
                        //_dataServices.UpdateCasheFiles(nsiFile);

                        //string[] paths = new string[] { @"C:\Work2\Fz44\", "error", nsiFile.BaseDir, nsiFile.Dirtype};
                        //string fullPath = Path.Combine(paths);
                        //Console.WriteLine(fullPath);

                        string[] paths  = { _nsiSettings44.WorkPath, @"error", nsiFile.BaseDir, nsiFile.Dirtype };
                        string fullPath = Path.Combine(paths);
                        Console.WriteLine(fullPath);


                        string errorPath = (_nsiSettings44.WorkPath + "error" + nsiFile.BaseDir + nsiFile.Dirtype);
                        if (!Directory.Exists(fullPath))
                        {
                            Directory.CreateDirectory(fullPath);
                        }

                        errorPath = (errorPath + nsiFile.Zip_file);

                        File.Copy(zipPath, errorPath);
                    }
                }

                Directory.Delete(extractPath, true);
            });
        }
Exemplo n.º 10
0
        void ParseContracts(List <FileCashes> FileCashes)
        {
            Parallel.ForEach(FileCashes,
                             new ParallelOptions {
                MaxDegreeOfParallelism = _fzSettings44.Parallels
            },
                             (nFile) =>
                             //foreach (var nFile in FileCashes)
            {
                string zipPath     = (_fzSettings44.WorkPath + nFile.Full_path);
                string extractPath = (_fzSettings44.WorkPath + "/extract" + nFile.Full_path);
                var contracts      = new List <Contracts>();

                if (Directory.Exists(extractPath))
                {
                    Directory.Delete(extractPath, true);
                }
                //и создаём её заново
                Directory.CreateDirectory(extractPath);

                if (File.Exists(zipPath))
                {
                    using (ZipArchive archive = ZipFile.OpenRead(zipPath))

                        foreach (ZipArchiveEntry entry in archive.Entries)
                        {
                            if (entry.FullName.EndsWith(".xml", StringComparison.OrdinalIgnoreCase))
                            {
                                entry.ExtractToFile(Path.Combine(extractPath, entry.FullName));
                                string xml_f_name = entry.FullName;
                                string xmlin      = (extractPath + "/" + entry.FullName);
                                _logger.LogInformation("xmlin parse: " + xmlin);

                                FileInfo infoCheck = new FileInfo(xmlin);
                                if (infoCheck.Length != 0)
                                {
                                    try
                                    {
                                        string read_xml_text;
                                        using (var streamReader = new StreamReader(xmlin, Encoding.UTF8, false))
                                        {
                                            read_xml_text = streamReader.ReadToEnd();
                                        }

                                        var strBuilder = new StringBuilder();
                                        using (var hash = SHA256.Create())
                                        {
                                            //Getting hashed byte array
                                            var result = hash.ComputeHash(Encoding.UTF8.GetBytes(read_xml_text));
                                            foreach (var b in result)
                                            {
                                                strBuilder.Append(b.ToString("x2")); //Byte as hexadecimal format
                                            }
                                        }

                                        var hashstr = strBuilder.ToString();

                                        //Console.WriteLine($"{hashstr}");

                                        using (StreamReader reader = new StreamReader(xmlin, Encoding.UTF8, false))
                                        {
                                            XmlSerializer serializer = new XmlSerializer(typeof(export));

                                            XmlSerializer xmlser = new XmlSerializer(typeof(export));
                                            export exportd       = xmlser.Deserialize(reader) as export;
                                            //Console.WriteLine($"{exportd.ItemsElementName[0].ToString()}");


                                            var settings = new JsonSerializerSettings()
                                            {
                                                Formatting       = Newtonsoft.Json.Formatting.Indented,
                                                TypeNameHandling = TypeNameHandling.Auto
                                            };

                                            switch (exportd.ItemsElementName[0].ToString())
                                            {
                                            case "contract":     //contract;zfcs_contract2015Type - Информация (проект информации) о заключенном контракте;
                                                {
                                                    zfcs_contract2015Type contract = exportd.Items[0] as zfcs_contract2015Type;
                                                    string unf_json = JsonConvert.SerializeObject(contract);

                                                    var fcontract = new Contracts();

                                                    //fscn.Wname = "";
                                                    fcontract.Contract_num = contract.regNum;
                                                    //fcontract.Purchase_num = contract.foundation.Item
                                                    //zfcs_contract2015TypeFoundationOosOrderOrder tt = contract.foundation.Item as zfcs_contract2015TypeFoundationOosOrderOrder;
                                                    fcontract.R_body        = unf_json;
                                                    fcontract.Xml_body      = read_xml_text;
                                                    fcontract.Hash          = hashstr;
                                                    fcontract.Zip_file      = nFile.Full_path;
                                                    fcontract.File_name     = entry.FullName;
                                                    fcontract.Fz_type       = 44;
                                                    fcontract.PublishDate   = contract.publishDate;
                                                    fcontract.Type_contract = exportd.Items[0].GetType().Name;
                                                    contracts.Add(fcontract);
                                                    //_dataServices.SaveNotification(notifications);
                                                    break;
                                                }

                                            case "contractCancel":     //contractCancel;zfcs_contractCancel2015Type - Информация об анулировании контракта;
                                                {
                                                    zfcs_contractCancel2015Type contractCancel = exportd.Items[0] as zfcs_contractCancel2015Type;
                                                    string unf_json = JsonConvert.SerializeObject(contractCancel);

                                                    var fcontract = new Contracts();

                                                    //fscn.Wname = "";
                                                    fcontract.Contract_num  = contractCancel.regNum;
                                                    fcontract.R_body        = unf_json;
                                                    fcontract.Xml_body      = read_xml_text;
                                                    fcontract.Hash          = hashstr;
                                                    fcontract.Zip_file      = nFile.Full_path;
                                                    fcontract.File_name     = entry.FullName;
                                                    fcontract.Fz_type       = 44;
                                                    fcontract.PublishDate   = contractCancel.publishDate;
                                                    fcontract.Type_contract = exportd.Items[0].GetType().Name;
                                                    contracts.Add(fcontract);
                                                    //_dataServices.SaveNotification(notifications);
                                                    break;
                                                }

                                            case "contractProcedure":     //contractProcedure;zfcs_contractProcedure2015Type - Информация об исполнении (расторжении) контракта;
                                                {
                                                    zfcs_contractProcedure2015Type contractProcedure = exportd.Items[0] as zfcs_contractProcedure2015Type;
                                                    string unf_json = JsonConvert.SerializeObject(contractProcedure);

                                                    var fcontract = new Contracts();

                                                    //fscn.Wname = "";
                                                    fcontract.Contract_num  = contractProcedure.regNum;
                                                    fcontract.R_body        = unf_json;
                                                    fcontract.Xml_body      = read_xml_text;
                                                    fcontract.Hash          = hashstr;
                                                    fcontract.Zip_file      = nFile.Full_path;
                                                    fcontract.File_name     = entry.FullName;
                                                    fcontract.Fz_type       = 44;
                                                    fcontract.PublishDate   = contractProcedure.publishDate;
                                                    fcontract.Type_contract = exportd.Items[0].GetType().Name;
                                                    contracts.Add(fcontract);
                                                    //_dataServices.SaveNotification(notifications);
                                                    break;
                                                }

                                            case "contractProcedureCancel":     //contractProcedureCancel;zfcs_contractProcedureCancel2015Type - Сведения об отмене информации об исполнении (расторжении) контракта;
                                                {
                                                    zfcs_contractProcedureCancel2015Type contractProcedureCancel = exportd.Items[0] as zfcs_contractProcedureCancel2015Type;
                                                    string unf_json = JsonConvert.SerializeObject(contractProcedureCancel);

                                                    var fcontract = new Contracts();

                                                    //fscn.Wname = "";
                                                    fcontract.Contract_num = contractProcedureCancel.regNum;
                                                    fcontract.R_body       = unf_json;
                                                    fcontract.Xml_body     = read_xml_text;
                                                    fcontract.Hash         = hashstr;
                                                    fcontract.Zip_file     = nFile.Full_path;
                                                    fcontract.File_name    = entry.FullName;
                                                    fcontract.Fz_type      = 44;
                                                    //fcontract.PublishDate = contractProcedureCancel.;
                                                    fcontract.Type_contract = exportd.Items[0].GetType().Name;
                                                    contracts.Add(fcontract);
                                                    //_dataServices.SaveNotification(notifications);
                                                    break;
                                                }

                                            default:
                                                {
                                                    if (exportd.Items.Length > 1)
                                                    {
                                                        Console.WriteLine("More one");
                                                        _logger.LogWarning($"More then one Items in file: {infoCheck.FullName} ");
                                                    }
                                                    string exp_json = JsonConvert.SerializeObject(exportd);
                                                    var EData       = JsonConvert.DeserializeObject <export>(exp_json);
                                                    string eltype   = $"{exportd.ItemsElementName[0].ToString()};{exportd.Items[0].GetType().Name}";
                                                    string fnel     = $"{exportd.ItemsElementName[0].ToString()}";

                                                    using (StreamWriter sw1 = new StreamWriter(@$ "D:\\FZ\\Types44\\Contracts\\{fnel}", true, System.Text.Encoding.Default))
                                                    {
                                                        sw1.WriteLine(eltype);
                                                    };


                                                    break;
                                                }
                                            }


                                            //#if true && DEBUG
                                            //                                            var json = JsonConvert.SerializeObject(exportd.item);
                                            //#endif
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        _logger.LogError(ex, "Error parse");
                                        _logger.LogError(ex, ex.Message);
                                        string errfile = (_commonSettings.DebugPath + nFile.Full_path);
                                        if (!Directory.Exists(errfile))
                                        {
                                            Directory.CreateDirectory(errfile);
                                        }
                                        System.IO.File.Copy(xmlin, _commonSettings.DebugPath + nFile.Full_path + '/' + entry.FullName, true);
                                    }
                                }
                            }
                        }
                }


                Console.WriteLine($"Всего добавляется записей Contracts в БД: {contracts.Count}");
                _dataServices.SaveContracts(contracts);
                nFile.Status = Status.Processed;
                _dataServices.UpdateCasheFiles(nFile);

                Directory.Delete(extractPath, true);
            });
        }
Exemplo n.º 11
0
        private void btn_Export_Click(object sender, EventArgs e)
        {
            export ex = new export();

            ex.excel(dgvstudent, "student");
        }
Exemplo n.º 12
0
        private void loadExportTable(Process process, uint exportTableAddress, uint length, uint baseAddress, PEOptHeader optHeader, List<section> sections)
        {
          // Read in the first _IMAGE_EXPORT_DIRECTORY structure
          byte[] export_directory_rawData = MemoryFunctions.ReadMemory(process, exportTableAddress, (uint)Marshal.SizeOf(typeof(_IMAGE_EXPORT_DIRECTORY)));
          _IMAGE_EXPORT_DIRECTORY export_directory = (_IMAGE_EXPORT_DIRECTORY)MemoryFunctions.RawDataToObject(ref export_directory_rawData, typeof(_IMAGE_EXPORT_DIRECTORY));
          exports = new Hashtable(20);

          UInt64 functionNameArray = (UInt64)export_directory.AddressOfNames + address;
          string exportName = MemoryFunctions.ReadString(process, (UInt64)export_directory.Name + address, MemoryFunctions.STRING_TYPE.ascii);
          UInt64 functionOrdinalArray = (UInt64)export_directory.AddressOfNameOrdinal + address;
          UInt64 functionAddressArray = (UInt64)export_directory.AddressOfFunctions + address;
          for (int i = 0; i < export_directory.NumberOfNames; i++)
          {
              int ordinal_relative = (int)MemoryFunctions.ReadMemoryUShort(process, functionOrdinalArray + (UInt64)i * 2);
              int ordinal = ordinal_relative + (int)export_directory.Base;

              if (ordinal_relative < export_directory.NumberOfFunctions)
              {
                  // Continue with importing this function
                  string name = "";
                  if (i < export_directory.NumberOfNames)
                      name = MemoryFunctions.ReadString(process, (UInt64)MemoryFunctions.ReadMemoryDword(process, functionNameArray + (UInt64)i * 4) + address, MemoryFunctions.STRING_TYPE.ascii);
                  else
                      name = "oridinal" + ordinal.ToString();
                  
                  // Lookup the function rva now
                  try
                  {
                      UInt64 offset = (UInt64)MemoryFunctions.ReadMemoryDword(process, functionAddressArray + (UInt64)ordinal_relative * 4);
                      
                      // Check to see if this is a forwarded export
                      if (offset < optHeader.DataDirectory1_export.VirtualAddress ||
                          offset > optHeader.DataDirectory1_export.VirtualAddress + optHeader.DataDirectory1_export.Size)
                      {
                          // Lookup privilege of heap to confirm it requests execute privileges. We only want to list exported functions, not variables.
                          foreach (section exp in sections)
                          {
                              if (exp.Contains(offset))
                              {
                                  if (exp.IsExecutable())
                                  {
                                      // Add this exported function
                                      export new_export = new export(offset + address,
                                                          name,
                                                          ordinal);

                                      exports.Add(name.ToLower(), new_export);
                                  }
                                  break;
                              }
                          }
                      }
                      else
                      {
                          // Forwarded export. Ignore it.
                      }
                  }
                  catch (Exception e)
                  {
                      Console.WriteLine("Warning, failed to parse PE header export directory entry for name '" + name + "'.");
                  }
              }
          }
      }
Exemplo n.º 13
0
        private void btn_Export_Click(object sender, EventArgs e)
        {
            export ex = new export();

            ex.excel(dgvbook, "Book_information");
        }