public void EXEC_usp_open_request_tab() { using (var db = new SNAPDatabaseDataContext()) { var req = db.SNAP_Requests.Single(x => x.submittedBy == "UnitTester"); var accessReq = new AccessRequest(req.pkId); accessReq.Ack(); } using (var db = new SNAPDatabaseDataContext()) { var req = db.SNAP_Requests.Single(x => x.submittedBy == "UnitTester"); Assert.IsTrue(req.statusEnum == (byte)RequestState.Pending); var accessReq = new AccessRequest(req.pkId); accessReq.RequestToChange("TEST"); } usp_open_request_tabResult t = new usp_open_request_tabResult(); t.requestId = 0; t.userId = "test"; t.userDisplayName = "test"; t.userTitle = "test"; t.submittedBy = "test"; t.managerUserId = "test"; t.managerDisplayName = "test"; t.statusEnum = 0; t.isChanged = false; t.ticketNumber = "test"; t.fieldId = 0; t.fieldLabel = "test"; t.fieldText = "ttest"; t.modifiedDate = DateTime.Now; t.createdDate = DateTime.Now; using (var db = new SNAPDatabaseDataContext()) { var req = db.SNAP_Requests.Single(x => x.submittedBy == "UnitTester"); Assert.IsTrue(req.statusEnum == (byte)RequestState.Change_Requested); var test = db.usp_open_request_tab(req.userId, req.pkId).First(); Assert.IsTrue(test.requestId > 0); Console.WriteLine(test.requestId); Console.WriteLine(test.userId); Console.WriteLine(test.userDisplayName); Console.WriteLine(test.userTitle); Console.WriteLine(test.submittedBy); Console.WriteLine(test.managerUserId); Console.WriteLine(test.managerDisplayName); Console.WriteLine(test.statusEnum); Console.WriteLine(test.isChanged); Console.WriteLine(test.ticketNumber); Console.WriteLine(test.fieldId); Console.WriteLine(test.fieldLabel); Console.WriteLine(test.fieldText); Console.WriteLine(test.modifiedDate); Console.WriteLine(test.createdDate); } }
public static WebMethodResponse AccessTeamActions(int requestId, WorkflowAction action, string comments) { //TODO: get actorId from current user var accessReq = new AccessRequest(requestId); comments = comments.FromJSONStringToObj<string>(); switch (action) { case WorkflowAction.Ack: return accessReq.Ack(); case WorkflowAction.Change: return accessReq.RequestToChange(comments); case WorkflowAction.Cancel: return accessReq.NoAccess(action, comments); case WorkflowAction.Denied: return accessReq.NoAccess(action, comments); default: return new WebMethodResponse(false, "AIM", "Unknown operation"); } }