public ActionResult Reject(int id, string reason) { if (getCurrentUser() == null) { return(RedirectToAction("Index", "Login")); } else { OverTimeRequest overTimeRequest = ioverTimeRequest.GetOverTimeRequest(id); WorkflowDetail workflow = iworkflowDetail.GetWorkFlowDetail(overTimeRequest.rq_workflow_id); WorkflowTracker workflowTracker = new WorkflowTracker(); Documents documents = idocuments.GetDocument(1); int rolePriority = iworkflowDetail.getPriorityByRole(overTimeRequest.rq_workflow_id, getCurrentUser().u_role_id); int previousStatus = iworkflowDetail.getPreviousWorkflow(overTimeRequest.rq_workflow_id, overTimeRequest.rq_status); int previousStatusByRole = iworkflowDetail.getPreviousWorkflow(overTimeRequest.rq_workflow_id, rolePriority); if (previousStatus == previousStatusByRole) { WorkflowDetail workflowDetail = iworkflowDetail.getWorkflowDetlByWorkflowCodeAndPriority(overTimeRequest.rq_workflow_id, previousStatus); workflowTracker.wt_doc_id = documents.dc_id; workflowTracker.wt_fun_doc_id = overTimeRequest.rq_id; workflowTracker.wt_status = overTimeRequest.rq_status; workflowTracker.wt_workflow_id = overTimeRequest.rq_workflow_id; workflowTracker.wt_role_id = getCurrentUser().u_role_id; workflowTracker.wt_role_description = getCurrentUser().u_role_description; workflowTracker.wt_status_to = previousStatus; workflowTracker.wt_assign_role = workflowDetail.wd_role_id; workflowTracker.wt_assigned_role_name = workflowDetail.wd_role_description; workflowTracker.wt_approve_status = "rejected"; workflowTracker.wt_cre_by = getCurrentUser().u_id; workflowTracker.wt_cre_by_name = getCurrentUser().u_name + "-" + getCurrentUser().u_full_name; workflowTracker.wt_cre_date = DateTime.Now; iworkflowTracker.Add(workflowTracker); overTimeRequest.rq_status = previousStatus; ioverTimeRequest.Update(overTimeRequest); if (!reason.Equals("")) { Insight insight = new Insight(); insight.in_fun_doc_id = overTimeRequest.rq_id; insight.in_doc_id = overTimeRequest.rq_doc_id; insight.in_remarks = reason; insight.in_cre_by = getCurrentUser().u_id; insight.in_cre_date = DateTime.Now; iinsight.Add(insight); } return(RedirectToAction("Approval")); } return(RedirectToAction("Approval")); } }
public ActionResult Create(IFormCollection collection) { if (getCurrentUser() == null) { return(RedirectToAction("Index", "Login")); } else { Insight insight = new Insight(); insight.in_fun_doc_id = Convert.ToInt32(collection["id"]); insight.in_doc_id = Convert.ToInt32(collection["doc_id"]); insight.in_remarks = Convert.ToString(collection["remarks"]); insight.in_cre_by = getCurrentUser().u_id; insight.in_cre_date = DateTime.Now; iinsight.Add(insight); return(View(iinsight.GetInsightsByDocument(Convert.ToInt32(collection["id"]), Convert.ToInt32(collection["doc_id"])))); } }
public string Reject(int id, String reason, int u_id) { Result result = new Result(); try { if (reason != null) { User user = iuser.GetUser(u_id); Role role = irole.GetRole(user.u_role_id); OverTimeRequest overTimeRequest = ioverTimeRequest.GetOverTimeRequest(id); WorkflowDetail workflow = iworkflowDetail.GetWorkFlowDetail(overTimeRequest.rq_workflow_id); WorkflowTracker workflowTracker = new WorkflowTracker(); Documents documents = idocuments.GetDocument(1); int previousStatus = iworkflowDetail.getPreviousWorkflow(overTimeRequest.rq_workflow_id, overTimeRequest.rq_status); int rolePriority = iworkflowDetail.getPriorityByRole(overTimeRequest.rq_workflow_id, role.r_id); int previousStatusByRole = iworkflowDetail.getPreviousWorkflow(overTimeRequest.rq_workflow_id, rolePriority); if (previousStatus == previousStatusByRole) { WorkflowDetail workflowDetail = iworkflowDetail.getWorkflowDetlByWorkflowCodeAndPriority(overTimeRequest.rq_workflow_id, previousStatus); workflowTracker.wt_doc_id = documents.dc_id; workflowTracker.wt_fun_doc_id = overTimeRequest.rq_id; workflowTracker.wt_status = overTimeRequest.rq_status; workflowTracker.wt_workflow_id = overTimeRequest.rq_workflow_id; workflowTracker.wt_role_id = user.u_role_id; workflowTracker.wt_role_description = role.r_description; workflowTracker.wt_status_to = previousStatus; workflowTracker.wt_assign_role = workflowDetail.wd_role_id; workflowTracker.wt_assigned_role_name = workflowDetail.wd_role_description; workflowTracker.wt_approve_status = "rejected"; workflowTracker.wt_cre_by = user.u_id; workflowTracker.wt_cre_by_name = user.u_name + "-" + user.u_full_name; workflowTracker.wt_cre_date = DateTime.Now; iworkflowTracker.Add(workflowTracker); overTimeRequest.rq_status = previousStatus; ioverTimeRequest.Update(overTimeRequest); if (!reason.Equals("")) { Insight insight = new Insight(); insight.in_fun_doc_id = overTimeRequest.rq_id; insight.in_doc_id = overTimeRequest.rq_doc_id; insight.in_remarks = reason; insight.in_cre_by = user.u_id; insight.in_cre_date = DateTime.Now; iinsight.Add(insight); } result.Objects = null; result.Message = "Success"; return(JsonConvert.SerializeObject(result)); } else { result.Objects = null; result.Message = "You have no priviage"; return(JsonConvert.SerializeObject(result)); } } else { result.Objects = null; result.Message = "Please enter Remarks"; return(JsonConvert.SerializeObject(result)); } } catch (Exception ex) { /* var st = new StackTrace(ex, true); * // Get the top stack frame * var frame = st.GetFrame(0); * // Get the line number from the stack frame * var line = frame.GetFileLineNumber();*/ result.Objects = null; result.Message = ex.Message; return(JsonConvert.SerializeObject(result)); } }