Ejemplo n.º 1
0
        private async void DownLoad_Click(object sender, EventArgs e)        //下载配额表
        {
            if (this.CategoryId.SelectedItem == null)
            {
                MessageBox.Show("请选择希望下载的会签单类别信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Search search = new Search
            {
                Year       = int.Parse(this.IdYear.Text),
                CategoryId = int.Parse(((ComboboxItem)this.CategoryId.SelectedItem).Value),
            };
            SaveFileDialog sfd = new SaveFileDialog();

            //设置文件类型
            sfd.Filter = "Microsoft Excel(*.xls) | *.xls";

            // 设置默认文件类型显示顺序
            //sfd.FilterIndex = 1;

            //保存对话框是否记忆上次打开的目录
            sfd.RestoreDirectory = true;

            sfd.FileName = this.CategoryId.Text + "计划费用分配表";
            if (sfd.ShowDialog() == DialogResult.OK)
            {
                MainWindow mw = (MainWindow)this.MdiParent;
                cmd.ShowOpaqueLayer(this.ReportAnalysis, 125, true, true, "正在下载中,请稍候");
                mw.treeView1.Enabled = false;

                string filepath = sfd.FileName.ToString();
                await _sc.DownloadRegularload(search, filepath);

                cmd.HideOpaqueLayer();
                MessageBox.Show("下载完成!");
                mw.treeView1.Enabled = true;
            }

            this.UpLoad.Visible = true;
        }