ShowAccount.aspx.cs
上传用户:autodoor
上传日期:2022-08-04
资源大小:9973k
文件大小:8k
- using System;
- using System.Collections;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Web;
- using System.Web.SessionState;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.HtmlControls;
- using qminoa.DA;
- using qminoa.Common;
- namespace qminoa.Webs.FM
- {
- public class ShowAccount : qminoa.Webs.PageBase
- {
- protected System.Web.UI.WebControls.ImageButton cmdCancel;
- protected System.Web.UI.WebControls.ImageButton cmdFinish;
- protected System.Web.UI.WebControls.ImageButton cmdLast;
- protected System.Web.UI.WebControls.Button cmdDelAll;
- protected System.Web.UI.WebControls.Button cmdAddAll;
- protected System.Web.UI.WebControls.Button cmdDel;
- protected System.Web.UI.WebControls.Button cmdAdd;
- protected System.Web.UI.WebControls.Label Label5;
- protected System.Web.UI.WebControls.Label Label4;
- protected System.Web.UI.WebControls.ListBox lstSelEmp;
- protected System.Web.UI.WebControls.Label Label6;
- protected System.Web.UI.WebControls.Label Label2;
- protected System.Web.UI.WebControls.Label Label3;
- protected System.Web.UI.WebControls.DropDownList BranchDropList;
- protected System.Web.UI.WebControls.DropDownList DepartmentDropList;
- protected System.Web.UI.WebControls.ListBox UserList;
- protected System.Web.UI.WebControls.Label Label1;
-
- private void Page_Load(object sender, System.EventArgs e)
- {
- if(!IsPostBack)
- {
- this.PageBegin("文档管理",true);
- AdminDB admin = new AdminDB();
- BranchDropList.DataSource=admin.GetAllBranch();
- BranchDropList.DataBind();
- BranchDropList.Items[0].Selected=true;
- DepartmentDropList.DataSource=admin.GetDepByBranch(Int32.Parse(BranchDropList.SelectedItem.Value));
- DepartmentDropList.DataBind();
- DepartmentDropList.Items[0].Selected=true;
- UserList.DataSource=admin.GetEmpInfo(Int32.Parse(DepartmentDropList.SelectedItem.Value),"dep");
- UserList.DataTextField = "EmpName";
- UserList.DataValueField = "EmpID";
- UserList.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.DepartmentDropList.SelectedIndexChanged += new System.EventHandler(this.DepartmentDropList_SelectedIndexChanged);
- this.cmdAdd.Click += new System.EventHandler(this.cmdAdd_Click);
- this.cmdDel.Click += new System.EventHandler(this.cmdDel_Click);
- this.cmdAddAll.Click += new System.EventHandler(this.cmdAddAll_Click);
- this.cmdDelAll.Click += new System.EventHandler(this.cmdDelAll_Click);
- this.BranchDropList.SelectedIndexChanged += new System.EventHandler(this.BranchDropList_SelectedIndexChanged);
- this.cmdLast.Click += new System.Web.UI.ImageClickEventHandler(this.cmdLast_Click);
- this.cmdFinish.Click += new System.Web.UI.ImageClickEventHandler(this.cmdFinish_Click);
- this.cmdCancel.Click += new System.Web.UI.ImageClickEventHandler(this.cmdCancel_Click);
- this.Load += new System.EventHandler(this.Page_Load);
- }
- #endregion
- private void cmdAdd_Click(object sender, System.EventArgs e)
- {
- bool exist=false;
- foreach( ListItem li in lstSelEmp.Items)
- {
- if(li.Value==UserList.SelectedItem.Value)
- {
- exist=true;
- }
- }
- if(exist==false)
- {
- lstSelEmp.Items.Add(new ListItem(UserList.SelectedItem.Text,UserList.SelectedItem.Value));
- }
- }
- private void cmdDel_Click(object sender, System.EventArgs e)
- {
- lstSelEmp.Items.Remove(lstSelEmp.SelectedItem);
- }
- private void cmdDelAll_Click(object sender, System.EventArgs e)
- {
- for(int i=0;i<lstSelEmp.Items.Count; )
- lstSelEmp.Items.Remove(lstSelEmp.Items[i]);
- }
- private void cmdAddAll_Click(object sender, System.EventArgs e)
- {
- foreach(ListItem li in UserList.Items)
- {
- bool exist=false;
- foreach( ListItem lised in lstSelEmp.Items)
- if(lised.Value==li.Value)
- exist=true;
- if(exist==false)
- lstSelEmp.Items.Add(new ListItem(li.Text,li.Value));
- }
- }
- private void cmdLast_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- Response.Redirect("SetRightType.aspx?type=0",false);
- }
- private void cmdFinish_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- int righttype=Convert.ToInt32(Session["RightType"]);
- int num=lstSelEmp.Items.Count;//所选的用户数量
- for(int i=0;i<lstSelEmp.Items.Count;i++ )
- {
- FileRight fright =new FileRight();
- int empid=Convert.ToInt32(lstSelEmp.Items[i].Value);
- if(righttype==4)
- {
- fright.SaveDocFolderRight(GetSaveData_Folder(empid),1);
- }
- else
- {
- fright.SaveDocRight(GetSaveData_Doc(empid),1);
- }
- }
- int type=Convert.ToInt32(Session["Type"]) ;
- int doc_id=Convert.ToInt32(Session["_docid"]);
- int fid=Convert.ToInt32(Session["_FolderId"]);
- if(righttype==4)
- {
- if(type==-2)
- {
- Response.Redirect("fmNewFolder.aspx?righttype=4&type=-2&id="+fid,false);
- }
- else
- {
- Response.Redirect("fmNewFolder.aspx?docid="+doc_id+"&id="+fid+"&type=-3",false);
- }
- }
- if(righttype==5)
- {
- if(type==-2)
- {
- Response.Redirect("fmNewFile.aspx?righttype=5&type=-2&did="+doc_id+"&fid="+fid,false);
- }
- else
- {
- Response.Redirect("fmNewFile.aspx?did="+doc_id+"&fid="+fid+"&type=-3",false);
- }
- }
- }
- private void cmdCancel_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- int righttype;
- int fid;
- int doc_id;
- righttype=Convert.ToInt32(Session["RightType"]);
- fid=Convert.ToInt32(Session["_FolderId"]);
- doc_id=Convert.ToInt32(Session["_docid"]);
- if(righttype==4)
- {
- Response.Redirect("fmNewFolder.aspx?docid="+doc_id+"&id="+fid+"&type=-3",false);
- }
- else if(righttype==5)
- {
- Response.Redirect("fmNewFile.aspx?did="+doc_id+"&fid="+fid+"&type=-3",false);
- }
- }
- public FileData GetSaveData_Doc(int EmpId)
- {
- int DocId;
- int type=Convert.ToInt32(Session["type"].ToString(),10);
- if(type==-2)
- {
- DocId=0;
- }
- else
- {
- DocId=Convert.ToInt32(Session["_docid"]);
- }
- FileData rightdata=new FileData();
- DataTable userdata =rightdata.Tables[FileData.FMDOCFOLDERCTR_TABLE];
- DataRow row =userdata.NewRow();
-
- row[0]=0;
- row[1]=DocId;
- row[2]=0;
- row[3]=EmpId;
- row[4]=0;
- row[5]=0;
- row[6]=1;
- row[7]=EmpId;
-
- userdata.Rows.Add(row);
- userdata.AcceptChanges();
- rightdata.AcceptChanges();
- return rightdata;
- }
-
- public FileData GetSaveData_Folder(int EmpId)
- {
- int FolderId;
- int type=Convert.ToInt32(Session["type"].ToString(),10);
- if(type==-2)
- {
- FolderId=0;
- }
- else
- {
- FolderId=Convert.ToInt32(Session["_FolderId"]);
- }
- FileData rightdata=new FileData();
- DataTable userdata =rightdata.Tables[FileData.FMDOCFOLDERCTR_TABLE];
- DataRow row =userdata.NewRow();
- row[0]=0;
- row[1]=FolderId;
- row[2]=0;
- row[3]=EmpId;
- row[4]=0;
- row[5]=0;
- row[6]=1;
- row[7]=EmpId;
- userdata.Rows.Add(row);
- userdata.AcceptChanges();
- rightdata.AcceptChanges();
- return rightdata;
- }
- private void BranchDropList_SelectedIndexChanged(object sender, System.EventArgs e)
- {
- AdminDB admin = new AdminDB();
- DepartmentDropList.DataSource=admin.GetDepByBranch(Int32.Parse(BranchDropList.SelectedItem.Value));
- DepartmentDropList.DataBind();
- if(DepartmentDropList.Items.Count !=0)
- {
- UserList.DataSource=admin.GetEmpInfo(Int32.Parse(DepartmentDropList.SelectedItem.Value),"dep");
- UserList.DataTextField = "EmpName";
- UserList.DataValueField = "EmpID";
- UserList.DataBind();
- }
- else
- {
- UserList.Items.Clear();
- }
- }
- private void DepartmentDropList_SelectedIndexChanged(object sender, System.EventArgs e)
- {
- AdminDB admin = new AdminDB();
- UserList.DataSource=admin.GetEmpInfo(Int32.Parse(DepartmentDropList.SelectedItem.Value),"dep");
- UserList.DataTextField = "EmpName";
- UserList.DataValueField = "EmpID";
- UserList.DataBind();
- }
- }
- }