示例#1
0
 public static Attencence GetAttencenceByID(int id)
 {
     Attencence attencence = new Attencence();
     SqlAttencenceProvider sqlAttencenceProvider = new SqlAttencenceProvider();
     attencence = sqlAttencenceProvider.GetAttencenceByID(id);
     return attencence;
 }
示例#2
0
 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;
     }
 }
示例#3
0
    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;
        }
    }
示例#4
0
 public static bool UpdateAttencence(Attencence attencence)
 {
     SqlAttencenceProvider sqlAttencenceProvider = new SqlAttencenceProvider();
     return sqlAttencenceProvider.UpdateAttencence(attencence);
 }
示例#5
0
 public static int InsertAttencence(Attencence attencence)
 {
     SqlAttencenceProvider sqlAttencenceProvider = new SqlAttencenceProvider();
     return sqlAttencenceProvider.InsertAttencence(attencence);
 }