예제 #1
0
        private void btnDownload_Click(object sender, EventArgs e)
        {
            try
            {
                FileDataSet dataset = this.fileDataSet;
                dataset = this.fileDataSet;
                // fileType = "档案";
                int[] selIndexs = gridView2.GetSelectedRows();

                foreach (int i in selIndexs)
                {
                    DataRowView rv = gridView2.GetRow(i) as DataRowView;
                    if (rv != null)
                    {
                        string fileID = rv["FILEID"].ToString();
                        saveFileDialog.DefaultExt = "图片文件 (*.jpg)|*.jpg,*.jpeg";
                        if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            string fileName = saveFileDialog.FileName;
                            byte[] bfile    = dataset.GetImageByID(fileID);
                            File.WriteAllBytes(fileName, bfile);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                UserMessages.ShowInfoBox(ex.Message);
            }
        }
예제 #2
0
        private void btnDownload_Click(object sender, EventArgs e)
        {
            try
            {
                DevExpress.XtraGrid.Views.Grid.GridView aGrid = null;
                FileDataSet dataset = this.fileDataSet;
                // string fileType = "档案";
                int[] selIndexs;
                if (tabbedControlGroup1.SelectedTabPageIndex == 1)
                {
                    // fileType = "合同";
                    dataset   = this.HTfileDataSet;
                    selIndexs = gridView3.GetSelectedRows();
                    aGrid     = gridView3;
                }
                else
                {
                    dataset = this.fileDataSet;
                    // fileType = "档案";
                    selIndexs = gridView2.GetSelectedRows();
                    aGrid     = gridView2;
                }


                foreach (int i in selIndexs)
                {
                    DataRowView rv = aGrid.GetRow(i) as DataRowView;
                    if (rv != null)
                    {
                        string fileID = rv["FILEID"].ToString();
                        saveFileDialog.DefaultExt = "图片文件 (*.jpg)|*.jpg,*.jpeg";
                        if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            string fileName = saveFileDialog.FileName;
                            byte[] bfile    = dataset.GetImageByID(fileID);
                            File.WriteAllBytes(fileName, bfile);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                UserMessages.ShowInfoBox(ex.Message);
            }
        }