/// <summary> /// 更新一条数据 /// </summary> public void Update(MesWeb.Model.T_MachineStateType model) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("T_MachineStateType_Update"); db.AddInParameter(dbCommand, "MachineStateTypeID", DbType.Int32, model.MachineStateTypeID); db.AddInParameter(dbCommand, "MachineStateType", DbType.String, model.MachineStateType); db.ExecuteNonQuery(dbCommand); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(MesWeb.Model.T_MachineStateType model) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("T_MachineStateType_ADD"); db.AddOutParameter(dbCommand, "MachineStateTypeID", DbType.Int32, 4); db.AddInParameter(dbCommand, "MachineStateType", DbType.String, model.MachineStateType); db.ExecuteNonQuery(dbCommand); return((int)db.GetParameterValue(dbCommand, "MachineStateTypeID")); }
/// <summary> /// 对象实体绑定数据 /// </summary> public MesWeb.Model.T_MachineStateType ReaderBind(IDataReader dataReader) { MesWeb.Model.T_MachineStateType model = new MesWeb.Model.T_MachineStateType(); object ojb; ojb = dataReader["MachineStateTypeID"]; if (ojb != null && ojb != DBNull.Value) { model.MachineStateTypeID = (int)ojb; } model.MachineStateType = dataReader["MachineStateType"].ToString(); return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public MesWeb.Model.T_MachineStateType DataRowToModel(DataRow row) { MesWeb.Model.T_MachineStateType model = new MesWeb.Model.T_MachineStateType(); if (row != null) { if (row["MachineStateTypeID"] != null && row["MachineStateTypeID"].ToString() != "") { model.MachineStateTypeID = int.Parse(row["MachineStateTypeID"].ToString()); } if (row["MachineStateType"] != null) { model.MachineStateType = row["MachineStateType"].ToString(); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public MesWeb.Model.T_MachineStateType GetModel(int MachineStateTypeID) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("T_MachineStateType_GetModel"); db.AddInParameter(dbCommand, "MachineStateTypeID", DbType.Int32, MachineStateTypeID); MesWeb.Model.T_MachineStateType model = null; using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { if (dataReader.Read()) { model = ReaderBind(dataReader); } } return(model); }