Пример #1
0
        public ErrorCodes UpdateRequestType(int orderId, RequestTypeEnum type, string reasonNote = "", string user = "")
        {
            ErrorCodes errorCodes = ErrorCodes.Success;

            try
            {
                var result = _orderDal.UpdateRequestType(orderId, (short)type, reasonNote, user);


                if (result <= 0)
                {
                    errorCodes = ErrorCodes.BusinessError;
                }
                else
                {
                    // history khi thay đổi request type sẽ không có thông tin status và delivery status
                    _orderHistoryBo.Insert(new OrderHistory
                    {
                        change_log   = reasonNote,
                        created_by   = user,
                        order_id     = orderId,
                        request_type = (short)type
                    });

                    // Push notify
                    if (type == RequestTypeEnum.CSRequestDestroy || type == RequestTypeEnum.KitchenDestroy)
                    {
                        _notifyService.PushNotifyToAccounts(orderId.ToString(), type);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                errorCodes = ErrorCodes.Exception;
            }
            return(errorCodes);
        }