private void gridView1_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left && e.Clicks == 2) { if (gridView1.RowCount <= 0)//判断是否选中要删除的行 { MessageBox.Show("请选中行!"); return; } string shijian = gridView1.GetRowCellValue(this.gridView1.FocusedRowHandle, "提交时间").ToString(); if (shijian != "") { string a = gridView1.GetRowCellValue(this.gridView1.FocusedRowHandle, "报告标题").ToString(); string b = gridView1.GetRowCellValue(this.gridView1.FocusedRowHandle, "员工姓名").ToString(); string baogaoleixing = gridView1.GetRowCellValue(this.gridView1.FocusedRowHandle, "报告类型").ToString(); string chaxun11 = "select 文件类型 from tb_wenjian where 员工姓名='" + b + "'and 提交时间='" + shijian + "' and 报告类型='" + baogaoleixing + "'"; leixing = SQLhelp.ExecuteScalar(chaxun11, CommandType.Text).ToString(); byte[] mypdffile = null; string sql = "Select 文件 From tb_wenjian Where 报告标题='" + a + "' and 提交时间='" + shijian + "'and 员工姓名='" + b + "' "; mypdffile = SQLhelp.duqu(sql, CommandType.Text); this.Cursor = Cursors.WaitCursor; string aaaa = System.Environment.CurrentDirectory; string lujing = aaaa + "\\" + a + "1" + "." + leixing; FileStream fs = new FileStream(lujing, FileMode.Create); fs.Write(mypdffile, 0, mypdffile.Length); fs.Flush(); fs.Close(); this.Cursor = Cursors.Default; Frchakanbaogao form1 = new Frchakanbaogao(); form1.lujing = lujing; form1.Show(); } } }
private void 查看附件ToolStripMenuItem_Click(object sender, EventArgs e) { if (gridView1.RowCount <= 0) { MessageBox.Show("请选中行!"); return; } if (Convert.ToString(this.gridView1.GetRowCellValue(this.gridView1.FocusedRowHandle, "指示项附件名称")) == "") { MessageBox.Show("没有附件!"); return; } if (Convert.ToString(this.gridView1.GetRowCellValue(this.gridView1.FocusedRowHandle, "指示项附件名称")) != "") { string zerenren = Convert.ToString(this.gridView1.GetRowCellValue(this.gridView1.FocusedRowHandle, "纪要内容")); string shijian = Convert.ToString(this.gridView1.GetRowCellValue(this.gridView1.FocusedRowHandle, "会议时间")); string aa = "Select 指示项附件类型 From tb_xiangxi Where 纪要内容='" + zerenren + "' and 会议时间='" + shijian + "'"; string leixing = SQLhelp.ExecuteScalar(aa, CommandType.Text).ToString(); string mingcheng = Convert.ToString(this.gridView1.GetRowCellValue(this.gridView1.FocusedRowHandle, "指示项附件名称")); byte[] mypdffile = null; string sql4 = "Select 指示项附件 From tb_xiangxi Where 纪要内容='" + zerenren + "' and 会议时间='" + shijian + "'"; mypdffile = SQLhelp.duqu(sql4, CommandType.Text); this.Cursor = Cursors.WaitCursor; string aaaa = System.Environment.CurrentDirectory; string bbbb = mingcheng.Replace("?", "1"); string lujing = aaaa + "\\" + bbbb + "1" + "." + leixing; FileStream fs = new FileStream(lujing, FileMode.Create); fs.Write(mypdffile, 0, mypdffile.Length); fs.Flush(); fs.Close(); this.Cursor = Cursors.Default; System.Diagnostics.Process.Start(lujing); } }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { string aaa = "Select 附件名称 From tb_xiangxi Where 完成责任人='" + zerenren + "' and 会议时间='" + shijian + "'"; mingcheng = SQLhelp.ExecuteScalar(aaa, CommandType.Text).ToString(); byte[] mypdffile = null; string sql = "Select 附件 From tb_xiangxi Where 完成责任人='" + zerenren + "' and 会议时间='" + shijian + "'"; mypdffile = SQLhelp.duqu(sql, CommandType.Text); try { Random ran = new Random(); string aaaa = System.Environment.CurrentDirectory; lujing = aaaa + "\\" + mingcheng + "." + leixing; FileStream fs = new FileStream(lujing, FileMode.Create); fs.Write(mypdffile, 0, mypdffile.Length); fs.Flush(); fs.Close(); } catch { } System.Diagnostics.Process.Start(lujing); }
private void 查看指示项附件ToolStripMenuItem_Click(object sender, EventArgs e) { if (dataGridViewX1.Rows.Count <= 0) { MessageBox.Show("请选中行!"); return; } if (Convert.ToString(dataGridViewX1.CurrentRow.Cells["指示项附件名称"].Value) == "") { MessageBox.Show("没有附件!"); return; } if (Convert.ToString(dataGridViewX1.CurrentRow.Cells["指示项附件名称"].Value) != "") { string zerenren = dataGridViewX1.CurrentRow.Cells["待完成指示项内容"].Value.ToString(); string shijian = dataGridViewX1.CurrentRow.Cells["会议时间1"].Value.ToString(); string aa = "Select 指示项附件类型 From tb_xiangxi Where 纪要内容='" + zerenren + "' and 会议时间='" + shijian + "'"; string leixing = SQLhelp.ExecuteScalar(aa, CommandType.Text).ToString(); string mingcheng = Convert.ToString(dataGridViewX1.CurrentRow.Cells["待完成指示项内容"].Value); byte[] mypdffile = null; string sql = "Select 指示项附件 From tb_xiangxi Where 纪要内容='" + zerenren + "' and 会议时间='" + shijian + "'"; mypdffile = SQLhelp.duqu(sql, CommandType.Text); Random ran = new Random(); string aaaa = System.Environment.CurrentDirectory; string lujing = aaaa + "\\" + mingcheng + "." + leixing; dakai(mypdffile, lujing); } }
private void 查看详情ToolStripMenuItem_Click(object sender, EventArgs e) { if (dataGridViewX1.Rows.Count <= 0)//判断是否选中要删除的行 { MessageBox.Show("请选中行!"); return; } string a = dataGridViewX1.CurrentRow.Cells["公告标题"].Value.ToString(); string aa = "Select 公告附件类型 From tb_gonggao Where 公告标题='" + a + "'"; leixing = SQLhelp.ExecuteScalar(aa, CommandType.Text).ToString(); string panduan = SQLhelp.ExecuteScalar(aa, CommandType.Text).ToString(); if (panduan == "") { MessageBox.Show("该公告没有附件!"); return; } string sqll = "Select 公告附件类型 From tb_gonggao Where 公告标题='" + a + "'"; leixing = SQLhelp.ExecuteScalar(sqll, CommandType.Text).ToString(); byte[] mypdffile = null; string sql = "Select 公告附件 From tb_gonggao Where 公告标题='" + a + "' and 公告类型='公告'"; mypdffile = SQLhelp.duqu(sql, CommandType.Text); try { Random ran = new Random(); //int RandKey = ran.Next(0, 999999999); //string suijishu = RandKey.ToString(); string aaaa = System.Environment.CurrentDirectory; lujing = aaaa + "\\" + a + "." + leixing; FileStream fs = new FileStream(lujing, FileMode.Create); fs.Write(mypdffile, 0, mypdffile.Length); fs.Flush(); fs.Close(); } catch { } this.Cursor = Cursors.Default; System.Diagnostics.Process.Start(lujing); }
private void 载toolStripMenuItem_Click(object sender, EventArgs e) { if (gridView2.RowCount <= 0)//判断是否选中要删除的行 { MessageBox.Show("请选中行!"); return; } FolderBrowserDialog lujingg = new FolderBrowserDialog(); if (lujingg.ShowDialog() == DialogResult.OK) { string xuanzelujing = lujingg.SelectedPath; string yonghu = gridView2.GetRowCellValue(this.gridView2.FocusedRowHandle, "员工姓名").ToString(); string baogaoleixing = gridView2.GetRowCellValue(this.gridView2.FocusedRowHandle, "报告类型").ToString(); string shijian = gridView2.GetRowCellValue(this.gridView2.FocusedRowHandle, "提交时间").ToString(); string jingque = shijian.Substring(0, 10); try { byte[] mypdffile = null; string ConStr = "Select 文件,员工姓名,日期 From tb_wenjian Where 员工姓名='" + yonghu + "'and 提交时间='" + shijian + "' and 报告类型='" + baogaoleixing + "'"; mypdffile = SQLhelp.duqu(ConStr, CommandType.Text); string dt1 = "Select 员工姓名 From tb_wenjian Where 员工姓名='" + yonghu + "'and 提交时间='" + shijian + "' and 报告类型='" + baogaoleixing + "'"; string mingcheng = SQLhelp.ExecuteScalar(dt1, CommandType.Text).ToString(); string dt2 = "Select 日期 From tb_wenjian Where 员工姓名='" + yonghu + "'and 提交时间='" + shijian + "' and 报告类型='" + baogaoleixing + "'"; string shijian1 = SQLhelp.ExecuteScalar(dt2, CommandType.Text).ToString(); string lujing = xuanzelujing + "\\" + mingcheng + shijian1 + baogaoleixing + ".doc"; FileStream fs = new FileStream(lujing, FileMode.Create); fs.Write(mypdffile, 0, mypdffile.Length); fs.Flush(); fs.Close(); MessageBox.Show("下载成功");//显示异常信息 } catch (Exception ex) { MessageBox.Show(ex.Message);//显示异常信息 } } }
private void 查看toolStripMenuItem1_Click(object sender, EventArgs e) { if (gridView2.RowCount <= 0)//判断是否选中要删除的行 { MessageBox.Show("请选中行!"); return; } string shijian = gridView2.GetRowCellValue(this.gridView2.FocusedRowHandle, "提交时间").ToString(); if (shijian != "") { string a = gridView2.GetRowCellValue(this.gridView2.FocusedRowHandle, "附件名称").ToString(); if (a != "") { string b = gridView2.GetRowCellValue(this.gridView2.FocusedRowHandle, "员工姓名").ToString(); string baogaoleixing = gridView2.GetRowCellValue(this.gridView2.FocusedRowHandle, "报告类型").ToString(); string chaxun11 = "select 附件类型 from tb_wenjian where 员工姓名='" + b + "'and 提交时间='" + shijian + "' and 报告类型='" + baogaoleixing + "'"; string leixing1 = SQLhelp.ExecuteScalar(chaxun11, CommandType.Text).ToString(); byte[] mypdffile = null; string sql = "Select 附件 From tb_wenjian Where 附件名称='" + a + "' and 提交时间='" + shijian + "'and 员工姓名='" + b + "' "; mypdffile = SQLhelp.duqu(sql, CommandType.Text); this.Cursor = Cursors.WaitCursor; string aaaa = System.Environment.CurrentDirectory; string lujing = aaaa + "\\" + a + "1" + "." + leixing1; FileStream fs = new FileStream(lujing, FileMode.Create); fs.Write(mypdffile, 0, mypdffile.Length); fs.Flush(); fs.Close(); this.Cursor = Cursors.Default; System.Diagnostics.Process.Start(lujing); } if (a == "") { MessageBox.Show("没有附件!"); return; } } }
private void 查看附件ToolStripMenuItem_Click(object sender, EventArgs e) { if (dataGridViewX1.Rows.Count <= 0) { MessageBox.Show("请选中行!"); return; } string zerenren = dataGridViewX1.CurrentRow.Cells["完成责任人"].Value.ToString(); string neirong = dataGridViewX1.CurrentRow.Cells["纪要内容"].Value.ToString(); string shijian = dataGridViewX1.CurrentRow.Cells["会议时间1"].Value.ToString(); string aa = "Select 附件格式 From tb_xiangxi Where 完成责任人='" + zerenren + "' and 纪要内容='" + neirong + "' and 会议时间='" + shijian + "'"; string leixing = SQLhelp.ExecuteScalar(aa, CommandType.Text).ToString(); string panduan = SQLhelp.ExecuteScalar(aa, CommandType.Text).ToString(); if (panduan == "") { MessageBox.Show("没有附件!"); return; } string aaa = "Select 附件名称 From tb_xiangxi Where 完成责任人='" + zerenren + "' and 纪要内容='" + neirong + "' and 会议时间='" + shijian + "'"; string mingcheng = SQLhelp.ExecuteScalar(aaa, CommandType.Text).ToString(); byte[] mypdffile = null; string sql = "Select 附件 From tb_xiangxi Where 完成责任人='" + zerenren + "' and 纪要内容='" + neirong + "' and 会议时间='" + shijian + "'"; mypdffile = SQLhelp.duqu(sql, CommandType.Text); Random ran = new Random(); string aaaa = System.Environment.CurrentDirectory; lujing = aaaa + "\\" + mingcheng + "." + leixing; FileStream fs = new FileStream(lujing, FileMode.Create); fs.Write(mypdffile, 0, mypdffile.Length); fs.Flush(); fs.Close(); System.Diagnostics.Process.Start(lujing); }