Ejemplo n.º 1
0
        public ActionResult _EditContent(long posId, string isReadonly, string fromType, long id = 0)
        {
            var now = DateTime.Now;

            ViewBag.CurrentTime = now.ToString("yyyy-MM-dd HH:mm:ss");
            ViewBag.HotelId     = UserContext.CurrentUser.HotelId;
            ViewBag.PosId       = posId;

            ViewBag.CurrentOrderNo = PosConsumeBll.GetNewOrderNo(posId);
            var pos = PosDefineBll.GetById(posId);

            ViewBag.Pos = pos;
            if (fromType == "History")
            {
                ViewBag.ReturnPage = "/PosConsume/History?id=" + pos.ProjectNo;
            }
            if (id == 0)
            {
                return(View(new PosConsume()
                {
                    OrderNo = PosConsumeBll.GetNewOrderNo(posId),
                    OpUserName = UserContext.CurrentUser.UserName,
                    PosId = posId
                }));
            }
            var info = PosConsumeBll.GetById(id);

            if (info.PosId == 0)
            {
                info.PosId = posId;
            }
            ViewBag.IsReadonly = isReadonly;
            return(View(info));
        }
Ejemplo n.º 2
0
        public ActionResult _PosPrintContent(long id)
        {
            var info = PosConsumeBll.GetById(id);
            var now  = DateTime.Now;

            ViewBag.CurrentTime     = now.ToString("yyyy-MM-dd HH:mm");
            ViewBag.HotelId         = UserContext.CurrentUser.HotelId;
            ViewBag.PosId           = info.PosId;
            ViewBag.CurrentUserName = UserContext.CurrentUser.Name;
            var hotel = HotelBll.GetById(UserContext.CurrentUser.HotelId);

            if (hotel != null)
            {
                ViewBag.HotelName = hotel.Name;
            }

            var models = PosConsumeDetailBll.GetList(id);

            models = models.Where(a => a.ToRoomRegId == 0 && a.SourceRoomRegId == 0).ToList(); //没有入账房间 而且没有部分转入账房间

            ViewBag.DetailPrice         = models.Select(a => a.Price).Sum();
            ViewBag.DetailDiscountPrice = models.Select(a => a.DiscountPrice).Sum();
            ViewBag.DetailAmount        = models.Select(a => a.Amount).Sum();
            ViewBag.Detail = models;
            var pos = PosDefineBll.GetById(info.PosId);

            ViewBag.Pos     = pos;
            ViewBag.PosName = pos.MenuName;
            return(View(info));
        }
Ejemplo n.º 3
0
        public ActionResult _Serve(long consumeId, decimal Amount, long roomRegId)
        {
            var now = DateTime.Now;

            ViewBag.CurrentTime = now.ToString("yyyy-MM-dd HH:mm:ss");

            ViewBag.ConsumeId = consumeId;
            ViewBag.HotelId   = UserContext.CurrentUser.HotelId;

            ViewBag.RoomRegId = roomRegId;
            var consume = PosConsumeBll.GetById(consumeId);
            var pos     = PosDefineBll.GetById(consume.PosId);

            ViewBag.Amount           = Amount;
            ViewBag.ServiceChargePer = pos.ServiceChargePer;
            ViewBag.DefaultAmount    = Convert.ToInt32(Amount * (decimal)0.01 * pos.ServiceChargePer);

            var data = new PosConsume()
            {
                Id = consumeId
            };

            data.ServeAmount = Convert.ToInt32(Amount * (decimal)0.01 * pos.ServiceChargePer);

            return(View(data));
        }
        public ActionResult Edit(long id = 0)
        {
            if (id == 0)
            {
                return(View(new PosDefine()
                {
                    HotelId = UserContext.CurrentUser.HotelId
                }));
            }
            var info = PosDefineBll.GetById(id);

            return(View(info));
        }
Ejemplo n.º 5
0
        public ActionResult Index(string id)
        {
            var o = PosDefineBll.GetByProjectNo(id);

            ViewBag.HotelId = UserContext.CurrentUser.HotelId;
            ViewBag.PosId   = o.Id;

            var types = PosCatBll.GetList(UserContext.CurrentUser.HotelId);

            ViewBag.Types = types;

            return(View());
        }
