//删除监测人 private void delObj_Click(object sender, EventArgs e) { delPwd DP = new delPwd(); string sql = ""; string getName = sqlDataView[0, sqlDataView.CurrentCell.RowIndex].Value.ToString(); string getSFZ = sqlDataView[7, sqlDataView.CurrentCell.RowIndex].Value.ToString(); DP.ShowDialog(); //执行删除 if (DP.rightYH == "1") { DialogResult res = MessageBox.Show("确定删除?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (DialogResult.Yes == res) { sql = "update JCRJBXX set JCRdellogo='1' where JCRsfz='" + getSFZ + "' "; string re = sqlMethod(sql, 2); if (re != "-1") { MessageBox.Show("删除成功", "提示"); singleQuery(); } else { MessageBox.Show("删除失败", "提示"); } } } }
private void btnDCSJ_Selected_Click(object sender, EventArgs e) { delPwd DP = new delPwd(); DP.Show(); if (DP.rightYH != "1") { return; } List <string> listSFZ = new List <string>(); List <int> RowsIndex = new List <int>();//记录选中行的集合 //MessageBox.Show(sqlDataView.SelectedRows[1].Index.ToString()); for (int j = dataGridView1.SelectedRows.Count - 1; j >= 0; j--) { RowsIndex.Add(dataGridView1.SelectedRows[j].Index); } foreach (int item in RowsIndex) { try { //listSFZ.Add(dataGridView1[1, item].Value.ToString()); //string sqlguid = "select SJguid from JCRSJXX where JCRsfz='" + dataGridView1[1,item].Value.ToString()+ "'"; //string getGuid = sqlMethod(sqlguid, 1); listSFZ.Add(dataGridView1[8, item].Value.ToString()); } catch { MessageBox.Show("请勿选择空行", "提示"); return; } } string path = ""; SaveFileDialog SFD = new SaveFileDialog(); SFD.Title = "选择存储地址"; SFD.Filter = "Excel文件|*.xls"; bool re = false; SFD.FileName = DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.Hour + "_" + DateTime.Now.Minute + "_" + DateTime.Now.Second + "SJ"; //SFD.ShowDialog(); if (SFD.ShowDialog() == DialogResult.Cancel) { return; } path = SFD.FileName; re = DCSJ_selected(path, listSFZ); if (re == true) { MessageBox.Show("导出成功!", "提示"); dataGridView1.ClearSelection(); } else { MessageBox.Show("导出失败!", "提示"); dataGridView1.ClearSelection(); } }
private void btnDCSJ_one_Click(object sender, EventArgs e) { delPwd DP = new delPwd(); DP.Show(); if (DP.rightYH != "1") { return; } //List<int> RowsIndex = new List<int>(); //for (int j = dataGridView1.SelectedRows.Count - 1; j >= 0; j--) //{ // RowsIndex.Add(dataGridView1.SelectedRows[j].Index); //} //获得要导出的对象的身份证集合 List <string> listSFZ = new List <string>(); for (int i = 0; i < dataGridView1.SelectedRows.Count; i++) { string sqlguid = "select SJguid from JCRSJXX where JCRsfz='" + dataGridView1[1, dataGridView1.CurrentRow.Index].Value.ToString() + "'"; string getGuid = sqlMethod(sqlguid, 1); listSFZ.Add(getGuid); } string path = ""; SaveFileDialog SFD = new SaveFileDialog(); SFD.Title = "选择存储地址"; SFD.Filter = "Excel文件|*.xls"; bool re = false; SFD.FileName = DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.Hour + "_" + DateTime.Now.Minute + "_" + DateTime.Now.Second + "SJ"; //SFD.ShowDialog(); if (SFD.ShowDialog() == DialogResult.Cancel) { return; } path = SFD.FileName; re = DCSJ_selected(path, listSFZ); if (re == true) { MessageBox.Show("导出成功!", "提示"); dataGridView1.ClearSelection(); } else { MessageBox.Show("导出失败!", "提示"); dataGridView1.ClearSelection(); } }
//修改对象信息按钮 private void changeObjInfo_Click(object sender, EventArgs e) { DetailForm DI = new DetailForm(); string sqlID = ""; //身份证号 sqlID = sqlDataView[7, sqlDataView.CurrentCell.RowIndex].Value.ToString(); SFZid = sqlID; delPwd DP = new delPwd(); if (Login.limit == "2") { MessageBox.Show("对不起,您没有权限访问", "提示"); } else { DP.ShowDialog(); if (DP.rightYH == "1") { #region 将详细信息显示出来 //姓名 sql = "select JCRname from JCRJBXX where JCRsfz='" + sqlID + "'"; DI.GetName = getInfo(sql); //性别 sql = "select JCRsex from JCRJBXX where JCRsfz='" + sqlID + "'"; DI.GetSex = getInfo(sql); //籍贯 sql = "select JCRJG from JCRJBXX where JCRsfz='" + sqlID + "'"; DI.GetJG = getInfo(sql); //职业 sql = "select JCRzy from JCRJBXX where JCRsfz='" + sqlID + "'"; DI.GetZY = getInfo(sql); //民族 sql = "select JCRnation from JCRJBXX where JCRsfz='" + sqlID + "'"; DI.GetMZ = getInfo(sql); //经济状况 sql = "select JCRjjzk from JCRJBXX where JCRsfz='" + sqlID + "'"; DI.GetJJZK = getInfo(sql); //列控单位 sql = "select JCRlkdw from JCRJBXX where JCRsfz='" + sqlID + "'"; DI.GetLKDW = getInfo(sql); //身份证号 DI.GetSFZ = sqlID; //政治面貌 sql = "select JCRpolity from JCRJBXX where JCRsfz='" + sqlID + "'"; DI.GetZZMM = getInfo(sql); //分类 sql = "select JCRfl from JCRJBXX where JCRsfz='" + sqlID + "'"; DI.GetFL = getInfo(sql); //列控级别 sql = "select JCRlkjb from JCRJBXX where JCRsfz='" + sqlID + "'"; DI.GetLKJB = getInfo(sql); //毕业院校 sql = "select JCRbyyx from JCRJBXX where JCRsfz='" + sqlID + "'"; DI.GetBYYX = getInfo(sql); //户籍所在地 sql = "select JCRhjszd from JCRJBXX where JCRsfz='" + sqlID + "'"; DI.GetHJSZD = getInfo(sql); //现居住地 sql = "select JCRxjzd from JCRJBXX where JCRsfz='" + sqlID + "'"; DI.GetXJZD = getInfo(sql); //工作单位 sql = "select JCRgzdw from JCRJBXX where JCRsfz='" + sqlID + "'"; DI.GetGZDW = getInfo(sql); //关系人员 sql = "select JCRgxry from JCRJBXX where JCRsfz='" + sqlID + "'"; DI.GetGXRY = getInfo(sql); //个人简历 sql = "select JCRgrjl from JCRJBXX where JCRsfz='" + sqlID + "'"; DI.GetGRJL = getInfo(sql); //固定电话 sql = "select JCRgddh from JCRJBXX where JCRsfz='" + sqlID + "'"; DI.GetGDDH = getInfo(sql); //备注 sql = "select JCRbz from JCRJBXX where JCRsfz='" + sqlID + "'"; DI.GetBZ = getInfo(sql); //移动电话 sql = "select JCRyddh from JCRJBXX where JCRsfz='" + sqlID + "'"; DI.GetYDDH = getInfo(sql); //电子邮件 sql = "select JCRdzyj from JCRJBXX where JCRsfz='" + sqlID + "'"; DI.GetDZYJ = getInfo(sql); //QQ sql = "select JCRqq from JCRJBXX where JCRsfz='" + sqlID + "'"; DI.GetQQ = getInfo(sql); //微信 sql = "select JCRwx from JCRJBXX where JCRsfz='" + sqlID + "'"; DI.GetWX = getInfo(sql); #endregion See_Change = "2"; DI.Show(); } } }
private void DCselected_Click(object sender, EventArgs e) { delPwd DP = new delPwd(); DP.Show(); if (DP.rightYH != "1") { return; } DialogResult DR = MessageBox.Show("导出该对象的全部信息吗?", "提示:选择否则导出部分信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question); //获得要导出的对象的身份证集合 List <string> listSFZ = new List <string>(); List <int> RowsIndex = new List <int>();//记录选中行的集合 //MessageBox.Show(sqlDataView.SelectedRows[1].Index.ToString()); for (int j = sqlDataView.SelectedRows.Count - 1; j >= 0; j--) { RowsIndex.Add(sqlDataView.SelectedRows[j].Index); } foreach (int item in RowsIndex) { try { listSFZ.Add(sqlDataView[7, item].Value.ToString()); } catch { MessageBox.Show("请勿选择空行", "提示"); return; } } //for (int i = 0; i < sqlDataView.SelectedRows.Count; i++) //{ // try // { // listSFZ.Add(sqlDataView[7, sqlDataView.CurrentRow.Index + i].Value.ToString()); // } // catch // { MessageBox.Show("请勿选择空行", "提示");return; } //} string path = ""; SaveFileDialog SFD = new SaveFileDialog(); SFD.Title = "选择存储地址"; SFD.Filter = "Excel文件|*.xls"; bool re = false; if (DR == DialogResult.No) { SFD.FileName = DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.Hour + "_" + DateTime.Now.Minute + "_" + DateTime.Now.Second + "_部分基本信息"; //SFD.ShowDialog(); if (SFD.ShowDialog() == DialogResult.Cancel) { return; } path = SFD.FileName; re = saveAsExcelMode_MulRows(path, listSFZ.Count, 1, listSFZ); } else { SFD.FileName = DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.Hour + "_" + DateTime.Now.Minute + "_" + DateTime.Now.Second + "_全部基本信息"; //SFD.ShowDialog(); if (SFD.ShowDialog() == DialogResult.Cancel) { return; } path = SFD.FileName; re = saveAsExcelMode_MulRows(path, listSFZ.Count, 2, listSFZ); } if (re == true) { MessageBox.Show("导出成功", "提示"); sqlDataView.ClearSelection(); } else { MessageBox.Show("导出失败", "提示"); sqlDataView.ClearSelection(); } }
//设置线程 public void RunDCinfo() { delPwd DP = new delPwd(); DP.Show(); if (DP.rightYH != "1") { return; } DialogResult DR = MessageBox.Show("导出该对象的全部信息吗?", "提示:选择否则导出部分信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question); //获得要导出的对象的身份证集合 List <string> listSFZ = new List <string>(); for (int i = 0; i < sqlDataView.SelectedRows.Count; i++) { listSFZ.Add(sqlDataView[7, sqlDataView.CurrentRow.Index].Value.ToString()); } string path = ""; SaveFileDialog SFD = new SaveFileDialog(); SFD.Title = "选择存储地址"; SFD.Filter = "Excel文件|*.xls"; bool re = false; if (DR == DialogResult.No) { SFD.FileName = DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.Hour + "_" + DateTime.Now.Minute + "_" + DateTime.Now.Second + "_部分基本信息"; //SFD.ShowDialog(); if (SFD.ShowDialog() == DialogResult.Cancel) { return; } path = SFD.FileName; re = saveAsExcelMode_MulRows(path, listSFZ.Count, 1, listSFZ); } else { SFD.FileName = DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.Hour + "_" + DateTime.Now.Minute + "_" + DateTime.Now.Second + "_全部基本信息"; // SFD.ShowDialog(); if (SFD.ShowDialog() == DialogResult.Cancel) { return; } path = SFD.FileName; re = saveAsExcelMode_MulRows(path, listSFZ.Count, 2, listSFZ); } if (re == true) { MessageBox.Show("导出成功", "提示"); sqlDataView.ClearSelection(); } else { MessageBox.Show("导出失败", "提示"); sqlDataView.ClearSelection(); } //持起主线程 Thread.Sleep(0); //执行线程 mythread.Abort(); }
//删除附件 private void DelThisFJ_Click(object sender, EventArgs e) { delPwd DP = new delPwd(); DP.ShowDialog(); if (DP.rightYH != "1") { return; } string delJCRsfz = dataGridWD[1, dataGridWD.CurrentCell.RowIndex].Value.ToString(); string delName = dataGridWD[2, dataGridWD.CurrentCell.RowIndex].Value.ToString(); if (FJflag == "文档") { string sql = "update FJWD set WDdellogo='1' where JCRsfz='" + delJCRsfz + "' and WDname='" + delName + "'"; string re = sqlMethod(sql, 2); if (re == "-1") { MessageBox.Show("删除失败", "提示"); return; } else { MessageBox.Show("删除成功", "提示"); } string sqlCount = "select WDCount from JCRFJ where JCRsfz='" + getSFZ + "'"; string sqlTable = "select JCRname as 姓名,JCRsfz as 身份证号, WDname as 文件名,WDAddTime as 添加时间 from FJWD where JCRsfz='" + getSFZ + "' and WDdellogo='0' "; if (queryMethod(sqlCount, sqlTable) == false) { MessageBox.Show("已无更多附件显示", "提示"); return; } } if (FJflag == "照片") { string sql = "update FJZP set ZPdellogo='1' where JCRsfz='" + delJCRsfz + "' and ZPname='" + delName + "'"; string re = sqlMethod(sql, 2); if (re == "-1") { MessageBox.Show("删除失败", "提示"); return; } else { MessageBox.Show("删除成功", "提示"); } string sqlCount = "select ZPCount from JCRFJ where JCRsfz='" + getSFZ + "'"; string sqlTable = "select JCRname as 姓名,JCRsfz as 身份证号, ZPname as 文件名,ZPAddTime as 添加时间 from FJZP where JCRsfz='" + getSFZ + "' and ZPdellogo='0' "; if (queryMethod(sqlCount, sqlTable) == false) { MessageBox.Show("已无更多附件显示", "提示"); return; } } if (FJflag == "视频") { string sql = "update FJSP set SPdellogo='1' where JCRsfz='" + delJCRsfz + "' and SPname='" + delName + "'"; string re = sqlMethod(sql, 2); if (re == "-1") { MessageBox.Show("删除失败", "提示"); return; } else { MessageBox.Show("删除成功", "提示"); } string sqlCount = "select SPCount from JCRFJ where JCRsfz='" + getSFZ + "'"; string sqlTable = "select JCRname as 姓名,JCRsfz as 身份证号, SPname as 文件名,SPAddTime as 添加时间 from FJSP where JCRsfz='" + getSFZ + "' and SPdellogo='0' "; if (queryMethod(sqlCount, sqlTable) == false) { MessageBox.Show("已无更多附件显示", "提示"); return; } } if (FJflag == "音频") { string sql = "update FJYY set YYdellogo='1' where JCRsfz='" + delJCRsfz + "' and YYname='" + delName + "'"; string re = sqlMethod(sql, 2); if (re == "-1") { MessageBox.Show("删除失败", "提示"); return; } else { MessageBox.Show("删除成功", "提示"); } string sqlCount = "select YYCount from JCRFJ where JCRsfz='" + getSFZ + "'"; string sqlTable = "select JCRname as 姓名,JCRsfz as 身份证号, YYname as 文件名,YYAddTime as 添加时间 from FJYY where JCRsfz='" + getSFZ + "' and YYdellogo='0' "; if (queryMethod(sqlCount, sqlTable) == false) { MessageBox.Show("已无更多附件显示", "提示"); return; } } }