public int Update_Att(Atten_Details att) { SqlConnection connection = new SqlConnection(cls.setConnectionString()); connection.Open(); String selectStr = "UPDATE Att_Details SET Emp_Id = @emp_Id,Date_Time=@date,Status=@status WHERE (Att_Id = '" + att.ATTID + "')"; SqlCommand command = new SqlCommand(selectStr, connection); command.CommandType = CommandType.Text; try { command.Parameters.AddWithValue("@emp_Id", att.EMPID); command.Parameters.AddWithValue("@date", att.DATETIME); command.Parameters.AddWithValue("@status", att.STATUS); return(command.ExecuteNonQuery()); } catch (Exception) { throw; } finally { command.Dispose(); connection.Close(); } }
public void Find(Atten_Details a_id) { SqlConnection connection = new SqlConnection(cls.setConnectionString()); connection.Open(); SqlCommand command = new SqlCommand("SELECT max(Att_Id) FROM Att_Details", connection); command.CommandType = CommandType.Text; try { SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { //MessageBox.Show("Employee ID already exists", "Exists", MessageBoxButtons.OK, MessageBoxIcon.Warning); } // return } catch (Exception) { throw; } finally { command.Dispose(); connection.Close(); } }
public int Insert(Atten_Details att_det) { SqlConnection connection = new SqlConnection(cls.setConnectionString()); connection.Open(); SqlCommand command = new SqlCommand("INSERT INTO Att_Details VALUES(@attid,@Emp_Id,@DateTime,@Status)", connection); command.CommandType = CommandType.Text; try { command.Parameters.AddWithValue("@attid", att_det.ATTID); command.Parameters.AddWithValue("@Emp_Id", att_det.EMPID); command.Parameters.AddWithValue("@DateTime", att_det.DATETIME); command.Parameters.AddWithValue("@Status", att_det.STATUS); return(command.ExecuteNonQuery()); } catch (Exception) { throw; } finally { command.Dispose(); connection.Close(); } }
public int Delete_Att(Atten_Details at) { SqlConnection connection = new SqlConnection(cls.setConnectionString()); connection.Open(); String selectStr = "DELETE FROM Att_Details WHERE (Att_Id = @att)"; SqlCommand command = new SqlCommand(selectStr, connection); command.CommandType = CommandType.Text; try { command.Parameters.AddWithValue("@att", at.ATTID); return(command.ExecuteNonQuery()); } catch (Exception) { throw; } finally { command.Dispose(); connection.Close(); } }
public int Insert(Atten_Details att_det) { AttenDAL ADAL = new AttenDAL(); try { return(ADAL.Insert(att_det)); } catch (Exception) { throw; } finally { //att_det = null; } }
public int Delete_leave(Atten_Details att) { AttenDAL ADDAL = new AttenDAL(); try { return(ADDAL.Delete_Att(att)); } catch (Exception) { throw; } finally { att = null; } }
public int Upate_Att(Atten_Details att_det) { AttenDAL ADAL = new AttenDAL(); try { return(ADAL.Update_Att(att_det)); } catch (Exception) { throw; } finally { att_det = null; } }