EmpBase.aspx.cs
上传用户:autodoor
上传日期:2022-08-04
资源大小:9973k
文件大小:11k
源码类别:

.net编程

开发平台:

Others

  1. using System;
  2. using System.Collections;
  3. using System.Data;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using qminoa.BLL;
  8. using qminoa.Common;
  9. using qminoa.Common.Data;
  10. namespace qminoa.Webs.MR
  11. {
  12. public class EmpBase : qminoa.Webs.PageBase
  13. {
  14. protected System.Web.UI.WebControls.Label lblFileID;
  15. protected System.Web.UI.WebControls.Label lblErr;
  16. protected System.Web.UI.WebControls.Label lblEmpID;
  17. protected System.Web.UI.WebControls.ValidationSummary valSum;
  18. protected System.Web.UI.WebControls.ImageButton cmdExit;
  19. protected System.Web.UI.WebControls.ImageButton cmdSaveExi;
  20. protected System.Web.UI.WebControls.ImageButton cmdSaveCon;
  21. protected System.Web.UI.WebControls.DropDownList dropPosition;
  22. protected System.Web.UI.WebControls.DropDownList dropDep;
  23. protected System.Web.UI.WebControls.Label Label10;
  24. protected System.Web.UI.WebControls.Label Label8;
  25. protected System.Web.UI.WebControls.DropDownList dropBranch;
  26. protected System.Web.UI.WebControls.LinkButton cmdAddPic;
  27. protected System.Web.UI.WebControls.Label Label14;
  28. protected System.Web.UI.WebControls.RequiredFieldValidator valBranch;
  29. protected System.Web.UI.WebControls.Label Label2;
  30. protected System.Web.UI.WebControls.TextBox txtEmpcode;
  31. protected System.Web.UI.WebControls.Label Label1;
  32. protected System.Web.UI.WebControls.TextBox txtMobile;
  33. protected System.Web.UI.WebControls.TextBox txtOfficefax;
  34. protected System.Web.UI.WebControls.Label Label7;
  35. protected System.Web.UI.WebControls.Label Label6;
  36. protected System.Web.UI.WebControls.TextBox txtOfficetel;
  37. protected System.Web.UI.WebControls.Label Label5;
  38. protected System.Web.UI.WebControls.TextBox txtEmail;
  39. protected System.Web.UI.WebControls.RegularExpressionValidator Re1;
  40. protected System.Web.UI.WebControls.Label Label9;
  41. protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
  42. protected System.Web.UI.WebControls.TextBox txtName;
  43. protected System.Web.UI.WebControls.Label Label3;
  44. protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
  45. protected System.Web.UI.WebControls.Label Label4;
  46. protected System.Web.UI.WebControls.TextBox txtLoginid;
  47. protected System.Web.UI.WebControls.ImageButton cmdMr36;
  48. protected System.Web.UI.WebControls.ImageButton cmdMr35;
  49. protected System.Web.UI.WebControls.ImageButton cmdMr34;
  50. protected System.Web.UI.WebControls.ImageButton cmdMr33;
  51. protected System.Web.UI.WebControls.ImageButton cmdMr32;
  52. protected System.Web.UI.WebControls.ImageButton cmdMR31;
  53. protected System.Web.UI.WebControls.ImageButton cmdMr3;
  54. protected System.Web.UI.HtmlControls.HtmlImage lnkEmpPic;
  55. protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator3;
  56. protected System.Web.UI.WebControls.RadioButtonList EmpSex;
  57. private const string PARAM_EMPID = "EmpID";
  58. private void Page_Load(object sender, System.EventArgs e)
  59. {
  60. this.PageBegin("人员管理",true);
  61. if(!Page.IsPostBack)
  62. {
  63. lblEmpID.Text = Request.QueryString[PARAM_EMPID];
  64. DataBind();
  65. FillPage();
  66. }
  67. }
  68. private void FillPage()
  69. {
  70. if(lblEmpID.Text!=string.Empty)
  71. {
  72. int empID = Convert.ToInt16(lblEmpID.Text,10);
  73. DataTable empTB = (new EmpSystem()).GetEmpTB_By_EmpID(empID);
  74. DataRow row = empTB.Rows[0];
  75. if(row[EmpBaseData.PHOTO_CONTENT_FIELD]!=DBNull.Value)
  76. lnkEmpPic.Src = "./EmpPicDown.aspx?empID="+lblEmpID.Text;
  77. else
  78. lnkEmpPic.Src = "../img/logo2.jpg";
  79. txtLoginid.Text = row[EmpBaseData.LOGINID_FIELD].ToString();
  80. txtName.Text = row[EmpBaseData.EMPNAME_FIELD].ToString();
  81. txtEmail.Text = row[EmpBaseData.EMAIL_FIELD].ToString();
  82. txtOfficetel.Text = row[EmpBaseData.OFFICETEL_FIELD].ToString();
  83. txtOfficefax.Text =row[EmpBaseData.OFFICEFAX_FIELD].ToString();
  84. txtMobile.Text = row[EmpBaseData.MOBILE_FIELD].ToString();
  85. txtEmpcode.Text = row[EmpBaseData.EMPCODE_FIELD].ToString();
  86. EmpSex.Items[Convert.ToInt16(row[EmpBaseData.SEX_FIELD])].Selected = true;
  87. string position = row[EmpBaseData.POSITION_FIELD].ToString();
  88. dropPosition.SelectedIndex = -1;
  89. foreach(ListItem item in dropPosition.Items)
  90. {
  91. if(item.Text == position)
  92. item.Selected =true;
  93. }
  94. int depID = (int)row[DepData.DEPID_FIELD];
  95. DataTable depTB = (new DepSystem()).GetDepTB_By_DepID(depID);
  96. row = depTB.Rows[0];
  97. int branchID = (int)row[DepData.BRANCHID_FIELD];
  98. dropBranch.SelectedIndex = -1;
  99. foreach(ListItem item in dropBranch.Items)
  100. {
  101. if(item.Value == branchID.ToString())
  102. item.Selected = true;
  103. }
  104. dropDep.DataBind();
  105. foreach(ListItem item in dropDep.Items)
  106. {
  107. if(item.Value == depID.ToString())
  108. item.Selected = true;
  109. }
  110. }
  111. }
  112. public DataTable BraTB
  113. {
  114. get
  115. {
  116. DataTable braTB = (new DepSystem()).GetBraTB();
  117. return braTB;
  118. }
  119. }
  120. public DataTable DepTB
  121. {
  122. get
  123. {
  124. int branchID = Convert.ToInt32(dropBranch.SelectedItem.Value,10);
  125. return (new DepSystem()).GetDepTB_By_BranchID(branchID);
  126. }
  127. }
  128. public ArrayList PositionLst
  129. {
  130. get
  131. {
  132. ArrayList array = new ArrayList();
  133. array.Add("");
  134. array.Add("系统工程师");
  135. array.Add("董事长");
  136. array.Add("总经理");
  137. array.Add("副总经理");
  138. array.Add("部门经理");
  139. array.Add("项目经理");
  140. array.Add("程序员");
  141. array.Add("高级程序员");
  142. array.Add("系统分析员");
  143. array.Add("网络工程师");
  144. array.Add("销售助理");
  145. array.Add("销售代表");
  146. array.Add("其它");
  147. return array;
  148. }
  149. }
  150. private void SaveEmpInf()
  151. {
  152. if(lblEmpID.Text ==string.Empty)
  153. {
  154. if(this.EmpRightCode  >= 2)
  155. {
  156. EmpBaseData empData = new EmpBaseData();
  157. DataTable empTB = empData.Tables[EmpBaseData.EMP_TABLE_NAME];
  158. DataRow row = empTB.NewRow();
  159. row[EmpBaseData.LOGINID_FIELD] = txtLoginid.Text.Trim();
  160. row[EmpBaseData.EMPNAME_FIELD] = txtName.Text.Trim();
  161. row[EmpBaseData.PASSWORD_FIELD] = txtLoginid.Text.Trim();
  162. row[EmpBaseData.EMAIL_FIELD] = txtEmail.Text.Trim();
  163. row[EmpBaseData.OFFICETEL_FIELD] = txtOfficetel.Text.Trim();
  164. row[EmpBaseData.OFFICEFAX_FIELD] = txtOfficefax.Text.Trim();
  165. row[EmpBaseData.MOBILE_FIELD] = txtMobile.Text.Trim();
  166. row[EmpBaseData.EMPCODE_FIELD] = txtEmpcode.Text.Trim();
  167. row[EmpBaseData.SEX_FIELD] = Convert.ToBoolean(EmpSex.SelectedIndex);
  168. row[DepData.DEPID_FIELD] = Convert.ToInt16(dropDep.SelectedItem.Value,10);
  169. row[EmpBaseData.POSITION_FIELD] = dropPosition.SelectedItem.Text;
  170. empTB.Rows.Add(row);
  171. int empID = (new EmpSystem()).CreateEmp(empData);
  172. if(empID == 0)
  173. JScript.Alert("新建人员操作失败!");
  174. else
  175. {
  176. lblEmpID.Text = empID.ToString();
  177. JScript.Alert("新建人员操作成功!");
  178. }
  179. }
  180. else
  181. JScript.Alert("您没有权限进行此操作!");
  182. }
  183. else
  184. {
  185. if(this.EmpRightCode  >= 3)
  186. {
  187. EmpBaseData empData = new EmpBaseData();
  188. DataTable empTB = empData.Tables[EmpBaseData.EMP_TABLE_NAME];
  189. DataRow row = empTB.NewRow();
  190. empTB.Rows.Add(row);
  191. empTB.AcceptChanges();
  192. row[EmpBaseData.EMPID_FIELD] = Convert.ToInt16(lblEmpID.Text,10);
  193. row[EmpBaseData.LOGINID_FIELD] = txtLoginid.Text.Trim();
  194. row[EmpBaseData.EMPNAME_FIELD] = txtName.Text.Trim();
  195. row[EmpBaseData.EMAIL_FIELD] = txtEmail.Text.Trim();
  196. row[EmpBaseData.OFFICETEL_FIELD] = txtOfficetel.Text.Trim();
  197. row[EmpBaseData.OFFICEFAX_FIELD] = txtOfficefax.Text.Trim();
  198. row[EmpBaseData.MOBILE_FIELD] = txtMobile.Text.Trim();
  199. row[EmpBaseData.EMPCODE_FIELD] = txtEmpcode.Text.Trim();
  200. row[EmpBaseData.SEX_FIELD] = Convert.ToBoolean(EmpSex.SelectedIndex);
  201. row[EmpBaseData.POSITION_FIELD] = dropPosition.SelectedItem.Text;
  202. row[DepData.DEPID_FIELD] = Convert.ToInt16(dropDep.SelectedItem.Value,10);
  203. if((new EmpSystem()).UpdateEmp(empData))
  204. JScript.Alert("修改人员操作成功!");
  205. else
  206. JScript.Alert("修改人员操作失败!");
  207. }
  208. else
  209. JScript.Alert("您没有权限进行此操作!");
  210. }
  211. }
  212. #region Web Form Designer generated code
  213. override protected void OnInit(EventArgs e)
  214. {
  215. //
  216. // CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
  217. //
  218. InitializeComponent();
  219. base.OnInit(e);
  220. }
  221. /// <summary>
  222. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  223. /// 此方法的内容。
  224. /// </summary>
  225. private void InitializeComponent()
  226. {    
  227. this.cmdSaveCon.Click += new System.Web.UI.ImageClickEventHandler(this.cmdSaveCon_Click);
  228. this.cmdSaveExi.Click += new System.Web.UI.ImageClickEventHandler(this.cmdSaveExi_Click);
  229. this.cmdExit.Click += new System.Web.UI.ImageClickEventHandler(this.cmdExit_Click);
  230. this.cmdMR31.Click += new System.Web.UI.ImageClickEventHandler(this.cmdMR31_Click);
  231. this.cmdMr32.Click += new System.Web.UI.ImageClickEventHandler(this.cmdMr32_Click);
  232. this.cmdMr33.Click += new System.Web.UI.ImageClickEventHandler(this.cmdMr33_Click);
  233. this.cmdMr34.Click += new System.Web.UI.ImageClickEventHandler(this.cmdMr34_Click);
  234. this.cmdMr35.Click += new System.Web.UI.ImageClickEventHandler(this.cmdMr35_Click);
  235. this.cmdMr36.Click += new System.Web.UI.ImageClickEventHandler(this.cmdMr36_Click);
  236. this.cmdAddPic.Click += new System.EventHandler(this.cmdAddPic_Click);
  237. this.dropBranch.SelectedIndexChanged += new System.EventHandler(this.dropBranch_SelectedIndexChanged);
  238. this.Load += new System.EventHandler(this.Page_Load);
  239. }
  240. #endregion
  241. private void cmdSaveCon_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  242. {
  243. SaveEmpInf();
  244. }
  245. private void cmdAddPic_Click(object sender, System.EventArgs e)
  246. {
  247. SaveEmpInf();
  248. Response.Redirect("./EmpPic.aspx?PARAM_EMPID="+lblEmpID.Text.Trim(),false);
  249. }
  250. private void cmdSaveExi_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  251. {
  252. SaveEmpInf();
  253. Response.Redirect("EmpInf.aspx",false);
  254. }
  255. private void cmdExit_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  256. {
  257. Response.Redirect("EmpInf.aspx",false);
  258. }
  259. private void cmdMR31_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  260. {
  261. SaveEmpInf();
  262. Response.Redirect("./EmpPers.aspx?PARAM_EMPID="+lblEmpID.Text.Trim(),false);
  263. }
  264. private void cmdMr32_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  265. {
  266. SaveEmpInf();
  267. Response.Redirect("./EmpWelInf.aspx?PARAM_EMPID="+lblEmpID.Text.Trim(),false);
  268. }
  269. private void cmdMr33_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  270. {
  271. Response.Redirect("EmpEdu.aspx?PARAM_EMPID="+lblEmpID.Text.Trim(),false);
  272. }
  273. private void cmdMr34_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  274. {
  275. Response.Redirect("EmpVisaInf.aspx?PARAM_EMPID="+lblEmpID.Text.Trim(),false);
  276. }
  277. private void dropBranch_SelectedIndexChanged(object sender, System.EventArgs e)
  278. {
  279. dropDep.DataBind();
  280. }
  281. private void cmdMr35_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  282. {
  283. Response.Redirect("EmpArcInf.aspx?PARAM_EMPID="+lblEmpID.Text.Trim(),false);
  284. }
  285. private void cmdMr36_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  286. {
  287. Response.Redirect("EmpContInf.aspx?PARAM_EMPID="+lblEmpID.Text.Trim(),false);
  288. }
  289. }
  290. }