コード例 #1
0
        protected void btnSubmit_OnClick(object sender, EventArgs e)
        {
            var listOfGroupPolicies = new List <EntityGroupPolicy>();

            foreach (GridViewRow row in gvPolicies.Rows)
            {
                var cb = (CheckBox)row.FindControl("chkSelector");
                if (cb == null || !cb.Checked)
                {
                    continue;
                }
                var dataKey = gvPolicies.DataKeys[row.RowIndex];
                if (dataKey == null)
                {
                    continue;
                }
                var groupPolicy = new EntityGroupPolicy();
                groupPolicy.PolicyId = Convert.ToInt32(dataKey.Value);
                groupPolicy.GroupId  = GroupEntity.Id;
                listOfGroupPolicies.Add(groupPolicy);
            }

            var result = Call.GroupPolicyApi.PostList(listOfGroupPolicies);

            EndUserMessage = result.Success ? "Successfully Added Policies To The Group" : result.ErrorMessage;
        }
コード例 #2
0
        public DtoActionResult Put(int id, EntityGroupPolicy groupPolicy)
        {
            groupPolicy.Id = id;
            var result = _groupPolicyServices.UpdateGroupPolicy(groupPolicy);

            if (result == null)
            {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
            }
            return(result);
        }
コード例 #3
0
        public DtoActionResult AddGroupPolicy(EntityGroupPolicy groupPolicy)
        {
            var actionResult = new DtoActionResult();

            _uow.GroupPolicyRepository.Insert(groupPolicy);
            _uow.Save();
            actionResult.Success = true;
            actionResult.Id      = groupPolicy.Id;


            return(actionResult);
        }
コード例 #4
0
        public DtoActionResult UpdateGroupPolicy(EntityGroupPolicy groupPolicy)
        {
            var u = GetGroupPolicy(groupPolicy.Id);

            if (u == null)
            {
                return new DtoActionResult {
                           ErrorMessage = "Group Policy Not Found", Id = 0
                }
            }
            ;
            var actionResult = new DtoActionResult();

            _uow.GroupPolicyRepository.Update(groupPolicy, groupPolicy.Id);
            _uow.Save();
            //recalculate Active group policies
            new Workflows.GenerateClientGroupPolicy().Execute(u.GroupId);
            actionResult.Success = true;
            actionResult.Id      = groupPolicy.Id;


            return(actionResult);
        }
    }
コード例 #5
0
 public DtoActionResult Post(EntityGroupPolicy groupPolicy)
 {
     return(_groupPolicyServices.AddGroupPolicy(groupPolicy));
 }