Example #1
0
        private void AddInfo()
        {
            DBScanInfo db = new DBScanInfo();

            PackageList.Add(Package);
            Package = "";
            string AllPackage = "";

            foreach (string s in PackageList)
            {
                AllPackage += s;
            }
            db.InsertUploadInfo(this.Year.ToString(), this.Login, AllPackage, this.IDZ, PDF, PIN);
            try
            {
                db.InsertPackage(PackageList, this.PIN, this.Year);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            db.BuildAndInsertHyperLink(this.PIN, this.Year.ToString());

            fp.Close();
            this.Enabled = true;
            MessageBox.Show("Привязка успешно завершена!", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Close();
        }
Example #2
0
        public fPreviewPDF(int IDZ_, string selectedYear, string fPDF_, string PIN_, string login_)
        {
            InitializeComponent();
            this.IDZ = IDZ_;
            this.fPDF = new FileInfo(fPDF_);
            this.PIN = PIN_;
            this.Login = login_;
            DBScanInfo db = new DBScanInfo();

            mTitle = db.GetTitleByIDZ(this.IDZ);
            label3.Text += mTitle;
            label4.Text += selectedYear + ". Выбранный PDF-файл: " +fPDF.Name;

            this.Year = int.Parse(selectedYear);

            ThreadPool.QueueUserWorkItem(new WaitCallback(EndlessProc));

            //получаем список номеров выбранного издания и года
            //NumberFolderList = GetNumberFolderList();

            //comboBox1.Items.AddRange(NumberFolderList.ToArray());
            //comboBox1.SelectedIndex = 0;
            /// <summary>
            /// Метод настраивающий просмотр первых 10 страниц выбранного номера
            /// </summary>
            /// <param name="msg"></param>            /// <exception cref="System.FileNotFoundException">Thrown when files in Temp Storage are not found</exception>
            //SetupViewing();

            SetupPreview();
            //this.Controls.Remove(rp);
            //fWait.Close();
            panel1.Focus();
            done = true;
        }
Example #3
0
        public fPreview(int IDZ_, string FolderYear_,string path_,string selectedYear,string PIN_,string login_)
        {
            InitializeComponent();
            this.IDZ = IDZ_;
            //this.Login = Login_;
            this.FolderYear = FolderYear_;
            this.YearPath = path_;
            this.PIN = PIN_;
            this.Login = login_;
            DBScanInfo db = new DBScanInfo();

            mTitle = db.GetTitleByIDZ(this.IDZ);
            if (!db.IfExistsYearByIDZandFolderYear(this.IDZ, FolderYear))
            {
                throw new Exception("В базе не найден год, соответствующий названию выбранной папки!");
            }
            label3.Text += mTitle;
            label4.Text += FolderYear;

            //проверяем  есть ли такой год для выбранного издания.
            int year = 0;
            if (FolderYear.Length != 4)
            {
                MessageBox.Show("Неверный формат года: " + FolderYear);
                Environment.Exit(0);
            }
            if (!int.TryParse(FolderYear, out year))
            {
                MessageBox.Show("Неверный формат года: " + FolderYear);
                Environment.Exit(0);
            }
            this.Year = year;

            ThreadPool.QueueUserWorkItem(new WaitCallback(EndlessProc));

            //получаем список номеров выбранного издания и года
            NumberFolderList = GetNumberFolderList();

            comboBox1.Items.AddRange(NumberFolderList.ToArray());
            comboBox1.SelectedIndex = 0;
            /// <summary>
            /// Метод настраивающий просмотр первых 10 страниц выбранного номера
            /// </summary>
            /// <param name="msg"></param>            /// <exception cref="System.FileNotFoundException">Thrown when files in Temp Storage are not found</exception>
            //SetupViewing();

            SetupPreview();
            //this.Controls.Remove(rp);
            //fWait.Close();
            panel1.Focus();
            done = true;
        }
Example #4
0
        private void button5_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Продолжить?", "Внимание!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dr == DialogResult.No)
            {
                return;
            }
            string     store_ip                 = XmlConnections.GetConnection("/Connections/store_ip");
            string     sTargetConnect           = @"\\" + store_ip + @"\BookAddInf\PERIOD\";
            string     sTarget                  = @"\\" + store_ip + @"\BookAddInf\PERIOD\";
            string     sTargetConnectBookAddInf = @"\\" + store_ip + @"\BookAddInf";
            DBScanInfo db = new DBScanInfo();

            Package = "";

            int Number = 1;
            int Total  = new PdfReader(fPDF.FullName).NumberOfPages;

            fp           = new fProgress(Total);
            this.Enabled = false;
            fp.Show();
            Application.DoEvents();

            //преобразовать и скопиировать все изображения номера
            //int Total = new PdfReader(fPDF.FullName).NumberOfPages;
            //fp.ResetProgress(Total, Number, Total);
            try
            {
                CopyPDFToTarget(store_ip, sTarget, fPDF.DirectoryName, fPDF, Number, Total, fp, sTargetConnectBookAddInf);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Произошла ошибка: " + ex.Message + ". Попробуйте еще раз!", "Внимание!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                fp.Close();
                this.Enabled = true;
                return;
            }
        }
Example #5
0
        public fPreviewPDF(int IDZ_, string selectedYear, string fPDF_, string PIN_, string login_)
        {
            InitializeComponent();
            this.IDZ   = IDZ_;
            this.fPDF  = new FileInfo(fPDF_);
            this.PIN   = PIN_;
            this.Login = login_;
            DBScanInfo db = new DBScanInfo();

            mTitle       = db.GetTitleByIDZ(this.IDZ);
            label3.Text += mTitle;
            label4.Text += selectedYear + ". Выбранный PDF-файл: " + fPDF.Name;


            this.Year = int.Parse(selectedYear);


            ThreadPool.QueueUserWorkItem(new WaitCallback(EndlessProc));


            //получаем список номеров выбранного издания и года
            //NumberFolderList = GetNumberFolderList();

            //comboBox1.Items.AddRange(NumberFolderList.ToArray());
            //comboBox1.SelectedIndex = 0;
            /// <summary>
            /// Метод настраивающий просмотр первых 10 страниц выбранного номера
            /// </summary>
            /// <param name="msg"></param>            /// <exception cref="System.FileNotFoundException">Thrown when files in Temp Storage are not found</exception>
            //SetupViewing();

            SetupPreview();
            //this.Controls.Remove(rp);
            //fWait.Close();
            panel1.Focus();
            done = true;
        }
Example #6
0
        private void button5_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Продолжить?", "Внимание!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (dr == DialogResult.No)
            {
                return;
            }
            string store_ip = XmlConnections.GetConnection("/Connections/store_ip");
            string sTargetConnect = @"\\" + store_ip + @"\BookAddInf\PERIOD\";
            string sTarget = @"\\" + store_ip + @"\BookAddInf\PERIOD\";
            DBScanInfo db = new DBScanInfo();
            string PIN = this.PIN;
            PIN = PINFormat(PIN);
            sTarget += PIN.Substring(0, 1) + @"\" + PIN.Substring(1, 3) + @"\" + PIN.Substring(4, 3) + @"\";

            DirectoryInfo diSource = new DirectoryInfo(YearPath);
            Package = "";
            DirectoryInfo[] diNumbers = diSource.GetDirectories();
            if (diNumbers.Length == 0)
            {
                throw new Exception("В источнике нет папок: " + diSource.ToString());
            }
            bool FirstPass = false;
            int Number = 1;
            int Total = diNumbers.Length;
            fp = new fProgress("Подождите...");
            this.Enabled = false;
            fp.Show();
            Application.DoEvents();

            foreach (DirectoryInfo d in diNumbers)
            {
                Set = d.Name + "; ";
                FileInfo[] fi = d.GetFiles();
                foreach (FileInfo f in fi)
                {
                    //скопиировать все изображения номера
                    //fp.ResetProgress(d.GetFiles("*.jpg").Length, Number, Total);
                    fp.IncProgress(Total, Number, Total);
                    Application.DoEvents();
                    //try
                    //{
                        bool result = CopyJPGToTarget(store_ip, sTarget, YearPath, f.Directory, FirstPass, Number, Total, fp,sTargetConnect);
                    //}
                    //catch (Exception ex)
                    if (!result)
                    {
                        //MessageBox.Show("Произошла ошибка: " + ex.Message + ". Попробуйте еще раз!", "Внимание!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        fp.Close();
                        this.Enabled = true;
                        return;
                    }
                    FirstPass = true;
                    Number++;
                    break;
                }
            }

            #region _info.txt
            FileInfo[] _infotxtsearch = diSource.GetFiles();
            FileInfo _infotxt = null;
            foreach (FileInfo f in _infotxtsearch)
            {
                if (f.Name == "_info.txt")
                {
                    _infotxt = f;
                }
            }
            if (_infotxt != null)
            {
                DirectoryInfo d = new DirectoryInfo(sTarget + this.Year + @"\");
                try
                {
                    _infotxt.CopyTo(sTarget + this.Year + @"\_info.txt",true);
                }
                catch
                {
                    using (new NetworkConnection(sTargetConnect, new NetworkCredential("libfl\\DigitCentreWork01", "DigCW_01")))
                    {
                        _infotxt.CopyTo(sTarget + this.Year + @"\_info.txt", true);
                    }
                }

                string outside_ip = @"\\" + XmlConnections.GetConnection("/Connections/outside_ip") + @"\Backup\BookAddInf\PERIOD\";
                outside_ip += PIN.Substring(0, 1) + @"\" + PIN.Substring(1, 3) + @"\" + PIN.Substring(4, 3) + @"\";
                try
                {
                    _infotxt.CopyTo(outside_ip + this.Year.ToString() + @"\_info.txt", true);
                }
                catch
                {
                    using (new NetworkConnection(outside_ip, new NetworkCredential("bj\\CopyPeriodAddInf", "Period_Copy")))
                    {
                        _infotxt.CopyTo(outside_ip + this.Year.ToString() + @"\_info.txt", true);
                    }
                }
            }
            #endregion
            AddInfo();
        }
