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 (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 chaxun = "select 纪要上传人 from tb_xiangxi Where 完成责任人='" + zerenren + "' and 会议时间='" + shijian + "' and 纪要内容='" + neirong + "'"; string ren = SQLhelp.ExecuteScalar(chaxun, CommandType.Text).ToString(); if (yonghu != ren) { MessageBox.Show("无权限!"); return; } try { string wanchengshijian = DateTime.Now.ToString(); DateTime zuizhong = DateTime.Now; string jiedian = dataGridViewX1.CurrentRow.Cells["完成时间节点2"].Value.ToString(); if (jiedian == "") { MessageBox.Show("请先让责任人输入完成时间节点,再确认完成"); return; } if (MessageBox.Show("确认完成吗?", "软件提示", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { string xiugai = "update tb_xiangxi set 已完成=1,完成时间='" + wanchengshijian + "' Where 完成责任人='" + zerenren + "' and 会议时间='" + shijian + "' and 纪要内容='" + neirong + "'"; SQLhelp.ExecuteScalar(xiugai, CommandType.Text); MessageBox.Show("修改成功!"); reload1(); Reload(); reload2(); } } catch (Exception ex) { MessageBox.Show("发生错误:" + ex.Message); } }
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 buttonX2_Click(object sender, EventArgs e) { if (MessageBox.Show("确认提交吗?", "软件提示", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { string quorysql = "select * from tb_xiangxi where id='" + id + "'"; DataTable dt1 = SQLhelp.GetDataTable(quorysql, CommandType.Text); string 纪要内容 = dt1.Rows[0]["纪要内容"].ToString(); string 纪要类型 = dt1.Rows[0]["纪要类型"].ToString(); string shangchuanren = dt1.Rows[0]["纪要上传人"].ToString(); //string message = 纪要类型+"纪要内容:" + 纪要内容 + ","+yonghu+"已回复,请查看"; //NetWork3J NetWork3J = new NetWork3J(yonghu, "http://" + MyGlobal.ip + ":81/"); //NetWork3J.sendmessageById(shangchuanren, message); try { if (txtName.Text != "") { DateTime shijian = DateTime.Now; string sql1 = "insert into tb_huiyi (落实措施,落实情况,定位,创建人,创建时间,附件格式,附件名称,附件) values('" + txtluoshicuoshi.Text + "','" + txtluoshiqingkuang.Text + "','" + id + "','" + yonghu + "','" + shijian + "','" + fileType + "','" + fileName + "',@pic)"; SQLhelp.ExecuteNonquery(sql1, CommandType.Text, files); string sql2 = "Select id from tb_huiyi where 落实措施='" + txtluoshicuoshi.Text + "' and 落实情况='" + txtluoshiqingkuang.Text + "' and 创建人='" + yonghu + "' and 创建时间='" + shijian + "'"; SQLhelp.ExecuteScalar(sql2, CommandType.Text); string sql = "update tb_xiangxi set 落实措施='" + txtluoshicuoshi.Text + "',落实情况='" + txtluoshiqingkuang.Text + "',更新='有更新!' where id='" + id + "'"; SQLhelp.ExecuteScalar(sql, CommandType.Text); MessageBox.Show("提交成功!", "软件提示"); DialogResult = DialogResult.OK; this.Close(); } if (txtName.Text == "") { DateTime shijian = DateTime.Now; string sql1 = "insert into tb_huiyi (落实措施,落实情况,定位,创建人,创建时间) values('" + txtluoshicuoshi.Text + "','" + txtluoshiqingkuang.Text + "','" + id + "','" + yonghu + "','" + shijian + "')"; SQLhelp.ExecuteScalar(sql1, CommandType.Text); string sql = "update tb_xiangxi set 落实措施='" + txtluoshicuoshi.Text + "',落实情况='" + txtluoshiqingkuang.Text + "',更新='有更新!' where id='" + id + "'"; SQLhelp.ExecuteScalar(sql, CommandType.Text); MessageBox.Show("提交成功!", "软件提示"); DialogResult = DialogResult.OK; this.Close(); } } catch (Exception ex) { MessageBox.Show("提交 " + fileName + " 时候发生了 " + ex.Message); } } }
private void 一键下载toolStripMenuItem_Click(object sender, EventArgs e) { string sql = "select 权限管理 from tb_operator where 用户名='" + yonghu + "'"; if (Convert.ToInt32(SQLhelp.ExecuteScalar(sql, CommandType.Text)) == 0) { MessageBox.Show("无权限!"); return; } if (gridView2.RowCount <= 0) { MessageBox.Show("请选中行!"); return; } FrDetails form1 = new FrDetails(); form1.yonghu = yonghu; form1.ShowDialog(); }
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); }
private void 确认完成情况ToolStripMenuItem_Click(object sender, EventArgs e) { if (gridView1.RowCount <= 0) { MessageBox.Show("请选中行!"); return; } if (MessageBox.Show("确认完成吗?", "软件提示", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { string zerenren = gridView1.GetRowCellValue(this.gridView1.FocusedRowHandle, "完成责任人").ToString(); string jiyaoneirong = gridView1.GetRowCellValue(this.gridView1.FocusedRowHandle, "纪要内容").ToString(); string huiyishijian = textshijian.Text; string huiyizhuti = textzhuti.Text; string chaxun = "select 纪要上传人 from tb_xiangxi Where 完成责任人='" + zerenren + "' and 会议时间='" + huiyishijian + "' and 纪要内容='" + jiyaoneirong + "'"; string ren = SQLhelp.ExecuteScalar(chaxun, CommandType.Text).ToString(); if (yonghu != ren) { MessageBox.Show("无权限!"); return; } try { string xiugai = "update tb_xiangxi set 已完成=1 Where 完成责任人='" + zerenren + "' and 会议时间='" + huiyishijian + "'and 纪要内容='" + jiyaoneirong + "'"; SQLhelp.ExecuteScalar(xiugai, CommandType.Text); MessageBox.Show("修改成功!"); Reload(); } catch (Exception ex) { MessageBox.Show("发生错误:" + ex.Message); } } }
private void gridView3_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left && e.Clicks == 2) { int dingwei = Convert.ToInt32(this.gridView3.GetRowCellValue(this.gridView3.FocusedRowHandle, "id")); string leixing = Convert.ToString(this.gridView3.GetRowCellValue(this.gridView3.FocusedRowHandle, "纪要类型")); if (leixing == "指示项" || leixing == "集团指示项" || leixing == "其他指示项") { string id = Convert.ToString(this.gridView3.GetRowCellValue(this.gridView3.FocusedRowHandle, "id")); string sql12 = "update tb_xiangxi set 更新 = '' where id='" + id + "'"; SQLhelp.ExecuteScalar(sql12, CommandType.Text); FrChakan form = new FrChakan(); form.jiyaoneirong = Convert.ToString(this.gridView3.GetRowCellValue(this.gridView3.FocusedRowHandle, "纪要内容")); form.shijian = Convert.ToString(this.gridView3.GetRowCellValue(this.gridView3.FocusedRowHandle, "会议时间")); form.zerenren = Convert.ToString(this.gridView3.GetRowCellValue(this.gridView3.FocusedRowHandle, "完成责任人")); form.yonghu = yonghu; form.jiyaoshangchuanren = Convert.ToString(this.gridView3.GetRowCellValue(this.gridView3.FocusedRowHandle, "纪要上传人")); form.ShowDialog(); Reload(); } if (leixing == "会议") { string id = Convert.ToString(this.gridView3.GetRowCellValue(this.gridView3.FocusedRowHandle, "id")); string sql12 = "update tb_xiangxi set 更新 = '' where id='" + id + "'"; SQLhelp.ExecuteScalar(sql12, CommandType.Text); Reload(); Frhuiyixiangxi form = new Frhuiyixiangxi(); form.yonghu = yonghu; form.dingwei = dingwei; form.ShowDialog(); } } }
private void 查看附件ToolStripMenuItem_Click(object sender, EventArgs e) { if (gridView1.RowCount <= 0) { MessageBox.Show("请选中行!"); return; } zerenren = gridView1.GetRowCellValue(this.gridView1.FocusedRowHandle, "完成责任人").ToString(); string aa = "Select 附件格式 From tb_xiangxi Where 完成责任人='" + zerenren + "' and 会议时间='" + shijian + "'"; leixing = SQLhelp.ExecuteScalar(aa, CommandType.Text).ToString(); string panduan = SQLhelp.ExecuteScalar(aa, CommandType.Text).ToString(); if (panduan == "") { MessageBox.Show("没有附件!"); return; } this.backgroundWorker1.RunWorkerAsync(); fpro.ShowDialog(this); }
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 ConStr = "Data Source=10.15.1.252;Initial Catalog=db_office;user id=sa;password=zttZTT123"; SqlConnection con = new SqlConnection(ConStr); SqlCommand cmd = new SqlCommand("", con); cmd.CommandText = "Select 附件 From tb_xiangxi Where 完成责任人='" + zerenren + "' and 会议时间='" + shijian + "'"; con.Open(); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { mypdffile = (byte[])dr.GetValue(0); } con.Close(); //this.Cursor = Cursors.WaitCursor; 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 (dataGridViewX2.Rows.Count <= 0) { MessageBox.Show("请选中行!"); return; } string zerenren = dataGridViewX2.CurrentRow.Cells["完成责任人"].Value.ToString(); string jiyaoneirong = dataGridViewX2.CurrentRow.Cells["纪要内容"].Value.ToString(); string huiyishijian = txtshijian.Text; string huiyizhuti = txtzhuti.Text; string chaxun = "select 纪要上传人 from tb_xiangxi Where 完成责任人='" + zerenren + "' and 会议时间='" + huiyishijian + "' and 纪要内容='" + jiyaoneirong + "'"; string ren = SQLhelp.ExecuteScalar(chaxun, CommandType.Text).ToString(); if (yonghu != ren) { MessageBox.Show("无权限!"); return; } try { string xiugai = "update tb_xiangxi set 已完成=1 Where 完成责任人='" + zerenren + "' and 会议时间='" + huiyishijian + "'and 纪要内容='" + jiyaoneirong + "'"; SQLhelp.ExecuteScalar(xiugai, CommandType.Text); MessageBox.Show("修改成功!"); Reload(); } catch (Exception ex) { MessageBox.Show("发生错误:" + ex.Message); } }
public void Reload() { string strsql = "select 会议时间,会议主题,主持人,记录人,参会人员 from tb_xiangxi where 会议时间='" + shijian + "' "; DataTable dt = SQLhelp.GetDataTable(strsql, CommandType.Text); for (int i = 0; i < dt.Rows.Count; i++) { textshijian.Text = dt.Rows[i]["会议时间"].ToString(); txtcanhuirenyuan.Text = dt.Rows[i]["参会人员"].ToString(); textjiluren.Text = dt.Rows[i]["记录人"].ToString(); textzhuchiren.Text = dt.Rows[i]["主持人"].ToString(); textzhuti.Text = dt.Rows[i]["会议主题"].ToString(); } string sql1 = "select id,会议时间,纪要内容,完成责任人,落实措施,完成时间,落实情况,已查看,已完成,完成时间节点,考核绩效点,更新,纪要上传人,批复 from tb_xiangxi where 会议时间='" + shijian + "'"; DataTable dt1 = SQLhelp.GetDataTable(sql1, CommandType.Text); string wanchengshijian = DateTime.Now.ToString(); DateTime zuizhong = DateTime.Now; for (int i = 0; i < dt1.Rows.Count; i++) { string jiedan = dt1.Rows[i]["完成时间节点"].ToString(); string yiwancheng = dt1.Rows[i]["已完成"].ToString(); if (yiwancheng != "1") { if (jiedan != "") { DateTime kaishi = Convert.ToDateTime(dt1.Rows[i]["会议时间"]); DateTime jieshu = Convert.ToDateTime(dt1.Rows[i]["完成时间节点"]); string kaishi1 = Convert.ToDateTime(dt1.Rows[i]["会议时间"]).ToString("yyyy - MM - dd"); string jieshu1 = Convert.ToDateTime(dt1.Rows[i]["完成时间节点"]).ToString("yyyy - MM - dd"); string zerenren = dt1.Rows[i]["完成责任人"].ToString(); string neirong = dt1.Rows[i]["纪要内容"].ToString(); string shijian = dt1.Rows[i]["会议时间"].ToString(); if (jieshu1 != kaishi1) { if (zuizhong < jieshu) { string xiugai = "update tb_xiangxi set 考核绩效点=0 Where 完成责任人='" + zerenren + "' and 会议时间='" + shijian + "' and 纪要内容='" + neirong + "'"; SQLhelp.ExecuteScalar(xiugai, CommandType.Text); } if (zuizhong > jieshu) { TimeSpan shijianshu = zuizhong - jieshu; int shuliang = Convert.ToInt32(shijianshu.TotalDays - 0.5); int shuliang1 = (Convert.ToInt32((shuliang / 7)) + 1) * 2; string xiugai = "update tb_xiangxi set 考核绩效点='" + shuliang1 + "' Where 完成责任人='" + zerenren + "' and 会议时间='" + shijian + "' and 纪要内容='" + neirong + "'"; SQLhelp.ExecuteScalar(xiugai, CommandType.Text); } } if (jieshu1 == kaishi1) { string xiugai = "update tb_xiangxi set 考核绩效点=0 Where 完成责任人='" + zerenren + "' and 会议时间='" + shijian + "' and 纪要内容='" + neirong + "'"; SQLhelp.ExecuteScalar(xiugai, CommandType.Text); } } } } gridControl1.DataSource = dt1; }
private void btntijiao_Click(object sender, EventArgs e) { if (dateEdit2.DateTime <= dateEdit1.DateTime) { MessageBox.Show("请重新设置时间!"); return; } if (comboBoxEdit1.SelectedIndex == -1) { MessageBox.Show("请选择部门!"); return; } if (textBox1.Text == "") { MessageBox.Show("请选择人员!"); return; } if (comboBoxEdit3.SelectedIndex == -1) { MessageBox.Show("请选择会议室!"); return; } if (textBox2.Text == "") { MessageBox.Show("请输入会议室主题!"); return; } TimeSpan time = dateEdit2.DateTime - dateEdit1.DateTime; int xiaoshi = (int)time.TotalHours; if (xiaoshi > 14) { MessageBox.Show("时间设定过长!"); return; } string sql1 = "select * from tb_huiyishi where 预约会议室='" + comboBoxEdit3.Text + "'"; DataTable table = SQLhelp.GetDataTable(sql1, CommandType.Text); for (int i = 0; i < table.Rows.Count; i++) { DateTime kaishi = Convert.ToDateTime(table.Rows[i]["预约开始时间"]); DateTime jieshu = Convert.ToDateTime(table.Rows[i]["预约结束时间"]); if (dateEdit1.DateTime < jieshu && dateEdit2.DateTime > kaishi || dateEdit1.DateTime > kaishi && dateEdit2.DateTime < jieshu || dateEdit1.DateTime < kaishi && dateEdit2.DateTime > jieshu) { MessageBox.Show("预约时间有重叠!"); return; } } if (MessageBox.Show("确认提交吗?", "软件提示", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { string sql = "insert into tb_huiyishi (预约会议室,预约人员,预约开始时间,预约结束时间,会议室主题) values('" + comboBoxEdit3.Text + "','" + textBox1.Text + "','" + dateEdit1.DateTime + "','" + dateEdit2.DateTime + "','" + textBox2.Text + "')"; SQLhelp.ExecuteScalar(sql, CommandType.Text); MessageBox.Show("预约成功!"); this.Close(); DialogResult = DialogResult.OK; } }
private void button2_Click_1(object sender, EventArgs e) { if (textBox1.Text == "") { MessageBox.Show("请选择接收人!"); return; } if (zhonglei == "日报") { if (dataGridViewX1.Rows.Count > 11) { MessageBox.Show("常规工作内容不得超过十条,请酌情压缩!"); return; } if (dataGridViewX2.Rows.Count > 6) { MessageBox.Show("重点工作内容不得超过五条,请酌情压缩!"); return; } if (dataGridViewX3.Rows.Count > 6) { MessageBox.Show("思考不得超过五条,请酌情压缩!"); return; } if (dataGridViewX4.Rows.Count > 6) { MessageBox.Show("下阶段规划不得超过五条,请酌情压缩!"); return; } if (dataGridViewX3.Rows.Count == 1) { MessageBox.Show("必须写思考内容!"); return; } if (dataGridViewX4.Rows.Count == 1) { MessageBox.Show("必须写下阶段规划内容!"); return; } if (dataGridViewX3.Rows.Count > 1 && dataGridViewX3.Rows.Count < 7) { if (dataGridViewX3.Rows[0].Cells["开展情况3"].Value == null) { MessageBox.Show("第一条思考内容必须大于十个字符!"); return; } string a = dataGridViewX3.Rows[0].Cells["开展情况3"].Value.ToString(); int changdu = a.Length; if (changdu < 10) { MessageBox.Show("第一条思考内容必须大于十个字符!"); return; } if (a.Trim() == "") { MessageBox.Show("不准投机取巧,必须输入十个真实文字!"); return; } } if (dataGridViewX4.Rows.Count > 1 && dataGridViewX4.Rows.Count < 7) { if (dataGridViewX4.Rows[0].Cells["规划情况"].Value == null) { MessageBox.Show("第一条下阶段内容必须大于十个字符!"); return; } string a = dataGridViewX4.Rows[0].Cells["规划情况"].Value.ToString(); int changdu = a.Length; if (changdu < 10) { MessageBox.Show("第一条下阶段内容必须大于十个字符!"); return; } if (a.Trim() == "") { MessageBox.Show("不准投机取巧,必须输入十个真实文字!"); return; } } if (MessageBox.Show("确认提交吗?", "软件提示", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { DataTable dt1 = new DataTable(); dt1.Columns.Add("日期", typeof(string)); //工程名称 dt1.Columns.Add("汇报人", typeof(string)); dt1.Columns.Add("工作类别1", typeof(string)); dt1.Columns.Add("工作类别2", typeof(string)); dt1.Columns.Add("工作类别3", typeof(string)); dt1.Columns.Add("工作类别4", typeof(string)); dt1.Columns.Add("工作类别5", typeof(string)); dt1.Columns.Add("工作类别6", typeof(string)); dt1.Columns.Add("工作类别7", typeof(string)); dt1.Columns.Add("工作类别8", typeof(string)); dt1.Columns.Add("工作类别9", typeof(string)); dt1.Columns.Add("工作类别10", typeof(string)); dt1.Columns.Add("工作内容1", typeof(string)); dt1.Columns.Add("工作内容2", typeof(string)); dt1.Columns.Add("工作内容3", typeof(string)); dt1.Columns.Add("工作内容4", typeof(string)); dt1.Columns.Add("工作内容5", typeof(string)); dt1.Columns.Add("工作内容6", typeof(string)); dt1.Columns.Add("工作内容7", typeof(string)); dt1.Columns.Add("工作内容8", typeof(string)); dt1.Columns.Add("工作内容9", typeof(string)); dt1.Columns.Add("工作内容10", typeof(string)); dt1.Columns.Add("完成情况1", typeof(string)); dt1.Columns.Add("完成情况2", typeof(string)); dt1.Columns.Add("完成情况3", typeof(string)); dt1.Columns.Add("完成情况4", typeof(string)); dt1.Columns.Add("完成情况5", typeof(string)); dt1.Columns.Add("完成情况6", typeof(string)); dt1.Columns.Add("完成情况7", typeof(string)); dt1.Columns.Add("完成情况8", typeof(string)); dt1.Columns.Add("完成情况9", typeof(string)); dt1.Columns.Add("完成情况10", typeof(string)); dt1.Columns.Add("思考1", typeof(string)); dt1.Columns.Add("思考2", typeof(string)); dt1.Columns.Add("思考3", typeof(string)); dt1.Columns.Add("思考4", typeof(string)); dt1.Columns.Add("思考5", typeof(string)); dt1.Columns.Add("下阶段1", typeof(string)); dt1.Columns.Add("下阶段2", typeof(string)); dt1.Columns.Add("下阶段3", typeof(string)); dt1.Columns.Add("下阶段4", typeof(string)); dt1.Columns.Add("下阶段5", typeof(string)); dt1.Columns.Add("日1", typeof(string)); dt1.Columns.Add("日2", typeof(string)); dt1.Columns.Add("日3", typeof(string)); dt1.Columns.Add("日4", typeof(string)); dt1.Columns.Add("日5", typeof(string)); dt1.Columns.Add("存在问题1", typeof(string)); dt1.Columns.Add("存在问题2", typeof(string)); dt1.Columns.Add("存在问题3", typeof(string)); dt1.Columns.Add("存在问题4", typeof(string)); dt1.Columns.Add("存在问题5", typeof(string)); DataRow dr1 = dt1.NewRow(); dr1["日期"] = DateTime.Now.ToString("yyyy-MM-dd"); dr1["汇报人"] = yonghu; for (int i = 0; i < dataGridViewX1.Rows.Count - 1; i++) { if (dataGridViewX1.Rows[i].Cells["工作类别"].Value == null) { dr1["工作类别" + (i + 1)] = ""; } if (dataGridViewX1.Rows[i].Cells["工作类别"].Value != null) { dr1["工作类别" + (i + 1)] = dataGridViewX1.Rows[i].Cells["工作类别"].Value.ToString(); } if (dataGridViewX1.Rows[i].Cells["工作内容"].Value == null) { dr1["工作内容" + (i + 1)] = ""; } if (dataGridViewX1.Rows[i].Cells["工作内容"].Value != null) { dr1["工作内容" + (i + 1)] = dataGridViewX1.Rows[i].Cells["工作内容"].Value.ToString(); } if (dataGridViewX1.Rows[i].Cells["完成情况"].Value == null) { dr1["完成情况" + (i + 1)] = ""; } if (dataGridViewX1.Rows[i].Cells["完成情况"].Value != null) { dr1["完成情况" + (i + 1)] = dataGridViewX1.Rows[i].Cells["完成情况"].Value.ToString(); } } for (int i = 0; i < dataGridViewX2.Rows.Count - 1; i++) { if (dataGridViewX2.Rows[i].Cells["开展情况2"].Value == null) { dr1["日" + (i + 1)] = ""; } if (dataGridViewX2.Rows[i].Cells["开展情况2"].Value != null) { dr1["日" + (i + 1)] = dataGridViewX2.Rows[i].Cells["开展情况2"].Value.ToString(); } if (dataGridViewX2.Rows[i].Cells["存在问题"].Value == null) { dr1["存在问题" + (i + 1)] = ""; } if (dataGridViewX2.Rows[i].Cells["存在问题"].Value != null) { dr1["存在问题" + (i + 1)] = dataGridViewX2.Rows[i].Cells["存在问题"].Value.ToString(); } } for (int i = 0; i < dataGridViewX3.Rows.Count - 1; i++) { if (dataGridViewX3.Rows[i].Cells["开展情况3"].Value == null) { dr1["思考" + (i + 1)] = ""; } if (dataGridViewX3.Rows[i].Cells["开展情况3"].Value != null) { dr1["思考" + (i + 1)] = dataGridViewX3.Rows[i].Cells["开展情况3"].Value.ToString(); } } for (int i = 0; i < dataGridViewX4.Rows.Count - 1; i++) { if (dataGridViewX4.Rows[i].Cells["规划情况"].Value == null) { dr1["下阶段" + (i + 1)] = ""; } if (dataGridViewX4.Rows[i].Cells["规划情况"].Value != null) { dr1["下阶段" + (i + 1)] = dataGridViewX4.Rows[i].Cells["规划情况"].Value.ToString(); } } dt1.Rows.Add(dr1); string tempFile = Application.StartupPath + "\\日报模板.doc"; Document doc = new Document(tempFile); DocumentBuilder builder = new DocumentBuilder(doc); NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true); Dictionary <string, string> dic = new Dictionary <string, string>(); DataRow dr = dt1.Rows[0]; dic.Add("日期", dr["日期"].ToString()); dic.Add("汇报人", dr["汇报人"].ToString()); dic.Add("工作类别1", dr["工作类别1"].ToString()); dic.Add("工作类别2", dr["工作类别2"].ToString()); dic.Add("工作类别3", dr["工作类别3"].ToString()); dic.Add("工作类别4", dr["工作类别4"].ToString()); dic.Add("工作类别5", dr["工作类别5"].ToString()); dic.Add("工作类别6", dr["工作类别6"].ToString()); dic.Add("工作类别7", dr["工作类别7"].ToString()); dic.Add("工作类别8", dr["工作类别8"].ToString()); dic.Add("工作类别9", dr["工作类别9"].ToString()); dic.Add("工作类别10", dr["工作类别10"].ToString()); dic.Add("工作内容1", dr["工作内容1"].ToString()); dic.Add("工作内容2", dr["工作内容2"].ToString()); dic.Add("工作内容3", dr["工作内容3"].ToString()); dic.Add("工作内容4", dr["工作内容4"].ToString()); dic.Add("工作内容5", dr["工作内容5"].ToString()); dic.Add("工作内容6", dr["工作内容6"].ToString()); dic.Add("工作内容7", dr["工作内容7"].ToString()); dic.Add("工作内容8", dr["工作内容8"].ToString()); dic.Add("工作内容9", dr["工作内容9"].ToString()); dic.Add("工作内容10", dr["工作内容10"].ToString()); dic.Add("完成情况1", dr["完成情况1"].ToString()); dic.Add("完成情况2", dr["完成情况2"].ToString()); dic.Add("完成情况3", dr["完成情况3"].ToString()); dic.Add("完成情况4", dr["完成情况4"].ToString()); dic.Add("完成情况5", dr["完成情况5"].ToString()); dic.Add("完成情况6", dr["完成情况6"].ToString()); dic.Add("完成情况7", dr["完成情况7"].ToString()); dic.Add("完成情况8", dr["完成情况8"].ToString()); dic.Add("完成情况9", dr["完成情况9"].ToString()); dic.Add("完成情况10", dr["完成情况10"].ToString()); dic.Add("思考1", dr["思考1"].ToString()); dic.Add("思考2", dr["思考2"].ToString()); dic.Add("思考3", dr["思考3"].ToString()); dic.Add("思考4", dr["思考4"].ToString()); dic.Add("思考5", dr["思考5"].ToString()); dic.Add("下阶段1", dr["下阶段1"].ToString()); dic.Add("下阶段2", dr["下阶段2"].ToString()); dic.Add("下阶段3", dr["下阶段3"].ToString()); dic.Add("下阶段4", dr["下阶段4"].ToString()); dic.Add("下阶段5", dr["下阶段5"].ToString()); dic.Add("日1", dr["日1"].ToString()); dic.Add("日2", dr["日2"].ToString()); dic.Add("日3", dr["日3"].ToString()); dic.Add("日4", dr["日4"].ToString()); dic.Add("日5", dr["日5"].ToString()); dic.Add("存在问题1", dr["存在问题1"].ToString()); dic.Add("存在问题2", dr["存在问题2"].ToString()); dic.Add("存在问题3", dr["存在问题3"].ToString()); dic.Add("存在问题4", dr["存在问题4"].ToString()); dic.Add("存在问题5", dr["存在问题5"].ToString()); foreach (var key in dic.Keys) { builder.MoveToBookmark(key); builder.Write(dic[key]); } string mingcheng = yonghu + DateTime.Now.ToString("yyyy-MM-dd") + "日报" + ".doc"; FileInfo info1 = new FileInfo(Application.StartupPath + "\\" + mingcheng); string fileName11 = info1.Name.ToString(); string floderName = fileName11.Substring(0, fileName11.Length - 4).ToString(); doc.Save(info1.DirectoryName + "\\" + fileName11); FileInfo info = new FileInfo(info1.DirectoryName + "\\" + fileName11); //获得文件大小 long fileSize12 = info.Length; //提取文件名,三步走 int index = info.FullName.LastIndexOf("."); string fileName12 = info.FullName.Remove(index); fileName12 = fileName12.Substring(fileName12.LastIndexOf(@"\") + 1); //txtMingcheng.Text = fileName; //获得文件扩展名 string fileType12 = info.Extension.Replace(".", ""); //把文件转换成二进制流 byte[] files12 = new byte[Convert.ToInt32(fileSize12)]; FileStream file = new FileStream(info1.DirectoryName + "\\" + fileName11, FileMode.Open, FileAccess.Read); BinaryReader read = new BinaryReader(file); read.Read(files12, 0, Convert.ToInt32(fileSize12)); DateTime shijian1 = DateTime.Now; string sql1 = "INSERT INTO tb_wenjian(文件,提交时间,员工姓名) VALUES (@pic,'" + shijian1 + "','" + yonghu + "')"; SQLhelp.ExecuteNonquery(sql1, CommandType.Text, files12); string riqi = DateTime.Now.ToString("yyyy-MM-dd"); string biaoti = DateTime.Now.ToString("yyyy-MM-dd") + yonghu + "日报"; string sql = "update tb_wenjian set 报告类型='日报',提交时间='" + shijian1 + "',员工备注='" + txtBeizhu.Text + "',文件类型='doc',部门='" + bumen + "',日期='" + riqi + "' ,报告标题='" + biaoti + "',接收人='" + textBox1.Text + "',编号='" + bianhao + "' where 员工姓名='" + yonghu + "' and 提交时间='" + shijian1 + "' "; int g = SQLhelp.innn(sql, CommandType.Text); if (txtName.Text != "") { string sql2 = "update tb_wenjian set 附件=@pic where 员工姓名='" + yonghu + "' and 提交时间='" + shijian1 + "' "; SQLhelp.ExecuteNonquery(sql2, CommandType.Text, files2); string sql3 = "update tb_wenjian set 附件名称='" + fileName2 + "',附件类型='" + fileType2 + "' where 员工姓名='" + yonghu + "' and 提交时间='" + shijian1 + "' "; SQLhelp.ExecuteScalar(sql3, CommandType.Text); } MessageBox.Show("提交成功!"); this.DialogResult = DialogResult.OK; this.Close(); } } }
public void reload1() { if (yonghu == "桑甜") { string strsql1 = "select id,会议时间,纪要内容,批复,纪要上传人,完成责任人,更新,是否有回复,完成时间节点,考核绩效点,关联责任人,指示项附件名称 from tb_xiangxi where 已完成=0 and 纪要类型='指示项' "; dataGridViewX1.DataSource = SQLhelp.GetDataTable(strsql1, CommandType.Text); } if (yonghu == "聂燕") { string strsql1 = "select id,会议时间,纪要内容,批复,纪要上传人,完成责任人,更新,是否有回复,完成时间节点,考核绩效点,关联责任人,指示项附件名称 from tb_xiangxi where 已完成=0 and 纪要类型='指示项' "; dataGridViewX1.DataSource = SQLhelp.GetDataTable(strsql1, CommandType.Text); } if (yonghu == "庄卫星") { string strsql1 = "select id,会议时间,纪要内容,批复,纪要上传人,完成责任人,更新,是否有回复,完成时间节点,考核绩效点,关联责任人,指示项附件名称 from tb_xiangxi where 已完成=0 and 纪要类型='指示项' ";; dataGridViewX1.DataSource = SQLhelp.GetDataTable(strsql1, CommandType.Text); } if (yonghu == "赵蕾蕾") { string strsql1 = "select id,会议时间,纪要内容,批复,纪要上传人,完成责任人,更新,是否有回复,完成时间节点,考核绩效点,关联责任人,指示项附件名称 from tb_xiangxi where 已完成=0 and 纪要类型='指示项' "; dataGridViewX1.DataSource = SQLhelp.GetDataTable(strsql1, CommandType.Text); } if (yonghu == "徐魏巍") { string strsql1 = "select id,会议时间,纪要内容,批复,纪要上传人,完成责任人,更新,是否有回复,完成时间节点,考核绩效点,关联责任人,指示项附件名称 from tb_xiangxi where 已完成=0 and 纪要类型='指示项' "; dataGridViewX1.DataSource = SQLhelp.GetDataTable(strsql1, CommandType.Text); } if (yonghu == "蔡红兵") { string strsql1 = "select id,会议时间,纪要内容,批复,纪要上传人,完成责任人,更新,是否有回复,完成时间节点,考核绩效点,关联责任人,指示项附件名称 from tb_xiangxi where 已完成=0 and 纪要类型='指示项' "; dataGridViewX1.DataSource = SQLhelp.GetDataTable(strsql1, CommandType.Text); } if (yonghu == "钱陆亦") { string strsql1 = "select id,会议时间,纪要内容,批复,纪要上传人,完成责任人,更新,是否有回复,完成时间节点,考核绩效点,关联责任人,指示项附件名称 from tb_xiangxi where 已完成=0 and 纪要类型='指示项' "; DataTable dt = SQLhelp.GetDataTable(strsql1, CommandType.Text); string wanchengshijian = DateTime.Now.ToString(); DateTime zuizhong = DateTime.Now; for (int i = 0; i < dt.Rows.Count; i++) { string jiedan = dt.Rows[i]["完成时间节点"].ToString(); if (jiedan != "") { DateTime kaishi = Convert.ToDateTime(dt.Rows[i]["会议时间"]); DateTime jieshu = Convert.ToDateTime(dt.Rows[i]["完成时间节点"]); string kaishi1 = Convert.ToDateTime(DateTime.Now).ToString("yyyy - MM - dd"); string jieshu1 = Convert.ToDateTime(dt.Rows[i]["完成时间节点"]).ToString("yyyy - MM - dd"); string zerenren = dt.Rows[i]["完成责任人"].ToString(); string neirong = dt.Rows[i]["纪要内容"].ToString(); string shijian = dt.Rows[i]["会议时间"].ToString(); if (jieshu1 != kaishi1) { if (zuizhong < jieshu) { string xiugai = "update tb_xiangxi set 考核绩效点=0 Where 完成责任人='" + zerenren + "' and 会议时间='" + shijian + "' and 纪要内容='" + neirong + "'"; SQLhelp.ExecuteScalar(xiugai, CommandType.Text); } if (zuizhong > jieshu) { TimeSpan shijianshu = zuizhong - jieshu; int shuliang = Convert.ToInt32(shijianshu.TotalDays - 0.5); int shuliang1 = (Convert.ToInt32((shuliang / 7)) + 1) * 2; string xiugai = "update tb_xiangxi set 考核绩效点='" + shuliang1 + "' Where 完成责任人='" + zerenren + "' and 会议时间='" + shijian + "' and 纪要内容='" + neirong + "'"; SQLhelp.ExecuteScalar(xiugai, CommandType.Text); } } if (jieshu1 == kaishi1) { string xiugai = "update tb_xiangxi set 考核绩效点=0 Where 完成责任人='" + zerenren + "' and 会议时间='" + shijian + "' and 纪要内容='" + neirong + "'"; SQLhelp.ExecuteScalar(xiugai, CommandType.Text); } } } dataGridViewX1.DataSource = dt; } }
private void simpleButton1_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtZerenren1.Text.Trim())) { MessageBox.Show("登录用户不许为空!", "软件提示"); return; } if (String.IsNullOrEmpty(txtPwd.Text)) { MessageBox.Show("登录密码不许为空!", "软件提示"); txtPwd.Focus(); return; } //用户编码不重复 string strSql = "select * from tb_operator where 用户名 = '" + txtZerenren1.Text.Trim() + "'"; if (Convert.ToString(SQLhelp.ExecuteScalar(strSql, CommandType.Text)) == "") { MessageBox.Show("登录用户不正确!", "软件提示"); return; } try { DataTable dt = SQLhelp.GetDataTable(strSql, CommandType.Text); DataRow dr = dt.Rows[0]; string a = dt.Rows[0]["用户名"].ToString(); //用户名 string ce = dt.Rows[0]["密码"].ToString(); if (txtPwd.Text != dt.Rows[0]["密码"].ToString()) //若密码不相同 { MessageBox.Show("登录密码不正确!", "软件提示"); txtPwd.Focus(); } else { String Triton = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); version version = new version(); if (version.pluto(Triton, "zttoffice") && judgedepartment(a)) { downloadexe downloadexe = new downloadexe(); downloadexe.ShowDialog(); this.Close(); } else if (version.pluto1(Triton)) { version.setprocess(); } else { BonusSkins.Register(); SkinManager.EnableFormSkins(); UserLookAndFeel.Default.SetSkinStyle("Office 2010 Blue"); // 设置皮肤样式 getdevice getdevice = new getdevice(); getData getData = new getData(); //string s = Convert.ToDateTime(getData.getservertime()); Dictionary <string, string> dty = getdevice.getdevice1(); //getdevice.readdata(dt.Rows[0]["用户名"].ToString()); string sql = "insert into tb_denglu (登录人,登录时间,mac号,cpuid,硬盘序号,操作系统,内外网,公网ip,内网ip,显卡信息,机子类型,版本号) values('" + dt.Rows[0]["用户名"].ToString() + "','" + Convert.ToDateTime(getData.getservertime()) + "','" + dty["mac号"] + "','" + dty["cpuid"] + "','" + dty["硬盘序号"] + "','" + dty["操作系统"] + "','" + dty["内外网"] + "','" + dty["公网ip"] + "','" + dty["内网ip"] + "','" + dty["显卡信息"] + "','" + dty["机子类型"] + "','" + Triton + "')"; xiangmusql.ExecuteScalar(sql, CommandType.Text); aa.yonghu = dt.Rows[0]["用户名"].ToString(); Properties.Settings.Default.isrem = this.checkbox1.Checked; Properties.Settings.Default.name = this.txtZerenren1.Text; Properties.Settings.Default.Save(); byte[] byData = new byte[100]; char[] charData = new char[1000]; FileStream file = new FileStream(Application.StartupPath + "\\提示.txt", FileMode.Open); file.Seek(0, SeekOrigin.Begin); file.Read(byData, 0, 100); Decoder d = Encoding.Default.GetDecoder(); d.GetChars(byData, 0, byData.Length, charData, 0); file.Close(); FileStream fs = new FileStream(Application.StartupPath + "\\提示.txt", FileMode.Open); //获得字节数组 byte[] data = System.Text.Encoding.Default.GetBytes("1"); //开始写入 fs.Write(data, 0, data.Length); //清空缓冲区、关闭流 fs.Flush(); fs.Close(); if (charData[0].ToString() == "0") { Frtishi form1 = new Frtishi(); form1.yonghu = dt.Rows[0]["用户名"].ToString(); form1.Show(); this.Hide(); } string sql3 = "select mac号 from tb_mac where mac号='" + dty["mac号"] + "'"; DataTable dt1 = xiangmusql.GetDataTable(sql3, CommandType.Text); if (dt1.Rows.Count < 1) { Frtishi1 Frtishi1 = new Frtishi1(dty["mac号"]); Frtishi1.ShowDialog(); } else { if (charData[0].ToString() == "1") { aa.Show(); this.Hide(); } } } } } catch (Exception ex) { MessageBox.Show(ex.Message, "软件提示"); } }
private void btnSave_Click_1(object sender, EventArgs e) { int b = 0; int a = 0; if (String.IsNullOrEmpty(txtOperatorName.Text.Trim())) { MessageBox.Show("操作名称不许为空!", "软件提示"); txtOperatorName.Focus(); return; } if (String.IsNullOrEmpty(txtPassword.Text)) { MessageBox.Show("操作密码不许为空!", "软件提示"); txtPassword.Focus(); return; } if (!(txtPassword.Text == txtAffirmPassword.Text)) { MessageBox.Show("确认密码与操作密码不相同!", "软件提示"); txtAffirmPassword.Focus(); return; } if (comboBox1.SelectedIndex == -1) { MessageBox.Show("请选择部门!", "软件提示"); txtPassword.Focus(); return; } if (textBox1.Text == "") { MessageBox.Show("序号不许为空!", "软件提示"); txtPassword.Focus(); return; } if (code == "Add") { if (Chquanxian.Checked == true) { b = 1; } if (checkBox1.Checked == true) { a = 1; } if (txtPassword.Text == txtAffirmPassword.Text) { string strSql11 = "select 用户名 from tb_operator where 用户名='" + txtOperatorName.Text + "' "; string result = Convert.ToString(SQLhelp.ExecuteScalar(strSql11, CommandType.Text)); if (result != "") { MessageBox.Show("该账号已存在!"); txtOperatorName.Focus(); return; } string strSql = string.Format(@"insert into tb_operator(用户名,密码,权限管理,部门,序号,报告组) values('{0}','{1}','{2}','{3}','{4}','{5}')", txtOperatorName.Text, txtPassword.Text, b, comboBox1.Text, textBox1.Text, a); if (MessageBox.Show("确认添加吗?", "软件提示", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { string aa = Convert.ToString(SQLhelp.ExecuteScalar(strSql, CommandType.Text)); string sql = "insert into tb_operator1(用户名,密码,权限管理,部门,序号,报告组) values('" + txtOperatorName.Text + "','" + txtPassword.Text + "','" + b + "','" + comboBox1.Text + "','" + textBox1.Text + "','" + a + "')"; SQLhelp.ExecuteScalar(sql, CommandType.Text); MessageBox.Show("保存成功!", "软件提示"); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("保存失败!", "软件提示"); txtOperatorName.SelectAll(); txtOperatorName.Focus(); } } else { MessageBox.Show("两次输入密码不同!"); txtPassword.Focus(); return; } } if (code == "Edit") { if (Chquanxian.Checked == true) { b = 1; } if (checkBox1.Checked == true) { a = 1; } if (txtPassword.Text == txtAffirmPassword.Text) { string strSql1 = "update tb_operator set 用户名= '" + txtOperatorName.Text + "' ,密码= " + txtPassword.Text + ",报告组= " + a + " ,权限管理= " + b + ",部门= '" + comboBox1.Text + "',序号= '" + textBox1.Text + "' where 用户名='" + yonghu + "'"; if (MessageBox.Show("确认修改吗?", "软件提示", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { string aa = Convert.ToString(SQLhelp.ExecuteScalar(strSql1, CommandType.Text)); MessageBox.Show("保存成功!", "软件提示"); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("保存失败!", "软件提示"); txtOperatorName.SelectAll(); txtOperatorName.Focus(); } } else { MessageBox.Show("两次输入密码不同!"); txtPassword.Focus(); return; } } }