麻烦修改一下,有类似的参考给你们
主要数据库:
OverTimeStatus:UserId,OrgId,OverTimeStatusId;人员权限:人员id,部门id,人员权限(0,1,2,3)
OverTimeHead:OverTimeHeadId,OrgName,UserId,ApplyNo, OverTimeHeadId;表头:表头id,部门名字,人员id,单号,表单状况(0,1,2,3)
有以下几个条件:
问题一:GridView2中的CheckBox1只有[OverTimeStatus表中OverTimeStatusId > OverTimeHead表中的OverTimeStatusId]才可以进行修改(后面有类似的参考)
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex > -1)
{
DataRowView drv = e.Row.DataItem as DataRowView;
string strOrgName = drv[ "OrgName "].ToString();
Guid guidUserId = new Guid(Context.Items[ "UserID "].ToString());
int intStatusId = Convert.ToInt32(ViewState[ "StatusId "]) + 1;
DataTable dtt = new OverTimeData().GetSignIdAndStatusId(guidUserId).Tables[0];
LinkButton lbselect = e.Row.FindControl( "LB1 ") as LinkButton;
if (dtt.Rows.Count == 0)
lbselect.Enabled = false;
}
}
//(下面是SQL语句,是否有错? )
//public int GetStatusUserCount(Guid guidUserId, int intStatusId, string strOrgName)
//{
// string strSql2 = "SELECT COUNT(*) AS Expr1 FROM OverTimeStatusUser " +
// "WHERE (UserId = '{0} ') AND (OverTimeStatusId = {1}) AND (OrgId IN (SELECT OrgId FROM Org WHERE (OrgName = '{2} '))) ";
// strSql2 = string.Format(strSql2, guidUserId.ToString(), intStatusId, strOrgName);
// return Convert.ToInt32(new CommonData().ExeQuery(strSql2).Tables[0].Rows[0][0]);
//}
问题二:GridView2按选择后,出现在GridView1中,主要是GridView2 只有所在部门的User的OverTimeStatusId为“1”时才能显示(下面是SQL语句,基本错的)(后面有参考)
protected void GridView2_SelectedIndexChanged(object sender, EventArgs e