📄 securityfmpage.aspx.cs
字号:
public void dgdFolder_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType==ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem||e.Item.ItemType==ListItemType.EditItem)
{
TableCell myTableCell = new TableCell();
myTableCell = e.Item.Cells[10];
LinkButton myDeleteButton =new LinkButton();
int count=myTableCell.Controls.Count;
myDeleteButton = (LinkButton)myTableCell.Controls[0];
myDeleteButton.Attributes.Add("onclick", "return confirm('您真的要删除该记录吗?');");
}
}
public void dgdFolder_delete(object Sender , DataGridCommandEventArgs E)
{
int FolderId =Convert.ToInt32(E.Item.Cells[1].Text);
int DocId=Convert.ToInt32(E.Item.Cells[0].Text);
if(FolderId==0)
{
if(RightForManage_Doc(DocId)==true)
{
DeleteDoc(DocId,fm_empid);
FirstLoad();
}
else
{
Response.Write("<script language='javascript'>alert('您没有权限管理该文件!');</script>");
}
}
else
{
if(RightForManage_Folder(FolderId)==true)
{
if( DocId==0)
{
DeleteFolder(FolderId);
}
else
{
int fid;
fid = Convert.ToInt32(Session["_fm_id"].ToString());
if(FolderId==fid)
{
if(RightForManage_Doc(DocId)==true)
{
DeleteDoc(DocId,fm_empid);
ReBind(fid);
}
}
else
{
DeleteFolder(FolderId);
ReBind(fid);
}
}
UpdateLeftTree();
}
else
{
Response.Write("<script language='javascript'>alert('您没有权限管理该文件夹!');</script>");
}
}
}
public void DeleteFolder(int folderid)
{
FileA FileA =new FileA();
ArrayList arrlist=(new FileA()).GetDelFolderId(folderid);
for(int i=0;i<arrlist.Count;i++)
{
int foldid=Convert.ToInt32(arrlist[i].ToString(),10);
FileA.DeleteFolder(foldid,fm_empid,1);
}
ArrayList arrlistDoc= FileA.GetDelDocId(arrlist);
for(int j=0;j<arrlistDoc.Count;j++)
{
int docid=Convert.ToInt32(arrlistDoc[j].ToString(),10);
DeleteDoc(docid,fm_empid);
}
int fid=Convert.ToInt32(Session["_fm_id"].ToString(),10);
if(fid==0)
{
FirstLoad();
}
else
{
ReBind(fid);
}
}
public void DeleteDoc(int docid,int empid)
{
FileA filedata=new FileA();
filedata.DeleteDoc(docid,empid);
}
public bool RightForManage_Folder(int folderid)
{
int depid=(new FileRight()).GetDepId(fm_empid);
string rightctr_dep=(new FileBLL()).GetFolderRightForDep(folderid,depid);
if(rightctr_dep=="Admin")
{
return true;
}
else
{
string rightctr_emp=(new FileBLL()).GetFolderRight(folderid,fm_empid);
if(rightctr_emp=="Admin")
{
return true;
}
else
{
return false;
}
}
}
public bool RightForManage_Doc(int docid)
{
int depid=(new FileRight()).GetDepId(fm_empid);
string rightctr_dep=(new FileBLL()).GetDocRightForDep(docid,depid);
if(rightctr_dep=="Admin")
{
return true;
}
else
{
string rightctr_emp=(new FileBLL()).GetDocRight(docid,fm_empid);
if(rightctr_emp=="Admin")
{
return true;
}
else
{
return false;
}
}
}
public void RightForEdit_Folder(int folderid,int docid,int empid)
{
string rightctr_emp=(new FileBLL()).GetFolderRight(folderid,empid);
if(rightctr_emp=="Admin"||rightctr_emp=="Write"||rightctr_emp=="Read")
{
Response.Redirect("fmNewFolder.aspx?type=-3&id="+ folderid+"&docid="+docid);
}
else
{
int depid=(new FileRight()).GetDepId(empid);
string rightctr_dep=(new FileBLL()).GetFolderRightForDep(folderid,depid);
if(rightctr_dep=="Admin"||rightctr_dep=="Write"||rightctr_dep=="Read")
{
Response.Redirect("fmNewFolder.aspx?type=-3&id="+ folderid+"&docid="+docid);
}
else
{
Response.Write("<script language='javascript'>alert('您没有权限访问改文件夹!');</script>");
}
}
}
public DataTable CreateTable(DataView dv)
{
DataTable dvtable=new DataTable();
DataColumnCollection d= dvtable.Columns;
d.Add("folderid",typeof(System.Int32));
d.Add("Docid", typeof(System.Int32));
d.Add("fname",typeof(System.String));
d.Add("typename",typeof(System.String));
d.Add("note",typeof(System.String));
d.Add("empid",typeof(System.String));
d.Add("cdate",typeof(System.String));
int recordcount = dv.Count;
for(int i=0;i<recordcount;i++)
{
DataRow row = dvtable.NewRow();
row["folderid"]=Convert.ToInt32(dv[i].Row[0].ToString(),10);
row["Docid"] =Convert.ToInt32(dv[i].Row[1].ToString(),10);
row["fname"]=dv[i].Row[14].ToString()+dv[i].Row[3].ToString();
row["note"]=dv[i].Row[5].ToString();
DateTime cdate=Convert.ToDateTime(dv[i].Row[7].ToString());
row["cdate"]=cdate.Year+"-"+cdate.Month+"-"+cdate.Day;
row["empid"]=(new FileA()).GetEmpName(Convert.ToInt32(dv[i].Row[9].ToString()));
row["typename"]=dv[i].Row[13].ToString();
dvtable.Rows.Add(row);
}
return dvtable;
}
private void dgdFolder_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if(e.CommandName=="move")
{
int did=Convert.ToInt32(e.Item.Cells[0].Text.ToString(),10);
int fid=Convert.ToInt32(e.Item.Cells[1].Text.ToString(),10);
if(did==0&&fid!=0)
{
if(RightForManage_Folder(fid)==true)
{
Response.Redirect("fmSelFolder.aspx?DocId="+did+"&FolderId="+fid);
}
else
{
Response.Write("<script language='javascript'>alert('您没有权限管理该文件夹!');</script>");
}
}
else if(did!=0&&fid==0)
{
if(RightForManage_Doc(did)==true)
{
Response.Redirect("fmSelFolder.aspx?DocId="+did+"&FolderId="+fid);
}
else
{
Response.Write("<script language='javascript'>alert('您没有权限管理该文件!');</script>");
}
}
else if(did!=0&&fid!=0)
{
int id=Convert.ToInt32(Session["_fm_id"].ToString());
if(fid!=id )
{
if(RightForManage_Folder(fid)==true)
{
Response.Redirect("fmSelFolder.aspx?DocId="+did+"&FolderId="+fid);
}
else
{
Response.Write("<script language='javascript'>alert('您没有权限管理该文件夹!');</script>");
}
}
else
{
if(RightForManage_Doc(did)==true)
{
Response.Redirect("fmSelFolder.aspx?DocId="+did+"&FolderId="+fid);
}
else
{
Response.Write("<script language='javascript'>alert('您没有权限管理该文件!');</script>");
}
}
}
}
}
private void UpdateLeftTree()
{
Response.Write("<script>parent.frmDocTree.location.reload();</script>");
}
private void dgdFolder_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType itemType = e.Item.ItemType;
e.Item.Attributes["onmouseover"] = "javascript:this.style.backgroundColor='#fff7ce';cursor='hand';" ;
if (itemType == ListItemType.Item )
{
e.Item.Attributes["onmouseout"] = "javascript:this.style.backgroundColor='#dedfde';";
}
else if( itemType == ListItemType.AlternatingItem)
{
e.Item.Attributes["onmouseout"] = "javascript:this.style.backgroundColor='#ffffff';";
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -