Пример #1
0
        public JsonResult ApplyFileBorrow(string files, string SpaceID)
        {
            var space = DocConfigHelper.CreateConfigSpaceByID(SpaceID);

            if (space == null)
            {
                throw new Formula.Exceptions.BusinessException("为找到【ID】为【" + SpaceID + "】的图档实例库");
            }
            var list = JsonHelper.ToList(files);

            foreach (var file in list)
            {
                S_FileInfo fileInfo = new S_FileInfo(file.GetValue("ID"), space);
                if (fileInfo == null)
                {
                    continue;
                }
                if (fileInfo.ConfigInfo == null)
                {
                    throw new Formula.Exceptions.BusinessException("未能找到文件【" + fileInfo.ID + "】的配置对象信息");
                }
                if (fileInfo.DataEntity.GetValue("StorageType") != StorageType.Physical.ToString())
                {
                    throw new Formula.Exceptions.BusinessException("电子版文件不能借阅!");
                }
                CarFO.CreateCarItem(fileInfo, ItemType.Borrow.ToString());
            }
            this.entities.SaveChanges();
            return(Json(new { }));
        }
Пример #2
0
        public JsonResult ApplyReDownload()
        {
            string fileID  = this.GetQueryString("files");
            string SpaceID = this.GetQueryString("SpaceID");
            var    space   = DocConfigHelper.CreateConfigSpaceByID(SpaceID);

            if (space == null)
            {
                throw new Formula.Exceptions.BusinessException("为找到【ID】为【" + SpaceID + "】的图档实例库");
            }
            S_FileInfo fileInfo = new S_FileInfo(fileID, space);

            if (fileInfo.ConfigInfo == null)
            {
                throw new Formula.Exceptions.BusinessException("未能找到文件【" + fileInfo.ID + "】的配置对象信息");
            }
            if (fileInfo.CurrentAttachment == null)
            {
                throw new Formula.Exceptions.BusinessException("附件不存在");
            }
            if (fileInfo.DataEntity.GetValue("StorageType") != StorageType.Electronic.ToString())
            {
                throw new Formula.Exceptions.BusinessException("实物文件不能下载!");
            }
            CarFO.CreateCarItem(fileInfo, ItemType.DownLoad.ToString());
            this.entities.SaveChanges();
            return(Json(new { }));
        }
Пример #3
0
        public JsonResult ApplyFileDownload(string files, string SpaceID)
        {
            ArrayList dirDownloads = new ArrayList();
            var       space        = DocConfigHelper.CreateConfigSpaceByID(SpaceID);

            if (space == null)
            {
                throw new Formula.Exceptions.BusinessException("为找到【ID】为【" + SpaceID + "】的图档实例库");
            }
            var list        = JsonHelper.ToList(files);
            var ArchiveType = System.Configuration.ConfigurationManager.AppSettings["ArchiveType"];

            if (string.IsNullOrEmpty(ArchiveType))
            {
                ArchiveType = "PdfFile";
            }
            ArchiveType = ArchiveType.Replace("PdfFile", "PDFFile");
            foreach (var file in list)
            {
                S_FileInfo fileInfo = new S_FileInfo(file.GetValue("ID"), space);
                if (fileInfo.ConfigInfo == null)
                {
                    throw new Formula.Exceptions.BusinessException("未能找到文件【" + fileInfo.ID + "】的配置对象信息");
                }
                if (fileInfo.DataEntity.GetValue("StorageType") != StorageType.Electronic.ToString())
                {
                    throw new Formula.Exceptions.BusinessException("实物文件不能下载!");
                }
                if (fileInfo.CurrentAttachment == null)
                {
                    throw new Formula.Exceptions.BusinessException("【" + fileInfo.Name + "】还没有主文件,不能下载!");
                }
                if (String.IsNullOrEmpty(fileInfo.ConfigInfo.DownloadFlowKey))
                {
                    dirDownloads.Add(fileInfo.CurrentAttachment.DataEntity);
                    var           entities = FormulaHelper.GetEntities <DocConstEntities>();
                    var           user     = FormulaHelper.GetUserInfo();
                    S_DocumentLog log      = entities.S_DocumentLog.Create();
                    log.ID             = FormulaHelper.CreateGuid();
                    log.LogType        = "DownLoad";
                    log.Name           = fileInfo.Name;
                    log.NodeID         = fileInfo.NodeID;
                    log.SpaceID        = fileInfo.Space.ID;
                    log.ConfigID       = fileInfo.ConfigInfo.ID;
                    log.CreateDate     = DateTime.Now;
                    log.CreateUserID   = user.UserID;
                    log.CreateUserName = user.UserName;
                    log.FileID         = fileInfo.ID;
                    log.FullNodeID     = fileInfo.FullNodeID;
                    entities.S_DocumentLog.Add(log);
                }
                else
                {
                    CarFO.CreateCarItem(fileInfo, ItemType.DownLoad.ToString());
                }
            }
            this.entities.SaveChanges();
            return(Json(dirDownloads));
        }
Пример #4
0
 public ActionResult AdvanceQueryList()
 {
     ViewBag.Lists = GetQueryString("List");
     //购物车数量
     //var carCount = constSqlHelper.ExecuteScalar(string.Format("select count(1) from S_CarInfo where CreateUserId='{0}' and State='New'", this.CurrentUserInfo.UserID));
     ViewBag.CarCount = CarFO.GetCarCount().ToString();
     return(View());
 }
