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