public M_RoomActiveJoin GetModelFromReader(DbDataReader rdr) { M_RoomActiveJoin model = new M_RoomActiveJoin(); model.ID = Convert.ToInt32(rdr["ID"]); model.ActiveID = Convert.ToInt32(rdr["ActiveID"]); model.UserID = Convert.ToInt32(rdr["UserID"]); model.UserName = rdr["UserName"].ToString(); model.AddTime = Convert.ToDateTime(rdr["AddTime"]); rdr.Close(); rdr.Dispose(); return(model); }
public SqlParameter[] GetParameters(M_RoomActiveJoin model) { string[,] strArr = FieldList(); SqlParameter[] sp = new SqlParameter[strArr.Length]; for (int i = 0; i < strArr.GetLength(0); i++) { sp[i] = new SqlParameter("@" + strArr[i, 0], (SqlDbType)Enum.Parse(typeof(SqlDbType), strArr[i, 1]), Convert.ToInt32(strArr[i, 2])); } sp[0].Value = model.ID; sp[1].Value = model.ActiveID; sp[2].Value = model.UserID; sp[3].Value = model.UserName; sp[4].Value = model.AddTime; return(sp); }