public ActionResult CancelRequestReturnRack(ProcessRequestReturnRackViewModel viewmodel) { var customer = GetCurrentUserName(); var result = RequestBLO.Current.CancelRequestReturnRack(viewmodel.RequestInfo.RequestCode, customer, viewmodel.RequestInfo.TaskCode); //dang ky ham cho client Notify(result.NotificationCodes); return RedirectToAction("Detail", "Request", new { code = viewmodel.RequestInfo.RequestCode, msg = Constants.Message.CANCEL_REQUEST_RETURN_RACK }); }
public ActionResult ProcessRequestReturnRack(ProcessRequestReturnRackViewModel viewmodel) { var status = RequestBLO.Current.GetByKeys(new Request { RequestCode = viewmodel.RequestInfo.RequestCode }).StatusCode; if (status == Constants.StatusCode.REQUEST_REJECTED || status == Constants.StatusCode.REQUEST_DONE || status == Constants.StatusCode.REQUEST_CANCELLED) { return RedirectToAction("Detail", "ProcessRequest", new { code = viewmodel.RequestInfo.RequestCode, msg = Constants.Message.ERROR_CANCEL_REQUEST }); } else { if (Request.Form[Constants.FormAction.ACCEPT_ACTION] != null) { if (status == Constants.StatusCode.REQUEST_PENDING) { var shifthead = GetCurrentUserName(); var result = RequestBLO.Current.AcceptRequest(viewmodel.RequestInfo.RequestCode, shifthead, viewmodel.RequestInfo.Assignee, Constants.StatusCode.REQUEST_PROCESSING, Constants.TypeOfLog.LOG_RETURN_RACK, true); var task = RequestBLO.Current.AssignTask(viewmodel.RequestInfo.RequestCode, shifthead, viewmodel.RequestInfo.Assignee); //dang ky ham cho client Notify(result.NotificationCodes); if (viewmodel.RequestInfo.Assignee != shifthead) { Notify(task.NotificationCodes); } return RedirectToAction("Detail", "ProcessRequest", new { code = viewmodel.RequestInfo.RequestCode, msg = Constants.Message.ACCEPT_REQUEST_RETURN_RACK }); } else { return RedirectToAction("Detail", "ProcessRequest", new { code = viewmodel.RequestInfo.RequestCode, msg = Constants.Message.ERROR_CANCEL_REQUEST }); } } if (Request.Form[Constants.FormAction.APPROVE_ACTION] != null) { var assignee = RequestBLO.Current.GetByKeys(new Request { RequestCode = viewmodel.RequestInfo.RequestCode }).Assignee; if (assignee == viewmodel.RequestInfo.Assignee) { var result = RequestBLO.Current.ApproveRequestReturnRack(viewmodel.RequestInfo.RequestCode, viewmodel.SelectedRacks, viewmodel.RequestInfo.Assignee, viewmodel.RequestInfo.TaskCode, viewmodel.CustomerInfo.Customer); //dang ky ham cho client Notify(result.NotificationCodes); return RedirectToAction("Detail", "ProcessRequest", new { code = viewmodel.RequestInfo.RequestCode, msg = Constants.Message.APPROVE_REQUEST_RETURN_RACK }); } else { return RedirectToAction("Detail", "ProcessRequest", new { code = viewmodel.RequestInfo.RequestCode, msg = "Error! You are not authorized." }); } } if (Request.Form[Constants.FormAction.REJECT_ACTION] != null) { var assignee = RequestBLO.Current.GetByKeys(new Request { RequestCode = viewmodel.RequestInfo.RequestCode }).Assignee; if (assignee == null) { assignee = GetCurrentUserName(); } if (assignee == viewmodel.RequestInfo.Assignee) { var result = RequestBLO.Current.RejectRequestAssignIP(viewmodel.RequestInfo.RequestCode, assignee, viewmodel.RequestInfo.TaskCode, viewmodel.RequestInfo.Reason); //dang ky ham cho client Notify(result.NotificationCodes); return RedirectToAction("Detail", "ProcessRequest", new { code = viewmodel.RequestInfo.RequestCode, msg = Constants.Message.REJECT_REQUEST_RETURN_RACK }); } else { return RedirectToAction("Detail", "ProcessRequest", new { code = viewmodel.RequestInfo.RequestCode, msg = "Error! You are not authorized." }); } } if (Request.Form[Constants.FormAction.REASSIGN_ACTION] != null) { var shifthead = GetCurrentUserName(); var check = RequestBLO.Current.IsShiftHeadDoingTask(viewmodel.RequestInfo.TaskCode); var taskstatus = TaskBLO.Current.GetByKeys(new Task { TaskCode = viewmodel.RequestInfo.TaskCode }).StatusCode; if (taskstatus == Constants.StatusCode.TASK_WAITING || taskstatus == Constants.StatusCode.TASK_NOTFINISH || check) { if (viewmodel.RequestInfo.TaskStatus != Constants.StatusCode.TASK_NOTFINISH) { var preTask = RequestBLO.Current.CancelTask(viewmodel.RequestInfo.TaskCode, viewmodel.RequestInfo.RequestCode, viewmodel.RequestInfo.Assignee, shifthead); //dang ky ham cho client if (viewmodel.RequestInfo.Assignee != shifthead) { Notify(preTask.NotificationCodes); } } var newTask = RequestBLO.Current.ReAssignTask(viewmodel.RequestInfo.TaskCode, viewmodel.RequestInfo.RequestCode, viewmodel.RequestInfo.Assignee, viewmodel.RequestInfo.AssignedStaff, shifthead); //dang ky ham cho client if (viewmodel.RequestInfo.AssignedStaff != shifthead) { Notify(newTask.NotificationCodes); } var message = Constants.Message.REASSIGN_TASK + viewmodel.RequestInfo.AssignedStaffName; return RedirectToAction("Detail", "ProcessRequest", new { code = viewmodel.RequestInfo.RequestCode, msg = message }); } else { return RedirectToAction("Detail", "ProcessRequest", new { code = viewmodel.RequestInfo.RequestCode, msg = "Error! Staff is processing request." }); } } if (Request.Form[Constants.FormAction.ACCEPT_TASK_ACTION] != null) { var taskstatus = TaskBLO.Current.GetByKeys(new Task { TaskCode = viewmodel.RequestInfo.TaskCode }).StatusCode; if (taskstatus == Constants.StatusCode.TASK_WAITING) { //update task TaskBLO.Current.UpdateTaskStatus(viewmodel.RequestInfo.TaskCode, Constants.StatusCode.TASK_DOING); return RedirectToAction("Detail", "ProcessRequest", new { code = viewmodel.RequestInfo.RequestCode, msg = Constants.Message.ACCEPT_TASK }); } else { return RedirectToAction("Detail", "ProcessRequest", new { code = viewmodel.RequestInfo.RequestCode, msg = "Error! Your task is cancelled." }); } } if (Request.Form[Constants.FormAction.NOT_FINISHED_TASK_ACTION] != null) { var result = RequestBLO.Current.NotFinishRequest(viewmodel.RequestInfo.TaskCode, viewmodel.RequestInfo.NotFinishReason); Notify(result.NotificationCodes); return RedirectToAction("Detail", "ProcessRequest", new { code = viewmodel.RequestInfo.RequestCode, msg = Constants.Message.NOT_FINISHED_TASK }); } } return RedirectToAction("Index"); }
public ActionResult ProcessRequestReturnRack(ProcessRequestReturnRackViewModel viewmodel) { if (Request.Form[Constants.FormAction.ACCEPT_ACTION] != null) { var shifthead = GetCurrentUserName(); var result = RequestBLO.Current.AcceptRequest(viewmodel.RequestInfo.RequestCode, shifthead, viewmodel.RequestInfo.Assignee, Constants.StatusCode.REQUEST_PROCESSING, Constants.TypeOfLog.LOG_RETURN_RACK, true); var task = RequestBLO.Current.AssignTask(viewmodel.RequestInfo.RequestCode, shifthead, viewmodel.RequestInfo.Assignee); //dang ky ham cho client Notify(result.NotificationCodes); if (viewmodel.RequestInfo.Assignee != shifthead) { Notify(task.NotificationCodes); } return RedirectToAction("Detail", "ProcessRequest", new { code = viewmodel.RequestInfo.RequestCode, msg = Constants.Message.ACCEPT_REQUEST_RETURN_RACK }); } if (Request.Form[Constants.FormAction.APPROVE_ACTION] != null) { var result = RequestBLO.Current.ApproveRequestReturnRack(viewmodel.RequestInfo.RequestCode, viewmodel.SelectedRacks, viewmodel.RequestInfo.Assignee, viewmodel.RequestInfo.TaskCode, viewmodel.CustomerInfo.Customer); //dang ky ham cho client Notify(result.NotificationCodes); return RedirectToAction("Detail", "ProcessRequest", new { code = viewmodel.RequestInfo.RequestCode, msg = Constants.Message.APPROVE_REQUEST_RETURN_RACK }); } if (Request.Form[Constants.FormAction.REJECT_ACTION] != null) { var assignee = viewmodel.RequestInfo.Assignee; if (viewmodel.RequestInfo.Assignee == null) { assignee = GetCurrentUserName(); } var result = RequestBLO.Current.RejectRequestReturnRack(viewmodel.RequestInfo.RequestCode, assignee, viewmodel.RequestInfo.TaskCode, viewmodel.CustomerInfo.Customer, viewmodel.RequestInfo.Reason); //dang ky ham cho client Notify(result.NotificationCodes); return RedirectToAction("Detail", "ProcessRequest", new { code = viewmodel.RequestInfo.RequestCode, msg = Constants.Message.REJECT_REQUEST_RETURN_RACK }); } if (Request.Form[Constants.FormAction.REASSIGN_ACTION] != null) { var shifthead = GetCurrentUserName(); if (viewmodel.RequestInfo.TaskStatus != Constants.StatusCode.TASK_NOTFINISH) { var preTask = RequestBLO.Current.CancelTask(viewmodel.RequestInfo.TaskCode, viewmodel.RequestInfo.RequestCode, viewmodel.RequestInfo.Assignee, shifthead); //dang ky ham cho client if (viewmodel.RequestInfo.Assignee != shifthead) { Notify(preTask.NotificationCodes); } } var newTask = RequestBLO.Current.ReAssignTask(viewmodel.RequestInfo.TaskCode, viewmodel.RequestInfo.RequestCode, viewmodel.RequestInfo.Assignee, viewmodel.RequestInfo.AssignedStaff, shifthead); //dang ky ham cho client if (viewmodel.RequestInfo.AssignedStaff != shifthead) { Notify(newTask.NotificationCodes); } var message = Constants.Message.REASSIGN_TASK + viewmodel.RequestInfo.AssignedStaffName; return RedirectToAction("Detail", "ProcessRequest", new { code = viewmodel.RequestInfo.RequestCode, msg = message }); } if (Request.Form[Constants.FormAction.ACCEPT_TASK_ACTION] != null) { //update task TaskBLO.Current.UpdateTaskStatus(viewmodel.RequestInfo.TaskCode, Constants.StatusCode.TASK_DOING); return RedirectToAction("Detail", "ProcessRequest", new { code = viewmodel.RequestInfo.RequestCode, msg = Constants.Message.ACCEPT_TASK }); } if (Request.Form[Constants.FormAction.NOT_FINISHED_TASK_ACTION] != null) { var result = RequestBLO.Current.NotFinishRequest(viewmodel.RequestInfo.TaskCode, viewmodel.RequestInfo.NotFinishReason); Notify(result.NotificationCodes); return RedirectToAction("Detail", "ProcessRequest", new { code = viewmodel.RequestInfo.RequestCode, msg = Constants.Message.NOT_FINISHED_TASK }); } return RedirectToAction("Index"); }
public ActionResult CancelRequestReturnRack(ProcessRequestReturnRackViewModel viewmodel) { var status = RequestBLO.Current.GetByKeys(new Request { RequestCode = viewmodel.RequestInfo.RequestCode }).StatusCode; if (status == Constants.StatusCode.REQUEST_REJECTED || status == Constants.StatusCode.REQUEST_DONE || status == Constants.StatusCode.REQUEST_CANCELLED) { return RedirectToAction("Detail", "Request", new { code = viewmodel.RequestInfo.RequestCode, msg = Constants.Message.ERROR_CANCEL_REQUEST }); } else { var customer = GetCurrentUserName(); var result = RequestBLO.Current.CancelRequestReturnRack(viewmodel.RequestInfo.RequestCode, customer, viewmodel.RequestInfo.TaskCode); //dang ky ham cho client Notify(result.NotificationCodes); return RedirectToAction("Detail", "Request", new { code = viewmodel.RequestInfo.RequestCode, msg = Constants.Message.CANCEL_REQUEST_RETURN_RACK }); } }