Staff punching and employee attendance sheets

Source: Internet
Author: User

Staff punching and employee attendance sheets

I. Main Interface

 

Using System; using System. collections. generic; using System. componentModel; using System. data; using System. drawing; using System. linq; using System. text; using System. threading. tasks; using System. windows. forms; namespace day03 _ employee attendance information management {public partial class Form1: Form {// Dictionary public Dictionary that records punch history <string, dakalei> recordList = new Dictionary <string, dakalei> (); // used to store the temporary table List <SE> temp = new L Ist <SE> (); public Form1 () {InitializeComponent () ;}// List, used to save the se object public List <SE> programmerList = new List <SE> (); // refresh the public void BindGrid (List <SE> list) {this. dataGridView1.DataSource = new BindingList <SE> (list);} private void xianShi () {programmerList. add (new SE () {ID = "001", Name = "Haha", Age = 20, Sex = "male"}); programmerList. add (new SE () {ID = "002", Name = "Haha", Age = 15, Sex = "female"}); programmerList. add (new SE () {ID = "003", Name = "", Age = 12, Sex = "male "}); dataGridView1.DataSource = new BindingList <SE> (programmerList);} private void FrmMain_Load (object sender, EventArgs e) {xianShi ();} public void chaXun () {// used to store temporary tables // List <SE> temp = new List <SE> (); foreach (SE item in this. programmerList) {if (item. ID. indexOf (this. textBox1.Text. trim ())! =-1) {temp. add (item) ;}} this. dataGridView1.DataSource = new BindingList <SE> (temp);} private void toolStripButton4_Click (object sender, EventArgs e) {} private void Form1_Load (object sender, EventArgs e) {xianShi ();} private void toolstripincluitemclicked (object sender, ToolStripItemClickedEventArgs e) {} private void toolStripLabel2_Click (object sender, EventArgs e) {} // Delete private void toolS TripButton3_Click_1 (object sender, EventArgs e) {DialogResult re = MessageBox. show ("are you sure you want to delete this data?", "prompt", MessageBoxButtons. OKCancel, MessageBoxIcon. error); if (re = DialogResult. OK) {foreach (SE item in this. programmerList) {if (maid [0]. cells [0]. value = item. ID) {programmerList. remove (item); break;} MessageBox. show ("deleted successfully"); this. dataGridView1.DataSource = new BindingLis T <SE> (programmerList) ;}} private void toolStripButton4_Click_1 (object sender, EventArgs e) {daka frm = new daka (); frm. re = this. recordList; frm. show ();} private void button1_Click_1 (object sender, EventArgs e) {this. temp. clear (); chaXun ();} private void toolstripbutton#click (object sender, EventArgs e) {zeng frm = new zeng (); frm. frmParent = this; frm. showDialog ();} private void toolStripB Utton2_Click (object sender, EventArgs e) {}// sign in private void sign in ToolStripMenuItem_Click (object sender, EventArgs e) {if (this. dataGridView1.SelectedRows. Count! = 1) {MessageBox. show ("select a row"); return;} // ensure that the string workID = dataGridView1.SelectedRows [0] has not been signed. cells [0]. value. toString (); foreach (string id in recordList. keys) {if (workID = id) {MessageBox. show ("You have signed"); return ;}// execute the sign-in dakalei re = new dakalei (); re. ID = workID; // re. name = maid. cells ["Column2"]. value. toString (); re. name = maid [0]. cells [1]. value. ToString (); re. signInTime = DateTime. now; // obtain the current system time this. recordList. add (re. ID, re); MessageBox. show ("sign-in successful");} // sign back private void sign back ToolStripMenuItem_Click (object sender, EventArgs e) {if (this. dataGridView1.SelectedRows. count! = 1) {MessageBox. show ("select a row"); return;} string ID = maid [0]. cells [0]. value. toString (); bool isOut = false; // identifies whether foreach (string key in recordList. keys) {if (key = ID) {// execute the Undo sign to set the return time this. recordList [key]. signOutTime = DateTime. now; MessageBox. show (""); isOut = true; break ;}} if (isOut = false) {MessageBox. show ("Sorry, you have not signed in yet! ") ;}} Private void maid cellcontentclick (object sender, DataGridViewCellEventArgs e ){}}}

Using System; using System. collections. generic; using System. componentModel; using System. data; using System. drawing; using System. linq; using System. text; using System. threading. tasks; using System. windows. forms; namespace day03 _ employee attendance information management {public partial class zeng: Form {public Form1 FrmParent {get; set;} public zeng () {InitializeComponent (); // this. comboBox1.SelectedIndex = 0;} private void button#click (object sender, EventArgs e) {try {SE pr = new SE (); pr. ID = this. textBox1.Text. trim (); pr. age = Int32.Parse (this. textBox2.Text. trim (); // age if (this. comboBox1.SelectedItem. toString () = "male") // gender {pr. sex = "male";} else {pr. sex = "female";} pr. name = this. textBox3.Text. trim (); // Add the operator ID to uniquely verify foreach (SE item in FrmParent. programmerList) {if (item. ID = pr. ID) {MessageBox. show ("this employee ID already exists"); return ;}} FrmParent. programmerList. add (pr); this. close ();} catch (Exception ex) {MessageBox. show ("error" + ex. message);} finally {// refresh the parent form this. frmParent. bindGrid (FrmParent. programmerList) ;}} private void xinxiweihu_Load (object sender, EventArgs e) {} private void groupBox1_Enter (object sender, EventArgs e ){}}}

Using System; using System. collections. generic; using System. componentModel; using System. data; using System. drawing; using System. linq; using System. text; using System. threading. tasks; using System. windows. forms; namespace day03 _ employee attendance information management {public partial class daka: Form {public Dictionary <string, dakalei> re {get; set;} public daka () {InitializeComponent ();} private void dakajilu_Load (object sender, EventArgs e) {BindRecords ();} public void BindRecords () {BindingSource bs = new BindingSource (); bs. dataSource = re. values; this. dataGridView1.DataSource = bs;} private void maid cellcontentclick (object sender, DataGridViewCellEventArgs e) {} private void maid cellcontentclick_1 (object sender, DataGridViewCellEventArgs e ){}}}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.