internal Permissions GetSpecificPermissions(int SectionTypeId, OysterTypes.OysterPermissionTypes OPT) { try { int PermissionId = Convert.ToInt32(OPT); string sSQL = "Select * from tblSectionTypePermissionRel WHERE SectionTypeID = " + SectionTypeId.ToString() + " AND PermissionId = " + PermissionId; DataTable DT = GetDataTable(sSQL); Permissions AP = new Permissions(); if(DT.Rows.Count > 0) { foreach(DataRow R in DT.Rows) { Permission P = new Permission(); P.mvarSectionTypeId = Convert.ToInt32((object)R[0]); P.mvarPermissionId = Convert.ToInt32((object)R[1]); P.mvarCanOperateOn = Convert.ToInt32((object)R[2]); P.mvarTargetSectionTypeId = Convert.ToInt32((object)R[2]); P.mvarDescription = GetPermissionDescription(P.mvarPermissionId); AP.Add(P); } } DT.Dispose(); return AP; } catch(Exception Err) { throw new ApplicationException(Err.Message); //return false; } }
public Permissions GetPermissions() { try { string sSQL = "SELECT Id, Name FROM tblPermission"; DataTable DT = GetDataTable(sSQL); Permissions X = new Permissions(); foreach(DataRow r in DT.Rows) { Permission P = new Permission(); P.mvarPermissionId = Convert.ToInt32(r[0]); P.mvarDescription = Convert.ToString(r[1]); X.Add(P); } return X; } catch(Exception Err) { throw new Exception(Err.Message,Err.InnerException); } }
/// <summary> /// Used by other functions to fill the permissions of a SectionType object /// </summary> /// <param name="ST"></param> /// <returns></returns> internal bool FillPermissions(ref SectionType ST) { try { string sSQL = "Select * from tblSectionTypePermissionRel WHERE SectionTypeID = " + ST.mvarID.ToString(); DataTable DT = GetDataTable(sSQL); if(DT.Rows.Count > 0) { foreach(DataRow R in DT.Rows) { Permission P = new Permission(); P.mvarSectionTypeId = Convert.ToInt32((object)R[0]); P.mvarPermissionId = Convert.ToInt32((object)R[1]); P.mvarCanOperateOn = Convert.ToInt32((object)R[2]); P.mvarTargetSectionTypeId = Convert.ToInt32((object)R[2]); P.mvarDescription = GetPermissionDescription(P.mvarPermissionId); switch(P.mvarPermissionId) { case 1: ST.mvarCanCreateSectionTypes.Add(P); break; case 2: ST.mvarCanEditSectionTypes.Add(P); break; case 3: ST.mvarCanMoveSectionTypes.Add(P); break; case 4: ST.mvarCanRemoveSectionTypes.Add(P); break; case 5: ST.mvarCanCopyRecordings.Add(P); break; case 6: ST.mvarCanMoveRecordings.Add(P); break; case 7: ST.mvarCanDestroyRecordings.Add(P); break; case 8: ST.mvarCanDestroyAnyUsers.Add(P); break; case 9: ST.CanViewUnassignedRecordings.Add(P); break; } } } DT.Dispose(); } catch(Exception Err) { throw new ApplicationException(Err.Message); //return false; } return true; }
public void Add(Permission X) { List.Add(X); }