📄 fmnewfile.aspx.cs
字号:
using System;
using System.Data;
using System.Web.UI.WebControls;
using System.IO;
using qminoa.Common;
using qminoa.DA;
using qminoa.BLL;
namespace qminoa.Webs.FM
{
public class fmNewFile : qminoa.Webs.PageBase
{
protected System.Web.UI.WebControls.ImageButton cmdSaveCon;
const string UpFilePath="UpFiles";
protected string FileName;
protected int FileSize;
protected string FileType;
protected string FilePath;
protected string dType;
protected int DocType;
protected static int id;
protected static int type;
protected static int docid;
protected string keyword;
protected string note;
protected string docname;
static int fm_empid;
static int righttype;
protected System.Web.UI.WebControls.Label lblURL;
protected System.Web.UI.WebControls.Label lblFileID;
protected System.Web.UI.WebControls.Label lblID;
protected System.Web.UI.WebControls.Label lblErr;
protected System.Web.UI.WebControls.ValidationSummary ValidationSummary1;
protected System.Web.UI.WebControls.ImageButton cmdExit;
protected System.Web.UI.WebControls.ImageButton cmdSaveExi;
protected System.Web.UI.WebControls.DataGrid dgdRight;
protected System.Web.UI.WebControls.LinkButton cmdRightAdd;
protected System.Web.UI.WebControls.LinkButton cmdRightSet;
protected System.Web.UI.WebControls.Button cmdUpFile;
protected System.Web.UI.WebControls.Label lblFileName;
protected System.Web.UI.WebControls.DataGrid dgdFileInf;
protected System.Web.UI.WebControls.RadioButton rdoExe;
protected System.Web.UI.WebControls.RadioButton rdoPdf;
protected System.Web.UI.WebControls.RadioButton rdoMedia;
protected System.Web.UI.WebControls.RadioButton rdoNote;
protected System.Web.UI.WebControls.RadioButton rdoZip;
protected System.Web.UI.WebControls.RadioButton rdoBmp;
protected System.Web.UI.WebControls.RadioButton rdoHtml;
protected System.Web.UI.WebControls.RadioButton rdoAccess;
protected System.Web.UI.WebControls.RadioButton rdoPpt;
protected System.Web.UI.WebControls.RadioButton rdoExcel;
protected System.Web.UI.WebControls.RadioButton rdoWord;
protected System.Web.UI.WebControls.RadioButton rdoOther;
protected System.Web.UI.WebControls.LinkButton cmdFileIco;
protected System.Web.UI.WebControls.Label lblEName;
protected System.Web.UI.WebControls.Label Label7;
protected System.Web.UI.WebControls.Label lblCDate;
protected System.Web.UI.WebControls.Label Label6;
protected System.Web.UI.WebControls.Label lblFileLoc;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Web.UI.WebControls.TextBox txtKeyWord;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.TextBox txtNote;
protected System.Web.UI.WebControls.Label Label4;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.TextBox txtFileName;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.HtmlControls.HtmlGenericControl DIV1;
protected System.Web.UI.HtmlControls.HtmlInputFile File1;
private void Page_Load(object sender, System.EventArgs e)
{
if(!this.IsPostBack)
{
this.PageBegin("文档管理",true);
fm_empid=Convert.ToInt16(this.Empid);
docid=Convert.ToInt32(Request.QueryString["did"]);
id = Convert.ToInt32(Request.QueryString["fid"]);
type=Convert.ToInt32(Request.QueryString["type"]);
righttype=Convert.ToInt32(Request.Params["righttype"],10);
Session["_folderid"]=id;
Session["_docid"]=docid;
Session["Type"]=type;
Session["RightType"]=righttype;
filldgdRight(docid,fm_empid);
if(type==-2&&righttype!=5)
{
if(docid==0 && id==0)
{
lblFileLoc.Text="C:\\";
lblCDate.Text=Convert.ToString( DateTime.Now.Year+"-"+DateTime.Now.Month+"-"+DateTime.Now.Day);
lblEName.Text=this.EmpName;
}
else if(docid==0&&id!=0)
{
lblFileLoc.Text="---"+GetPath(id);
lblCDate.Text=Convert.ToString( DateTime.Now.Year+"-"+DateTime.Now.Month+"-"+DateTime.Now.Day);
lblEName.Text=this.EmpName;
}
}
else if(type==-1||type==-3)
{
DataView data=GetDoc(docid);
string time;
time =Convert.ToString(data[0].Row[7].ToString());
lblCDate.Text=time;
txtFileName.Text = data[0].Row[2].ToString();
txtKeyWord.Text= data[0].Row[4].ToString();
txtNote.Text=data[0].Row[5].ToString();
lblEName.Text=(new FileA()).GetEmpName(Convert.ToInt32(data[0].Row[9].ToString()));;
int rdotype= Convert.ToInt32(data[0].Row[3].ToString());
Setrdo(rdotype);
if(id==0 && docid!=0)
{
lblFileLoc.Text ="C:\\";
}
else if(id!=0 && docid!=0)
{
lblFileLoc.Text=GetPath(id);
}
BindToDataGrid(docid);
RightforWrite();
}
else if(righttype==5)
{
if(Session["NewDoc"]!=null)
{
DataTable data=(DataTable)Session["NewDoc"];
txtFileName.Text=data.Rows[0][0].ToString();
lblFileLoc.Text=data.Rows[0][1].ToString();
txtKeyWord.Text=data.Rows[0][2].ToString();
txtNote.Text=data.Rows[0][3].ToString();
lblCDate.Text=data.Rows[0][4].ToString();
lblEName.Text=this.EmpName;
int typeindex=Convert.ToInt32(data.Rows[0][5].ToString(),10);
Setrdo(typeindex);
BindToDataGrid(0);
}
filldgdRight(0,fm_empid);
}
}
}
private void filldgdRight(int docid,int empid)
{
FileData filedata = (new FileRight()).GetDocCtr(docid,empid,0);
dgdRight.DataSource =filedata.Tables[FileData.FMDOCFOLDERCTR_TABLE].DefaultView;
dgdRight.DataBind();
}
public void RightforWrite()
{
int depid=(new FileRight()).GetDepId(fm_empid);
string rightctr_dep=(new FileBLL()).GetDocRightForDep(docid,depid);
if(rightctr_dep=="Admin")
{
cmdRightSet.Visible=true;
}
else if(rightctr_dep=="Write")
{
cmdRightSet.Visible=false;
}
else if(rightctr_dep=="Read")
{
cmdRightSet.Visible=false;
txtFileName.Enabled=false;
txtKeyWord.Enabled=false;
txtNote.Enabled=false;
cmdFileIco.Enabled=false;
cmdUpFile.Enabled=false;
}
else
{
string rightctr_emp=(new FileBLL()).GetDocRight(docid,fm_empid);
if(rightctr_emp=="Admin")
{
cmdRightSet.Visible=true;
}
else if(rightctr_emp=="Write")
{
cmdRightSet.Visible=false;
}
else if(rightctr_emp=="Read")
{
cmdRightSet.Visible=false;
txtFileName.Enabled=false;
txtKeyWord.Enabled=false;
txtNote.Enabled=false;
cmdFileIco.Enabled=false;
cmdUpFile.Enabled=false;
}
}
}
private void BindToDataGrid(int docid)
{
DataView dvdata;
if(docid==0)
{
FileData data=(new FileA()).GetNullFileCont();
dvdata=data.Tables[FileData.FILECONT_TABLE].DefaultView;
}
else
{
FileData data =(new FileA()).ShowAllFileCont();
dvdata=data.Tables[FileData.FILECONT_TABLE].DefaultView;
dvdata.RowFilter="DocId="+docid;
}
if(dvdata.Count == 0)
{
dgdFileInf.Visible=false;
}
else
{
int cout=dvdata.Count;
dgdFileInf.Visible=true;
dgdFileInf.DataSource=dvdata;
dgdFileInf.DataBind();
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.cmdFileIco.Click += new System.EventHandler(this.cmdFileIco_Click);
this.dgdFileInf.ItemCreated += new System.Web.UI.WebControls.DataGridItemEventHandler(this.dgdFileInf_ItemCreated);
this.dgdFileInf.DeleteCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgdFileInf_DeleteCommand);
this.cmdUpFile.Click += new System.EventHandler(this.cmdUpFile_Click);
this.cmdRightSet.Click += new System.EventHandler(this.cmdRightSet_Click);
this.cmdRightAdd.Click += new System.EventHandler(this.cmdRightAdd_Click);
this.dgdRight.ItemCreated += new System.Web.UI.WebControls.DataGridItemEventHandler(this.dgdRight_ItemCreated);
this.dgdRight.DeleteCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgdRight_DeleteCommand);
this.cmdSaveExi.Click += new System.Web.UI.ImageClickEventHandler(this.cmdSaveExi_Click);
this.cmdExit.Click += new System.Web.UI.ImageClickEventHandler(this.cmdExit_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void cmdRightSet_Click(object sender, System.EventArgs e)
{
dgdRight.Visible=!dgdRight.Visible;
cmdRightAdd.Visible=!cmdRightAdd.Visible;
}
private void cmdFileIco_Click(object sender, System.EventArgs e)
{
DIV1.Visible = !DIV1.Visible;
rdoOther.Checked =true;
}
private void cmdSaveExi_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
SaveDocRight();
if(docid==0 && id==0 && type==-2)
{
Saveinfo(0,1);
Response.Redirect("SecurityFMPage.aspx",true);
}
else if(docid==0 && id!=0 && type==-2)
{
Saveinfo(id,0);
Response.Redirect("SecurityFMPage.aspx?Id="+id+"&type=-2",true);
}
else if(type==-1||type==-3)
{
Saveinfo(docid,1);
if(id==0&&docid!=0)
{
Response.Redirect("SecurityFMPage.aspx",true);
}
else
{
Response.Redirect("SecurityFMPage.aspx?Id="+id+"&type=-2",true);
}
}
}
private void Saveinfo(int foldid,int layer)
{
docname=txtFileName.Text;
note=txtNote.Text;
keyword=txtKeyWord.Text;
DocType=GetFileTypeID();
FileA filedata = new FileA();
filedata.ChangDocInfo(foldid,docname,note,DateTime.Now,keyword,fm_empid,DocType,layer);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -