Пример #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("保存失败");
            }
        }
Пример #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("保存失败");
            }
        }