Exemple #1
0
 //emp是否有权下载此文档
 public Boolean ifEmpCanDownlaodThisDoc(int empNumber, int docid)
 {
     DocumentModel tempDocModel = new BLLDocument().getDocumentById(docid);
     UserEmployeeModel empModel = new BLLUserAccount().GetUserByEmpNumber(empNumber);
     BLLUserAccount bllAccount = new BLLUserAccount();
     if (tempDocModel.PublisherNumber.Equals(empNumber))
     {
         return true;
     }
     else
     {
         switch (tempDocModel.AuthLevel)
         {
             //所有人都能看和下载
             case 1:
                 return true;
             //外部的人不能下载
             case 2:
             //外部的人不能看,也不能下载
             case 3:
                 if (empModel.DepartmentId.Equals(bllAccount.GetUserByEmpNumber(tempDocModel.PublisherNumber).DepartmentId))
                 {
                     return true;
                 }
                 return false;
             //外部的人不能看,也不能下载,内部人只能看不能下载
             case 4:
                 return false;
         }
     }
     return false;
 }
Exemple #2
0
 public ActionResult addFavorite(int docid,string returnURL)
 {
     string employeeNumber = User.Identity.Name;
     UserEmployeeModel empModel = new BLLUserAccount().GetUserByEmpNumber(Convert.ToInt32(employeeNumber));
     //这里要先判断是否已经收藏过
     if (new BLLFavorite().isFavorite(Convert.ToInt32(employeeNumber),docid))
     {
         TempData["errorMsg"] = "您已经收藏过此文档了。";
         return RedirectToAction(returnURL, "User");
     }
     BLLDocument bllDocument = new BLLDocument();
     DocumentModel docModel = bllDocument.getDocumentById(docid);
     if (employeeNumber == "" || docModel == null )
     {
         TempData["errorMsg"] = "您无权进行添加收藏操作,请重新登录。";
         return RedirectToAction(returnURL, "User");
     }
     if (docModel.PublisherNumber == Convert.ToInt32(employeeNumber))
     {
         TempData["errorMsg"] = "您不能收藏自己发布的文档。";
         return RedirectToAction(returnURL, "User");
     }
     BLLFavorite bllFavorite = new BLLFavorite();
     if (bllFavorite.addToMyFavorite(Convert.ToInt32(employeeNumber), docid))
     {
         TempData["successMsg"] = "添加成功。";
     }
     else
     {
         TempData["errorMsg"] = "添加失败。";
     }
     return RedirectToAction(returnURL, "User");
 }
    public void SaveDocument()
    {
        try
        {
            ATTDocument Doc = new ATTDocument();
            Doc.OrgID = int.Parse(drpOrganisation_rqd.SelectedValue);

            if (this.drpOrganisation_rqd.SelectedIndex > 0)
            {
                Doc.UnitID = int.Parse(drpUnit_rqd.SelectedValue);
            }

            Doc.DocFlowType    = int.Parse(drpFlowType_rqd.SelectedValue);
            Doc.DocumentName   = txtDocName_rqd.Text;
            Doc.DocCategory    = int.Parse(drpDocCategory_rqd.SelectedValue);
            Doc.DocDescription = txtDocDesc.Text;

            ObjectValidation OV = BLLDocument.ValidateDocument(Doc);

            if (OV.IsValid == false)
            {
                this.lblStatus.Text = OV.ErrorMessage;
                return;
            }

            if (Session["LstDocAttachment"] != null)
            {
                Doc.LstDocAttachment = (List <ATTDocumentAttachment>)Session["LstDocAttachment"];
            }

            if (Session["LstDocProcess"] != null)
            {
                Doc.LstDocProcess = (List <ATTDocumentProcess>)Session["LstDocProcess"];
            }

            if (BLLDocument.SaveDocument(Doc))
            {
                this.lblStatus.Text = " Document Added Successfully !!!! ";

                this.gvFiles.DataSource = null;
                this.gvFiles.DataBind();

                this.grdDocProcess.DataSource = null;
                this.grdDocProcess.DataBind();

                Session["LstDocAttachment"] = null;
                Session["LstDocProcess"]    = null;

                ScriptManager.RegisterStartupScript(this, this.GetType(), "ClearForm", "javascript:clearForm();", true);

                drpUnit_rqd.Enabled = false;
            }
        }
        catch (Exception ex)
        {
            lblStatus.Text = ex.Message;
        }
    }