Example #7
0
        private void AddInfo()
        {
            DBScanInfo db = new DBScanInfo();
            PackageList.Add(Package);
            Package = "";
            string AllPackage = "";
            foreach (string s in PackageList)
            {
                AllPackage += s;
            }
            db.InsertUploadInfo( FolderYear, this.Login, AllPackage, this.IDZ, PDF,PIN);
            try
            {
                db.InsertPackage(PackageList, this.PIN,this.Year);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            db.BuildAndInsertHyperLink(this.PIN,this.Year.ToString());

            fp.Close();
            this.Enabled = true;
            MessageBox.Show("Привязка успешно завершена!", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Close();
        }
Example #8
0
        private void button5_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Продолжить?", "Внимание!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dr == DialogResult.No)
            {
                return;
            }
            string     store_ip       = XmlConnections.GetConnection("/Connections/store_ip");
            string     sTargetConnect = @"\\" + store_ip + @"\BookAddInf\PERIOD\";
            string     sTarget        = @"\\" + store_ip + @"\BookAddInf\PERIOD\";
            DBScanInfo db             = new DBScanInfo();
            string     PIN            = this.PIN;

            PIN = PINFormat(PIN);
            string ExactPath = GetPath(PIN, FolderYear);

            sTarget += ExactPath;//PIN.Substring(0, 1) + @"\" + PIN.Substring(1, 3) + @"\" + PIN.Substring(4, 3) + @"\";

            DirectoryInfo diSource = new DirectoryInfo(YearPath);

            Package = "";
            DirectoryInfo[] diNumbers = diSource.GetDirectories();
            if (diNumbers.Length == 0)
            {
                throw new Exception("В источнике нет папок: " + diSource.ToString());
            }
            bool FirstPass = false;
            int  Number    = 1;
            int  Total     = diNumbers.Length;

            fp           = new fProgress("Подождите...");
            this.Enabled = false;
            fp.Show();
            Application.DoEvents();

            foreach (DirectoryInfo d in diNumbers)
            {
                Set = d.Name + "; ";
                FileInfo[] fi = d.GetFiles();
                foreach (FileInfo f in fi)
                {
                    //скопиировать все изображения номера
                    //fp.ResetProgress(d.GetFiles("*.jpg").Length, Number, Total);
                    fp.IncProgress(Total, Number, Total);
                    Application.DoEvents();
                    //try
                    //{
                    bool result = CopyJPGToTarget(store_ip, sTarget, YearPath, f.Directory, FirstPass, Number, Total, fp, sTargetConnect);
                    //}
                    //catch (Exception ex)
                    if (!result)
                    {
                        //MessageBox.Show("Произошла ошибка: " + ex.Message + ". Попробуйте еще раз!", "Внимание!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        fp.Close();
                        this.Enabled = true;
                        return;
                    }
                    FirstPass = true;
                    Number++;
                    break;
                }
            }

            #region _info.txt
            FileInfo[] _infotxtsearch = diSource.GetFiles();
            FileInfo   _infotxt       = null;
            foreach (FileInfo f in _infotxtsearch)
            {
                if (f.Name == "_info.txt")
                {
                    _infotxt = f;
                }
            }
            if (_infotxt != null)
            {
                DirectoryInfo d = new DirectoryInfo(sTarget + this.Year + @"\");
                try
                {
                    _infotxt.CopyTo(sTarget + this.Year + @"\_info.txt", true);
                }
                catch
                {
                    using (new NetworkConnection(sTargetConnect, new NetworkCredential("libfl\\DigitCentreWork01", "DigCW_01")))
                    {
                        _infotxt.CopyTo(sTarget + this.Year + @"\_info.txt", true);
                    }
                }

                string outside_ip = @"\\" + XmlConnections.GetConnection("/Connections/outside_ip") + @"\Backup\BookAddInf\PERIOD\";
                outside_ip += PIN.Substring(0, 1) + @"\" + PIN.Substring(1, 3) + @"\" + PIN.Substring(4, 3) + @"\";
                try
                {
                    _infotxt.CopyTo(outside_ip + this.Year.ToString() + @"\_info.txt", true);
                }
                catch
                {
                    using (new NetworkConnection(outside_ip, new NetworkCredential("bj\\CopyPeriodAddInf", "Period_Copy")))
                    {
                        _infotxt.CopyTo(outside_ip + this.Year.ToString() + @"\_info.txt", true);
                    }
                }
            }
            #endregion
            AddInfo();
        }
Example #9
0
        public fPreview(int IDZ_, string FolderYear_, string path_, string selectedYear, string PIN_, string login_)
        {
            InitializeComponent();
            this.IDZ = IDZ_;
            //this.Login = Login_;
            this.FolderYear = FolderYear_;
            this.YearPath   = path_;
            this.PIN        = PIN_;
            this.Login      = login_;
            DBScanInfo db = new DBScanInfo();

            mTitle = db.GetTitleByIDZ(this.IDZ);
            if (!db.IfExistsYearByIDZandFolderYear(this.IDZ, FolderYear))
            {
                throw new Exception("В базе не найден год, соответствующий названию выбранной папки!");
            }
            label3.Text += mTitle;
            label4.Text += FolderYear;


            //проверяем  есть ли такой год для выбранного издания.
            int year = 0;

            if (FolderYear.Length != 4)
            {
                MessageBox.Show("Неверный формат года: " + FolderYear);
                Environment.Exit(0);
            }
            if (!int.TryParse(FolderYear, out year))
            {
                MessageBox.Show("Неверный формат года: " + FolderYear);
                Environment.Exit(0);
            }
            this.Year = year;


            ThreadPool.QueueUserWorkItem(new WaitCallback(EndlessProc));


            //получаем список номеров выбранного издания и года
            NumberFolderList = GetNumberFolderList();

            if (NumberFolderList.Count == 0)
            {
                throw new Exception("Внутри папки с годом отсутствуют папки с номерами!");
            }


            comboBox1.Items.AddRange(NumberFolderList.ToArray());
            comboBox1.SelectedIndex = 0;
            /// <summary>
            /// Метод настраивающий просмотр первых 10 страниц выбранного номера
            /// </summary>
            /// <param name="msg"></param>            /// <exception cref="System.FileNotFoundException">Thrown when files in Temp Storage are not found</exception>
            //SetupViewing();

            SetupPreview();
            //this.Controls.Remove(rp);
            //fWait.Close();
            panel1.Focus();
            done = true;
        }
Example #10
0
        private void button5_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Продолжить?", "Внимание!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (dr == DialogResult.No)
            {
                return;
            }
            string store_ip = XmlConnections.GetConnection("/Connections/store_ip");
            string sTargetConnect = @"\\" + store_ip + @"\BookAddInf\PERIOD\";
            string sTarget = @"\\" + store_ip + @"\BookAddInf\PERIOD\";
            string sTargetConnectBookAddInf = @"\\" + store_ip + @"\BookAddInf";
            DBScanInfo db = new DBScanInfo();
            string PIN = this.PIN;
            PIN = PINFormat(PIN);
            sTarget += PIN.Substring(0, 1) + @"\" + PIN.Substring(1, 3) + @"\" + PIN.Substring(4, 3) + @"\";

            Package = "";

            int Number = 1;
            int Total = new PdfReader(fPDF.FullName).NumberOfPages;
            fp = new fProgress(Total);
            this.Enabled = false;
            fp.Show();
            Application.DoEvents();

            //преобразовать и скопиировать все изображения номера
            //int Total = new PdfReader(fPDF.FullName).NumberOfPages;
            //fp.ResetProgress(Total, Number, Total);
            try
            {
                CopyPDFToTarget(store_ip, sTarget, fPDF.DirectoryName, fPDF, Number, Total, fp, sTargetConnectBookAddInf);

            }
            catch (Exception ex)
            {
                MessageBox.Show("Произошла ошибка: " + ex.Message + ". Попробуйте еще раз!", "Внимание!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                fp.Close();
                this.Enabled = true;
                return;
            }
        }