Пример #1
0
        public static void AddRight(User user, List<Right> r, Role role)
        {
            //chk if user can do this anot
            try
            {
                DAL dalDataContext = new DAL();
                Table<Right> rights = dalDataContext.rights;

                //using (TransactionScope tScope = new TransactionScope(TransactionScopeOption.Required))
                //{
                for (int i = 0; i < r.Count; i++)
                {
                    r[i].RoleID = role.RoleID;
                    rights.InsertOnSubmit(r[i]);
                }

                rights.Context.SubmitChanges();
                //use this to Create rights //if error need to delete it
                //       throw new Exception();
                //tScope.Complete();
                // }
            }
            catch
            {
                throw new FaultException<SException>(new SException(),
                   new FaultReason("An Error occured While Adding New Right, Please Try Again!"));
            }
        }
Пример #2
0
        public static Role AddRole(string RoleUserID, int EventID, string RolePost, string RoleDescription, DAL dalDataContext)
        {
            try
            {
                Table<Role> roles = dalDataContext.roles;

                Role creatingRole = new Role(RolePost, RoleDescription, EventID, RoleUserID);
                roles.InsertOnSubmit(creatingRole);

                roles.Context.SubmitChanges();

                return creatingRole;

            }
            catch
            {
                throw new FaultException<SException>(new SException(),
                   new FaultReason("An Error occured While Adding New Role, Please Try Again!"));
            }
        }
Пример #3
0
        public static void AddRight(User user, Role r, EnumFunctions f)
        {
            try
            {
                DAL dalDataContext = new DAL();
                Table<Right> rights = dalDataContext.rights;

                Right creatingright = new Right(r.RoleID, f);
                //using (TransactionScope tScope = new TransactionScope(TransactionScopeOption.Required))
                //{
                rights.InsertOnSubmit(creatingright);
                rights.Context.SubmitChanges();
                //use this to Create rights //if error need to delete it
                //       throw new Exception();
                //tScope.Complete();
                // }
            }
            catch
            {
                throw new FaultException<SException>(new SException(),
                   new FaultReason("An Error occured While Adding New Right, Please Try Again!"));
            }
        }
Пример #4
0
 public RoleWithUser(Role role, string user)
 {
     this.role = role;
     this.user = user;
 }