using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace YXSetingSystem
{
public partial class Form权限管理添加组 : Form
{
public bool IsOK = false;
public string Title = "";
//定义公共变量pno和pname
public string pno = "";
public string pname = "";
//public string PNO { get { return pname; } set { pname = value; } }
private void button1_Click(object sender, EventArgs e)
{
this.Title = this.textBox1.Text.Trim();
//给pname赋值等于this.textBox1.Text
this.pname = this.textBox1.Text;
this.IsOK = true;
Form权限管理 f = new Form权限管理();
//在窗体Form权限管理中用pname值
f.pname = this.pname;
this.Close();
}
}
}
将Form权限管理添加组窗体里面的值传给Form权限管理
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using YXToolSystem;
using DataSystem;
namespace YXSetingSystem
{
public partial class FormF权限管理 : Form
{
public string pno = "";
public string pname = "";
public bool IsOK = false;
public string PGLNO = "0";
void save()
{
string sql = "delete from powergroup where pgtitleno=‘" + pno + "‘";
for (int i = 0; i < this.cDGV权限列表.Rows.Count; i++)
{
List<YXToolSystem.SQLStruct> col = new List<YXToolSystem.SQLStruct>();
col.Add(new SQLStruct("PGTitleNO", pno));
col.Add(new SQLStruct("PGTitleName", pname));
col.Add(new SQLStruct("PGPBNO", this.cDGV权限列表.Rows[i].Cells["编号"].Value));
col.Add(new SQLStruct("PGPBAdd", (this.cDGV权限列表.Rows[i].Cells["添加"].Value.ToString() == "√")));
col.Add(new SQLStruct("PGPBAme", (this.cDGV权限列表.Rows[i].Cells["修改"].Value.ToString() == "√")));
col.Add(new SQLStruct("PGPBDel", (this.cDGV权限列表.Rows[i].Cells["删除"].Value.ToString() == "√")));
col.Add(new SQLStruct("PGPBSeeOne", (this.cDGV权限列表.Rows[i].Cells["查看个人"].Value.ToString() == "√")));
col.Add(new SQLStruct("PGPBSeeDepartment", (this.cDGV权限列表.Rows[i].Cells["查看部门"].Value.ToString() == "√")));
col.Add(new SQLStruct("PGPBSeeCompany", (this.cDGV权限列表.Rows[i].Cells["查看公司"].Value.ToString() == "√")));
col.Add(new SQLStruct("PGPBSeeALL", (this.cDGV权限列表.Rows[i].Cells["查看全部"].Value.ToString() == "√")));
sql += SQLGet.Add(col, "powergroup");
}
if (ClassData.UpDate(sql) > 0)
{
MessageBox.Show("设置成功!");
this.Close();
}
else
{
MessageBox.Show("设置失败!");
}
}
}
}