本文整理汇总了C#中CheckBox.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# CheckBox.GetType方法的具体用法?C# CheckBox.GetType怎么用?C# CheckBox.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CheckBox
的用法示例。
在下文中一共展示了CheckBox.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnAdd_Click
protected void btnAdd_Click(object sender, EventArgs e)
{
PEmpPermissionsData empPermissionsData = new PEmpPermissionsData();
PEmpPermissionsBB empPermissionsBB = new PEmpPermissionsBB();
HEemployeeBB eemployeeBB = new HEemployeeBB();
try
{
//删除当前人员所有权限
empPermissionsBB.DeleteRecordByEmp(this.EmpId, 2);
//保存权限
CheckBox checkBox = new CheckBox();
foreach (DataListItem item in this.DataList1.Items)
{
//获取ItemoNo
Label label = (Label)item.FindControl("itemNo");
string itemNo = label.Text;
if (itemNo.IndexOf('-') >= 0)
{
itemNo = itemNo.Substring(itemNo.LastIndexOf('-') + 1);
}
foreach (System.Web.UI.Control control in item.Controls)
{
if (control.GetType() == checkBox.GetType())
{
if (((CheckBox)control).Checked == true && !eemployeeBB.HasPermissions(this.EmpId, itemNo, ((CheckBox)control).ToolTip))
{
//保存权限
empPermissionsData.empId = this.EmpId;
empPermissionsData.itemNo = itemNo;
empPermissionsData.permissionsTypeNo = ((CheckBox)control).ToolTip;
empPermissionsData.isSpecial = false;
empPermissionsBB.AddRecord(empPermissionsData);
}
}
}
}
}
catch (Exception ex)
{
this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
return;
}
finally
{
empPermissionsBB.Dispose();
eemployeeBB.Dispose();
}
this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('保存成功!');", true);
}
示例2: btnSave_Click
protected void btnSave_Click(object sender, EventArgs e)
{
PRolePermissionsData rolePermissionsData = new PRolePermissionsData();
SCommBB commBB = new SCommBB();
PRolePermissionsBB rolePermissionsBB = new PRolePermissionsBB();
try
{
//删除当前角色所有权限
rolePermissionsBB.DeleteRecordByRole(this.RoleId, 2);
//保存权限
string strPermissions = "";
CheckBox checkBox = new CheckBox();
foreach (DataListItem item in this.DataList1.Items)
{
//获取ItemoNo
Label label = (Label)item.FindControl("itemNo");
string itemNo = label.Text;
if (itemNo.IndexOf('-') >= 0)
{
itemNo = itemNo.Substring(itemNo.LastIndexOf('-') + 1);
}
foreach (System.Web.UI.Control control in item.Controls)
{
if (control.GetType() == checkBox.GetType())
{
if (((CheckBox)control).Checked == true)
{
strPermissions += itemNo + "," + ((CheckBox)control).ToolTip + ",0|";
}
}
}
}
//保存权限
commBB.ExecuteSql("exec sys_BatchSavePermissions " + this.RoleId.ToString() + ",'" + strPermissions.Remove(strPermissions.Length - 1) + "'");
}
catch (Exception ex)
{
this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
return;
}
finally
{
commBB.Dispose();
rolePermissionsBB.Dispose();
}
this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('保存成功!');", true);
}
示例3: CheckBox1_CheckedChanged
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
CheckBox checkBox = new CheckBox();
foreach (DataListItem item in this.DataList1.Items)
{
foreach (System.Web.UI.Control control in item.Controls)
{
if (control.GetType() == checkBox.GetType())
{
//判断是否全选
if (this.CheckBox1.Checked)
{
((CheckBox)control).Checked = true;
}
else
{
((CheckBox)control).Checked = false;
}
}
}
}
}