예제 #1
0
        public JsonResult SaveActionDelineClassify(IntegrationOrderCommentViewModel param)
        {
            var location = 2;
            var result   = _integrationOrderService.SaveActionDelineClassify(param, CurrentUserName, location);

            return(Json(result));
        }
예제 #2
0
        public BaseResultViewModel <string> SaveActionDelineClassify(IntegrationOrderCommentViewModel param, string user, int location)
        {
            var result = new BaseResultViewModel <string>
            {
                IsSuccess = false,
                Message   = "",
                Extra     = null
            };

            try
            {
                //0 = Decline Order, 1 = Classify Order
                if (param.State == 0)
                {
                    var getStatusProgress = _repository.GetAll <IntegrationOrderProgress>().Where(p => !p.IsArchived && p.Name.Contains("Decline", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
                    if (getStatusProgress != null)
                    {
                        var findOrder = _repository.GetById <IntegrationOrder>(param.OrderId);
                        findOrder.OrderLastProgressId = getStatusProgress.Id;
                        _repository.SaveExisting(findOrder);

                        //Save to tracker
                        var tracker = new IntegrationOrderTracking
                        {
                            IntegrationOrderId     = findOrder.Id,
                            OrderCurrentLocationId = location,
                            OrderLastProgressId    = findOrder.OrderLastProgressId,
                            Comment = param.Comment
                        };
                        tracker.SetCreateDetails(user);
                        var saveTracking = _repository.SaveNew(tracker);

                        result.IsSuccess = true;
                        result.Message   = "Order Declined";
                        return(result);
                    }
                    else
                    {
                        result.Message = "No Declined status describe on database, please check database";
                        return(result);
                    }
                }
                else if (param.State == 1)
                {
                    var getStatusProgress = _repository.GetAll <IntegrationOrderProgress>().Where(p => !p.IsArchived && p.Name.Contains("Classify", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
                    if (getStatusProgress != null)
                    {
                        var findOrder = _repository.GetById <IntegrationOrder>(param.OrderId);
                        findOrder.OrderLastProgressId       = getStatusProgress.Id;
                        findOrder.OrderlastClassificationId = param.Classification;
                        _repository.SaveExisting(findOrder);

                        //Save to tracker
                        var tracker = new IntegrationOrderTracking
                        {
                            IntegrationOrderId        = findOrder.Id,
                            OrderCurrentLocationId    = location,
                            OrderLastProgressId       = findOrder.OrderLastProgressId,
                            OrderLastClassificationId = findOrder.OrderlastClassificationId,
                            Comment = param.Comment
                        };
                        tracker.SetCreateDetails(user);
                        var saveTracking = _repository.SaveNew(tracker);

                        result.IsSuccess = true;
                        result.Message   = "Order Declined";
                        return(result);
                    }
                    else
                    {
                        result.Message = "No Classify Order status describe on database, please check database";
                        return(result);
                    }
                }
            }
            catch (Exception ex)
            {
                result.Extra = ex.Message;
            }

            return(result);
        }
예제 #3
0
 public ActionResult GetComment(IntegrationOrderCommentViewModel param)
 {
     param.Classifications = _integrationOrderService.GetOrderClassifications();
     return(PartialView("_FormComment", param));
 }