Exemplo n.º 1
0
        private void btnSaveAll_Click(object sender, EventArgs e)
        {
            if (_model == null)
            {
                return;
            }

            string path = GlobalUtils.OpenBrowseFolderDlg();

            if (string.IsNullOrEmpty(path))
            {
                return;
            }
            int res = PassportPicHandler.DownloadSelectedTypes(_model.PassportNo, path);

            if (res > 0)
            {
                if (MessageBoxEx.Show("保存成功,是否打开所在文件夹?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    Process.Start(path);
                }
            }
            else
            {
                MessageBoxEx.Show("保存失败");
            }
        }
Exemplo n.º 2
0
        private void 全部ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string path = String.Empty;

            if (this.dataGridView1.SelectedRows.Count == 1)
            {
                string passportNo = dataGridView1.SelectedRows[0].Cells["PassportNo"].Value.ToString();
                path = GlobalUtils.OpenBrowseFolderDlg();
                if (string.IsNullOrEmpty(path))
                {
                    return;
                }

                int res1 = PassportPicHandler.DownloadSelectedTypes(passportNo, path,
                                                                    PassportPicHandler.PicType.Type01Normal | PassportPicHandler.PicType.Type02Head); //传默认值就是全部类型,考虑到他们不需要红外图像,就去掉吧
                if (res1 > 0)
                {
                    if (MessageBoxEx.Show("保存成功,是否打开所在文件夹?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        Process.Start(path);
                    }
                }
                else
                {
                    MessageBoxEx.Show("保存失败");
                }
                return;
            }

            List <string> passList = new List <string>();

            for (int i = 0; i < dataGridView1.SelectedRows.Count; i++)
            {
                passList.Add(dataGridView1.SelectedRows[i].Cells["PassportNo"].Value.ToString());
            }

            path = GlobalUtils.OpenBrowseFolderDlg();
            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            int res = PassportPicHandler.DownloadSelectedTypesBatch(passList.ToArray(), path,
                                                                    PassportPicHandler.PicType.Type01Normal | PassportPicHandler.PicType.Type02Head);

            if (res > 0)
            {
                if (MessageBoxEx.Show("保存成功,是否打开所在文件夹?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    Process.Start(path);
                }
            }
            else
            {
                MessageBoxEx.Show("保存失败");
            }
        }
Exemplo n.º 3
0
        private void LoadImageFromModel(Model.VisaInfo model)
        {
            if (model == null)
            {
                pictureBox1.Image = Resources.PassportPictureNotFound;
                return;
            }

            if (!PassportPicHandler.CheckAndDownloadIfNotExist(model.PassportNo, PassportPicHandler.PicType.Type01Normal))
            {
                pictureBox1.Image = Resources.PassportPictureNotFound;
                return;
            }
            pictureBox1.Image = GlobalUtils.LoadImageFromFileNoBlock(GlobalUtils.PassportPicPath + "\\" + model.PassportNo + ".jpg");
        }
Exemplo n.º 4
0
        private void btnSaveIR_Click(object sender, EventArgs e)
        {
            if (_model == null)
            {
                return;
            }
            string fileName = PassportPicHandler.GetFileName(_model.PassportNo, PassportPicHandler.PicType.Type03IR);
            string dstName  =
                GlobalUtils.OpenSaveFileDlg(fileName);

            if (string.IsNullOrEmpty(dstName))
            {
                return;
            }

            PassportPicHandler.DownloadPic(_model.PassportNo, PassportPicHandler.PicType.Type03IR, dstName);
        }
Exemplo n.º 5
0
        private void DownloadSelectedPics(PassportPicHandler.PicType type)
        {
            if (this.dataGridView1.SelectedRows.Count == 1)
            {
                string passportNo = dataGridView1.SelectedRows[0].Cells["PassportNo"].Value.ToString();
                string fileName   = PassportPicHandler.GetFileName(passportNo, type);
                string dstName    =
                    GlobalUtils.OpenSaveFileDlg(fileName);
                if (string.IsNullOrEmpty(dstName))
                {
                    return;
                }

                PassportPicHandler.DownloadPic(passportNo, type, dstName);
                return;
            }

            List <string> passList = new List <string>();

            for (int i = 0; i < dataGridView1.SelectedRows.Count; i++)
            {
                passList.Add(dataGridView1.SelectedRows[i].Cells["PassportNo"].Value.ToString());
            }

            string path = GlobalUtils.OpenBrowseFolderDlg();

            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            int res = PassportPicHandler.DownloadPicBatch(passList.ToArray(), type, path);

            if (res > 0)
            {
                if (MessageBoxEx.Show("保存成功,是否打开所在文件夹?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    Process.Start(path);
                }
            }
            else
            {
                MessageBoxEx.Show("保存失败");
            }
        }