public static Attencence GetAttencenceByID(int id) { Attencence attencence = new Attencence(); SqlAttencenceProvider sqlAttencenceProvider = new SqlAttencenceProvider(); attencence = sqlAttencenceProvider.GetAttencenceByID(id); return attencence; }
public Attencence GetAttencenceFromReader(IDataReader reader) { try { Attencence attencence = new Attencence ( (int)reader["AttencenceID"], reader["UserID"].ToString(), (DateTime)reader["InOutTime"], reader["ExtraField1"].ToString(), reader["ExtraFileld2"].ToString() ); return attencence; } catch(Exception ex) { return null; } }
public bool UpdateAttencence(Attencence attencence) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("Cucwebappdb_UpdateAttencence", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@AttencenceID", SqlDbType.Int).Value = attencence.AttencenceID; cmd.Parameters.Add("@UserID", SqlDbType.UniqueIdentifier).Value = attencence.UserID; cmd.Parameters.Add("@InOutTime", SqlDbType.DateTime).Value = attencence.InOutTime; cmd.Parameters.Add("@ExtraField1", SqlDbType.NVarChar).Value = attencence.ExtraField1; cmd.Parameters.Add("@ExtraFileld2", SqlDbType.NVarChar).Value = attencence.ExtraFileld2; connection.Open(); int result = cmd.ExecuteNonQuery(); return result == 1; } }
public static bool UpdateAttencence(Attencence attencence) { SqlAttencenceProvider sqlAttencenceProvider = new SqlAttencenceProvider(); return sqlAttencenceProvider.UpdateAttencence(attencence); }
public static int InsertAttencence(Attencence attencence) { SqlAttencenceProvider sqlAttencenceProvider = new SqlAttencenceProvider(); return sqlAttencenceProvider.InsertAttencence(attencence); }