Пример #1
0
        /// <summary>
        /// 选择发送用户
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public PartialViewResult SelectUser(int id)
        {
            ZC_RoleController zc_role = new ZC_RoleController();

            //查询接收文件的用户
            string selected_users = zc_role.GenerateStringFromList(db.T_NB_File.Find(id).ReceiveUsers.Where(p => p.IsValid == true).ToList());
            ViewBag.selected_users = selected_users;

            var select_user = new VM_SelectUser();
            select_user.Users = db.T_ZC_User.Where(p => p.IsValid == true).ToList();
            select_user.Departments = db.T_ZC_Department.Where(p => p.IsValid == true).ToList();

            ViewBag.FileId = id;
            return PartialView(select_user);
        }
Пример #2
0
        public ActionResult DownFile(int id,int parentId)
        {
            ZC_RoleController zc_role = new ZC_RoleController();

            string selected_users = zc_role.GenerateStringFromList(db.T_NB_File.Find(parentId).ReceiveUsers.Where(p => p.IsValid == true).ToList());
            if (selected_users.IndexOf(CurrentUser().ID.ToString()) > 0)
            {
                var nb_file = db.T_NB_File.Find(id);
                var filePath = "";
                if (nb_file.FileUrl != null)
                {
                    string locaUrl = ConfigurationSettings.AppSettings["Url"];
                    filePath = locaUrl + nb_file.FileUrl;
                }

                return File(filePath, "application/msword", nb_file.FileName != null ? nb_file.FileName : nb_file.Title);
            }
            else
            {
                return ReturnJson(false, "无权限下载", "", "FileInfoBox", false, "");
            }
        }