PunishmentManage.cs
Upload User: hjieqiu
Upload Date: 2013-05-11
Package Size: 16494k
Code Size: 26k
Development Platform:

C#

  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. namespace 人力资源管理系统
  7. {
  8. /// <summary>
  9. /// PunishmentManage 的摘要说明。
  10. /// </summary>
  11. public class PunishmentManage : System.Windows.Forms.Form
  12. {
  13. private CurrencyManager cmManage;
  14. private System.Windows.Forms.GroupBox groupBox1;
  15. private System.Windows.Forms.TextBox txt1;
  16. private System.Windows.Forms.TextBox txt2;
  17. private System.Windows.Forms.TextBox txt3;
  18. private System.Windows.Forms.Label label3;
  19. private System.Windows.Forms.Label label4;
  20. private System.Windows.Forms.Label label5;
  21. private System.Windows.Forms.Label label6;
  22. private System.Windows.Forms.Label label7;
  23. private System.Windows.Forms.Label label8;
  24. private System.Windows.Forms.Label label18;
  25. private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
  26. private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
  27. private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
  28. private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
  29. private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
  30. private System.Data.SqlClient.SqlConnection sqlConnection1;
  31. private System.Windows.Forms.TextBox txt7;
  32. private System.Windows.Forms.TextBox txt6;
  33. private System.Windows.Forms.TextBox txt5;
  34. private System.Windows.Forms.TextBox txt4;
  35. private 人力资源管理系统.DataSet1 dataSet11;
  36. private System.Windows.Forms.ToolBarButton toolBarFirst;
  37. private System.Windows.Forms.ToolBarButton toolBarPre;
  38. private System.Windows.Forms.ToolBarButton toolBarNext;
  39. private System.Windows.Forms.ToolBarButton toolBarLast;
  40. private System.Windows.Forms.ToolBarButton tbarBtnNew;
  41. private System.Windows.Forms.ToolBarButton tbarBtnDelete;
  42. private System.Windows.Forms.ToolBarButton toolBarSubmit;
  43. private System.Windows.Forms.ToolBar toolBar;
  44. private System.Windows.Forms.ToolBarButton toolBarCancel;
  45. private System.Windows.Forms.ToolBarButton toolBarQuit;
  46. private System.Windows.Forms.ImageList imageList1;
  47. private System.ComponentModel.IContainer components;
  48. public PunishmentManage()
  49. {
  50. //
  51. // Windows 窗体设计器支持所必需的
  52. //
  53. InitializeComponent();
  54. //
  55. // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
  56. //
  57. }
  58. /// <summary>
  59. /// 清理所有正在使用的资源。
  60. /// </summary>
  61. protected override void Dispose( bool disposing )
  62. {
  63. if( disposing )
  64. {
  65. if(components != null)
  66. {
  67. components.Dispose();
  68. }
  69. }
  70. base.Dispose( disposing );
  71. }
  72. #region Windows 窗体设计器生成的代码
  73. /// <summary>
  74. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  75. /// 此方法的内容。
  76. /// </summary>
  77. private void InitializeComponent()
  78. {
  79. this.components = new System.ComponentModel.Container();
  80. System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(PunishmentManage));
  81. this.groupBox1 = new System.Windows.Forms.GroupBox();
  82. this.txt7 = new System.Windows.Forms.TextBox();
  83. this.dataSet11 = new 人力资源管理系统.DataSet1();
  84. this.txt6 = new System.Windows.Forms.TextBox();
  85. this.txt1 = new System.Windows.Forms.TextBox();
  86. this.txt2 = new System.Windows.Forms.TextBox();
  87. this.txt5 = new System.Windows.Forms.TextBox();
  88. this.txt3 = new System.Windows.Forms.TextBox();
  89. this.txt4 = new System.Windows.Forms.TextBox();
  90. this.label3 = new System.Windows.Forms.Label();
  91. this.label4 = new System.Windows.Forms.Label();
  92. this.label5 = new System.Windows.Forms.Label();
  93. this.label6 = new System.Windows.Forms.Label();
  94. this.label7 = new System.Windows.Forms.Label();
  95. this.label8 = new System.Windows.Forms.Label();
  96. this.label18 = new System.Windows.Forms.Label();
  97. this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
  98. this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
  99. this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
  100. this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
  101. this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
  102. this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
  103. this.toolBar = new System.Windows.Forms.ToolBar();
  104. this.toolBarFirst = new System.Windows.Forms.ToolBarButton();
  105. this.toolBarPre = new System.Windows.Forms.ToolBarButton();
  106. this.toolBarNext = new System.Windows.Forms.ToolBarButton();
  107. this.toolBarLast = new System.Windows.Forms.ToolBarButton();
  108. this.tbarBtnNew = new System.Windows.Forms.ToolBarButton();
  109. this.tbarBtnDelete = new System.Windows.Forms.ToolBarButton();
  110. this.toolBarSubmit = new System.Windows.Forms.ToolBarButton();
  111. this.toolBarCancel = new System.Windows.Forms.ToolBarButton();
  112. this.toolBarQuit = new System.Windows.Forms.ToolBarButton();
  113. this.imageList1 = new System.Windows.Forms.ImageList(this.components);
  114. this.groupBox1.SuspendLayout();
  115. ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
  116. this.SuspendLayout();
  117. // 
  118. // groupBox1
  119. // 
  120. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
  121. | System.Windows.Forms.AnchorStyles.Right)));
  122. this.groupBox1.Controls.Add(this.txt7);
  123. this.groupBox1.Controls.Add(this.txt6);
  124. this.groupBox1.Controls.Add(this.txt1);
  125. this.groupBox1.Controls.Add(this.txt2);
  126. this.groupBox1.Controls.Add(this.txt5);
  127. this.groupBox1.Controls.Add(this.txt3);
  128. this.groupBox1.Controls.Add(this.txt4);
  129. this.groupBox1.Controls.Add(this.label3);
  130. this.groupBox1.Controls.Add(this.label4);
  131. this.groupBox1.Controls.Add(this.label5);
  132. this.groupBox1.Controls.Add(this.label6);
  133. this.groupBox1.Controls.Add(this.label7);
  134. this.groupBox1.Controls.Add(this.label8);
  135. this.groupBox1.Controls.Add(this.label18);
  136. this.groupBox1.Location = new System.Drawing.Point(0, 46);
  137. this.groupBox1.Name = "groupBox1";
  138. this.groupBox1.Size = new System.Drawing.Size(528, 250);
  139. this.groupBox1.TabIndex = 5;
  140. this.groupBox1.TabStop = false;
  141. // 
  142. // txt7
  143. // 
  144. this.txt7.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "职员惩罚表.部门意见"));
  145. this.txt7.Location = new System.Drawing.Point(312, 192);
  146. this.txt7.Name = "txt7";
  147. this.txt7.Size = new System.Drawing.Size(192, 21);
  148. this.txt7.TabIndex = 6;
  149. this.txt7.Text = "";
  150. // 
  151. // dataSet11
  152. // 
  153. this.dataSet11.DataSetName = "DataSet1";
  154. this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN");
  155. // 
  156. // txt6
  157. // 
  158. this.txt6.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "职员惩罚表.惩罚原因"));
  159. this.txt6.Location = new System.Drawing.Point(40, 192);
  160. this.txt6.Name = "txt6";
  161. this.txt6.Size = new System.Drawing.Size(232, 21);
  162. this.txt6.TabIndex = 5;
  163. this.txt6.Text = "";
  164. // 
  165. // txt1
  166. // 
  167. this.txt1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "职员惩罚表.职员编号"));
  168. this.txt1.Location = new System.Drawing.Point(40, 72);
  169. this.txt1.Name = "txt1";
  170. this.txt1.Size = new System.Drawing.Size(88, 21);
  171. this.txt1.TabIndex = 0;
  172. this.txt1.Text = "";
  173. // 
  174. // txt2
  175. // 
  176. this.txt2.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "职员惩罚表.惩罚类型"));
  177. this.txt2.Location = new System.Drawing.Point(144, 72);
  178. this.txt2.Name = "txt2";
  179. this.txt2.Size = new System.Drawing.Size(356, 21);
  180. this.txt2.TabIndex = 1;
  181. this.txt2.Text = "";
  182. // 
  183. // txt5
  184. // 
  185. this.txt5.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "职员惩罚表.是否计入工资"));
  186. this.txt5.Location = new System.Drawing.Point(400, 136);
  187. this.txt5.Name = "txt5";
  188. this.txt5.Size = new System.Drawing.Size(104, 21);
  189. this.txt5.TabIndex = 4;
  190. this.txt5.Text = "";
  191. // 
  192. // txt3
  193. // 
  194. this.txt3.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "职员惩罚表.惩罚金额"));
  195. this.txt3.Location = new System.Drawing.Point(40, 136);
  196. this.txt3.Name = "txt3";
  197. this.txt3.Size = new System.Drawing.Size(136, 21);
  198. this.txt3.TabIndex = 2;
  199. this.txt3.Text = "";
  200. // 
  201. // txt4
  202. // 
  203. this.txt4.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "职员惩罚表.惩罚日期"));
  204. this.txt4.Location = new System.Drawing.Point(192, 136);
  205. this.txt4.Name = "txt4";
  206. this.txt4.Size = new System.Drawing.Size(192, 21);
  207. this.txt4.TabIndex = 3;
  208. this.txt4.Text = "";
  209. // 
  210. // label3
  211. // 
  212. this.label3.Location = new System.Drawing.Point(400, 112);
  213. this.label3.Name = "label3";
  214. this.label3.Size = new System.Drawing.Size(88, 16);
  215. this.label3.TabIndex = 19;
  216. this.label3.Text = "是否记入工资";
  217. // 
  218. // label4
  219. // 
  220. this.label4.Location = new System.Drawing.Point(40, 168);
  221. this.label4.Name = "label4";
  222. this.label4.Size = new System.Drawing.Size(64, 16);
  223. this.label4.TabIndex = 19;
  224. this.label4.Text = "惩罚原因";
  225. // 
  226. // label5
  227. // 
  228. this.label5.Location = new System.Drawing.Point(312, 168);
  229. this.label5.Name = "label5";
  230. this.label5.Size = new System.Drawing.Size(64, 16);
  231. this.label5.TabIndex = 19;
  232. this.label5.Text = "部门意见";
  233. // 
  234. // label6
  235. // 
  236. this.label6.Location = new System.Drawing.Point(144, 48);
  237. this.label6.Name = "label6";
  238. this.label6.Size = new System.Drawing.Size(64, 16);
  239. this.label6.TabIndex = 19;
  240. this.label6.Text = "惩罚类型";
  241. // 
  242. // label7
  243. // 
  244. this.label7.Location = new System.Drawing.Point(192, 112);
  245. this.label7.Name = "label7";
  246. this.label7.Size = new System.Drawing.Size(64, 16);
  247. this.label7.TabIndex = 19;
  248. this.label7.Text = "惩罚日期";
  249. // 
  250. // label8
  251. // 
  252. this.label8.Location = new System.Drawing.Point(40, 48);
  253. this.label8.Name = "label8";
  254. this.label8.Size = new System.Drawing.Size(64, 16);
  255. this.label8.TabIndex = 19;
  256. this.label8.Text = "职员编号";
  257. // 
  258. // label18
  259. // 
  260. this.label18.Location = new System.Drawing.Point(40, 112);
  261. this.label18.Name = "label18";
  262. this.label18.Size = new System.Drawing.Size(64, 16);
  263. this.label18.TabIndex = 19;
  264. this.label18.Text = "惩罚金额";
  265. // 
  266. // sqlDataAdapter1
  267. // 
  268. this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1;
  269. this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
  270. this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
  271. this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
  272.   new System.Data.Common.DataTableMapping("Table", "职员惩罚表", new System.Data.Common.DataColumnMapping[] {
  273.    new System.Data.Common.DataColumnMapping("序号", "序号"),
  274.    new System.Data.Common.DataColumnMapping("职员编号", "职员编号"),
  275.    new System.Data.Common.DataColumnMapping("惩罚类型", "惩罚类型"),
  276.    new System.Data.Common.DataColumnMapping("惩罚金额", "惩罚金额"),
  277.    new System.Data.Common.DataColumnMapping("是否计入工资", "是否计入工资"),
  278.    new System.Data.Common.DataColumnMapping("惩罚原因", "惩罚原因"),
  279.    new System.Data.Common.DataColumnMapping("部门意见", "部门意见"),
  280.    new System.Data.Common.DataColumnMapping("惩罚日期", "惩罚日期")})});
  281. this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1;
  282. // 
  283. // sqlDeleteCommand1
  284. // 
  285. this.sqlDeleteCommand1.CommandText = @"DELETE FROM 职员惩罚表 WHERE (序号 = @Original_序号) AND (惩罚原因 = @Original_惩罚原因 OR @Original_惩罚原因 IS NULL AND 惩罚原因 IS NULL) AND (惩罚日期 = @Original_惩罚日期 OR @Original_惩罚日期 IS NULL AND 惩罚日期 IS NULL) AND (惩罚类型 = @Original_惩罚类型 OR @Original_惩罚类型 IS NULL AND 惩罚类型 IS NULL) AND (惩罚金额 = @Original_惩罚金额 OR @Original_惩罚金额 IS NULL AND 惩罚金额 IS NULL) AND (是否计入工资 = @Original_是否计入工资 OR @Original_是否计入工资 IS NULL AND 是否计入工资 IS NULL) AND (职员编号 = @Original_职员编号) AND (部门意见 = @Original_部门意见 OR @Original_部门意见 IS NULL AND 部门意见 IS NULL)";
  286. this.sqlDeleteCommand1.Connection = this.sqlConnection1;
  287. this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_序号", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "序号", System.Data.DataRowVersion.Original, null));
  288. this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_惩罚原因", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "惩罚原因", System.Data.DataRowVersion.Original, null));
  289. this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_惩罚日期", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "惩罚日期", System.Data.DataRowVersion.Original, null));
  290. this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_惩罚类型", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "惩罚类型", System.Data.DataRowVersion.Original, null));
  291. this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_惩罚金额", System.Data.SqlDbType.Float, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "惩罚金额", System.Data.DataRowVersion.Original, null));
  292. this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_是否计入工资", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "是否计入工资", System.Data.DataRowVersion.Original, null));
  293. this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_职员编号", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "职员编号", System.Data.DataRowVersion.Original, null));
  294. this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_部门意见", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "部门意见", System.Data.DataRowVersion.Original, null));
  295. // 
  296. // sqlConnection1
  297. // 
  298. this.sqlConnection1.ConnectionString = "workstation id=localhost;Integrated Security=SSPI;Database=hrmbook;";
  299. // 
  300. // sqlInsertCommand1
  301. // 
  302. this.sqlInsertCommand1.CommandText = "INSERT INTO 职员惩罚表(职员编号, 惩罚类型, 惩罚金额, 是否计入工资, 惩罚原因, 部门意见, 惩罚日期) VALUES (@职员编号, @惩罚类" +
  303. "型, @惩罚金额, @是否计入工资, @惩罚原因, @部门意见, @惩罚日期); SELECT 序号, 职员编号, 惩罚类型, 惩罚金额, 是否计入工资, 惩罚" +
  304. "原因, 部门意见, 惩罚日期 FROM 职员惩罚表 WHERE (序号 = @@IDENTITY)";
  305. this.sqlInsertCommand1.Connection = this.sqlConnection1;
  306. this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@职员编号", System.Data.SqlDbType.VarChar, 30, "职员编号"));
  307. this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@惩罚类型", System.Data.SqlDbType.VarChar, 20, "惩罚类型"));
  308. this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@惩罚金额", System.Data.SqlDbType.Float, 8, "惩罚金额"));
  309. this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@是否计入工资", System.Data.SqlDbType.VarChar, 10, "是否计入工资"));
  310. this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@惩罚原因", System.Data.SqlDbType.VarChar, 50, "惩罚原因"));
  311. this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@部门意见", System.Data.SqlDbType.VarChar, 100, "部门意见"));
  312. this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@惩罚日期", System.Data.SqlDbType.Int, 4, "惩罚日期"));
  313. // 
  314. // sqlSelectCommand1
  315. // 
  316. this.sqlSelectCommand1.CommandText = "SELECT 序号, 职员编号, 惩罚类型, 惩罚金额, 是否计入工资, 惩罚原因, 部门意见, 惩罚日期 FROM 职员惩罚表";
  317. this.sqlSelectCommand1.Connection = this.sqlConnection1;
  318. // 
  319. // sqlUpdateCommand1
  320. // 
  321. this.sqlUpdateCommand1.CommandText = @"UPDATE 职员惩罚表 SET 职员编号 = @职员编号, 惩罚类型 = @惩罚类型, 惩罚金额 = @惩罚金额, 是否计入工资 = @是否计入工资, 惩罚原因 = @惩罚原因, 部门意见 = @部门意见, 惩罚日期 = @惩罚日期 WHERE (序号 = @Original_序号) AND (惩罚原因 = @Original_惩罚原因 OR @Original_惩罚原因 IS NULL AND 惩罚原因 IS NULL) AND (惩罚日期 = @Original_惩罚日期 OR @Original_惩罚日期 IS NULL AND 惩罚日期 IS NULL) AND (惩罚类型 = @Original_惩罚类型 OR @Original_惩罚类型 IS NULL AND 惩罚类型 IS NULL) AND (惩罚金额 = @Original_惩罚金额 OR @Original_惩罚金额 IS NULL AND 惩罚金额 IS NULL) AND (是否计入工资 = @Original_是否计入工资 OR @Original_是否计入工资 IS NULL AND 是否计入工资 IS NULL) AND (职员编号 = @Original_职员编号) AND (部门意见 = @Original_部门意见 OR @Original_部门意见 IS NULL AND 部门意见 IS NULL); SELECT 序号, 职员编号, 惩罚类型, 惩罚金额, 是否计入工资, 惩罚原因, 部门意见, 惩罚日期 FROM 职员惩罚表 WHERE (序号 = @序号)";
  322. this.sqlUpdateCommand1.Connection = this.sqlConnection1;
  323. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@职员编号", System.Data.SqlDbType.VarChar, 30, "职员编号"));
  324. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@惩罚类型", System.Data.SqlDbType.VarChar, 20, "惩罚类型"));
  325. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@惩罚金额", System.Data.SqlDbType.Float, 8, "惩罚金额"));
  326. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@是否计入工资", System.Data.SqlDbType.VarChar, 10, "是否计入工资"));
  327. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@惩罚原因", System.Data.SqlDbType.VarChar, 50, "惩罚原因"));
  328. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@部门意见", System.Data.SqlDbType.VarChar, 100, "部门意见"));
  329. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@惩罚日期", System.Data.SqlDbType.Int, 4, "惩罚日期"));
  330. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_序号", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "序号", System.Data.DataRowVersion.Original, null));
  331. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_惩罚原因", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "惩罚原因", System.Data.DataRowVersion.Original, null));
  332. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_惩罚日期", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "惩罚日期", System.Data.DataRowVersion.Original, null));
  333. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_惩罚类型", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "惩罚类型", System.Data.DataRowVersion.Original, null));
  334. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_惩罚金额", System.Data.SqlDbType.Float, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "惩罚金额", System.Data.DataRowVersion.Original, null));
  335. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_是否计入工资", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "是否计入工资", System.Data.DataRowVersion.Original, null));
  336. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_职员编号", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "职员编号", System.Data.DataRowVersion.Original, null));
  337. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_部门意见", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "部门意见", System.Data.DataRowVersion.Original, null));
  338. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@序号", System.Data.SqlDbType.Int, 4, "序号"));
  339. // 
  340. // toolBar
  341. // 
  342. this.toolBar.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
  343.    this.toolBarFirst,
  344.    this.toolBarPre,
  345.    this.toolBarNext,
  346.    this.toolBarLast,
  347.    this.tbarBtnNew,
  348.    this.tbarBtnDelete,
  349.    this.toolBarSubmit,
  350.    this.toolBarCancel,
  351.    this.toolBarQuit});
  352. this.toolBar.DropDownArrows = true;
  353. this.toolBar.ImageList = this.imageList1;
  354. this.toolBar.Location = new System.Drawing.Point(0, 0);
  355. this.toolBar.Name = "toolBar";
  356. this.toolBar.ShowToolTips = true;
  357. this.toolBar.Size = new System.Drawing.Size(528, 41);
  358. this.toolBar.TabIndex = 26;
  359. this.toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_ButtonClick);
  360. // 
  361. // toolBarFirst
  362. // 
  363. this.toolBarFirst.ImageIndex = 0;
  364. this.toolBarFirst.Text = "首记录";
  365. this.toolBarFirst.ToolTipText = "首记录";
  366. // 
  367. // toolBarPre
  368. // 
  369. this.toolBarPre.ImageIndex = 1;
  370. this.toolBarPre.Text = "上一记录";
  371. this.toolBarPre.ToolTipText = "上一记录";
  372. // 
  373. // toolBarNext
  374. // 
  375. this.toolBarNext.ImageIndex = 2;
  376. this.toolBarNext.Text = "下一记录";
  377. this.toolBarNext.ToolTipText = "下一记录";
  378. // 
  379. // toolBarLast
  380. // 
  381. this.toolBarLast.ImageIndex = 3;
  382. this.toolBarLast.Text = "尾记录";
  383. this.toolBarLast.ToolTipText = "尾记录";
  384. // 
  385. // tbarBtnNew
  386. // 
  387. this.tbarBtnNew.ImageIndex = 4;
  388. this.tbarBtnNew.Text = "新增记录";
  389. this.tbarBtnNew.ToolTipText = "新增记录";
  390. // 
  391. // tbarBtnDelete
  392. // 
  393. this.tbarBtnDelete.ImageIndex = 5;
  394. this.tbarBtnDelete.Text = "删除记录";
  395. this.tbarBtnDelete.ToolTipText = "删除记录";
  396. // 
  397. // toolBarSubmit
  398. // 
  399. this.toolBarSubmit.ImageIndex = 6;
  400. this.toolBarSubmit.Text = "提交修改";
  401. this.toolBarSubmit.ToolTipText = "提交修改";
  402. // 
  403. // toolBarCancel
  404. // 
  405. this.toolBarCancel.ImageIndex = 7;
  406. this.toolBarCancel.Text = "取消修改";
  407. this.toolBarCancel.ToolTipText = "取消修改";
  408. // 
  409. // toolBarQuit
  410. // 
  411. this.toolBarQuit.ImageIndex = 8;
  412. this.toolBarQuit.Text = "退出";
  413. this.toolBarQuit.ToolTipText = "退出";
  414. // 
  415. // imageList1
  416. // 
  417. this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
  418. this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
  419. this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
  420. // 
  421. // PunishmentManage
  422. // 
  423. this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
  424. this.ClientSize = new System.Drawing.Size(528, 357);
  425. this.Controls.Add(this.toolBar);
  426. this.Controls.Add(this.groupBox1);
  427. this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
  428. this.Name = "PunishmentManage";
  429. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  430. this.Text = "【职员惩罚管理】";
  431. this.Load += new System.EventHandler(this.PunishmentManage_Load);
  432. this.groupBox1.ResumeLayout(false);
  433. ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();
  434. this.ResumeLayout(false);
  435. }
  436. #endregion
  437. //--------------------初始化窗体,读入数据------------------
  438. private void PunishmentManage_Load(object sender, System.EventArgs e)
  439. {
  440. this.sqlDataAdapter1.Fill(this.dataSet11.职员惩罚表);
  441. cmManage = (CurrencyManager) BindingContext[this.dataSet11,"职员惩罚表"];
  442. }
  443. //------------------处理数据导航条和新增修改等事务---------------------
  444. private void toolBar_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
  445. {
  446. if (e.Button.ToolTipText == "首记录")
  447. {
  448. cmManage.Position = 0;
  449. return;
  450. }
  451. if (e.Button.ToolTipText == "上一记录")
  452. {
  453. if (cmManage.Position > 0)
  454. cmManage.Position--;
  455. return;
  456. }
  457. if (e.Button.ToolTipText == "下一记录")
  458. {
  459. if (cmManage.Position < cmManage.Count-1)
  460. cmManage.Position++;
  461. return;
  462. }
  463. if (e.Button.ToolTipText == "尾记录")
  464. {
  465. cmManage.Position = cmManage.Count-1;
  466. return;
  467. }
  468. if (e.Button.ToolTipText == "新增记录")
  469. {
  470. cmManage.AddNew();
  471. return;
  472. }
  473. if (e.Button.ToolTipText == "删除记录")
  474. {
  475. if (MessageBox.Show("      确实要删除这条记录吗?","询问",MessageBoxButtons.YesNo) == DialogResult.Yes)
  476. {
  477. if (cmManage.Count > 0)
  478. cmManage.RemoveAt(cmManage.Position);
  479. else
  480. {
  481. MessageBox.Show("没有可以删除的数据","提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
  482. }
  483. return;
  484. }
  485. }
  486. if (e.Button.ToolTipText == "提交修改")
  487. {
  488. if (this.txt1.Text.Trim() == "")
  489. {
  490. MessageBox.Show("职员编号不能为空!","提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
  491. return;
  492. }
  493. cmManage.EndCurrentEdit();
  494. if (this.dataSet11.职员惩罚表.GetChanges() != null)
  495. {
  496. try
  497. {
  498. this.sqlDataAdapter1.Update(this.dataSet11.职员惩罚表);
  499. }
  500. catch(Exception express)
  501. {
  502. MessageBox.Show(express.ToString(),"提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
  503. }
  504. }
  505. return;
  506. }
  507. if (e.Button.ToolTipText == "取消修改")
  508. {
  509. try
  510. {
  511. cmManage.CancelCurrentEdit();  //取消编辑
  512. }
  513. catch(Exception express)
  514. {
  515. MessageBox.Show(express.ToString(),"提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
  516. }
  517. return;
  518. }
  519. if (e.Button.ToolTipText == "退出")
  520. {
  521. this.Close();
  522. }
  523. }
  524. }
  525. }