Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ActionResult ProjectGrid(tk_ProjectSearch ProjectSearch)
        {
            if (ModelState.IsValid)
            {
                string where = "";
                string strCurPage;
                string strRowNum;
                string ProID = ProjectSearch.ProID;
                string Pname = ProjectSearch.Pname;
                string start = ProjectSearch.StartDate;
                string end   = ProjectSearch.EndDate;

                if (Request["curpage"] != null)
                {
                    strCurPage = Request["curpage"].ToString();
                }
                if (Request["rownum"] != null)
                {
                    strRowNum = Request["rownum"].ToString();
                }
                else
                {
                    strRowNum = "10";
                }
                if (ProID != "" && ProID != null)
                {
                    where += " and a.ProID like '%" + ProID + "%'";
                }
                if (Pname != "" && Pname != null)
                {
                    where += " and a.Pname like '%" + Pname + "%'";
                }
                if (start != "" && start != null)
                {
                    where += " and a.CreateTime >= '" + start + "' and a.CreateTime <= '" + end + "'";
                }
                UIDataTable udtTask = ContractMan.getNewProjectGrid(GFun.SafeToInt32(strRowNum), GFun.SafeToInt32(Request["curpage"]) - 1, where);
                string      strjson = GFun.Dt2Json("", udtTask.DtData);
                strjson = strjson.Substring(1);
                strjson = strjson.Substring(0, strjson.Length - 1);
                string jsonData = "{ \"page\":" + GFun.SafeToInt32(Request["curpage"]) + ", \"total\": " + udtTask.IntTotalPages + ", \"records\": " + udtTask.IntRecords + ", \"rows\": ";
                jsonData += strjson + "}";
                return(Json(jsonData, JsonRequestBehavior.AllowGet));
            }
            else
            {
                //如果有错误,继续输入信息
                return(Json(new { success = false, Msg = "查询条件验证不通过" }));
            }
        }