private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (this.dataGridView2.Rows[e.RowIndex].Cells[0].EditedFormattedValue.ToString() == "True") { int st = e.RowIndex; for (int i = 0; i < dataGridView2.RowCount - 1; i++) { if (i != st) { dataGridView2.Rows[i].Cells[0].Value = false; } } } string str99 = ""; int count = dataGridView2.Rows.Count; for (int n = 0; n < count; n++) { if ((bool)dataGridView2.Rows[n].Cells[0].EditedFormattedValue == true) { str99 = dataGridView2.Rows[n].Cells["案卷题名"].Value.ToString(); anId = dataGridView2.Rows[n].Cells["案卷号"].Value.ToString(); } } DataTable fff = new AABAL().Select7777(pId, str99); s11 = fff.Rows[0][0].ToString(); }
private void button1_Click(object sender, EventArgs e) { int n = 0; int l = 0; for (int j = 0; j < dataGridView1.RowCount; j++) { if ((bool)dataGridView1.Rows[j].Cells[0].EditedFormattedValue == true) { n++; string a = dataGridView1.Rows[j].Cells[1].Value.ToString(); bool flag = new AABAL().update112703(a); if (flag == true) { l++; } } } if (n == l) { MessageBox.Show("删除成功"); } DataTable dt1 = new projectBAL().Select112701(pId); dataGridView1.DataSource = dt1; dataGridView1.Refresh(); }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (this.dataGridView1.Rows[e.RowIndex].Cells[0].EditedFormattedValue.ToString() == "True") { int st = e.RowIndex; for (int i = 0; i < dataGridView1.RowCount - 1; i++) { if (i != st) { dataGridView1.Rows[i].Cells[0].Value = false; } } } string xmh = ""; string xmname = ""; int count = dataGridView1.Rows.Count; for (int n = 0; n < count; n++) { if ((bool)dataGridView1.Rows[n].Cells[0].EditedFormattedValue == true) { xmname = dataGridView1.Rows[n].Cells["项目题名"].Value.ToString(); xmh = dataGridView1.Rows[n].Cells["项目号"].Value.ToString(); } } DataTable dt = new AABAL().Select77777(pId, xmname); f11 = dt.Rows[0][0].ToString(); // MessageBox.Show(f11); }
private bool Check() { string s = textBox1.Text.Trim(); DataTable dt = new AABAL().Select4(s); DataTable dt2 = new AABAL().Select1123(s); if (dt2.Rows.Count == 0) { MessageBox.Show("用户名输入错误!"); } else { if (string.IsNullOrEmpty(textBox2.Text)) { MessageBox.Show("请输入密码!"); textBox2.Focus(); return(false); } else if (dt.Rows[0][0].ToString() != textBox2.Text) { MessageBox.Show("密码不正确!"); } } return(true); }
private void button1_Click(object sender, EventArgs e) { string a = textBox1.Text; string b = textBox2.Text; string c = textBox3.Text; DataTable dt4 = new AABAL().Select1128(a, b, c); dataGridView1.DataSource = dt4; AutoSizeColumn(dataGridView1); }
/// <summary> /// 根据用户的角色得到用户所具有的资源编号 /// </summary> /// <param name="useId"></param> private void GetResourceIdByRoleId(int[] uId) { for (int a = 0; a < i; a++) { DataTable dt = new AABAL().Select3(uId[a]); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { SearchFirstNode(dr[0].ToString()); } } } }
/// <summary> /// 递归调用遍历子节点,如果角色对子节点有权限则将其存入“角色-资源表” /// </summary> /// <param name="node"></param> private void GetSubNodeRole(TreeNode node) { for (int a = 0; a < i; a++) { foreach (TreeNode subNode in node.Nodes) { if (subNode.Checked) { bool flag = new AABAL().insert(_uId[a], Convert.ToInt32(subNode.Name)); } GetSubNodeRole(subNode); } } }
private void btn_xmnext_Click(object sender, EventArgs e) { cc2 = 0; DataTable dt12 = new ZLBAL().Select3(f11);//找sx if (dt12 == null || dt12.Rows.Count == 0) { DataTable dt11 = new DataTable(); DataTable dt5 = new AABAL().Select6(pId); int m = 0; int cnt2 = 0; while (m < dt5.Rows.Count) { dt11.Columns.Add(dt5.Rows[m][0].ToString(), typeof(string)); cnt2++; m++; } copy2 = cnt2; dataGridView2.DataSource = dt11; copyll = ll; } else { DataTable dt11 = new DataTable(); DataTable dt5 = new AABAL().Select6(pId); int m = 0; int cnt2 = 0; while (m < dt5.Rows.Count) { dt11.Columns.Add(dt5.Rows[m][0].ToString(), typeof(string)); cnt2++; m++; } copy2 = cnt2; for (int ss = 0; ss < dt12.Rows.Count;) { DataRow dr = dt11.NewRow(); for (int w = 0; w < cnt2; w++) { dr[dt5.Rows[w][0].ToString()] = dt12.Rows[ss][0].ToString(); ss++; } ll++; copyll = ll; dt11.Rows.Add(dr); } dataGridView2.DataSource = dt11; } }
/// <summary> /// 构造树的子节点 /// </summary> /// <param name="node"></param> private void InitialSubNodeList(TreeNode node) { int parentId = Convert.ToInt32(node.Name); DataTable dt = new AABAL().Select2(parentId); foreach (DataRow dr in dt.Rows) { TreeNode subNode = new TreeNode(); subNode.Name = dr[0].ToString(); subNode.Text = dr[2].ToString(); InitialSubNodeList(subNode); node.Nodes.Add(subNode); } }
/// <summary> /// 构造树的一级节点 /// </summary> private void InitialFirstNode() { DataTable dt = new AABAL().Select1(); // MessageBox.Show(dt.Rows.Count.ToString()); for (int i = 0; i < dt.Rows.Count; i++) { TreeNode node = new TreeNode(); node.Name = dt.Rows[i]["resourceId"].ToString(); node.Text = dt.Rows[i]["menuText"].ToString(); //加载子节点 InitialSubNodeList(node); treeView1.Nodes.Add(node); } }
private void LoadFirstMenuItem() { DataTable dt = new AABAL().Selectinfo(UId); foreach (DataRow dr in dt.Rows) { ToolStripMenuItem item = new ToolStripMenuItem(); item.Text = dr[2].ToString(); item.Name = dr[0].ToString(); item.Tag = dr[5]; item.Click += new EventHandler(subItem_Click); LoadSubMenuItem(item); menuStrip1.Items.Add(item); } }
private void button1_Click(object sender, EventArgs e) { string s = textBox1.Text.Trim(); if (Check()) { DataTable dt = new AABAL().Select4(s); if (dt != null && dt.Rows.Count > 0) { if (textBox2.Text == dt.Rows[0][0].ToString()) { Form主面 f = new Form主面(s); f.Show(); this.Hide(); } } } }
private void button3_Click(object sender, EventArgs e) { int[] a = new int[10000]; for (int i = 0; i < 9999; i++) { a[i] = 0; } int j = 0; bool flag1 = false; DialogResult button = MessageBox.Show("确定要删除本条信息?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk); if (button == DialogResult.Yes) { flag1 = true; } for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (Convert.ToBoolean(dataGridView1.Rows[i].Cells["cb_check"].Value) == true) { a[j++] = i; // dataGridView1.Rows.Remove(dataGridView1.Rows[i]); // i --; string useId = dataGridView1.Rows[i].Cells[1].Value.ToString();//获取焦点触发行的第二个值 bool flag = new AABAL().Delete(useId); } } int s = 0; if (flag1 == true) { while (a[s] >= 0) { dataGridView1.Rows.RemoveAt(a[s]); for (int i = s + 1; i < 9999; i++) { a[i] = a[i] - 1; } s++; } } count = dataGridView1.Rows.Count; }
private void LoadSubMenuItem(ToolStripMenuItem item) { int resourceId = Convert.ToInt32(item.Name); //根据父菜单项Id加载子菜单 DataTable dt = new AABAL().Selectinfo2(resourceId, UId); foreach (DataRow dr in dt.Rows) { ToolStripMenuItem subItem = new ToolStripMenuItem(); subItem.Tag = dr[5]; subItem.Name = dr[0].ToString(); subItem.Text = dr[2].ToString(); subItem.Click += new EventHandler(subItem_Click); LoadSubMenuItem(subItem); item.DropDownItems.Add(subItem); } }
/// <summary> /// 将角色所具有的权限进行保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { //将角色原有的资源权限删除 for (int a = 0; a < i; a++) { bool flag = new AABAL().delete(_uId[a]); } //角色拥有的一级节点写入数据库 foreach (TreeNode node in treeView1.Nodes) { for (int a = 0; a < i; a++) { if (node.Checked) { bool flag1 = new AABAL().insert(_uId[a], Convert.ToInt32(node.Name)); //将一级节点的子节点写入数据库 GetSubNodeRole(node); } } } MessageBox.Show("成功!"); this.Close(); }
private void Form图处管理_Load(object sender, EventArgs e) { DataTable dt11 = new ZLXIBAL().Select7(lzId); pId = dt11.Rows[0][0].ToString(); DataTable dt = new ZLXIBAL().Select3(lzId); gdmethod = dt.Rows[0][0].ToString(); if (gdmethod == "项目") { DataTable dt3 = new ZLXIBAL().Select2(pId, lzId); DataTable dt1 = new DataTable(); DataTable dt2 = new ZLXIBAL().Select1(); int i = 0; int cnt = 0; while (i < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[i][0].ToString(), typeof(string)); cnt++; i++; } for (int ss = 0; ss < dt3.Rows.Count;) { DataRow dr = dt1.NewRow(); for (int w = 0; w < cnt; w++) { dr[dt2.Rows[w][0].ToString()] = dt3.Rows[ss][0].ToString(); ss++; } ll++; dt1.Rows.Add(dr); } dataGridView1.DataSource = dt1; } else if (gdmethod == "案卷") { dataGridView1.ReadOnly = true; DataTable dt12 = new ZLBAL().Select112(pId, lzId); DataTable dt111 = new DataTable(); DataTable dt5 = new AABAL().Select6(pId); int m = 0; int cnt2 = 0; while (m < dt5.Rows.Count) { dt111.Columns.Add(dt5.Rows[m][0].ToString(), typeof(string)); cnt2++; m++; } for (int ss = 0; ss < dt12.Rows.Count;) { DataRow dr = dt111.NewRow(); for (int w = 0; w < cnt2; w++) { dr[dt5.Rows[w][0].ToString()] = dt12.Rows[ss][1].ToString(); ss++; } ll++; dt111.Rows.Add(dr); } dataGridView2.DataSource = dt111; } else { dataGridView1.ReadOnly = true; dataGridView2.ReadOnly = true; DataTable dt22 = new ZLBAL().Select1113(pId, lzId); DataTable dt1 = new DataTable(); DataTable dt2 = new ZLXIBAL().Select6(pId); int j = 0; int cnt3 = 0; while (j < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[j][0].ToString(), typeof(string)); cnt3++; j++; } for (int ss = 0; ss < dt22.Rows.Count;) { DataRow dr = dt1.NewRow(); for (int w = 0; w < cnt3; w++) { dr[dt2.Rows[w][0].ToString()] = dt22.Rows[ss][1].ToString(); ss++; } lw++; dt1.Rows.Add(dr); } dataGridView3.DataSource = dt1; DataGridViewButtonColumn btn = new DataGridViewButtonColumn(); btn.Name = "btnck"; btn.HeaderText = "查看"; btn.DefaultCellStyle.NullValue = "查看"; dataGridView3.Columns.Add(btn); DataGridViewButtonColumn btn2 = new DataGridViewButtonColumn(); btn2.Name = "btntc"; btn2.HeaderText = "图处"; btn2.DefaultCellStyle.NullValue = "图处"; dataGridView3.Columns.Add(btn2); } }
private void 查询_Click(object sender, EventArgs e) { pId = textBox1.Text.Trim(); filetype = textBox4.Text.Trim(); gdmethod = comboBox1.Text.Trim(); // DataSet ds = new projectBAL().Select(filetype, pId,gdmethod); adapter = new MySqlDataAdapter("SELECT pId ,projectunit ,filetype ,gdmethod ,year,url,hz FROM project1 WHERE filetype like '%" + filetype + "%' and pId like '%" + pId + "%' and gdmethod like '%" + gdmethod + "%'", strConn); /*DataGridViewCheckBoxColumn columncb = new DataGridViewCheckBoxColumn(); * columncb.HeaderText = "选择"; * columncb.Name = "cb_check"; * columncb.TrueValue = true; * columncb.FalseValue = false; * //column9.DataPropertyName = "IsScienceNature"; * * columncb.DataPropertyName = "IsChecked"; * if (cnt == 0) * { * dataGridView1.Columns.Add(columncb); * cnt++; * }*/ // dataGridView1.DataSource = ds.Tables[0]; // dSet = new DataSet(); DataTable de = new DataTable(); adapter.Fill(de); de.Columns.Add("编码规则", typeof(string)); de.Columns.Add("项目流程定义", typeof(string)); int i = 0; foreach (DataRow dr in de.Rows) { int j = 0; string bmgz = ""; string xmdy = ""; DataTable dt4 = new AABAL().Select10041127(de.Rows[i][0].ToString()); while (j < 5 && dt4.Rows[0][j].ToString() != "") { if (j == 0) { bmgz = dt4.Rows[0][j].ToString(); } else { bmgz = bmgz + "-" + dt4.Rows[0][j].ToString(); } j++; } DataTable dt5 = new AABAL().Select1004112701(de.Rows[i++][0].ToString()); for (int s = 0; s < dt5.Rows.Count - 1; s++) { if (s == 0) { xmdy = dt5.Rows[s][0].ToString(); } else { xmdy = xmdy + "-" + dt5.Rows[s][0].ToString(); } } dr["编码规则"] = bmgz; dr["项目流程定义"] = xmdy; } dataGridView1.DataSource = de; //InitDataSet(); }
private void btn_aj_select_Click(object sender, EventArgs e) { string anId1 = textBox6.Text.Trim(); string anId2 = textBox5.Text.Trim(); string dangId = textBox4.Text.Trim(); DataTable dtt = (DataTable)dataGridView2.DataSource; dtt.Rows.Clear(); dataGridView2.DataSource = dtt; if (gdmethod == "项目") { if (anId1 != "" && anId2 == "") { DataTable dt = new ZLBAL().Select16(xmname, "3", pId, bh, anId1, "11"); DataTable dt111 = new DataTable(); DataTable dt5 = new AABAL().Select6(pId); int m = 0; int cnt2 = 0; while (m < dt5.Rows.Count) { dt111.Columns.Add(dt5.Rows[m][0].ToString(), typeof(string)); cnt2++; m++; } for (int ss = 0; ss < dt.Rows.Count;) { DataRow dr = dt111.NewRow(); for (int w = 0; w < cnt2; w++) { dr[dt5.Rows[w][0].ToString()] = dt.Rows[ss][0].ToString(); ss++; } ll++; dt111.Rows.Add(dr); } dataGridView2.DataSource = dt111; } else if (anId1 == "" && anId2 != "") { DataTable dt = new ZLBAL().Select17(xmname, "3", pId, bh, anId2, "11"); DataTable dt111 = new DataTable(); DataTable dt5 = new AABAL().Select6(pId); int m = 0; int cnt2 = 0; while (m < dt5.Rows.Count) { dt111.Columns.Add(dt5.Rows[m][0].ToString(), typeof(string)); cnt2++; m++; } for (int ss = 0; ss < dt.Rows.Count;) { DataRow dr = dt111.NewRow(); for (int w = 0; w < cnt2; w++) { dr[dt5.Rows[w][0].ToString()] = dt.Rows[ss][0].ToString(); ss++; } ll++; dt111.Rows.Add(dr); } dataGridView2.DataSource = dt111; } else if (anId1 != "" && anId2 != "") { DataTable dt = new ZLBAL().Select15(xmname, "3", pId, bh, anId1, anId2, "11"); DataTable dt111 = new DataTable(); DataTable dt5 = new AABAL().Select6(pId); int m = 0; int cnt2 = 0; while (m < dt5.Rows.Count) { dt111.Columns.Add(dt5.Rows[m][0].ToString(), typeof(string)); cnt2++; m++; } for (int ss = 0; ss < dt.Rows.Count;) { DataRow dr = dt111.NewRow(); for (int w = 0; w < cnt2; w++) { dr[dt5.Rows[w][0].ToString()] = dt.Rows[ss][0].ToString(); ss++; } ll++; dt111.Rows.Add(dr); } dataGridView2.DataSource = dt111; } } else { if (anId1 != "" && anId2 == "") { DataTable dt = new ZLBAL().Select10("11", anId1, pId); DataTable dt111 = new DataTable(); DataTable dt5 = new AABAL().Select6(pId); int m = 0; int cnt2 = 0; while (m < dt5.Rows.Count) { dt111.Columns.Add(dt5.Rows[m][0].ToString(), typeof(string)); cnt2++; m++; } for (int ss = 0; ss < dt.Rows.Count;) { DataRow dr = dt111.NewRow(); for (int w = 0; w < cnt2; w++) { dr[dt5.Rows[w][0].ToString()] = dt.Rows[ss][0].ToString(); ss++; } ll++; dt111.Rows.Add(dr); } dataGridView2.DataSource = dt111; } else if (anId1 == "" && anId2 != "") { DataTable dt = new ZLBAL().Select11("11", anId2, pId); DataTable dt111 = new DataTable(); DataTable dt5 = new AABAL().Select6(pId); int m = 0; int cnt2 = 0; while (m < dt5.Rows.Count) { dt111.Columns.Add(dt5.Rows[m][0].ToString(), typeof(string)); cnt2++; m++; } for (int ss = 0; ss < dt.Rows.Count;) { DataRow dr = dt111.NewRow(); for (int w = 0; w < cnt2; w++) { dr[dt5.Rows[w][0].ToString()] = dt.Rows[ss][0].ToString(); ss++; } ll++; dt111.Rows.Add(dr); } dataGridView2.DataSource = dt111; } else if (anId1 != "" && anId2 != "") { DataTable dt = new ZLBAL().Select9("11", anId1, anId2, pId); DataTable dt111 = new DataTable(); DataTable dt5 = new AABAL().Select6(pId); int m = 0; int cnt2 = 0; while (m < dt5.Rows.Count) { dt111.Columns.Add(dt5.Rows[m][0].ToString(), typeof(string)); cnt2++; m++; } for (int ss = 0; ss < dt.Rows.Count;) { DataRow dr = dt111.NewRow(); for (int w = 0; w < cnt2; w++) { dr[dt5.Rows[w][0].ToString()] = dt.Rows[ss][0].ToString(); ss++; } ll++; dt111.Rows.Add(dr); } dataGridView2.DataSource = dt111; } } if (dangId != "") { DataTable tt = new ZLBAL().Select13(dangId, pId); DataTable dt111 = new DataTable(); DataTable dt5 = new AABAL().Select6(pId); int m = 0; int cnt2 = 0; while (m < dt5.Rows.Count) { dt111.Columns.Add(dt5.Rows[m][0].ToString(), typeof(string)); cnt2++; m++; } for (int ss = 0; ss < tt.Rows.Count;) { DataRow dr = dt111.NewRow(); for (int w = 0; w < cnt2; w++) { dr[dt5.Rows[w][0].ToString()] = tt.Rows[ss][0].ToString(); ss++; } ll++; dt111.Rows.Add(dr); } dataGridView2.DataSource = dt111; } }
private void Form加工流转单_Load(object sender, EventArgs e) { textBoxYS.Enabled = false; if (nowrole != "【编码】") { DataTable dt555 = new AABAL().Select1018(textBoxLZDH.Text); textBoxYS.Text = dt555.Rows[0][0].ToString(); textBoxYS.Enabled = false; } DataTable dt4 = new AABAL().Select1004(textBoxJGLX.Text); // MessageBox.Show(dt4.Rows[0][0].ToString()); // MessageBox.Show(dt4.Rows[1][0].ToString()); // MessageBox.Show(dt4.Rows[2][0].ToString()); int cnt = 0; int i = dt4.Rows.Count; if (cnt < i) { textBoxJGLX.Text = dt4.Rows[cnt][0].ToString(); cnt++; } if (cnt < i) { textBox1.Text = dt4.Rows[cnt][0].ToString(); cnt++; } if (cnt < i) { textBox2.Text = dt4.Rows[cnt][0].ToString(); cnt++; } if (cnt < i) { textBox3.Text = dt4.Rows[cnt][0].ToString(); cnt++; } if (cnt < i) { textBox4.Text = dt4.Rows[cnt][0].ToString(); cnt++; } if (cnt < i) { textBox5.Text = dt4.Rows[cnt][0].ToString(); cnt++; } if (cnt < i) { textBox6.Text = dt4.Rows[cnt][0].ToString(); cnt++; } if (cnt < i) { textBox7.Text = dt4.Rows[cnt][0].ToString(); cnt++; } if (cnt < i) { textBox8.Text = dt4.Rows[cnt][0].ToString(); cnt++; } if (cnt < i) { textBox9.Text = dt4.Rows[cnt][0].ToString(); cnt++; } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "" || textBox2.Text == "" || comboBox5.Text == "" || textBox4.Text == "" || textBox8.Text == "" || textBox3.Text == "") { MessageBox.Show("输入信息不完全"); } else { if (checkBox1.Checked == true && checkBox11.Checked == true) { string url = textBox3.Text.Trim(); url = url.Replace("\\", "\\\\"); string hz = comboBox7.Text.Trim(); project p = new project(); p.pId = textBox8.Text.Trim(); p.projectunit = textBox1.Text.Trim(); p.filetype = textBox2.Text.Trim(); p.gdmethod = comboBox5.Text.Trim(); p.year = textBox4.Text.Trim(); p.str1 = comboBox1.Text.Trim(); p.str2 = comboBox2.Text.Trim(); p.str3 = comboBox3.Text.Trim(); p.str4 = comboBox4.Text.Trim(); p.str5 = comboBox5.Text.Trim(); p.pgz = comboBox8.Text.Trim(); p.pdf = comboBox11.Text.Trim(); p.pdfgz = comboBox9.Text.Trim(); p.ocr = comboBox10.Text.Trim(); p.url = url; p.hz = hz; bool flag = new projectBAL().Insert456(p); /* if (checkBox12.Checked == true) * { * string b = "2"; * bool flag7 = new projectBAL().Insert4444(p.pId, b); * }*/ if (cb_xmh.Checked == true) { string b = "1"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_xmtm.Checked == true) { string b = "3"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_xmys.Checked == true) { string b = "2"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } /* if (checkBox19.Checked == true) * { * string b = "8"; * bool flag7 = new projectBAL().Insert4444(p.pId, b); * }*/ if (cb_ajh.Checked == true) { string b = "11"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_ajtm.Checked == true) { string b = "12"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_ajys.Checked == true) { string b = "13"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_ajzrr.Checked == true) { string b = "18"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_wjdh.Checked == true) { string b = "19"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_wjjh.Checked == true) { string b = "20"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_wjtm.Checked == true) { string b = "21"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_wjys.Checked == true) { string b = "22"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_wjyh.Checked == true) { string b = "23 "; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_xmkssj.Checked == true) { string b = "4"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_xmjssj.Checked == true) { string b = "5"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_xmyzdw.Checked == true) { string b = "6"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_xmsjdw.Checked == true) { string b = "7"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_xmsgdw.Checked == true) { string b = "8"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_xmjldw.Checked == true) { string b = "9"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_xmflh.Checked == true) { string b = "10"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_ajqzrq.Checked == true) { string b = "14"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_ajbgqx.Checked == true) { string b = "15"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_ajflh.Checked == true) { string b = "16"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_ajmj.Checked == true) { string b = "17"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_wjzrr.Checked == true) { string b = "24"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_wjrq.Checked == true) { string b = "25"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_wjnd.Checked == true) { string b = "26"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_wjbgqx.Checked == true) { string b = "27"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_wjflh.Checked == true) { string b = "28"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } if (cb_wjmj.Checked == true) { string b = "29"; bool flag7 = new projectBAL().Insert4444(p.pId, b); } // bool flag11 = new projectBAL().Insert4444(z1,p.pId,p.projectunit); // bool flag22 = new projectBAL().Insert5555(z2, p.pId, p.projectunit); // bool flag33 = new projectBAL().Insert6666(z3, p.pId, p.projectunit); int cnt = 0; int cnt1 = 0; workstatus w = new workstatus(); w.projectUnit = textBox1.Text.Trim(); if (checkBox1.Checked == true) { string a = "1"; string b = "领取"; bool flag7 = new projectBAL().Insert(p.pId, a, b); DataTable str = new AABAL().Select101(p.pId, 1); DataTable str2 = new AABAL().Select102(p.pId, 1); cnt++; bool flag101 = new projectBAL().Insert101(p.pId, a, b, str.Rows[0][0].ToString(), str2.Rows[0][0].ToString()); if (flag101 == true) { cnt1++; } } if (checkBox2.Checked == true) { string a = "2"; string b = "打码"; bool flag7 = new projectBAL().Insert(p.pId, a, b); DataTable str = new AABAL().Select101(p.pId, 2); DataTable str2 = new AABAL().Select102(p.pId, 2); cnt++; bool flag101 = new projectBAL().Insert101(p.pId, a, b, str.Rows[0][0].ToString(), str2.Rows[0][0].ToString()); if (flag101 == true) { cnt1++; } } if (checkBox3.Checked == true) { string a = "3"; string b = "拆分"; bool flag7 = new projectBAL().Insert(p.pId, a, b); DataTable str = new AABAL().Select101(p.pId, 3); DataTable str2 = new AABAL().Select102(p.pId, 3); cnt++; bool flag101 = new projectBAL().Insert101(p.pId, a, b, str.Rows[0][0].ToString(), str2.Rows[0][0].ToString()); if (flag101 == true) { cnt1++; } } if (checkBox4.Checked == true) { string a = "4"; string b = "著录"; bool flag7 = new projectBAL().Insert(p.pId, a, b); DataTable str = new AABAL().Select101(p.pId, 4); DataTable str2 = new AABAL().Select102(p.pId, 4); cnt++; bool flag101 = new projectBAL().Insert101(p.pId, a, b, str.Rows[0][0].ToString(), str2.Rows[0][0].ToString()); if (flag101 == true) { cnt1++; } } if (checkBox13.Checked == true) { string a = "5"; string b = "再次著录"; bool flag7 = new projectBAL().Insert(p.pId, a, b); DataTable str = new AABAL().Select101(p.pId, 5); DataTable str2 = new AABAL().Select102(p.pId, 5); cnt++; bool flag101 = new projectBAL().Insert101(p.pId, a, b, str.Rows[0][0].ToString(), str2.Rows[0][0].ToString()); if (flag101 == true) { cnt1++; } } if (checkBox5.Checked == true) { string a = "6"; string b = "扫描"; bool flag7 = new projectBAL().Insert(p.pId, a, b); DataTable str = new AABAL().Select101(p.pId, 6); DataTable str2 = new AABAL().Select102(p.pId, 6); cnt++; bool flag101 = new projectBAL().Insert101(p.pId, a, b, str.Rows[0][0].ToString(), str2.Rows[0][0].ToString()); if (flag101 == true) { cnt1++; } } /* if (checkBox6.Checked == true) * { * w.bm = ++cnt; * }*/ if (checkBox7.Checked == true) { string a = "7"; string b = "图处"; bool flag7 = new projectBAL().Insert(p.pId, a, b); DataTable str = new AABAL().Select101(p.pId, 7); DataTable str2 = new AABAL().Select102(p.pId, 7); cnt++; bool flag101 = new projectBAL().Insert101(p.pId, a, b, str.Rows[0][0].ToString(), str2.Rows[0][0].ToString()); if (flag101 == true) { cnt1++; } } if (checkBox8.Checked == true) { string a = "8"; string b = "质检"; bool flag7 = new projectBAL().Insert(p.pId, a, b); DataTable str = new AABAL().Select101(p.pId, 8); DataTable str2 = new AABAL().Select102(p.pId, 8); cnt++; bool flag101 = new projectBAL().Insert101(p.pId, a, b, str.Rows[0][0].ToString(), str2.Rows[0][0].ToString()); if (flag101 == true) { cnt1++; } } if (checkBox9.Checked == true) { string a = "9"; string b = "挂接"; bool flag7 = new projectBAL().Insert(p.pId, a, b); DataTable str = new AABAL().Select101(p.pId, 9); DataTable str2 = new AABAL().Select102(p.pId, 9); cnt++; bool flag101 = new projectBAL().Insert101(p.pId, a, b, str.Rows[0][0].ToString(), str2.Rows[0][0].ToString()); if (flag101 == true) { cnt1++; } } if (checkBox10.Checked == true) { string a = "10"; string b = "还原"; bool flag7 = new projectBAL().Insert(p.pId, a, b); DataTable str = new AABAL().Select101(p.pId, 10); DataTable str2 = new AABAL().Select102(p.pId, 10); cnt++; bool flag101 = new projectBAL().Insert101(p.pId, a, b, str.Rows[0][0].ToString(), str2.Rows[0][0].ToString()); if (flag101 == true) { cnt1++; } } if (checkBox11.Checked == true) { string a = "11"; string b = "归还"; bool flag7 = new projectBAL().Insert(p.pId, a, b); DataTable str = new AABAL().Select101(p.pId, 11); DataTable str2 = new AABAL().Select102(p.pId, 11); cnt++; bool flag101 = new projectBAL().Insert101(p.pId, a, b, str.Rows[0][0].ToString(), str2.Rows[0][0].ToString()); if (flag101 == true) { cnt1++; } if (cnt == cnt1) { MessageBox.Show("项目规则定义成功!"); this.Close(); } else { MessageBox.Show("项目规则定义失败!"); } } w.flag = cnt; } else { MessageBox.Show("第一个环节必须为领取,最后一个环节必须为归还"); } } }
//文件著录 private void btn_wj_Click(object sender, EventArgs e) { if (cc3 < dataGridView3.Rows.Count) { cc3 = dataGridView3.Rows.Count; int l = dataGridView3.Rows.Count; int bnt = 0; bool cnt1 = true; var cco = 0; foreach (DataGridViewRow v in dataGridView3.Rows) { if (v.Cells["件号"].Value != null) { var count2 = 0; foreach (DataGridViewRow v2 in dataGridView3.Rows) { if (v2.Cells["件号"].Value != null) { if (v.Cells["件号"].Value.ToString().Equals(v2.Cells["件号"].Value.ToString())) { count2++; cco = count2; } } } if (count2 > 1) { MessageBox.Show("件号【" + v.Cells["件号"].Value + "】重复"); cc3 = 0; return; } } } if (cco == 1) { for (int jq = lw; jq < l - 1; jq++) { Random rd = new Random(); string str788 = (rd.Next(1, 99999) * (jq + 1)).ToString(); string[] str1 = new string[20]; string[] str2 = new string[copy3]; int s = 0; DataTable dt3 = new AABAL().Select7(pId); int i = 0; while (i < dt3.Rows.Count) { if (dt3.Rows[i][0].ToString() != "") { DataTable dt4 = new AABAL().Select222(dt3.Rows[i][0].ToString(), "19", "29"); if (dt3.Rows[i][0].ToString() == "文件题名") { bnt = i; } str1[s] = dt4.Rows[0][0].ToString(); ++s; } i++; } //如果页数匹配能够插入再生成档号! string[] ss = new string[5]; DataTable str438 = new AABAL().Select438(pId); for (int b = 0; b < 5; b++) { if (str438.Rows[0][b].ToString() == "年度") { DataTable str7438 = new AABAL().Select7438(pId, bh); ss[b] = str7438.Rows[0][0].ToString(); } else if (str438.Rows[0][b].ToString() == "项目号") { ss[b] = pId; } else if (str438.Rows[0][b].ToString() == "案卷号") { ss[b] = anId; } else if (str438.Rows[0][b].ToString() == "文件号") { ss[b] = dataGridView3.Rows[jq].Cells["件号"].Value.ToString(); } else if (str438.Rows[0][b].ToString() == "保管期限") { ss[b] = dataGridView3.Rows[jq].Cells["保管期限"].Value.ToString(); } else { ss[b] = ""; } } int sbgege = 0; string dangId = ""; for (int sb = 0; sb < 5; sb++) { if (ss[sb] != "" && sbgege == 0) { sbgege = 1; dangId = ss[sb]; sb++; } if (ss[sb] != "" && sbgege != 0) { dangId = dangId + "-" + ss[sb]; } } dataGridView3.Rows[jq].Cells["档号3"].Value = dangId; int a = dataGridView3.CurrentRow.Index; for (int j = 1; j <= copy3; j++) { str2[j - 1] = dataGridView3.Rows[jq].Cells[j].Value.ToString(); } DataTable f = new AABAL().Select777(pId, s11); if (gdmethod == "项目" || gdmethod == "案卷") { int sum = 0; int c = Convert.ToInt32(dataGridView2.CurrentRow.Cells["页数"].Value.ToString()); // MessageBox.Show(c.ToString()); int count = dataGridView3.Rows.Count; for (int k = copylw; k < count - 1; k++) { sum += Convert.ToInt32(dataGridView3.Rows[k].Cells["页数"].Value.ToString()); } if (sum == c) { cnt1 = false; for (int j = 0; j < copy3; j++) { if (j == bnt) { bool flag = new AABAL().insert110(pId, str1[j], str2[j], s11, str788, bh, lzId);//pId,zId,sx,parentId,parentId2,bh,lzId } else { bool flag = new AABAL().insert1122(pId, str1[j], str2[j], str788, bh, lzId);//pId,zId,sx,parentId2,pc,bh,lzId } } //查询zl表,判断是否之前著录过删掉的,如果没著录过就插入,如果著录过后又删掉了,就更新iszl=0 DataTable dt111 = new ZLBAL().Select114(lzId, bh); if (dt111.Rows.Count == 0) { bool flag2 = new ZLBAL().insert(lzId, bh, "1"); } else { bool ff = new ZLBAL().Update112("1", lzId, bh); } } } else { DataTable tt = new ZLBAL().Select8(lzId, bh); int page = Convert.ToInt32(tt.Rows[0][0].ToString()); int sum = 0; int count = dataGridView3.Rows.Count; for (int k = copylw; k < count - 1; k++) { sum += Convert.ToInt32(dataGridView3.Rows[k].Cells["页数"].Value.ToString()); } if (sum == page) { cnt1 = false; for (int j = 0; j < copy3; j++) { if (j == bnt) { // DataTable dt444 = new AABAL().Select444(pId); bool flag = new AABAL().insert110(pId, str1[j], str2[j], "0", str788, bh, lzId);//pId,zId,sx,parentId,parentId2,pc } else { // DataTable dt444 = new AABAL().Select444(pId); bool flag = new AABAL().insert1122(pId, str1[j], str2[j], str788, bh, lzId);//pId,zId,sx,parentId2,pc } } //查询zl表,判断是否之前著录过删掉的,如果没著录过就插入,如果著录过后又删掉了,就更新iszl=0 DataTable dt111 = new ZLBAL().Select114(lzId, bh); if (dt111.Rows.Count == 0) { bool flag2 = new ZLBAL().insert(lzId, bh, "1"); } else { bool ff = new ZLBAL().Update112("1", lzId, bh); } } } } if (cnt1 == false) { MessageBox.Show("提交成功!"); raiseCallBackRefreshEvent2(); } else { MessageBox.Show("页数不匹配!"); cc3 = 0; } } } else { MessageBox.Show("请勿重复提交!"); } }
private void btn_next_Click(object sender, EventArgs e) { cc3 = 0; string str99 = ""; int count = dataGridView2.Rows.Count; for (int n = 0; n < count; n++) { if ((bool)dataGridView2.Rows[n].Cells[0].EditedFormattedValue == true) { str99 = dataGridView2.Rows[n].Cells["案卷题名"].Value.ToString(); anId = dataGridView2.Rows[n].Cells["案卷号"].Value.ToString(); DataTable dt22 = new ZLXIBAL().Select8(pId, str99); if (dt22 == null || dt22.Rows.Count == 0) { int cnt3 = 0; DataTable dt = new DataTable(); DataTable dt11 = new AABAL().Select7(pId); int k = 0; while (k < dt11.Rows.Count) { dt.Columns.Add(dt11.Rows[k][0].ToString(), typeof(string)); cnt3++; k++; } copy3 = cnt3; dataGridView3.DataSource = dt; copylw = lw; } else { DataTable dt1 = new DataTable(); DataTable dt2 = new ZLXIBAL().Select6(pId); int j = 0; int cnt3 = 0; while (j < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[j][0].ToString(), typeof(string)); cnt3++; j++; } for (int ss = 0; ss < dt22.Rows.Count;) { DataRow dr = dt1.NewRow(); for (int w = 0; w < cnt3; w++) { dr[dt2.Rows[w][0].ToString()] = dt22.Rows[ss][0].ToString(); ss++; } lw++; copylw = lw; dt1.Rows.Add(dr); } dataGridView3.DataSource = dt1; } } } DataTable fff = new AABAL().Select7777(pId, str99); s11 = fff.Rows[0][0].ToString(); }
private void Form著录3_Load(object sender, EventArgs e) { dtp1.Value = System.DateTime.Now; this.dataGridView1.Controls.Add(dtp1); dtp1.Visible = false; dtp2.Value = System.DateTime.Now; this.dataGridView2.Controls.Add(dtp2); dtp2.Visible = false; dtp3.Value = System.DateTime.Now; this.dataGridView3.Controls.Add(dtp3); dtp3.Visible = false; DataTable dt11 = new ZLXIBAL().Select7(lzId); pId = dt11.Rows[0][0].ToString(); DataTable dt = new ZLBAL().Select(pId); gdmethod = dt.Rows[0][0].ToString(); if (gdmethod == "项目") { DataTable dt3 = new ZLBAL().Select2(pId, lzId); if (dt3 == null || dt3.Rows.Count == 0) { int cnt = 0; DataTable dt1 = new DataTable(); DataTable dt2 = new ZLBAL().Select1(pId); int i = 0; while (i < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[i][0].ToString(), typeof(string)); cnt++; i++; } copy = cnt; DataRow dr = dt1.NewRow(); dt1.Rows.Add(dr); dataGridView1.DataSource = dt1; copylx = lx; } else { int cnt = 0; parentId = dt3.Rows[1][0].ToString(); DataTable dt1 = new DataTable(); DataTable dt2 = new ZLBAL().Select1(pId); int i = 0; while (i < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[i][0].ToString(), typeof(string)); cnt++; i++; } copy = cnt; //cnt是列数 // MessageBox.Show(copy.ToString()); for (int ss = 0; ss < dt3.Rows.Count;) { DataRow dr = dt1.NewRow(); for (int m = 0; m < cnt; m++) { dr[dt2.Rows[m][0].ToString()] = dt3.Rows[ss][1].ToString(); ss++; } lx++; copylx = lx; dt1.Rows.Add(dr); } dataGridView1.DataSource = dt1; } } else if (gdmethod == "案卷") { dataGridView1.ReadOnly = true; DataTable dt12 = new ZLBAL().Select112(pId, lzId);//找sx if (dt12 == null || dt12.Rows.Count == 0) { DataTable dt111 = new DataTable(); DataTable dt5 = new AABAL().Select6(pId); int m = 0; int cnt2 = 0; while (m < dt5.Rows.Count) { dt111.Columns.Add(dt5.Rows[m][0].ToString(), typeof(string)); cnt2++; m++; } copy2 = cnt2; dataGridView2.DataSource = dt111; copyll = ll; } else { DataTable dt111 = new DataTable(); DataTable dt5 = new AABAL().Select6(pId); int m = 0; int cnt2 = 0; while (m < dt5.Rows.Count) { dt111.Columns.Add(dt5.Rows[m][0].ToString(), typeof(string)); cnt2++; m++; } copy2 = cnt2; for (int ss = 0; ss < dt12.Rows.Count;) { DataRow dr = dt111.NewRow(); for (int w = 0; w < cnt2; w++) { dr[dt5.Rows[w][0].ToString()] = dt12.Rows[ss][1].ToString(); ss++; } ll++; copyll = ll; dt111.Rows.Add(dr); } dataGridView2.DataSource = dt111; } } else { dataGridView1.ReadOnly = true; dataGridView2.ReadOnly = true; DataTable dt13 = new ZLBAL().Select113(pId, lzId);//找sx if (dt13 == null || dt13.Rows.Count == 0) { int cnt3 = 0; DataTable dt1 = new DataTable(); DataTable dt2 = new ZLXIBAL().Select6(pId); int j = 0; while (j < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[j][0].ToString(), typeof(string)); cnt3++; j++; } copy3 = cnt3; dataGridView3.DataSource = dt1; copylw = lw; } else { DataTable dt1 = new DataTable(); DataTable dt2 = new ZLXIBAL().Select6(pId); int j = 0; int cnt3 = 0; while (j < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[j][0].ToString(), typeof(string)); cnt3++; j++; } copy3 = cnt3; for (int ss = 0; ss < dt13.Rows.Count;) { DataRow dr = dt1.NewRow(); for (int w = 0; w < cnt3; w++) { dr[dt2.Rows[w][0].ToString()] = dt13.Rows[ss][1].ToString(); ss++; } lw++; copylw = lw; dt1.Rows.Add(dr); } dataGridView3.DataSource = dt1; } } }
private void btn_aj_Click(object sender, EventArgs e) { if (cc2 < dataGridView2.Rows.Count) { cc2 = dataGridView2.Rows.Count; int l = dataGridView2.Rows.Count; bool fafa = true; var cco = 0; foreach (DataGridViewRow v in dataGridView2.Rows) { if (v.Cells["案卷号"].Value != null) { var count2 = 0; foreach (DataGridViewRow v2 in dataGridView2.Rows) { if (v2.Cells["案卷号"].Value != null) { if (v.Cells["案卷号"].Value.ToString().Equals(v2.Cells["案卷号"].Value.ToString())) { count2++; cco = count2; } } } if (count2 > 1) { MessageBox.Show("案卷号【" + v.Cells["案卷号"].Value + "】重复"); cc2 = 0; return; } } } if (cco == 1) { for (int jq = ll; jq < l - 1; jq++) { string[] str1 = new string[copy2]; string[] str2 = new string[copy2]; int s = 0; DataTable dt3 = new AABAL().Select6(pId); int i = 0; int bnt = 0; while (i < dt3.Rows.Count) { if (dt3.Rows[i][0].ToString() != "") { DataTable dt4 = new AABAL().Select222(dt3.Rows[i][0].ToString(), "11", "18"); if (dt3.Rows[i][0].ToString() == "案卷题名") { bnt = i; } str1[s] = dt4.Rows[0][0].ToString(); ++s; } i++; } Random rd = new Random(); string str788 = (rd.Next(1, 99999999) * 1000).ToString(); DataTable dt1 = new AABAL().Select5(pId); for (int j = 1; j <= copy2; j++) { str2[j - 1] = dataGridView2.Rows[jq].Cells[j].Value.ToString(); } DataTable f = new AABAL().Select77(pId); if (gdmethod == "项目") { int sum = 0; int c = Convert.ToInt32(dataGridView1.CurrentRow.Cells["总页数"].Value.ToString()); //MessageBox.Show(dataGridView2.Rows[0].Cells[3].Value.ToString()); int count = dataGridView2.Rows.Count; for (int k = copyll; k < count - 1; k++) { sum += Convert.ToInt32(dataGridView2.Rows[k].Cells[3].Value.ToString()); } if (sum == c) { fafa = false; for (int j = 0; j < copy2; j++) { if (j == bnt) { // DataTable dt444 = new AABAL().Select444(pId); bool flag = new AABAL().insert110(pId, str1[j], str2[j], f11, str788, bh, lzId);//pId,zId,sx,parentId,parentId2,pc } else { // DataTable dt444 = new AABAL().Select444(pId); bool flag = new AABAL().insert1122(pId, str1[j], str2[j], str788, bh, lzId);//pId,zId,sx,parentId2,pc } } //查询zl表,判断是否之前著录过删掉的,如果没著录过就插入,如果著录过后又删掉了,就更新iszl=0 DataTable dt111 = new ZLBAL().Select114(lzId, bh); if (dt111.Rows.Count == 0) { bool flag2 = new ZLBAL().insert(lzId, bh, "1"); } else { bool ff = new ZLBAL().Update112("1", lzId, bh); } } } else { DataTable tt = new ZLBAL().Select8(lzId, bh); int page = Convert.ToInt32(tt.Rows[0][0].ToString()); int sum = 0; int count = dataGridView2.Rows.Count; // MessageBox.Show(ll.ToString()); for (int k = copyll; k < count - 1; k++) { sum += Convert.ToInt32(dataGridView2.Rows[k].Cells["页数"].Value.ToString()); } if (sum == page) { fafa = false; for (int j = 0; j < copy2; j++) { if (j == bnt) { // DataTable dt444 = new AABAL().Select444(pId); bool flag = new AABAL().insert110(pId, str1[j], str2[j], "0", str788, bh, lzId);//pId,zId,sx,parentId,parentId2,pc } else { // DataTable dt444 = new AABAL().Select444(pId); bool flag = new AABAL().insert1122(pId, str1[j], str2[j], str788, bh, lzId);//pId,zId,sx,parentId2,pc } } //查询zl表,判断是否之前著录过删掉的,如果没著录过就插入,如果著录过后又删掉了,就更新iszl=0 DataTable dt111 = new ZLBAL().Select114(lzId, bh); if (dt111.Rows.Count == 0) { bool flag2 = new ZLBAL().insert(lzId, bh, "1"); } else { bool ff = new ZLBAL().Update112("1", lzId, bh); } } } str7 = f.Rows[0][0].ToString(); } if (fafa == false) { MessageBox.Show("提交成功!"); } else { MessageBox.Show("页数不匹配!"); cc2 = 0; } } } else { MessageBox.Show("请勿重复提交!"); } }
private void btn_项目_Click(object sender, EventArgs e) { if (qwer < dataGridView1.Rows.Count) { qwer = dataGridView1.Rows.Count; int l = dataGridView1.Rows.Count; bool fafa = true; //判断是否提交成功,如果提交成功就是false var cco = 0; //用来复制count2,判断是否有重复,没有重复则提交 (下面案卷,文件都一样) foreach (DataGridViewRow v in dataGridView1.Rows) { if (v.Cells["项目号"].Value != null) { var count2 = 0; foreach (DataGridViewRow v2 in dataGridView1.Rows) { if (v2.Cells["项目号"].Value != null) { if (v.Cells["项目号"].Value.ToString().Equals(v2.Cells["项目号"].Value.ToString())) { count2++; cco = count2; } } } if (count2 > 1) { MessageBox.Show("项目号【" + v.Cells["项目号"].Value + "】重复"); qwer = 0; return; } } } if (cco == 1) { for (int jq = lx; jq < l - 1; jq++) { int bnt = 0; string[] str1 = new string[copy]; string[] str2 = new string[copy]; int s = 0; DataTable dt3 = new AABAL().Select5(pId); int i = 0; while (i < dt3.Rows.Count) { if (dt3.Rows[i][0].ToString() != "") { DataTable dt4 = new AABAL().Select222(dt3.Rows[i][0].ToString(), "1", "10"); if (dt3.Rows[i][0].ToString() == "项目题名") { bnt = i; } str1[s] = dt4.Rows[0][0].ToString(); ++s; } i++; } DataTable dt1 = new AABAL().Select5(pId); //MessageBox.Show(copy.ToString()); for (int j = 1; j <= copy; j++) { str2[j - 1] = dataGridView1.Rows[jq].Cells[j].Value.ToString(); } Random rd = new Random(); string str788 = rd.Next(1, 99999999).ToString(); if (flag == true) { DataTable tt = new ZLBAL().Select8(lzId, bh); int page = Convert.ToInt32(tt.Rows[0][0].ToString()); int sum = 0; int count = dataGridView1.Rows.Count; //MessageBox.Show(copylx.ToString()); for (int k = copylx; k < count - 1; k++) { sum += Convert.ToInt32(dataGridView1.Rows[k].Cells["总页数"].Value.ToString()); } if (sum == page) { fafa = false; for (int j = 0; j < copy; j++) { if (j == 0) { bool flag = new AABAL().insert1122(pId, str1[j], str2[j], str788, bh, lzId);//pId,zId,sx,parentId2,pc } else if (j == bnt) { // DataTable dt444 = new AABAL().Select444(pId); bool flag = new AABAL().insert110(pId, str1[j], str2[j], "0", str788, bh, lzId);//pId,zId,sx,parentId,parentId2,pc DataTable dt111 = new ZLBAL().Select4(pId); parentId = dt111.Rows[0][0].ToString(); } else { // DataTable dt444 = new AABAL().Select444(pId); bool flag = new AABAL().insert1122(pId, str1[j], str2[j], str788, bh, lzId); } } //查询zl表,判断是否之前著录过删掉的,如果没著录过就插入,如果著录过后又删掉了,就更新iszl=0 DataTable dt112 = new ZLBAL().Select114(lzId, bh); if (dt112.Rows.Count == 0) { bool flag2 = new ZLBAL().insert(lzId, bh, "1"); } else { bool ff = new ZLBAL().Update112("1", lzId, bh); } } } } if (fafa == false) { MessageBox.Show("提交成功!"); } else { MessageBox.Show("页数不匹配!"); qwer = 0; } } } else { MessageBox.Show("请勿重复提交"); } }