public M_RoomNotify GetModelFromReader(DbDataReader rdr) { M_RoomNotify model = new M_RoomNotify(); model.ID = Convert.ToInt32(rdr["ID"]); model.NotifyTitle = rdr["SendID"].ToString(); model.NotifyContext = rdr["InceptID"].ToString(); model.AddTime = Convert.ToDateTime(rdr["Mcontent"]); model.RoomID = Convert.ToInt32(rdr["RestoreID"]); model.UserID = Convert.ToInt32(rdr["State"]); rdr.Close(); rdr.Dispose(); return(model); }
public SqlParameter[] GetParameters(M_RoomNotify 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.NotifyTitle; sp[2].Value = model.NotifyContext; sp[3].Value = model.AddTime; sp[4].Value = model.RoomID; sp[5].Value = model.UserID; return(sp); }