- 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.BLL;
- using qminoa.Common;
- using qminoa.Common.Data;
- namespace qminoa.Webs.MR
- {
- public class EmpPosition : qminoa.Webs.PageBase
- {
- protected System.Web.UI.WebControls.ValidationSummary ValidationSummary1;
- protected System.Web.UI.WebControls.Label lblEmpID;
- protected System.Web.UI.WebControls.Label lblArcID;
- protected System.Web.UI.WebControls.Label lblErr;
- protected System.Web.UI.WebControls.ImageButton cmdExit;
- protected System.Web.UI.WebControls.ImageButton cmdSaveExi;
- protected System.Web.UI.WebControls.RangeValidator RangeValidator2;
- protected System.Web.UI.WebControls.RangeValidator RangeValidator1;
- protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator4;
- protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
- protected System.Web.UI.WebControls.TextBox txtNote;
- protected System.Web.UI.WebControls.TextBox txtReason;
- protected System.Web.UI.WebControls.TextBox txtPosition;
- protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator3;
- protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
- protected System.Web.UI.WebControls.LinkButton cmdPosition;
- protected System.Web.UI.WebControls.TextBox txtDepName;
- protected System.Web.UI.WebControls.LinkButton cmdDep;
- protected System.Web.UI.WebControls.TextBox txtBranch;
- protected System.Web.UI.WebControls.LinkButton cmdBranch;
- protected System.Web.UI.WebControls.DropDownList dropCate;
- protected System.Web.UI.WebControls.Label Label3;
- protected System.Web.UI.WebControls.TextBox txtTDate;
- protected System.Web.UI.WebControls.Label Label2;
- protected System.Web.UI.WebControls.TextBox txtFDate;
- protected System.Web.UI.WebControls.Label Label1;
- private const string PARAM_ARCID = "arcID";
- private void Page_Load(object sender, System.EventArgs e)
- {
- this.PageBegin("人员管理",true);
- if(Page.IsPostBack)
- {
- return;
- }
- FillPage();
- }
- /// <summary>
- ///
- /// </summary>
- private void FillPage()
- {
- string str = Request.Params[PARAM_ARCID];
- if(str!=null)
- {
- int arcID = Convert.ToInt16(str,10);
- lblArcID.Text = arcID.ToString();
- DataTable arcTB = (new EmpSystem()).GetEmpArcTB_By_ArcID(arcID);
- DataRow row = arcTB.Rows[0];
- txtFDate.Text = ((System.DateTime)row[EmpArcData.FDATE_FIELD]).ToString("d");
- txtTDate.Text = ((System.DateTime)row[EmpArcData.TDATE_FIELD]).ToString("d");
- dropCate.SelectedIndex = -1;
- foreach(ListItem item in dropCate.Items)
- {
- if(item.Text==row[EmpArcData.CATETORY_FIELD].ToString())
- item.Selected = true;
- }
- txtBranch.Text = row[EmpArcData.BRANAME_FIELD].ToString();
- txtDepName.Text = row[EmpArcData.DEPNAME_FIELD].ToString();
- txtPosition.Text = row[EmpArcData.POSITION_FIELD].ToString();
- txtReason.Text = row[EmpArcData.REASON_FIELD].ToString();
- txtNote.Text = row[EmpArcData.ARCNOTE_FIELD].ToString();
- lblEmpID.Text = row["EmpID"].ToString();
- }
- else
- {
- lblEmpID.Text = Request.Params["empid"];
- }
- }
- private bool SaveArcInf()
- {
- if(this.EmpRightCode >= 3)
- {
- bool result;
- if(lblArcID.Text!=string.Empty)
- {
- EmpArcData arcData = new EmpArcData();
- DataTable table = arcData.Tables[EmpArcData.EMPARCHIVE_TABLE_NAME];
- DataRow row = table.NewRow();
- table.Rows.Add(row);
- table.AcceptChanges();
- row[EmpArcData.ARCID_FIELD] = Convert.ToInt16(lblArcID.Text,10);
- row[EmpArcData.CATETORY_FIELD] = dropCate.SelectedItem.Text;
- row[EmpArcData.FDATE_FIELD] = Convert.ToDateTime(txtFDate.Text);
- row[EmpArcData.TDATE_FIELD] = Convert.ToDateTime(txtTDate.Text);
- row[EmpArcData.BRANAME_FIELD] = txtBranch.Text;
- row[EmpArcData.DEPNAME_FIELD] = txtDepName.Text;
- row[EmpArcData.POSITION_FIELD] = txtPosition.Text;
- row[EmpArcData.REASON_FIELD] = txtReason.Text;
- row[EmpArcData.ARCNOTE_FIELD] = txtNote.Text;
- result = (new EmpSystem()).UpdateMrArchive(arcData);
- }
- else
- {
- EmpArcData arcData = new EmpArcData();
- DataTable table = arcData.Tables[EmpArcData.EMPARCHIVE_TABLE_NAME];
- DataRow row = table.NewRow();
- row[EmpBaseData.EMPID_FIELD] = Convert.ToInt16(lblEmpID.Text);
- row[EmpArcData.CATETORY_FIELD] = dropCate.SelectedItem.Text;
- row[EmpArcData.FDATE_FIELD] = Convert.ToDateTime(txtFDate.Text);
- row[EmpArcData.TDATE_FIELD] = Convert.ToDateTime(txtTDate.Text);
- row[EmpArcData.BRANAME_FIELD] = txtBranch.Text;
- row[EmpArcData.DEPNAME_FIELD] = txtDepName.Text;
- row[EmpArcData.POSITION_FIELD] = txtPosition.Text;
- row[EmpArcData.REASON_FIELD] = txtReason.Text;
- row[EmpArcData.ARCNOTE_FIELD] = txtNote.Text;
- table.Rows.Add(row);
- result = (new EmpSystem()).InsertMrArchive(arcData);
- }
- return result;
- }
- else
- {
- JScript.Alert("您没有权限进行此操作!");
- return false;
- }
- }
- #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.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 cmdSaveExi_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- if(!SaveArcInf())
- JScript.Alert("操作失败!");
- else
- Response.Redirect("EmpArcInf.aspx?PARAM_EMPID="+lblEmpID.Text,false);
- }
- private void cmdExit_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- Response.Redirect("EmpArcInf.aspx?PARAM_EMPID="+lblEmpID.Text,false);
- }
- }
- }