Пример #1
0
        public string GetUsers()
        {
            BllMonitor mo = new BllMonitor();
            List <Dictionary <string, string> > list = mo.GetUserZTree();

            for (int i = 0; i < list.Count; i++)
            {
                Dictionary <string, string> dic = list[i];
            }
            StringBuilder sbStr = new StringBuilder();

            sbStr.Append("[");
            foreach (Dictionary <string, string> item in list)
            {
                sbStr.Append("{id:\"" + item["_id"] + "\",pId:\"" + (item["parent"] == "" ? "0" : item["parent"]) + "\",name:\"" + (item["username"] == "" ? item["_id"] : item["username"]) + "\"},");
            }
            sbStr.Remove(sbStr.Length - 1, 1);
            sbStr.Append("]");
            //  [{ id:"captain",  pId:"0",      name:"东莞美谷电子科技"},
            //   { id:"test",     pId:"captain",name:"测试账号"},
            //   { id:"dongguan", pId:"test",   name:"东莞3"},
            //   { id:"jupiter",  pId:"captain",name:"jupiter"}]
            string json = Utils.ToJson(list);

            return(json);
        }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         BllMonitor mo = new BllMonitor();
         zTree = mo.GetUserZTree();
     }
     catch {   }
     try
     {
         if (Request.Files.Count > 0)
         {
             HttpPostedFile File = Request.Files[0];
             if (File.ContentLength > 2097152)
             {
                 Response.Write("{\"success\":\"false\"}");
             }
             String filepath = HttpContext.Current.Server.MapPath("~") + @"Upload\";
             if (!Directory.Exists(filepath))
             {
                 Directory.CreateDirectory(filepath);
             }
             String fileName = DateTime.Now.ToString("yyMMddhhmmss") + ".png";
             File.SaveAs(filepath + fileName);
             Response.Write(new Utils().GetThumbnail(filepath + fileName, filepath + "MG-" + fileName, 130, 140, "MG-" + fileName));
         }
     }
     catch
     {
         Response.Write("{\"success\":\"false\"}");
     }
     finally
     {
         if (Request.Files.Count > 0)
         {
             Response.End();
         }
     }
 }