Exemple #1
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);
        }
        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("保存失败");
            }
        }