Exemplo n.º 1
0
        void FLWSAttachmentDownload_Click(object sender, EventArgs e)
        {
            Control _te        = sender as Control;
            string  _tagString = (_te.Tag == null) ? "" : _te.Tag.ToString();

            string[] _strs = _tagString.Split(',');
            if (_strs.Length < 4)
            {
                XtraMessageBox.Show(string.Format("下载法律文书失败!错误的参数信息:{0}", _tagString), "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            using (MetaDataQueryServiceClient _msc = new MetaDataQueryServiceClient())
            {
                string         _indexString = _strs[0];
                SaveFileDialog _f           = new SaveFileDialog();
                _f.FileName = _msc.GetFLWSFileName(_indexString, _strs[1] + "," + _strs[2]);
                if (_f.ShowDialog() == DialogResult.OK)
                {
                    byte[] _fileBytes = _msc.GetFLWSFileBytes(_indexString, _strs[3]);
                    if (_fileBytes == null)
                    {
                        XtraMessageBox.Show("下载法律文书失败!取得的附件数据为空!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    FileStream stream = File.OpenWrite(_f.FileName);
                    int        _count = _fileBytes.Length;
                    stream.Write(_fileBytes, 0, _count);
                    stream.Close();
                    XtraMessageBox.Show("下载法律文书成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
        }