Ejemplo n.º 6
0
        public ActionResult _DetailView(long id, long roomRegId)
        {
            var now = DateTime.Now;

            ViewBag.CurrentTime = now.ToString("yyyy-MM-dd HH:mm:ss");
            ViewBag.HotelId     = UserContext.CurrentUser.HotelId;
            var data = PosConsumeBll.GetById(id);

            ViewBag.Pos       = PosDefineBll.GetById(data.PosId);
            ViewBag.PosId     = data.PosId;
            ViewBag.RoomRegId = roomRegId;
            return(View(data));
        }
        public ActionResult _SearchContent(long posId, string searchKey, decimal discountValue = 1)
        {
            var pos = PosDefineBll.GetById(posId);

            ViewBag.Pos           = pos;
            ViewBag.HotelId       = UserContext.CurrentUser.HotelId;
            ViewBag.PosId         = posId;
            ViewBag.DiscountValue = discountValue;
            var types = PosCatBll.GetListByPos(posId);

            ViewBag.Types     = types;
            ViewBag.SearchKey = searchKey;
            return(View());
        }
Ejemplo n.º 8
0
        public ActionResult History(string id, long posId = 0)
        {
            var now = DateTime.Now;

            ViewBag.CurrentTime = now.ToString("yyyy-MM-dd HH:mm:ss");
            var o = PosDefineBll.GetByProjectNo(id);

            if (posId != 0 && o == null)
            {
                o = PosDefineBll.GetById(posId);
            }
            ViewBag.HotelId = UserContext.CurrentUser.HotelId;
            ViewBag.PosId   = o.Id;

            ViewBag.HotelId = UserContext.CurrentUser.HotelId;
            return(View());
        }
        public ActionResult Delete(long id)
        {
            var apiResult = new APIResult();

            try
            {
                PosDefineBll.DeleteById(id);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }
            return(Json(apiResult));
        }
        public JsonResult Edit(PosDefine model)
        {
            var apiResult = new APIResult();

            try
            {
                PosDefineBll.AddOrUpdate(model, UserContext.CurrentUser.HotelId);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }

            return(Json(apiResult));
        }
Ejemplo n.º 11
0
        public ActionResult Index()
        {
            List <Menu> topMenuList  = new List <Menu>(); //页面顶部菜单
            List <Menu> leftMenuList = new List <Menu>(); //页面左侧菜单



            if (UserContext.CurrentUser.GId == 1)
            {
                //如果是平台管理员
                //获取父级菜单
                var parentMenuList = GetMenuListBy(0);
                //获取第一个菜单的子级
                var kidMenuList = new List <Menu>();
                if (parentMenuList != null && parentMenuList.Any())
                {
                    var first = parentMenuList[0];
                    kidMenuList = GetMenuListBy(first.Id);
                    if (kidMenuList == null)
                    {
                        kidMenuList = new List <Menu>();
                    }
                }
                ViewBag.User        = UserContext.CurrentUser;
                ViewBag.KidMenuList = kidMenuList;
                topMenuList         = parentMenuList;
            }
            else
            {
                //如果不是平台管理员
                //获取用户权限
                var groupAuthList = GroupAuthorityBll.GetGroupAuthorityList(UserContext.CurrentUser.GId);
                if (groupAuthList != null && groupAuthList.Any())
                {
                    //获取所有菜单
                    var menuList   = MenuBll.GetMenus();
                    var parentList = menuList.Where(m => m.Pid == 0);
                    foreach (var menu in parentList)
                    {
                        //获取所有的子菜单
                        var kidList = menuList.Where(m => m.Pid == menu.Id);
                        if (kidList == null || !kidList.Any())
                        {
                            continue;
                        }
                        foreach (var auth in groupAuthList)
                        {
                            if (kidList.FirstOrDefault(m => m.Id == auth.MenuId) != null)
                            {
                                if (topMenuList.FirstOrDefault(m => m.Id == menu.Id) == null)
                                {
                                    topMenuList.Add(menu);
                                }
                            }
                        }
                    }
                    if (topMenuList.Any())
                    {
                        var first   = topMenuList[0];
                        var kidList = menuList.Where(m => m.Pid == first.Id);
                        foreach (var auth in groupAuthList)
                        {
                            var menu = kidList.FirstOrDefault(m => m.Id == auth.MenuId);
                            if (menu != null && !leftMenuList.Exists(m => m.Id == menu.Id))
                            {
                                leftMenuList.Add(menu);
                            }
                        }
                    }
                }

                ViewBag.User        = UserContext.CurrentUser;
                ViewBag.KidMenuList = leftMenuList;
            }


            ViewBag.PosEnabledMenus = string.Join(",", PosDefineBll.GetEnabledMenus().ToArray());
            return(View(topMenuList));
        }
        public string GetList()
        {
            var models = PosDefineBll.GetList(UserContext.CurrentUser.HotelId);

            return(JsonConvert.SerializeObject(models));
        }