示例#1
0
        /// <summary>
        /// 绑定树形结构为单位部门
        /// </summary>
        /// <returns></returns>
        private string GetTree()
        {
            string bm = " and lx='dw'";

            string where = string.Empty;
            object[] values = new object[2];
            string   key    = Request["key"];

            if (key != null && !string.IsNullOrEmpty(key))
            {
                where    += " and NAME like :NAME";
                values[0] = "%" + key + "%";
            }
            string id = Request["id"];

            if (id != null && !string.IsNullOrEmpty("id"))
            {
                bm        = "";
                where    += " and PARENTID=:PARENTID";
                values[1] = id;
            }
            //if (!string.IsNullOrEmpty(Request["dkey"]))
            //    where += " and DWBM in (" + Request["dkey"].ToString() + ")";
            XT_ZZJG_BMBM bll = new XT_ZZJG_BMBM(this.Request);

            DataSet ds = bll.GetOrganization(bm + where, values);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                //DataTable dt = ds.Tables[0];


                //GetTreeJsonByTable(dt, "ID", "NAME", "PARENTID", "");
                //string j = result.ToString();
                //return j.Replace("[", "").Remove(j.Length-1,1);
                return("{\"total\":0,\"rows\":" + JsonHelper.JsonString(ds.Tables[0]) + "}");
            }
            return(ReturnString.JsonToString(Prompt.error, "该单位还未设置部门", null));
        }