Exemple #4
0
 public ActionResult Index()
 {
     List<DocumentModel> viewdocList = new BLLDocument().getTopTenDocumentByViewNumber();
     ViewData["viewTop10Doc"] = viewdocList;
     List<DocumentModel> dldocList = new BLLDocument().getTopTenDocumentByDownloadNumber();
     ViewData["dlTop10Doc"] = dldocList;
     List<TagModel> tagModel = new BLLTag().getTop50TagModelList();
     ViewData["tagModel"] = tagModel;
     BLLFolder bllFolder = new BLLFolder();
     List<FolderModel> folders = (List<FolderModel>)bllFolder.GetAllFolders();
     ViewData["folders"] = folders;
     return View();
 }
 public ActionResult Detail(int docid)
 {
     BLLDocument bllDocument = new BLLDocument();
     DocumentModel docModel = bllDocument.getDocumentById(docid);
     ViewData["docModel"] = docModel;
     List<DocumentModel> viewdocList = bllDocument.getTopTenDocumentByViewNumber();
     ViewData["viewTop10Doc"] = viewdocList;
     List<DocumentModel> dldocList = bllDocument.getTopTenDocumentByDownloadNumber();
     ViewData["dlTop10Doc"] = dldocList;
     ViewData["canIDownload"] = new BLLAuth().ifEmpCanDownlaodThisDoc(Convert.ToInt32(User.Identity.Name), docid);
     bllDocument.ViewNumberIncrement(docid);
     return View();
 }
 //删除单个文档
 public ActionResult Delete(int docid)
 {
     Boolean result = new BLLDocument().deleteDocumentById(docid);
     if (result)
     {
         TempData["successMsg"] = "删除成功!";
         return RedirectToAction("Index", "Document");
     }
     else
     {
         TempData["errorMsg"] = "删除失败!";
         return RedirectToAction("Index", "Document");
     }
 }
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        try
        {
            int?OrgID  = null;
            int?UnitID = null;
            int?DocID  = null;

            string DocName  = "";
            string StatusID = "";

            if (drpOrganisation.SelectedIndex > 0)
            {
                OrgID = int.Parse(drpOrganisation.SelectedValue.ToString());
            }

            if (drpUnit.SelectedIndex > 0)
            {
                UnitID = int.Parse(drpUnit.SelectedValue.ToString());
            }

            if (drpDocName.SelectedIndex > 0)
            {
                DocID   = int.Parse(drpDocName.SelectedValue.ToString());
                DocName = drpDocName.SelectedItem.ToString();
            }

            //if (drpDocStatus.SelectedIndex > 0)
            //    StatusID = drpDocStatus.SelectedValue.ToString();

            StatusID = "";

            //if(Session["Flag"] == null)
            Session["DocSearchResultList"] = BLLDocument.SearchDocumentList(OrgID, UnitID, DocID, DocName, StatusID);

            if (Session["DocSearchResultList"] != null)
            {
                this.grdDocSearchResult.DataSource = (List <ATTDocument>)Session["DocSearchResultList"];
                this.grdDocSearchResult.DataBind();

                //Session["Flag"] = null;
            }
        }
        catch (Exception ex)
        {
            lblStatus.Text = ex.Message;
        }
    }
    public void finalUpdate()
    {
        try
        {
            foreach (ATTDocument item in (List <ATTDocument>)Session["lstRqdDocDetail"])
            {
                if (drpUnit_rqd.SelectedIndex > 0)
                {
                    item.UnitID = int.Parse(drpUnit_rqd.SelectedValue);
                }

                item.DocFlowType     = int.Parse(drpFlowType_rqd.SelectedValue);
                item.DocFlowTypeName = drpFlowType_rqd.SelectedItem.ToString();
                item.DocCategory     = int.Parse(drpDocCategory_rqd.SelectedValue);
                item.DocCategoryName = drpDocCategory_rqd.SelectedItem.ToString();
                item.DocumentName    = txtDocName_rqd.Text;
                item.DocDescription  = txtDocDescription.Text;

                if (Session["lstDocUpdAttachment"] != null)
                {
                    item.LstDocAttachment = (List <ATTDocumentAttachment>)Session["lstDocUpdAttachment"];
                }

                if (Session["lstDocUpdProcess"] != null)
                {
                    item.LstDocProcess = (List <ATTDocumentProcess>)Session["lstDocUpdProcess"];
                }

                if (BLLDocument.UpdateDocument(item))
                {
                    //BLLDocument.UpdateDocument(item);
                    //this.lblStatus.Text = " Document Updated Successfully !!!! ";
                    Session["Flag"] = 1;
                    Response.Redirect("OASSearch.aspx");
                }
            }
        }
        catch (Exception ex)
        {
            lblStatus.Text = ex.Message;
        }
    }
    public void LoadDocName()
    {
        try
        {
            Session["DocSearchDocNameList"] = BLLDocument.GetDocumentNameList(null, null, null);
            this.drpDocName.DataSource      = (List <ATTDocument>)Session["DocSearchDocNameList"];
            this.drpDocName.DataTextField   = "DocumentName";
            this.drpDocName.DataValueField  = "DocID";
            this.drpDocName.DataBind();

            ListItem a = new ListItem();
            a.Selected = true;
            a.Text     = "Select Document";
            a.Value    = "0";
            drpDocName.Items.Insert(0, a);
        }
        catch (Exception ex)
        {
            this.lblStatus.Text = ex.Message;
        }
    }
 public ActionResult Delete(int docid, string returnURL)
 {
     //先要判断当前用户是否有权限删除这篇文档
     string employeeNumber = User.Identity.Name;
     BLLDocument bllDocument = new BLLDocument();
     DocumentModel docModel = bllDocument.getDocumentById(docid);
     UserEmployeeModel empModel = new BLLUserAccount().GetUserByEmpNumber(Convert.ToInt32(employeeNumber));
     //如果是审核者,则直接删除
     if (empModel != null && empModel.IsChecker.Equals(true) && docModel.CheckerNumber.Equals(Convert.ToInt32(employeeNumber)))
     {
         if (bllDocument.deleteDocumentById(docid))
         {
             TempData["successMsg"] = "删除成功。";
         }
         else
         {
             TempData["errorMsg"] = "删除失败。";
         }
         return RedirectToAction(returnURL, "User");
     }
     //如果不是审核者,也不是这篇文档的发布者,删除失败
     if (employeeNumber == "" || docModel == null || docModel.PublisherNumber != Convert.ToInt32(employeeNumber))
     {
         TempData["errorMsg"] = "您无权删除此文件,请重新登录。";
         return RedirectToAction(returnURL, "User");
     }
     //如果不是审核者,也是这篇文档的发布者,则删除
     if (bllDocument.deleteDocumentById(docid))
     {
         TempData["successMsg"] = "删除成功。";
     }
     else
     {
         TempData["errorMsg"] = "删除失败。";
     }
     return RedirectToAction(returnURL, "User");
 }
