コード例 #1
0
        public SecurityAction ApproveRequest(int requestId, int? vlanId, string notes)
        {
            var request = GetRequestById(requestId);

            if (request == null)
            {
                throw new ArgumentException("The specified request Id doesn't exist.");
            }

            var action = new SecurityAction
            {
                Date = DateTime.Now,
                User = GetCurrentUser(),
                Assigned = true,
                RequestId = requestId,
                Notes = notes,
                Approved = true,
                VlanId = vlanId
            };

            db.SecurityActions.AddObject(action);

            return action;
        }
コード例 #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the SecurityActions EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSecurityActions(SecurityAction securityAction)
 {
     base.AddObject("SecurityActions", securityAction);
 }
コード例 #3
0
 /// <summary>
 /// Create a new SecurityAction object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="userId">Initial value of the UserId property.</param>
 /// <param name="date">Initial value of the Date property.</param>
 /// <param name="requestId">Initial value of the RequestId property.</param>
 /// <param name="assigned">Initial value of the Assigned property.</param>
 public static SecurityAction CreateSecurityAction(global::System.Int32 id, global::System.Int32 userId, global::System.DateTime date, global::System.Int32 requestId, global::System.Boolean assigned)
 {
     SecurityAction securityAction = new SecurityAction();
     securityAction.Id = id;
     securityAction.UserId = userId;
     securityAction.Date = date;
     securityAction.RequestId = requestId;
     securityAction.Assigned = assigned;
     return securityAction;
 }
コード例 #4
0
        public SecurityAction ReleaseSecurityEngineer(int requestId, string notes)
        {
            var request = GetRequestById(requestId);

            var lastAction = request.SecurityActions.LastOrDefault();

            if (lastAction != null && lastAction.Assigned)
            {
                var action = new SecurityAction
                {
                    User = GetCurrentUser(),
                    Assigned = false,
                    RequestId = requestId,
                    Notes = notes,
                    Date = DateTime.Now
                };

                db.SecurityActions.AddObject(action);

                return action;
            }

            return null;
        }
コード例 #5
0
        public SecurityAction AssignSecurityEngineer(int requestId, string notes)
        {
            var request = GetRequestById(requestId);

            var action = new SecurityAction
            {
                User = GetCurrentUser(),
                Assigned = true,
                RequestId = requestId,
                Notes = notes,
                Date = DateTime.Now
            };

            db.SecurityActions.AddObject(action);

            return action;
        }