private void ViewdataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { String ConnString = ConfigurationManager.ConnectionStrings["PayrollConn"].ConnectionString; SqlConnection Conn = new SqlConnection(ConnString); try { String ID = ViewdataGridView[2, e.RowIndex].Value.ToString(); SqlCommand cmd = new SqlCommand("SP_EmployeeExitTime", Conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Emp_ID", ID); cmd.Parameters.AddWithValue("@ExitTime", DateTime.Now.ToString()); Conn.Open(); cmd.ExecuteNonQuery(); ViewdataGridView[0, e.RowIndex].Value = "Exit"; MyConnectionMethods.NoDayUpdate(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { Conn.Close(); } }
public void SearchAtt() { try { String ConnString = ConfigurationManager.ConnectionStrings["PayrollConn"].ConnectionString; SqlConnection conn = new SqlConnection(ConnString); using (conn) { SqlCommand cmds = new SqlCommand("SP_getEmployeeAttendance", conn); cmds.CommandType = CommandType.StoredProcedure; cmds.Parameters.Add("@ID", SqlDbType.VarChar).Value = IDTB.Text; cmds.Parameters.AddWithValue("@Month", GetSelected.Month(DT.Month)); cmds.Parameters.AddWithValue("@Year", DT.Year); SqlDataAdapter sda = new SqlDataAdapter(cmds); DataTable dt = new DataTable(); sda.Fill(dt); ViewdataGridView.DataSource = dt; GetData = dt; } MyConnectionMethods.NoDayUpdate(); } catch (Exception) { } }
private void AttendanceForm_Load(object sender, EventArgs e) { MyConnectionMethods.NoDayUpdate(); StartTimePicker.Value = DateTime.Now; EndTimePicker.Value = DateTime.Now; if (EmployeeID != "") { IDTB.Text = EmployeeID; groupBox2.Hide(); } SearchAtt(); }
private void EmployeeExitFormRec_Load(object sender, EventArgs e) { MyConnectionMethods.NoDayUpdate(); SearchEmp(); }