예제 #1
0
        public ActionResult SaveChangeLgForm(string keyValue, HotelResourceEntity entity)
        {
            try
            {
                entity.Content = entity.Content == null ? "" : entity.Content.Replace("&amp;", "&").Replace("&gt;", ">").Replace("&lt;", "<");
                if (keyValue != "")
                {
                    //新增
                    var model = HotelResourceBLL.Instance.GetEntity(keyValue);
                    if (model != null)
                    {
                        if (model.LanguageKey == entity.LanguageKey)
                        {
                            return(Error("该语言已存在"));
                        }
                    }
                    entity.HotelResourceId = Util.Util.NewUpperGuid();

                    entity.CreateTime = DateTime.Now;
                    HotelResourceBLL.Instance.Add(entity);
                }

                return(Success("操作成功。"));
            }
            catch (Exception ex)
            {
                return(Error("操作失败。"));
            }
        }
예제 #2
0
        public ActionResult GetPageListJson(Pagination pagination, string queryJson)
        {
            var watch = CommonHelper.TimerStart();
            HotelResourceEntity para = new HotelResourceEntity();

            if (!string.IsNullOrWhiteSpace(queryJson))
            {
                var queryParam = queryJson.ToJObject();
                if (!queryParam["LanguageKey"].IsEmpty())
                {
                    para.LanguageKey = queryParam["LanguageKey"].ToString();
                }
                if (!queryParam["keyword"].IsEmpty())
                {
                    para.Title = queryParam["keyword"].ToString();
                }
            }
            var pageList = HotelResourceBLL.Instance.GetPageList(para, ref pagination);
            var JsonData = new
            {
                rows     = pageList,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(Content(JsonData.ToJson()));
        }
예제 #3
0
        public ActionResult SaveForm(string keyValue, HotelResourceEntity entity)
        {
            try
            {
                entity.Content = entity.Content == null ? "" : entity.Content.Replace("&amp;", "&").Replace("&gt;", ">").Replace("&lt;", "<");
                if (keyValue == "")
                {
                    //新增
                    entity.HotelResourceId = Util.Util.NewUpperGuid();

                    entity.CreateTime = DateTime.Now;
                    HotelResourceBLL.Instance.Add(entity);
                }
                else
                {
                    entity.HotelResourceId = keyValue;
                    HotelResourceBLL.Instance.Update(entity);
                }
                return(Success("操作成功。"));
            }
            catch (Exception ex)
            {
                return(Error("操作失败。"));
            }
        }
예제 #4
0
        public ActionResult GetHotelList()
        {
            HotelResourceEntity para = new HotelResourceEntity();

            para.LanguageKey = CurrentLanguge.LanguageKey;
            var list = HotelResourceBLL.Instance.GetList(para).OrderBy((o) => o.CreateTime).ToList();

            return(Content(list.ToJson()));
        }