예제 #1
0
 public CallbackResult CallBack_JsonTag_82729_11()
 {
     /*orderby=时间&desc=false&pagesize=3&fields=title,时间,time,desc,img,id*/
     string jsonname = this.CallValue("jsonname");
     if (jsonname != "JsonTag_82729_11")
     {
         return null;
     }
     var list = from a in Db_Context.Article.Where(x => x.IsLock != true)
                 select new
                 {
                     a.Title,
                     a.Time,
                     a.Desc,
                     a.Img,
                     a.ID
                 };
     int __page = 0;
     int.TryParse(this.CallValue("page"), out __page);
     __page = __page < 1 ? 1 : __page;
     int totalsize = list.Count();
     list = list.OrderBy(c=>c.Time).Skip((__page - 1) * 3).Take(3);
     dynamic json = new ExpandoObject();
     json.jsonname = "JsonTag_82729_11";
     json.tagstr = "orderby=时间&desc=false&pagesize=3&fields=title,时间,time,desc,img,id";
     json.skip = (__page - 1) * 3;
     json.pagesize = 3;
     json.listsize = totalsize;
     json.page = __page;
     json.over = list.Count() < 3;
     json.data = list;
     CallbackResult call = new CallbackResult(json) ;
     call.type = "jsoncall";
     return call;
 }
예제 #2
0
파일: TagPage.cs 프로젝트: ichynul/vowstag
 /// <summary>
 /// ���ڻ�ȡһ��tag���÷������callack������
 /// </summary>
 /// <returns>CallbackResult</returns>
 public string GetCallbackResult()
 {
     CallbackResult call = TagCallback();
     if (call == null)
     {
         call = BeforDoCallback();
         if (call != null)
         {
             call.type = "mycall";
         }
     }
     if (call == null)
     {
         try
         {
             call = DoCallback();
             if (call != null)
             {
                 call.type = "mycall";
             }
             else
             {
                 call = new CallbackResult(new
                 {
                     code = "1",
                     msg = string.Concat("��������յ���", this._callBackstr,
                     "����Ҫ��������󣬷���˴������踲��(override)���� public CallbackResult DoCallback"),
                     type = "none"
                 });
             }
         }
         catch (Exception ex)
         {
             call = new CallbackResult(new { code = "1", msg = "�����ˣ�-" + ex.Message });
             call.type = "error";
             CallbackException(ex);
         }
     }
     if (call != null)
     {
         if (call.type != "error")
         {
             call.callstr = this._callBackstr;
         }
         call.action = action;
         call.pageName = this.GetType().BaseType.BaseType.Name;
     }
     return tools.JsonSerialize(call);
 }
예제 #3
0
 public CallbackResult CallBack_JsonTag_85711_12()
 {
     /*orderby=time&pagesize=3&fields=title,time,desc,img,id&categ=call.cid*/
     string jsonname = this.CallValue("jsonname");
     if (jsonname != "JsonTag_85711_12")
     {
         return null;
     }
     int int_cid = int.MinValue;
     int.TryParse("" + CallString["cid"],out int_cid);
     var list = from a in Db_Context.Article.Where(x => x.IsLock != true)
             .Where( b=>
                  b.Categ == int_cid
                 )
                 select new
                 {
                     a.Title,
                     a.Time,
                     a.Desc,
                     a.Img,
                     a.ID
                 };
     int __page = 0;
     int.TryParse(this.CallValue("page"), out __page);
     __page = __page < 1 ? 1 : __page;
     int totalsize = list.Count();
     list = list.OrderByDescending(c=>c.Time).Skip((__page - 1) * 3).Take(3);
     dynamic json = new ExpandoObject();
     json.jsonname = "JsonTag_85711_12";
     json.tagstr = "orderby=time&pagesize=3&fields=title,time,desc,img,id&categ=call.cid";
     json.skip = (__page - 1) * 3;
     json.pagesize = 3;
     json.listsize = totalsize;
     json.page = __page;
     json.over = list.Count() < 3;
     json.data = list;
     CallbackResult call = new CallbackResult(json) ;
     call.type = "jsoncall";
     return call;
 }
예제 #4
0
    public CallbackResult CallBack_FormTag_65200_9()
    {
        /*id=request.id&allowempty=author,view&action=edit*/
        string formname = this.CallValue("formname");
        if (formname != "FormTag_65200_9")
        {
            return null;
        }
        dynamic error = new ExpandoObject();
        error.formname = formname;
        CallbackResult call = new CallbackResult(error) ;
        call.type = "formcall";
        Article _article = null ;
        long long_id = long.MinValue;
        long.TryParse("" + Request.QueryString["id"],out long_id);

        _article = Db_Context.Article.Where(x => x.IsLock != true).FirstOrDefault( b=>
                     b.ID == long_id
                    );
        if (_article == null)
        {
            /*编辑模式(action = edit),未找到记录则返回*/;
            error.code = 3;
            error.msg = "操作失败:not found!";
            error.dom = "";
            return call;
        }
        string _Title = this.CallValue("Title");
        if (string.IsNullOrEmpty(_Title))
        {
            error.code = 1;
            error.msg = "不能为空!";
            error.dom = "Title";
            return call;
        }
        _article.Title = _Title;
        string _Author = this.CallValue("Author");
        _article.Author = _Author;
        string _Time = this.CallValue("Time");
        DateTime __Time = DateTime.Now;
        if (DateTime.TryParse(_Time,out __Time))
        {
            _article.Time = __Time ;
        }
        else
        {
            if (string.IsNullOrEmpty(_Time))
            {
                error.code = 1;
                error.msg = "不能为空!";
                error.dom = "Time";
                return call;
            }
            else
            {
                error.code = 2;
                error.msg = "请输入正确的时间";
                error.dom = "Time";
                return call;
            }
        }
        string _View = this.CallValue("View");
        int __View = 0 ;
        if (int.TryParse(_View,out __View))
        {
            _article.View = __View ;
        }
        string _Content = this.CallValue("Content");
        if (string.IsNullOrEmpty(_Content))
        {
            error.code = 1;
            error.msg = "不能为空!";
            error.dom = "Content";
            return call;
        }
        _article.Content = _Content;
        //
        Db_Context.SaveChanges();
        error.code = 0;
        error.msg = "操作成功!";
        error.dom = "";
        return call;
    }