Exemple #11
0
 public ActionResult CheckedByMe()
 {
     int employeeNumber = Convert.ToInt32(User.Identity.Name);
     UserEmployeeModel empModel = new BLLUserAccount().GetUserByEmpNumber(employeeNumber);
     ViewData["empModel"] = empModel;
     BLLDocument bllDocument = new BLLDocument();
     UserEmployeeModel userEmployeeModel = new BLLUserAccount().GetUserByEmpNumber(employeeNumber);
     if (userEmployeeModel.IsChecker.Equals(false))
     {
         //非审核员
         return RedirectToAction("Index", "Index");
     }
     List<DocumentModel> docList = new List<DocumentModel>();
     docList = new BLLDocument().getHaveCheckedDocByCheckerNumber(employeeNumber);
     if (docList.Count == 0)
     {
         ViewData["docList"] = "nodata";
     }
     else
     {
         ViewData["docList"] = docList;
     }
     return View();
 }
    public void LoadOrganisation()
    {
        try
        {
            Session["DocSearchOrgList"]         = BLLOrganization.GetOrganizationNameList();
            this.drpOrganisation.DataSource     = (List <ATTOrganization>)Session["DocSearchOrgList"];
            this.drpOrganisation.DataTextField  = "OrgName";
            this.drpOrganisation.DataValueField = "OrgId";
            this.drpOrganisation.DataBind();

            ListItem a = new ListItem();
            a.Selected = true;
            a.Text     = "Select Organisation";
            a.Value    = "0";
            drpOrganisation.Items.Insert(0, a);

            Session["DocSearchUnitList"]    = BLLOrganizationUnit.GetOrganizationUnits(null, null);
            Session["DocSearchDocNameList"] = BLLDocument.GetDocumentNameList(null, null, null);
        }
        catch (Exception ex)
        {
            lblStatus.Text = ex.Message;
        }
    }
        public void getFile(int docid)
        {
            BLLDocument bllDocument = new BLLDocument();
            bllDocument.DownloadNumberIncrement(docid);
            string FileDownloadName = bllDocument.getDocumentById(docid).FileDiskName;
            string FileFolderPath = new BLLFolder().GetFolderById(bllDocument.getDocumentById(docid).FolderId).PhysicalPath;
            HttpContext.Response.AddHeader("content-disposition",
                "attachment; filename=" + FileDownloadName);

            string filePath = REPO_ROOT + FileFolderPath + "\\" + FileDownloadName;
            HttpContext.Response.TransmitFile(filePath);
        }
 public ActionResult Index()
 {
     List<DocumentModel> docList = new BLLDocument().getAllDocOrderByPubtime();
     ViewData["docList"] = docList;
     return View();
 }
