- 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 EmpVita : qminoa.Webs.PageBase
- {
- protected System.Web.UI.WebControls.ValidationSummary ValidationSummary1;
- protected System.Web.UI.WebControls.Label lblErr;
- protected System.Web.UI.WebControls.Label lblVisaID;
- 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 RequiredFieldValidator2;
- protected System.Web.UI.WebControls.TextBox txtPosition;
- protected System.Web.UI.WebControls.Label Label3;
- protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
- protected System.Web.UI.WebControls.LinkButton cmdPosition;
- protected System.Web.UI.WebControls.TextBox txtNote;
- protected System.Web.UI.WebControls.TextBox txtDepName;
- protected System.Web.UI.WebControls.Label Label5;
- protected System.Web.UI.WebControls.TextBox txtCompany;
- protected System.Web.UI.WebControls.Label Label4;
- 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_VISAID = "visaID";
- protected System.Web.UI.WebControls.Label lblEmpID;
- private void Page_Load(object sender, System.EventArgs e)
- {
- this.PageBegin("人员管理",true);
- if(!Page.IsPostBack)
- {
- FillPage();
- }
- }
- private void FillPage()
- {
- string str = Request.Params[PARAM_VISAID];
- if(str!=null)
- {
- int visaID = Convert.ToInt16(str,10);
- lblVisaID.Text = visaID.ToString();
- DataTable visaTB = (new EmpSystem()).GetEmpVisaTB_By_VisaID(visaID);
- DataRow row = visaTB.Rows[0];
- txtFDate.Text = ((System.DateTime)row[EmpVisaData.FDATE_FIELD]).ToString("d");
- txtTDate.Text = ((System.DateTime)row[EmpVisaData.TDATE_FIELD]).ToString("d");
- txtCompany.Text = row[EmpVisaData.COMMPANY_FIELD].ToString();
- txtDepName.Text = row[EmpVisaData.DEPNAME_FIELD].ToString();
- txtPosition.Text = row[EmpVisaData.POSITION_FIELD].ToString();
- txtNote.Text = row[EmpVisaData.VISANOTE_FIELD].ToString();
- lblEmpID.Text = row["EmpID"].ToString();
- }
- else
- {
- lblEmpID.Text = Request.Params["empid"];
- }
- }
- private bool SaveVisaInf()
- {
- if(this.EmpRightCode >= 3)
- {
- bool result;
- if(lblVisaID.Text!=string.Empty)
- {
- EmpVisaData visaData = new EmpVisaData();
- DataTable table = visaData.Tables[EmpVisaData.EMPVISA_TABLE_NAME];
- DataRow row = table.NewRow();
- table.Rows.Add(row);
- table.AcceptChanges();
- row[EmpVisaData.VISAID_FIELD] = Convert.ToInt16(lblVisaID.Text,10);
- row[EmpVisaData.FDATE_FIELD] = Convert.ToDateTime(txtFDate.Text);
- row[EmpVisaData.TDATE_FIELD] = Convert.ToDateTime(txtTDate.Text);
- row[EmpVisaData.COMMPANY_FIELD] = txtCompany.Text;
- row[EmpVisaData.DEPNAME_FIELD] = txtDepName.Text;
- row[EmpVisaData.POSITION_FIELD] = txtPosition.Text;
- row[EmpVisaData.VISANOTE_FIELD] = txtNote.Text;
- result = (new EmpSystem()).UpdateMrVita(visaData);
- }
- else
- {
- EmpVisaData visaData = new EmpVisaData();
- DataTable table = visaData.Tables[EmpVisaData.EMPVISA_TABLE_NAME];
- DataRow row = table.NewRow();
- row[EmpBaseData.EMPID_FIELD] = Convert.ToInt16(lblEmpID.Text);
- row[EmpVisaData.FDATE_FIELD] = Convert.ToDateTime(txtFDate.Text);
- row[EmpVisaData.TDATE_FIELD] = Convert.ToDateTime(txtTDate.Text);
- row[EmpVisaData.COMMPANY_FIELD] = txtCompany.Text;
- row[EmpVisaData.DEPNAME_FIELD] = txtDepName.Text;
- row[EmpVisaData.POSITION_FIELD] = txtPosition.Text;
- row[EmpVisaData.VISANOTE_FIELD] = txtNote.Text;
- table.Rows.Add(row);
- result = (new EmpSystem()).InsertMrVita(visaData);
- }
- 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(!SaveVisaInf())
- {
- JScript.Alert("操作失败!");
- }
- else
- {
- JScript.Alert("操作成功!");
- Response.Redirect("EmpVisaInf.aspx?PARAM_EMPID="+lblEmpID.Text,false);
- }
- }
- private void cmdExit_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- Response.Redirect("EmpVisaInf.aspx?PARAM_EMPID="+lblEmpID.Text,false);
- }
- }
- }