1

嗨,我有 ID 为 usertypeId、managerId、SupervisorId n 代表 ID 的表。

当perticuler用户登录时..假设经理然后它将显示与经理相关的数据..当我们要删除数据时登录用户不会被删除但是当假设superviosr被删除时,它的相关数据如reperesentative应该被删除..

这是我的代码:

if (Session["UserTypeId"].ToString() == "2")
{
   DataTable dt1 = new BALUserProfile().SelectForGridManager(
      new BOLUserProfile() { Id = int.Parse(Session["UserId"].ToString()), 
                      ManagerId = int.Parse(Session["UserId"].ToString()) });

   for (int i = 0; i < dt1.Rows.Count; i++)
   {
       if (dt1.Rows[i]["Id"].ToString() == Session["UserId"].ToString() &&
                 lblGUserTypeId1.ToString() == "2")
       {
           lblMessageGrid.Visible = true;
           lblMessageGrid.Text = "Data Can Not Be Delete";
       }
       else
       {
           //ObjBOL.Id = int.Parse(dt1.Rows[i]["Id"].ToString());
           //ObjBOL1.Id = int.Parse(dt1.Rows[i]["Id"].ToString());
           ObjBAL.Delete(ObjBOL);
           ObjBAL1.Delete(ObjBOL1);

       }
   }
} //this was missing

是的,我知道,但谢谢...

4

0 回答 0