- 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 EmpCont : qminoa.Webs.PageBase
- {
- protected System.Web.UI.WebControls.ValidationSummary ValidationSummary1;
- protected System.Web.UI.WebControls.Label lblConID;
- 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 RequiredFieldValidator2;
- protected System.Web.UI.WebControls.TextBox txtAnnSala;
- protected System.Web.UI.WebControls.Label Label8;
- protected System.Web.UI.WebControls.DropDownList dropStatus;
- protected System.Web.UI.WebControls.Label Label7;
- protected System.Web.UI.WebControls.DropDownList dropCate;
- protected System.Web.UI.WebControls.Label Label6;
- protected System.Web.UI.WebControls.Label Label3;
- protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
- protected System.Web.UI.WebControls.TextBox txtNote;
- protected System.Web.UI.WebControls.TextBox txtSalaLevl;
- protected System.Web.UI.WebControls.Label Label5;
- protected System.Web.UI.WebControls.TextBox txtPosiLevl;
- 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;
- protected System.Web.UI.WebControls.Label lblEmpID;
- private const string PARAM_CONID = "ConID";
- 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_CONID];
- if(str!=null)
- {
- int conID = Convert.ToInt16(str,10);
- lblConID.Text = conID.ToString();
- DataTable table = (new EmpSystem()).GetEmpConTB_By_ConID(conID);
- DataRow row = table.Rows[0];
- dropCate.SelectedIndex = -1;
- foreach(ListItem item in dropCate.Items)
- {
- if(item.Text==row[EmpConData.CATETORY_FIELD].ToString())
- item.Selected = true;
- }
- txtFDate.Text = ((DateTime)row[EmpConData.FDATE_FIELD]).ToString("d");
- txtTDate.Text = ((DateTime)row[EmpConData.TDATE_FIELD]).ToString("d");
- txtPosiLevl.Text = row[EmpConData.POSILEVL_FIELD].ToString();
- txtSalaLevl.Text = row[EmpConData.SALALEVL_FIELD].ToString();
- txtAnnSala.Text = row[EmpConData.ANNSALA_FIELD].ToString();
- txtNote.Text = row[EmpConData.CONNOTE_FIELD].ToString();
- lblEmpID.Text = row["EmpID"].ToString();
- dropStatus.SelectedIndex = -1;
- foreach(ListItem item in dropStatus.Items)
- {
- if(item.Text==row[EmpConData.STATUS_FIELD].ToString())
- item.Selected = true;
- }
- }
- else
- {
- lblEmpID.Text = Request.Params["empid"];
- }
- }
- private bool SaveConInf()
- {
- if(this.EmpRightCode >= 3)
- {
- bool result;
- if(lblConID.Text!=string.Empty)
- {
- EmpConData data = new EmpConData();
- DataTable table = data.Tables[EmpConData.EMPCONTACT_TABLE_NAME];
- DataRow row = table.NewRow();
- table.Rows.Add(row);
- table.AcceptChanges();
- row[EmpConData.CONID_FIELD] = Convert.ToInt16(lblConID.Text,10);
- row[EmpConData.FDATE_FIELD] = Convert.ToDateTime(txtFDate.Text);
- row[EmpConData.TDATE_FIELD] = Convert.ToDateTime(txtTDate.Text);
- row[EmpConData.CATETORY_FIELD] = dropCate.SelectedItem.Text;
- row[EmpConData.POSILEVL_FIELD] = txtPosiLevl.Text;
- row[EmpConData.SALALEVL_FIELD] = txtSalaLevl.Text;
- row[EmpConData.ANNSALA_FIELD] = txtAnnSala.Text;
- row[EmpConData.STATUS_FIELD] = dropStatus.SelectedItem.Text;
- row[EmpConData.CONNOTE_FIELD] = txtNote.Text;
- result = (new EmpSystem()).UpdateMrContact(data);
- }
- else
- {
- EmpConData data = new EmpConData();
- DataTable table = data.Tables[EmpConData.EMPCONTACT_TABLE_NAME];
- DataRow row = table.NewRow();
- row[EmpBaseData.EMPID_FIELD] = Convert.ToInt16(lblEmpID.Text);
- row[EmpConData.FDATE_FIELD] = Convert.ToDateTime(txtFDate.Text);
- row[EmpConData.TDATE_FIELD] = Convert.ToDateTime(txtTDate.Text);
- row[EmpConData.CATETORY_FIELD] = dropCate.SelectedItem.Text;
- row[EmpConData.POSILEVL_FIELD] = txtPosiLevl.Text;
- row[EmpConData.SALALEVL_FIELD] = txtSalaLevl.Text;
- row[EmpConData.ANNSALA_FIELD] = txtAnnSala.Text;
- row[EmpConData.STATUS_FIELD] = dropStatus.SelectedItem.Text;
- row[EmpConData.CONNOTE_FIELD] = txtNote.Text;
- table.Rows.Add(row);
- result = (new EmpSystem()).InsertMrContact(data);
- }
- 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(!SaveConInf())
- JScript.Alert("操作失败!");
- else
- Response.Redirect("EmpContInf.aspx?PARAM_EMPID="+lblEmpID.Text,false);
- }
- private void cmdExit_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- Response.Redirect("EmpContInf.aspx?PARAM_EMPID="+lblEmpID.Text,false);
- }
- }
- }