Exemple #15
0
 public ActionResult DeleteFavorite(int docid)
 {
     string employeeNumber = User.Identity.Name;
     UserEmployeeModel empModel = new BLLUserAccount().GetUserByEmpNumber(Convert.ToInt32(employeeNumber));
     ViewData["empModel"] = empModel;
     BLLDocument bllDocument = new BLLDocument();
     DocumentModel docModel = bllDocument.getDocumentById(docid);
     if (employeeNumber == "" || docModel == null || docModel.PublisherNumber != Convert.ToInt32(employeeNumber))
     {
         TempData["errorMsg"] = "您无权进行删除操作,请重新登录。";
         return RedirectToAction("MyFavorite", "User");
     }
     BLLFavorite bllFavorite = new BLLFavorite();
     if (bllFavorite.deleteMyFavorite(Convert.ToInt32(employeeNumber),docid))
     {
         TempData["successMsg"] = "删除成功。";
     }
     else
     {
         TempData["errorMsg"] = "删除失败。";
     }
     return RedirectToAction("MyFavorite", "User");
 }
Exemple #16
0
        public ActionResult Workshop()
        {
            string empno = User.Identity.Name;
            List<DocumentModel> docList = new List<DocumentModel>();
            int employeeNumber = Convert.ToInt32(empno);
            UserEmployeeModel empModel = new BLLUserAccount().GetUserByEmpNumber(employeeNumber);
            ViewData["empModel"] = empModel;
            docList = new BLLDocument().getMyCheckedDocList(employeeNumber);
            if (docList.Count == 0)
            {
                ViewData["docList"] = "nodata";
            }
            else
            {
                ViewData["docList"] = docList;
            }

            return View();
        }
 public ActionResult doCheck(int docid, string returnURL)
 {
     //先要判断当前用户是否有权设置这篇文档
     string employeeNumber = User.Identity.Name;
     BLLDocument bllDocument = new BLLDocument();
     DocumentModel docModel = bllDocument.getDocumentById(docid);
     UserEmployeeModel empModel = new BLLUserAccount().GetUserByEmpNumber(Convert.ToInt32(employeeNumber));
     //如果不是审核者,则返回错误
     if (empModel == null || empModel.IsChecker.Equals(false))
     {
         TempData["errorMsg"] = "您无权操作此文件,请重新登录。";
         return RedirectToAction(returnURL, "User");
     }
     //如果是审核者,可以操作
     if (bllDocument.setDocCheckedById(docid, Convert.ToInt32(employeeNumber)))
     {
         TempData["successMsg"] = "操作成功。";
     }
     else
     {
         TempData["errorMsg"] = "操作失败。";
     }
     return RedirectToAction(returnURL, "User");
 }
 public JsonResult GetFolderList(int folderId, int page)
 {
     BLLDocument bllDocument = new BLLDocument();
     List<DocumentModel> documents = bllDocument.getDocByFolderId(Convert.ToInt32(User.Identity.Name), folderId, page);
     return Json(documents);
 }
 //编辑单个文档
 public ActionResult Edit(int docid)
 {
     DocumentModel docModel = new BLLDocument().getDocumentById(docid);
     ViewData["docModel"] = docModel;
     return View();
 }
 //根据标签得到doc
 public ActionResult getDocByTagId(int tagid)
 {
     //带权限过滤的
     UserEmployeeDetailModel empDetailModel = new BLLUserAccount().GetUserDetailByEmpNumber(Convert.ToInt32(User.Identity.Name));
     List<DocumentModel> docList = new BLLDocument().getDocByTagId(empDetailModel.EmployeeNumber,tagid);
     ViewData["empDetailModel"] = empDetailModel;
     if (docList.Count == 0)
     {
         ViewData["docList"] = "nodata";
     }
     else
     {
         ViewData["docList"] = docList;
     }
     return View();
 }
        //显示某人的所有发布的文档
        public ActionResult GetDocByEmpployeeNumber(int empno)
        {
            //带权限过滤的
            List<DocumentModel> docList = new BLLDocument().GetDocByEmpployeeNumber(empno);
            UserEmployeeDetailModel empDetailModel = new BLLUserAccount().GetUserDetailByEmpNumber(empno);
            ViewData["empDetailModel"] = empDetailModel;
            if (docList.Count == 0)
            {
                ViewData["docList"] = "nodata";
            }
            else
            {
                ViewData["docList"] = docList;
            }

            return View();
        }
 public JsonResult FileDetail(DocumentModel document,  string tags)
 {
     string[] tagArr = null;
     if (tags != "")
     {
         tagArr = tags.Split(new string[] { " ", " " }, StringSplitOptions.RemoveEmptyEntries);
     }
     BLLDocument bllDoc = new BLLDocument();
     if (User.Identity.Name != null)
     {
         return Json(bllDoc.AddDocument(document, tagArr, Convert.ToInt32(User.Identity.Name)));
     }
     return Json(false);
 }
 public ActionResult Edit(int docid,string returnURL)
 {
     //先要判断当前用户是否有权限编辑这篇文档(是不是发布者)
     string employeeNumber = User.Identity.Name;
     DocumentModel docModel = new BLLDocument().getDocumentById(docid);
     if (employeeNumber == "" || docModel == null || docModel.PublisherNumber != Convert.ToInt32(employeeNumber))
     {
         TempData["errorMsg"] = "您无权编辑此文件,请重新登录。";
         return RedirectToAction(returnURL, "User");
     }
     ViewData["docModel"] = docModel;
     return View();
 }
        public void getFilePath(string FileDownloadName)
        {
            BLLDocument bllDocument = new BLLDocument();
            int docid = bllDocument.getDocumentByFileDiskName(FileDownloadName).Id;
            string folderPath = new BLLFolder().GetFolderById(bllDocument.getDocumentById(docid).FolderId).PhysicalPath;
            string fileType = FileDownloadName.Split('.')[1];
            string filePath = "";
            HttpContext.Response.AddHeader("content-disposition",
                "attachment; filename=" + FileDownloadName);

            if (fileType.Equals("flv"))
            {
                filePath = REPO_ROOT + folderPath + "\\" + FileDownloadName;
            }
            else {
                //filePath = "C:\\Users\\Margaret\\Documents\\Visual Studio 2010\\Projects\\GeekInsideKMS\\Index\\swf\\" + FileDownloadName.Split('.')[0] + ".swf";
                filePath = REPO_ROOT + "swf\\" + FileDownloadName.Split('.')[0] + ".swf";
            }

            HttpContext.Response.TransmitFile(filePath);
        }
 public void CancelFileUploaded(string id, string fileName)
 {
     BLLDocument bllDoc = new BLLDocument();
     bllDoc.DeleteTempFile(id, fileName);
 }