示例#1
0
        /// <summary>
        /// 绑定部门数据
        /// </summary>
        /// <returns></returns>
        private string GetSHBM()
        {
            string where = string.Empty;
            string withWhere = string.Empty;

            object[] values = new object[2];
            where    += " and SFSC=:SFSC";
            values[0] = "N";

            withWhere = " FBMBM is NULL";


            where    += " and DWBM = :DWBM ";
            values[1] = base.UserInfo.DWBM;


            XT_ZZJG_BMBM bll = new XT_ZZJG_BMBM(this.Request);
            DataSet      ds  = bll.GetTreeList(where, withWhere, values);

            if (ds != null && ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    DataTable dt = ds.Tables[0].Copy();
                    DataView  dv = dt.DefaultView;
                    dv.Sort = "DWBM asc,BMBM asc";
                    dt      = dv.ToTable();
                    return(JsonHelper.JsonString(dt));
                }
                else
                {
                    return("[]");
                }
            }

            return(ReturnString.JsonToString(Prompt.error, "获取部门列表出现错误", null));
        }
示例#2
0
        /// <summary>
        /// 绑定数据列表
        /// </summary>
        /// <returns></returns>
        private string ListBind()
        {
            string where = string.Empty;
            string withWhere = string.Empty;

            object[] values = new object[2];
            where    += " and SFSC=:SFSC";
            values[0] = "N";
            string key = Request["key"];

            if (!string.IsNullOrEmpty(key))
            {
                withWhere = " (BMMC like '%" + StringPlus.ReplaceSingle(key) + "%' or BMJC like '%" + StringPlus.ReplaceSingle(key) + "%')";
            }
            else
            {
                withWhere = " FBMBM is NULL";
            }

            if (!string.IsNullOrEmpty(Request["dkey"]) || base.UserInfo != null)
            {
                where += " and DWBM = :DWBM ";
                if (Request["dkey"] != null && !string.IsNullOrEmpty(Request["dkey"]))
                {
                    values[1] = Request["dkey"].ToString();
                }
                else
                {
                    values[1] = base.UserInfo.DWBM;
                }
            }
            else
            {
                return(ReturnString.JsonToString(Prompt.error, "查询条件不正确", null));
            }

            XT_ZZJG_BMBM bll = new XT_ZZJG_BMBM(this.Request);
            DataSet      ds  = bll.GetTreeList(where, withWhere, values);

            if (ds != null && ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    string sortname = Request.Params["sortname"];

                    string sortorder = Request.Params["sortorder"];

                    DataTable dt = ds.Tables[0].Copy();
                    DataView  dv = dt.DefaultView;
                    if (!string.IsNullOrEmpty(sortname) && !string.IsNullOrEmpty(sortorder))
                    {
                        dv.Sort = sortname + " " + sortorder;
                    }
                    else
                    {
                        dv.Sort = "DWBM asc,BMBM asc";
                    }
                    dt = dv.ToTable();
                    //数据日志
                    OperateLog.AddLog(OperateLog.LogType.部门管理Web, "获取部门列表成功", UserInfo, UserRole, this.Request);
                    return("{\"Rows\":" + JsonHelper.JsonString(dt) + "}");
                }
                else
                {
                    return("{\"Rows\":[]}");
                }
            }
            //数据日志
            OperateLog.AddLog(OperateLog.LogType.部门管理Web, "获取部门列表失败", UserInfo, UserRole, this.Request);
            return(ReturnString.JsonToString(Prompt.error, "获取部门列表出现错误", null));
        }