Page 170 - ระบบสารสนเทศเพื่อการบริหารจัดการเอกสารอิเล็กทรอนิกส์ (e-Document)
P. 170
ห้องสมุดกรมพัฒนาที่ดิน
ค- 57
if (cbActive.Checked)
sTmp = "yes";
else
sTmp = "no";
sql.AddString("GroupActive", sTmp);
if (hdMode.Value == "AddNew")
sSql = sql.SqlAdd("Permission");
else
sSql = sql.SqlEdit("Permission", "where GroupID='" +
hdGroupID.Value + "'");
if (table.exNonQuery(sSql) == true)
{
Response.Write(ut.alert("บันทึกข้อมูลส าเร็จ"));
txtGroupID.Text = "";
txtGroupName.Text = "";
txtOwner.Text = "";
cbActive.Checked = false;
hdMode.Value = "AddNew";
gvPermission.DataBind();
}
else
{
Response.Write(ut.alert("บันทึกข้อมูลไม่ส าเร็จ"));
}
}
protected void gvPermission_SelectedIndexChanged(object sender,
EventArgs e)
{
string sTmp;
string sGroupID = gvPermission.SelectedValue.ToString();
string sSql = "select GroupID, GroupOwner, GroupName, GroupActive
from Permission where GroupID='" + sGroupID + "'";
DbMgt table = new DbMgt(str);
MyDataSet ds = new MyDataSet(table.exReader(sSql));
txtGroupID.Text = ds.showFieldValue("GroupID", 0);
hdGroupID.Value = ds.showFieldValue("GroupID", 0);
txtOwner.Text = ds.showFieldValue("GroupOwner", 0);
txtGroupName.Text = ds.showFieldValue("GroupName", 0);
sTmp = ds.showFieldValue("GroupActive", 0);
if (sTmp == "yes")
cbActive.Checked = true;
else
cbActive.Checked = false;
hdMode.Value = "Edit";
pnlGroupList.Visible = true;
sSql = "SELECT GroupList.GroupID + '|' + GroupList.Member AS Gkey,
GroupList.GroupID, GroupList.Member, BureauIntra.Bureau FROM GroupList
INNER JOIN BureauIntra ON GroupList.Member = BureauIntra.BureauID WHERE
(GroupList.GroupID = N'" + hdGroupID.Value + "')";
dsGroupList.SelectCommand = sSql;
gvGroupList.DataBind();
}