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 Rights Management Add Group : Form
{
public bool IsOK = FALSE;
public string Title = "";
Define public variables pno and 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 ();
Assigning a value to pname equals this.textBox1.Text
This.pname = This.textBox1.Text;
This. IsOK = true;
Form Rights Management F = new form rights Management ();
Using the pname value in form Rights Management for forms
F.pname = This.pname;
This. Close ();
}
}
}
Pass the value of form Rights Management Add group to forms Rights Management
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 Rights Management : 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 permissions list. 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 permissions list. rows[i]. cells["Number"]. Value));
Col. ADD (New Sqlstruct ("Pgpbadd", (THIS.CDGV permission list. rows[i]. cells["Add"]. value.tostring () = = "√")));
Col. ADD (New Sqlstruct ("Pgpbame", (THIS.CDGV permission list. rows[i]. cells["Modify"]. value.tostring () = = "√")));
Col. ADD (New Sqlstruct ("Pgpbdel", (THIS.CDGV permission list. rows[i]. cells["Delete"]. value.tostring () = = "√")));
Col. ADD (New Sqlstruct ("Pgpbseeone", (THIS.CDGV permission list. rows[i]. cells["View Personal"]. value.tostring () = = "√")));
Col. ADD (New Sqlstruct ("Pgpbseedepartment", (THIS.CDGV permission list. rows[i]. cells["View Department"]. value.tostring () = = "√")));
Col. ADD (New Sqlstruct ("Pgpbseecompany", (THIS.CDGV permission list. rows[i]. cells["View Company"]. value.tostring () = = "√")));
Col. ADD (New Sqlstruct ("Pgpbseeall", (THIS.CDGV permission list. rows[i]. cells["View All"]. value.tostring () = = "√")));
SQL + = Sqlget.add (col, "Powergroup");
}
if (classdata.update (SQL) > 0)
{
MessageBox.Show ("Setup succeeded! ");
This. Close ();
}
Else
{
MessageBox.Show ("Setup failed! ");
}
}
}
}
Passing values between windows (defining common variables)