public ActionResult SaveChangeLgForm(string keyValue, ServiceResourceEntity entity)
        {
            try
            {
                entity.Content = entity.Content == null ? "" : entity.Content.Replace("&amp;", "&").Replace("&gt;", ">").Replace("&lt;", "<");
                if (keyValue != "")
                {
                    //新增
                    var model = ServiceResourceBLL.Instance.GetEntity(keyValue);
                    if (model != null)
                    {
                        if (model.LanguageKey == entity.LanguageKey)
                        {
                            return(Error("该语言已存在"));
                        }
                    }
                    entity.ServiceResourceId = Util.Util.NewUpperGuid();
                    entity.CreateTime        = DateTime.Now;
                    ServiceResourceBLL.Instance.Add(entity);
                }

                return(Success("操作成功。"));
            }
            catch (Exception ex)
            {
                return(Error("操作失败。"));
            }
        }
Example #2
0
        public ActionResult GetDataList(string classid)
        {
            ServiceResourceEntity para = new ServiceResourceEntity();

            para.LanguageKey = CurrentLanguge.LanguageKey;
            if (!string.IsNullOrWhiteSpace(classid))
            {
                para.ClassId = classid;
            }
            var list = ServiceResourceBLL.Instance.GetList(para).OrderBy((o) => o.CreateTime).ToList();

            return(Content(list.ToJson()));
        }
        public ActionResult GetPageListJson(Pagination pagination, string queryJson)
        {
            var watch = CommonHelper.TimerStart();
            ServiceResourceEntity para = new ServiceResourceEntity();

            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 = ServiceResourceBLL.Instance.GetPageList(para, ref pagination);

            pageList.ForEach((o) =>
            {
                if (o.ClassId != null)
                {
                    var serviceClass = ServiceClassBLL.Instance.GetEntity(o.ClassId);
                    if (serviceClass != null)
                    {
                        o.ClassName = serviceClass.Title;
                    }
                }
            });
            var JsonData = new
            {
                rows     = pageList,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(Content(JsonData.ToJson()));
        }
 public ActionResult SaveForm(string keyValue, ServiceResourceEntity entity)
 {
     try
     {
         entity.Content = entity.Content == null ? "" : entity.Content.Replace("&amp;", "&").Replace("&gt;", ">").Replace("&lt;", "<");
         if (keyValue == "")
         {
             //新增
             entity.ServiceResourceId = Util.Util.NewUpperGuid();
             entity.CreateTime        = DateTime.Now;
             ServiceResourceBLL.Instance.Add(entity);
         }
         else
         {
             entity.ServiceResourceId = keyValue;
             ServiceResourceBLL.Instance.Update(entity);
         }
         return(Success("操作成功。"));
     }
     catch (Exception ex)
     {
         return(Error("操作失败。"));
     }
 }