protected void CreateClick(object sender, EventArgs e) { // create the hiringRequest info and populate it with data from the UI HiringRequestInfo requestInfo = new HiringRequestInfo() { Id = Guid.NewGuid(), RequesterId = currentUser.Id, CreationDate = DateTime.Now, DepartmentId = this.hiringRequestDetails1.DepartmentId, PositionId = this.hiringRequestDetails1.PositionId, Description = this.hiringRequestDetails1.Description, Title = this.hiringRequestDetails1.CreateRequestTitle(this.currentUser) }; // start the hiring request HiringRequestServiceClient client = new HiringRequestServiceClient(); client.StartProcess(requestInfo); client.Close(); // update ui this.btnCancel.Text = "Request created, click here to go back to the Inbox"; this.btnCancel.Width = new System.Web.UI.WebControls.Unit(400, System.Web.UI.WebControls.UnitType.Pixel); this.btnCreate.Visible = false; }
// Handler of click on an action button (Accept, Reject, Review) protected void OnActionClick(object sender, EventArgs e) { // get data from the clicked buttton string action = ((Button)sender).Text; // perform the action according with the current state HiringRequestServiceClient client = new HiringRequestServiceClient(); switch (state) { case HiringRequestProcessStates.WaitingForManagerApproval: client.ReceiveManagerApproval(this.requestId, action, this.hiringRequestDetails1.Comments, currentUser.Id); break; case HiringRequestProcessStates.WaitingForDepartmentOwnerApproval: client.ReceiveDeptOwnerApproval(this.requestId, action, this.hiringRequestDetails1.Comments, currentUser.Id); break; case HiringRequestProcessStates.InReview: client.CompleteReview(this.requestId, this.hiringRequestDetails1.PositionId, this.hiringRequestDetails1.DepartmentId, this.hiringRequestDetails1.Description, this.hiringRequestDetails1.Comments, this.hiringRequestDetails1.CreateRequestTitle(currentUser), currentUser.Id); break; case HiringRequestProcessStates.WaitingForHrManagersOrCeoApproval: client.ReceiveHrManagerApproval(this.requestId, action, this.hiringRequestDetails1.Comments, currentUser.Id); break; } // close client client.Close(); // hide all button this.HideAllButtons("Message sent, click here to go back to the Inbox"); }