public override JsonResult SaveData(UserDto user)
        {
            user.Roles = RoleService.GetByUserID(user.ID).Data;
            var result = UserService.UpdateUserSystem(user);

            return(Json(JsonModel.Create(result)));
        }
        public JsonNetResult GetAllRowDelimiters()
        {
            var rowDelimiters = from RowDelimiter rd in Enum.GetValues(typeof(RowDelimiter))
                                select new { Value = (int)rd, Text = rd.GetLocalizedDescription() };
            var jsonModel = JsonModel.Create(rowDelimiters.ToList());

            return(new JsonNetResult(jsonModel));
        }
Example #3
0
 public virtual JsonResult DeleteData(long recordID)
 {
     if (!CanDelete)
     {
         return(ErrorAjax(HttpStatusCode.Forbidden, SmsCache.Message.Get(ConstMessageIds.Forbidden)));
     }
     return(Json(JsonModel.Create(Service.Delete(recordID))));
 }
Example #4
0
 public virtual JsonResult SaveData(TDto data)
 {
     if (!CanAdd && !CanEdit)
     {
         return(ErrorAjax(HttpStatusCode.Forbidden, SmsCache.Message.Get(ConstMessageIds.Forbidden)));
     }
     return(Json(JsonModel.Create(Service.Save(data))));
 }
Example #5
0
 public virtual JsonResult GetSchemaForAdd()
 {
     if (!CanAdd)
     {
         return(ErrorAjax(HttpStatusCode.Forbidden, SmsCache.Message.Get(ConstMessageIds.Forbidden)));
     }
     return(Json(JsonModel.Create(new TDto())));
 }
        public JsonResult ResetSystemData()
        {
            if (!SmsCache.UserContext.IsSystemAdmin)
            {
                return(Json(JsonModel.Create(false)));
            }

            SmsCache.ClearCache();
            return(Json(JsonModel.Create(true)));
        }
        public JsonResult GetTablesByAreaID(long areaID)
        {
            if (areaID < 0)
            {
                return(Json(JsonModel.Create(false)));
            }
            var listTable = OrderService.GetOrderTablesByAreaID <SimpleOrderTableDto>(areaID);

            return(Json(JsonModel.Create(listTable)));
        }
        public virtual JsonResult Delete(string tokenStr)
        {
            Guid tokenId;

            if (!Guid.TryParse(tokenStr, out tokenId))
            {
                return(ErrorAjax("loi~"));
            }

            return(Json(JsonModel.Create(SmsCache.UserAccesses.Remove(tokenId))));
        }
        public JsonResult CheckOrderStatus(long orderID)
        {
            if (orderID <= 0)
            {
                return(Json(JsonModel.Create(false)));
            }

            var result = OrderService.CheckOrderStatus(orderID);

            return(Json(JsonModel.Create(result)));
        }
        public JsonResult CheckTableStatus(long tableID)
        {
            if (tableID <= 0)
            {
                return(Json(JsonModel.Create(false)));
            }

            var result = OrderService.CheckTableStatus(tableID);

            return(Json(JsonModel.Create(result)));
        }
        public JsonResult CancelOrder(long orderTableID)
        {
            if (orderTableID <= 0)
            {
                return(Json(JsonModel.Create(false)));
            }

            var result = OrderService.DeleteByOrderTableID(orderTableID);

            return(Json(JsonModel.Create(result)));
        }
        public JsonResult CancelTable(long orderTableID)
        {
            if (orderTableID <= 0)
            {
                return(Json(JsonModel.Create(false)));
            }

            var flag = OrderService.Delete(orderTableID);

            return(Json(JsonModel.Create(flag)));
        }
        public JsonResult UpdateOtherFee(long orderID, decimal otherFee, string otherFeeDescription)
        {
            if (orderID <= 0)
            {
                return(Json(JsonModel.Create(false)));
            }

            var order = OrderService.UpdateOtherFee(orderID, otherFee, otherFeeDescription);

            return(Json(JsonModel.Create(order)));
        }
        public JsonResult CreateOrderTable(long tableID)
        {
            if (tableID <= 0)
            {
                return(Json(JsonModel.Create(false)));
            }

            var orderTableID = OrderService.CreateOrderTable(tableID);

            return(Json(JsonModel.Create(orderTableID)));
        }
