예제 #1
0
파일: XForm.cs 프로젝트: radtek/EMIP
        public virtual JObject GetFormsInFolder(HttpContext context)
        {
            YZRequest    request = new YZRequest(context);
            string       path    = request.GetString("path", null);
            string       rsid    = String.IsNullOrEmpty(path) ? WellKnownRSID.FormRoot : StoreZoneType.Form.ToString() + "://" + path;
            BPMPermision perm    = request.GetEnum <BPMPermision>("perm");

            BPMFileInfoCollection fileInfos = new BPMFileInfoCollection();

            JObject rv = new JObject();

            rv["dataVersion"] = new JObject();
            rv["dataVersion"]["lastUpdateTime"] = DateTime.Now;

            //获得数据
            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                if (SecurityManager.CheckPermision(cn, rsid, perm))
                {
                    fileInfos = cn.GetFileInfoList(StoreZoneType.Form, path);
                }
            }

            //将数据转化为Json集合
            rv[YZJsonProperty.total] = fileInfos.Count;

            JArray children = new JArray();

            rv[YZJsonProperty.children] = children;

            foreach (BPMFileInfo fileInfo in fileInfos)
            {
                if (!FileTypeChecker.IsFormFile(fileInfo.FileName))
                {
                    continue;
                }

                string fullName = String.IsNullOrEmpty(path) ? fileInfo.FileName : path + "/" + fileInfo.FileName;

                JObject item = new JObject();
                children.Add(item);

                item["FileName"]      = fileInfo.FileName;
                item["FullName"]      = fullName;
                item["Length"]        = fileInfo.Length;
                item["CreationTime"]  = fileInfo.CreationTime;
                item["LastWriteTime"] = fileInfo.LastWriteTime;
            }

            return(rv);
        }
예제 #2
0
        public virtual JObject GetFilesInFolder(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            string    path    = request.GetString("path", null);

            BPMFileInfoCollection fileInfos;

            //获得数据
            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                fileInfos = cn.GetFileInfoList(StoreZoneType.Dll, path);
            }

            //将数据转化为Json集合
            JObject rv = new JObject();

            rv[YZJsonProperty.total] = fileInfos.Count;

            JArray children = new JArray();

            rv[YZJsonProperty.children] = children;

            foreach (BPMFileInfo fileInfo in fileInfos)
            {
                string fullName = String.IsNullOrEmpty(path) ? fileInfo.FileName : path + "/" + fileInfo.FileName;

                JObject item = new JObject();
                children.Add(item);

                item["FileName"]     = fileInfo.FileName;
                item["FullName"]     = fullName;
                item["Length"]       = fileInfo.Length;
                item["LengthString"] = fileInfo.LengthString;
            }

            return(rv);
        }