FileBLL.cs
上传用户:autodoor
上传日期:2022-08-04
资源大小:9973k
文件大小:7k
- using System;
- using System.ComponentModel;
- using System.Data;
- using System.Data.SqlClient;
- using System.Text;
- using System.Collections;
-
- using qminoa.Common;
- using qminoa.DA;
- namespace qminoa.BLL
- {
- public class FileBLL
- {
- public FileBLL()
- {
-
- }
- const string FOLDER="文件夹";
- public string GetFolderRight(int folderid,int empid)
- {
- FileRight fr= new FileRight();
- FileData data=fr.GetDocFolderCtr(folderid,empid,1);
- DataView dv=data.Tables[FileData.FMDOCFOLDERCTR_TABLE].DefaultView;
- dv.RowFilter="FolderId="+folderid+"and Empid="+empid;
-
- int count=dv.Count;
- if(count!=0)
- {
- bool flag=Convert.ToBoolean(dv[0].Row[4].ToString());
- if(flag==true)
- {
- return "Admin";
- }
- else
- {
- flag=Convert.ToBoolean(dv[0].Row[5].ToString());
- if(flag==true)
- {
- return "Read";
- }
- else
- {
- return "Write";
- }
- }
- }
- else
- {
- return "NoRight";
- }
- }
-
- public string GetDocRight(int docid,int empid)
- {
- FileRight fr= new FileRight();
- FileData data=fr.GetDocCtr(docid,empid,1);
- DataView dv=data.Tables[FileData.FMDOCFOLDERCTR_TABLE].DefaultView;
- dv.RowFilter="DocId="+docid+"and Empid="+empid;
- int count=dv.Count;
- if(count!=0)
- {
- bool flag=Convert.ToBoolean(dv[0].Row[4].ToString());
- if(flag==true)
- {
- return "Admin";
- }
- else
- {
- flag=Convert.ToBoolean(dv[0].Row[5].ToString());
- if(flag==true)
- {
- return "Read";
- }
- else
- {
- return "Write";
- }
- }
- }
- else
- {
- return "NoRight";
- }
- }
- public string GetDocRightForDep(int docid,int depid)
- {
- FileRight fr= new FileRight();
- FileData data=fr.GetDocCtr(docid,depid,1);
- DataView dv=data.Tables[FileData.FMDOCFOLDERCTR_TABLE].DefaultView;
- dv.RowFilter="DocId="+docid+"and DepId="+depid;
- int count=dv.Count;
- if(count!=0)
- {
- bool flag=Convert.ToBoolean(dv[0].Row[4].ToString());
- if(flag==true)
- {
- return "Admin";
- }
- else
- {
- flag=Convert.ToBoolean(dv[0].Row[5].ToString());
- if(flag==true)
- {
- return "Read";
- }
- else
- {
- return "Write";
- }
- }
- }
- else
- {
- return "NoRight";
- }
- }
- public string GetFolderRightForDep(int folderid,int depid)
- {
- FileRight fr= new FileRight();
- FileData data=fr.GetDocFolderCtr(folderid,depid,1);
- DataView dv=data.Tables[FileData.FMDOCFOLDERCTR_TABLE].DefaultView;
- dv.RowFilter="FolderId="+folderid+"and DepId="+depid;
-
- int count=dv.Count;
- if(count!=0)
- {
- bool flag=Convert.ToBoolean(dv[0].Row[4].ToString());
- if(flag==true)
- {
- return "Admin";
- }
- else
- {
- flag=Convert.ToBoolean(dv[0].Row[5].ToString());
- if(flag==true)
- {
- return "Read";
- }
- else
- {
- return "Write";
- }
- }
- }
- else
- {
- return "NoRight";
- }
- }
- private string GetPath(int fid)
- {
- string fpath;
- FileA fa= new FileA();
- fpath=fa.GetDocPath(fid);
- return fpath;
- }
- public DataTable DoRecycle()
- {
- DataTable dtRecycle = new DataTable();
- DataColumnCollection d= dtRecycle.Columns;
- d.Add("folderid",typeof(System.Int32));
- d.Add("hifolderid", typeof(System.Int32));
- d.Add("name",typeof(System.String));
- d.Add("path",typeof(System.String));
- d.Add("type",typeof(System.String));
- d.Add("dempid",typeof(System.Int32));
- d.Add("Ddate",typeof(System.DateTime));
- FileData recycleinfo=(new FileA()).LoadRecycleFile();
- DataView dvdata=recycleinfo.Tables[FileData.FMDOC_TABLE].DefaultView;
- int counts = dvdata.Count;
- for(int i=0;i<counts;i++)
- {
- string type=dvdata[i].Row[13].ToString();
- int docid=Convert.ToInt32(dvdata[i].Row[0].ToString(),10);
- int folderid=Convert.ToInt32(dvdata[i].Row[1].ToString(),10);
- if(folderid==0)
- {
- DataRow row = dtRecycle.NewRow();
- row["folderid"]=Convert.ToInt32(dvdata[i].Row[0].ToString(),10);
- row["hifolderid"] =Convert.ToInt32(dvdata[i].Row[1].ToString(),10);
- row["name"]=dvdata[i].Row[14].ToString()+dvdata[i].Row[2].ToString();
- int fid=Convert.ToInt32(dvdata[i].Row[1].ToString(),10);
- row["path"]=GetPath(fid);
- row["Ddate"]=Convert.ToDateTime(dvdata[i].Row[10].ToString());
- row["dempid"]=Convert.ToInt32(dvdata[i].Row[15].ToString()) ;
- row["type"]=dvdata[i].Row[13].ToString();
- dtRecycle.Rows.Add(row);
- }
- else
- {
- GetTopFolder(dtRecycle,docid,folderid,type);
- }
- }
- return dtRecycle;
- }
- private void GetTopFolder(DataTable dtRecycle,int docid,int folderid,string type)
- {
- FileData recycleseach=(new FileA()).LoadRecycleFile();
- DataView dvdata2=recycleseach.Tables[FileData.FMDOC_TABLE].DefaultView;
- dvdata2.RowFilter="DocId="+folderid+"and TypeName='文件夹'";
- int counts=dvdata2.Count;
- if(counts!=0)
- {
- try
- {
- int did=Convert.ToInt32(dvdata2[0].Row[0].ToString(),10);
- int fid=Convert.ToInt32(dvdata2[0].Row[1].ToString(),10);
- GetTopFolder(dtRecycle,did,fid,FOLDER);
- }
- catch
- {
- }
- }
- else
- {
- DataView dvdata3=recycleseach.Tables[FileData.FMDOC_TABLE].DefaultView;
- if(type=="文件夹")
- {
- dvdata3.RowFilter="DocId="+ docid+"and TypeName='文件夹'";
- DataRow row = dtRecycle.NewRow();
- row["folderid"]=Convert.ToInt32(dvdata3[0].Row[0].ToString(),10);
- row["hifolderid"] =Convert.ToInt32(dvdata3[0].Row[1].ToString(),10);
- row["name"]=dvdata3[0].Row[14].ToString()+dvdata3[0].Row[2].ToString();
- int fid=Convert.ToInt32(dvdata3[0].Row[1].ToString(),10);
- row["path"]=GetPath(fid);
- row["Ddate"]=Convert.ToDateTime(dvdata3[0].Row[10].ToString());
- row["dempid"]=Convert.ToInt32(dvdata3[0].Row[15].ToString()) ;
- row["type"]=dvdata3[0].Row[13].ToString();
- dtRecycle.Rows.Add(row);
- }
- else
- {
- dvdata3.RowFilter="DocId="+docid+"and TypeName='"+type+"'";
- DataRow row = dtRecycle.NewRow();
- row["folderid"]=Convert.ToInt32(dvdata3[0].Row[0].ToString(),10);
- row["hifolderid"] =Convert.ToInt32(dvdata3[0].Row[1].ToString(),10);
- row["name"]=dvdata3[0].Row[14].ToString()+dvdata3[0].Row[2].ToString();
- int fid=Convert.ToInt32(dvdata3[0].Row[1].ToString(),10);
- row["path"]=GetPath(fid);
- row["Ddate"]=Convert.ToDateTime(dvdata3[0].Row[10].ToString());
- row["dempid"]=Convert.ToInt32(dvdata3[0].Row[15].ToString()) ;
- row["type"]=dvdata3[0].Row[13].ToString();
- dtRecycle.Rows.Add(row);
- }
- }
- }
- }
- }