Example #15
0
        public JsonResult UpdateUserProfile(string password, string firstName, string lastName, string cellPhone, string email, string address, string theme, int pageSize, HttpPostedFileBase profileImg)
        {
            if (profileImg != null)
            {
                Utility.UploadFile(profileImg, UploadedFileCategory.ProfileImage);
            }

            var result = UserService.UpdateUserProfile(password, firstName, lastName, cellPhone, email, address, theme, pageSize);

            return(Json(JsonModel.Create(result)));
        }
        public JsonResult RemoveOrderedProduct(long orderDetailID)
        {
            if (orderDetailID <= 0)
            {
                return(Json(JsonModel.Create(false)));
            }

            var result = OrderService.DeleteOrderDetail(orderDetailID);

            return(Json(JsonModel.Create(result)));
        }
        public JsonResult UpdateOrderedProduct(long orderDetailID, string columnName, string columnValue)
        {
            if (orderDetailID <= 0)
            {
                return(Json(JsonModel.Create(false)));
            }

            var result = OrderService.UpdateProductToOrderTable(orderDetailID, columnName, columnValue);

            return(Json(JsonModel.Create(result)));
        }
        public JsonResult MoveTable(long orderTableID, long tableID)
        {
            if (orderTableID <= 0 || tableID <= 0)
            {
                return(Json(JsonModel.Create(false)));
            }

            var result = OrderService.MoveTable(orderTableID, tableID);

            return(Json(JsonModel.Create(result.Success)));
        }
        public JsonResult UpdateOrderedProductStatus(long orderDetailID, OrderStatus value)
        {
            if (orderDetailID <= 0)
            {
                return(Json(JsonModel.Create(false)));
            }

            var orderDetail = OrderService.UpdateOrderedProductStatus <LanguageOrderDetailDto>(orderDetailID, value);

            return(Json(JsonModel.Create(orderDetail)));
        }
        public JsonResult OrderProduct(long orderTableID, long productID, decimal quantity)
        {
            if (productID <= 0 || quantity <= 0 || orderTableID <= 0)
            {
                return(Json(JsonModel.Create(false)));
            }

            var result = OrderService.AddProductToOrderTable <OrderTableDto>(orderTableID, productID, quantity);

            return(Json(JsonModel.Create(result)));
        }
        public JsonResult SelectTable(long orderTableID)
        {
            if (orderTableID <= 0)
            {
                return(Json(JsonModel.Create(false)));
            }

            var order = OrderService.GetByOrderTableID <OrderDataDto>(orderTableID);

            return(Json(JsonModel.Create(order)));
        }
        public JsonResult GetOrderDiscount(long orderID)
        {
            if (orderID <= 0)
            {
                return(Json(JsonModel.Create(false)));
            }

            var listOrderDiscount = OrderService.GetOrderDiscount <OrderDiscountDto>(orderID);

            return(Json(JsonModel.Create(listOrderDiscount)));
        }
        public JsonResult GetOrderBasic(long orderID)
        {
            if (orderID <= 0)
            {
                return(Json(JsonModel.Create(false)));
            }

            var order = OrderService.GetByID <OrderBasicDto>(orderID);

            return(Json(JsonModel.Create(order)));
        }
        public JsonResult SaveCashierInfo(CashierInfoModel info)
        {
            var result = UserConfigService.SaveCashierInfo(info.DefaultAreaID, info.ListTableHeight);

            if (result.Success)
            {
                SmsCache.UserContext.DefaultAreaID   = result.Data.DefaultAreaID;
                SmsCache.UserContext.ListTableHeight = result.Data.ListTableHeight;
            }
            return(Json(JsonModel.Create(result)));
        }
        public JsonResult SendToKitchen(long orderTableID)
        {
            if (orderTableID <= 0)
            {
                return(Json(JsonModel.Create(false)));
            }

            var result = OrderService.SendToKitchen(orderTableID);

            return(Json(JsonModel.Create(result)));
        }
        public JsonResult Payment(long orderID, string taxInfo, decimal tax, decimal serviceFee, PaymentMethod paymentMethod)
        {
            if (orderID <= 0)
            {
                return(Json(JsonModel.Create(false)));
            }

            var result = OrderService.Payment(orderID, taxInfo, tax, serviceFee, paymentMethod);

            return(Json(JsonModel.Create(result)));
        }
        public JsonResult GetDataForPayment(long orderID)
        {
            if (orderID <= 0)
            {
                return(Json(JsonModel.Create(false)));
            }

            var order = OrderService.GetOrder <OrderDto>(orderID);

            return(Json(JsonModel.Create(order)));
        }
        public JsonResult TestSendMail()
        {
            var mail = new SmtpMail
            {
                From = "*****@*****.**",
                To   = new List <string>
                {
                    "*****@*****.**"
                },
                Body    = "test email",
                Subject = "test email from SMS"
            };

            return(Json(JsonModel.Create(mail.Send())));
        }
        public JsonResult GetReportData(string spName, DateTime fromDate, DateTime toDate)
        {
            var param = new List <SpParameter>
            {
                new SpParameter {
                    Name = "I_vFromDate", Value = fromDate
                },
                new SpParameter {
                    Name = "I_vToDate", Value = toDate
                }
            };
            DataTable result = ReportService.ExecuteStoredProcedure(spName, param);

            return(Json(JsonModel.Create(result)));
        }
Example #30
0
        /// <summary>
        /// Returns all WMS layers stored in MySettings
        /// </summary>
        /// <returns></returns>
        public JsonNetResult GetWmsLayers()
        {
            JsonModel jsonModel;

            try
            {
                var viewManager = new WmsLayersViewManager(GetCurrentUser(), SessionHandler.MySettings);
                List <WmsLayerViewModel> wmsLayers = viewManager.GetWmsLayers();
                jsonModel = JsonModel.Create(wmsLayers);
            }
            catch (Exception ex)
            {
                jsonModel = JsonModel.CreateFailure(ex.Message);
            }
            return(new JsonNetResult(jsonModel));
        }