EmpBase.aspx.cs
上传用户:autodoor
上传日期:2022-08-04
资源大小:9973k
文件大小:11k
- using System;
- using System.Collections;
- using System.Data;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using qminoa.BLL;
- using qminoa.Common;
- using qminoa.Common.Data;
- namespace qminoa.Webs.MR
- {
- public class EmpBase : qminoa.Webs.PageBase
- {
- protected System.Web.UI.WebControls.Label lblFileID;
- protected System.Web.UI.WebControls.Label lblErr;
- protected System.Web.UI.WebControls.Label lblEmpID;
- protected System.Web.UI.WebControls.ValidationSummary valSum;
- protected System.Web.UI.WebControls.ImageButton cmdExit;
- protected System.Web.UI.WebControls.ImageButton cmdSaveExi;
- protected System.Web.UI.WebControls.ImageButton cmdSaveCon;
- protected System.Web.UI.WebControls.DropDownList dropPosition;
- protected System.Web.UI.WebControls.DropDownList dropDep;
- protected System.Web.UI.WebControls.Label Label10;
- protected System.Web.UI.WebControls.Label Label8;
- protected System.Web.UI.WebControls.DropDownList dropBranch;
- protected System.Web.UI.WebControls.LinkButton cmdAddPic;
- protected System.Web.UI.WebControls.Label Label14;
- protected System.Web.UI.WebControls.RequiredFieldValidator valBranch;
- protected System.Web.UI.WebControls.Label Label2;
- protected System.Web.UI.WebControls.TextBox txtEmpcode;
- protected System.Web.UI.WebControls.Label Label1;
- protected System.Web.UI.WebControls.TextBox txtMobile;
- protected System.Web.UI.WebControls.TextBox txtOfficefax;
- protected System.Web.UI.WebControls.Label Label7;
- protected System.Web.UI.WebControls.Label Label6;
- protected System.Web.UI.WebControls.TextBox txtOfficetel;
- protected System.Web.UI.WebControls.Label Label5;
- protected System.Web.UI.WebControls.TextBox txtEmail;
- protected System.Web.UI.WebControls.RegularExpressionValidator Re1;
- protected System.Web.UI.WebControls.Label Label9;
- protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
- protected System.Web.UI.WebControls.TextBox txtName;
- protected System.Web.UI.WebControls.Label Label3;
- protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
- protected System.Web.UI.WebControls.Label Label4;
- protected System.Web.UI.WebControls.TextBox txtLoginid;
- protected System.Web.UI.WebControls.ImageButton cmdMr36;
- protected System.Web.UI.WebControls.ImageButton cmdMr35;
- protected System.Web.UI.WebControls.ImageButton cmdMr34;
- protected System.Web.UI.WebControls.ImageButton cmdMr33;
- protected System.Web.UI.WebControls.ImageButton cmdMr32;
- protected System.Web.UI.WebControls.ImageButton cmdMR31;
- protected System.Web.UI.WebControls.ImageButton cmdMr3;
- protected System.Web.UI.HtmlControls.HtmlImage lnkEmpPic;
- protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator3;
- protected System.Web.UI.WebControls.RadioButtonList EmpSex;
- private const string PARAM_EMPID = "EmpID";
-
- private void Page_Load(object sender, System.EventArgs e)
- {
- this.PageBegin("人员管理",true);
- if(!Page.IsPostBack)
- {
- lblEmpID.Text = Request.QueryString[PARAM_EMPID];
- DataBind();
- FillPage();
- }
- }
- private void FillPage()
- {
- if(lblEmpID.Text!=string.Empty)
- {
- int empID = Convert.ToInt16(lblEmpID.Text,10);
- DataTable empTB = (new EmpSystem()).GetEmpTB_By_EmpID(empID);
- DataRow row = empTB.Rows[0];
- if(row[EmpBaseData.PHOTO_CONTENT_FIELD]!=DBNull.Value)
- lnkEmpPic.Src = "./EmpPicDown.aspx?empID="+lblEmpID.Text;
- else
- lnkEmpPic.Src = "../img/logo2.jpg";
- txtLoginid.Text = row[EmpBaseData.LOGINID_FIELD].ToString();
- txtName.Text = row[EmpBaseData.EMPNAME_FIELD].ToString();
- txtEmail.Text = row[EmpBaseData.EMAIL_FIELD].ToString();
- txtOfficetel.Text = row[EmpBaseData.OFFICETEL_FIELD].ToString();
- txtOfficefax.Text =row[EmpBaseData.OFFICEFAX_FIELD].ToString();
- txtMobile.Text = row[EmpBaseData.MOBILE_FIELD].ToString();
- txtEmpcode.Text = row[EmpBaseData.EMPCODE_FIELD].ToString();
- EmpSex.Items[Convert.ToInt16(row[EmpBaseData.SEX_FIELD])].Selected = true;
- string position = row[EmpBaseData.POSITION_FIELD].ToString();
- dropPosition.SelectedIndex = -1;
- foreach(ListItem item in dropPosition.Items)
- {
- if(item.Text == position)
- item.Selected =true;
- }
- int depID = (int)row[DepData.DEPID_FIELD];
- DataTable depTB = (new DepSystem()).GetDepTB_By_DepID(depID);
- row = depTB.Rows[0];
- int branchID = (int)row[DepData.BRANCHID_FIELD];
- dropBranch.SelectedIndex = -1;
- foreach(ListItem item in dropBranch.Items)
- {
- if(item.Value == branchID.ToString())
- item.Selected = true;
- }
- dropDep.DataBind();
- foreach(ListItem item in dropDep.Items)
- {
- if(item.Value == depID.ToString())
- item.Selected = true;
- }
- }
- }
- public DataTable BraTB
- {
- get
- {
- DataTable braTB = (new DepSystem()).GetBraTB();
- return braTB;
- }
- }
- public DataTable DepTB
- {
- get
- {
- int branchID = Convert.ToInt32(dropBranch.SelectedItem.Value,10);
- return (new DepSystem()).GetDepTB_By_BranchID(branchID);
- }
- }
- public ArrayList PositionLst
- {
- get
- {
- ArrayList array = new ArrayList();
- array.Add("");
- array.Add("系统工程师");
- array.Add("董事长");
- array.Add("总经理");
- array.Add("副总经理");
- array.Add("部门经理");
- array.Add("项目经理");
- array.Add("程序员");
- array.Add("高级程序员");
- array.Add("系统分析员");
- array.Add("网络工程师");
- array.Add("销售助理");
- array.Add("销售代表");
- array.Add("其它");
- return array;
- }
- }
- private void SaveEmpInf()
- {
- if(lblEmpID.Text ==string.Empty)
- {
- if(this.EmpRightCode >= 2)
- {
- EmpBaseData empData = new EmpBaseData();
- DataTable empTB = empData.Tables[EmpBaseData.EMP_TABLE_NAME];
- DataRow row = empTB.NewRow();
- row[EmpBaseData.LOGINID_FIELD] = txtLoginid.Text.Trim();
- row[EmpBaseData.EMPNAME_FIELD] = txtName.Text.Trim();
- row[EmpBaseData.PASSWORD_FIELD] = txtLoginid.Text.Trim();
- row[EmpBaseData.EMAIL_FIELD] = txtEmail.Text.Trim();
- row[EmpBaseData.OFFICETEL_FIELD] = txtOfficetel.Text.Trim();
- row[EmpBaseData.OFFICEFAX_FIELD] = txtOfficefax.Text.Trim();
- row[EmpBaseData.MOBILE_FIELD] = txtMobile.Text.Trim();
- row[EmpBaseData.EMPCODE_FIELD] = txtEmpcode.Text.Trim();
- row[EmpBaseData.SEX_FIELD] = Convert.ToBoolean(EmpSex.SelectedIndex);
- row[DepData.DEPID_FIELD] = Convert.ToInt16(dropDep.SelectedItem.Value,10);
- row[EmpBaseData.POSITION_FIELD] = dropPosition.SelectedItem.Text;
- empTB.Rows.Add(row);
- int empID = (new EmpSystem()).CreateEmp(empData);
- if(empID == 0)
- JScript.Alert("新建人员操作失败!");
- else
- {
- lblEmpID.Text = empID.ToString();
- JScript.Alert("新建人员操作成功!");
- }
- }
- else
- JScript.Alert("您没有权限进行此操作!");
- }
- else
- {
- if(this.EmpRightCode >= 3)
- {
- EmpBaseData empData = new EmpBaseData();
- DataTable empTB = empData.Tables[EmpBaseData.EMP_TABLE_NAME];
- DataRow row = empTB.NewRow();
- empTB.Rows.Add(row);
- empTB.AcceptChanges();
- row[EmpBaseData.EMPID_FIELD] = Convert.ToInt16(lblEmpID.Text,10);
- row[EmpBaseData.LOGINID_FIELD] = txtLoginid.Text.Trim();
- row[EmpBaseData.EMPNAME_FIELD] = txtName.Text.Trim();
- row[EmpBaseData.EMAIL_FIELD] = txtEmail.Text.Trim();
- row[EmpBaseData.OFFICETEL_FIELD] = txtOfficetel.Text.Trim();
- row[EmpBaseData.OFFICEFAX_FIELD] = txtOfficefax.Text.Trim();
- row[EmpBaseData.MOBILE_FIELD] = txtMobile.Text.Trim();
- row[EmpBaseData.EMPCODE_FIELD] = txtEmpcode.Text.Trim();
- row[EmpBaseData.SEX_FIELD] = Convert.ToBoolean(EmpSex.SelectedIndex);
- row[EmpBaseData.POSITION_FIELD] = dropPosition.SelectedItem.Text;
- row[DepData.DEPID_FIELD] = Convert.ToInt16(dropDep.SelectedItem.Value,10);
- if((new EmpSystem()).UpdateEmp(empData))
- JScript.Alert("修改人员操作成功!");
- else
- JScript.Alert("修改人员操作失败!");
- }
- else
- JScript.Alert("您没有权限进行此操作!");
- }
- }
- #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.cmdSaveCon.Click += new System.Web.UI.ImageClickEventHandler(this.cmdSaveCon_Click);
- this.cmdSaveExi.Click += new System.Web.UI.ImageClickEventHandler(this.cmdSaveExi_Click);
- this.cmdExit.Click += new System.Web.UI.ImageClickEventHandler(this.cmdExit_Click);
- this.cmdMR31.Click += new System.Web.UI.ImageClickEventHandler(this.cmdMR31_Click);
- this.cmdMr32.Click += new System.Web.UI.ImageClickEventHandler(this.cmdMr32_Click);
- this.cmdMr33.Click += new System.Web.UI.ImageClickEventHandler(this.cmdMr33_Click);
- this.cmdMr34.Click += new System.Web.UI.ImageClickEventHandler(this.cmdMr34_Click);
- this.cmdMr35.Click += new System.Web.UI.ImageClickEventHandler(this.cmdMr35_Click);
- this.cmdMr36.Click += new System.Web.UI.ImageClickEventHandler(this.cmdMr36_Click);
- this.cmdAddPic.Click += new System.EventHandler(this.cmdAddPic_Click);
- this.dropBranch.SelectedIndexChanged += new System.EventHandler(this.dropBranch_SelectedIndexChanged);
- this.Load += new System.EventHandler(this.Page_Load);
- }
- #endregion
- private void cmdSaveCon_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- SaveEmpInf();
- }
- private void cmdAddPic_Click(object sender, System.EventArgs e)
- {
- SaveEmpInf();
- Response.Redirect("./EmpPic.aspx?PARAM_EMPID="+lblEmpID.Text.Trim(),false);
- }
- private void cmdSaveExi_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- SaveEmpInf();
- Response.Redirect("EmpInf.aspx",false);
- }
- private void cmdExit_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- Response.Redirect("EmpInf.aspx",false);
- }
- private void cmdMR31_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- SaveEmpInf();
- Response.Redirect("./EmpPers.aspx?PARAM_EMPID="+lblEmpID.Text.Trim(),false);
- }
- private void cmdMr32_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- SaveEmpInf();
- Response.Redirect("./EmpWelInf.aspx?PARAM_EMPID="+lblEmpID.Text.Trim(),false);
- }
- private void cmdMr33_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- Response.Redirect("EmpEdu.aspx?PARAM_EMPID="+lblEmpID.Text.Trim(),false);
- }
- private void cmdMr34_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- Response.Redirect("EmpVisaInf.aspx?PARAM_EMPID="+lblEmpID.Text.Trim(),false);
- }
- private void dropBranch_SelectedIndexChanged(object sender, System.EventArgs e)
- {
- dropDep.DataBind();
- }
- private void cmdMr35_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- Response.Redirect("EmpArcInf.aspx?PARAM_EMPID="+lblEmpID.Text.Trim(),false);
- }
- private void cmdMr36_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- Response.Redirect("EmpContInf.aspx?PARAM_EMPID="+lblEmpID.Text.Trim(),false);
- }
- }
- }