Пример #5
0
        public JsonResult ApplyNodeBorrow(string nodes, string SpaceID)
        {
            var space = DocConfigHelper.CreateConfigSpaceByID(SpaceID);

            if (space == null)
            {
                throw new Formula.Exceptions.BusinessException("为找到【ID】为【" + SpaceID + "】的图档实例库");
            }
            var list = JsonHelper.ToList(nodes);

            foreach (var item in list)
            {
                S_NodeInfo nodeInfo = new S_NodeInfo(item.GetValue("ID"), space);
                if (nodeInfo == null)
                {
                    continue;
                }
                CarFO.CreateCarItem(nodeInfo, ItemType.Borrow.ToString());
            }
            this.entities.SaveChanges();
            return(Json(new { }));
        }
Пример #6
0
        public ActionResult Index()
        {
            SQLHelper constSqlHelper = SQLHelper.CreateSqlHelper(ConnEnum.DocConst);
            //下载车数据
            DataTable table = constSqlHelper.ExecuteDataTable(string.Format("select * from S_CarInfo with(nolock) where CreateUserId='{0}' and State='New' and Type='DownLoad'", this.CurrentUserInfo.UserID));

            ViewBag.table = JsonConvert.SerializeObject(table);
            //购物车数量
            //var carCount = constSqlHelper.ExecuteScalar(string.Format("select count(1) from S_CarInfo where CreateUserId='{0}' and State='New'", this.CurrentUserInfo.UserID));
            ViewBag.CarCount = CarFO.GetCarCount().ToString();
            //档案空间列表
            SQLHelper configSqlHelper = SQLHelper.CreateSqlHelper(ConnEnum.InfrasBaseConfig);
            DataTable spaceTable      = configSqlHelper.ExecuteDataTable("select * from S_DOC_Space  with(nolock)");

            ViewBag.spaceTable = spaceTable;
            //我的下载数量
            string myDownSql = "select count(1) from S_DownloadDetail  with(nolock) where DownloadExpireDate>='" + DateTime.Now.ToString() + "'";

            ViewBag.MyDownCount = constSqlHelper.ExecuteScalar(myDownSql);
            //我的借阅数量
            string myBorrowSql = @"select count(1) from S_BorrowDetail  with(nolock) where   BorrowState in ('Finish','" + BorrowReturnState.Borrow.ToString() + "')";

            ViewBag.MyBorrowCount = constSqlHelper.ExecuteScalar(myBorrowSql);
            //档案空间列表子项信息
            DataTable nodeConfigTable = configSqlHelper.ExecuteDataTable("select ID,Name,spaceID from S_DOC_Node  with(nolock) where AllowDisplay='true' order by SortIndex asc");

            ViewBag.nodeConfigTable = nodeConfigTable;
            //历史浏览
            DataTable userSearchHistory = UserSearchHistory();

            ViewBag.userSearchHistory = userSearchHistory;
            //档案空间添加数量
            List <DataTable> list = new List <DataTable>();

            foreach (DataRow spaceRow in spaceTable.Rows)
            {
                SQLHelper SqlHelper = new SQLHelper(@"Data Source=" + spaceRow["Server"] + ";initial Catalog=master;User ID=" + spaceRow["UserName"] + ";PassWord="******"Pwd"]);

                //判断数据库是否存在
                if ((int)SqlHelper.ExecuteScalar(" select COUNT(*) From master.dbo.sysdatabases where name='" + spaceRow["DbName"] + "'") <= 0)
                {
                    continue;
                }
                SQLHelper spaceSqlHelper = new SQLHelper(@"Data Source=" + spaceRow["Server"] + ";initial Catalog=" + spaceRow["DbName"] + ";User ID=" + spaceRow["UserName"] + ";PassWord="******"Pwd"]);
                //取总文档数 data source=10.10.1.235\sql2008;Initial Catalog=EPM_HR;User ID=sa;PWD=zxc.123
                DataTable fileCount = spaceSqlHelper.ExecuteDataTable(string.Format("select COUNT(1) spaceCount,SpaceID from S_FileInfo where SpaceID = '{0}' and State='Published' group by SpaceID ", spaceRow["ID"]));
                //spaceRow["Name"] = spaceRow["Name"] + "(" + fileCount.ToString() + ")";
                list.Add(fileCount);
            }
            ViewBag.spaceNameCount = list;
            //档案空间下的子项的数量
            List <DataTable> listChild = new List <DataTable>();

            foreach (DataRow spaceRow in spaceTable.Rows)
            {
                SQLHelper SqlHelper = new SQLHelper(@"Data Source=" + spaceRow["Server"] + ";initial Catalog=master;User ID=" + spaceRow["UserName"] + ";PassWord="******"Pwd"]);

                //判断数据库是否存在
                if ((int)SqlHelper.ExecuteScalar(" select COUNT(*) From master.dbo.sysdatabases where name='" + spaceRow["DbName"] + "'") <= 0)
                {
                    continue;
                }
                SQLHelper spaceSqlHelper = new SQLHelper(@"Data Source=" + spaceRow["Server"] + ";initial Catalog=" + spaceRow["DbName"] + ";User ID=" + spaceRow["UserName"] + ";PassWord="******"Pwd"]);


                DataTable childCount = spaceSqlHelper.ExecuteDataTable(string.Format("select COUNT(1) childCount,ConfigID,SpaceID from S_NodeInfo where State='Published' group by ConfigID,SpaceID "));

                listChild.Add(childCount);
            }
            ViewBag.childCount = listChild;
            return(View());
        }
Пример #7
0
 public JsonResult GetCarCount()
 {
     //购物车数量
     return(Json(new { carCount = CarFO.GetCarCount() }));
 }