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