/// <summary> /// 得到一个对象实体 /// </summary> public MesWeb.Model.T_HumanEfficience DataRowToModel(DataRow row) { MesWeb.Model.T_HumanEfficience model = new MesWeb.Model.T_HumanEfficience(); if (row != null) { if (row["HumanEfficienceID"] != null && row["HumanEfficienceID"].ToString() != "") { model.HumanEfficienceID = int.Parse(row["HumanEfficienceID"].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["EmplouyeeID"] != null && row["EmplouyeeID"].ToString() != "") { model.EmplouyeeID = int.Parse(row["EmplouyeeID"].ToString()); } if (row["EfficienceValue"] != null && row["EfficienceValue"].ToString() != "") { model.EfficienceValue = int.Parse(row["EfficienceValue"].ToString()); } if (row["DateTime"] != null && row["DateTime"].ToString() != "") { model.DateTime = DateTime.Parse(row["DateTime"].ToString()); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(MesWeb.Model.T_HumanEfficience model) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("T_HumanEfficience_Update"); db.AddInParameter(dbCommand, "HumanEfficienceID", DbType.Int32, model.HumanEfficienceID); db.AddInParameter(dbCommand, "JobSheetID", DbType.Int32, model.JobSheetID); db.AddInParameter(dbCommand, "MachineID", DbType.Int32, model.MachineID); db.AddInParameter(dbCommand, "EmplouyeeID", DbType.Int32, model.EmplouyeeID); db.AddInParameter(dbCommand, "EfficienceValue", DbType.Int32, model.EfficienceValue); db.AddInParameter(dbCommand, "DateTime", DbType.DateTime, model.DateTime); db.ExecuteNonQuery(dbCommand); }
/// <summary> /// 得到一个对象实体 /// </summary> public MesWeb.Model.T_HumanEfficience GetModel(int HumanEfficienceID) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("T_HumanEfficience_GetModel"); db.AddInParameter(dbCommand, "HumanEfficienceID", DbType.Int32, HumanEfficienceID); MesWeb.Model.T_HumanEfficience model = null; using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { if (dataReader.Read()) { model = ReaderBind(dataReader); } } return(model); }
/// <summary> /// 对象实体绑定数据 /// </summary> public MesWeb.Model.T_HumanEfficience ReaderBind(IDataReader dataReader) { MesWeb.Model.T_HumanEfficience model = new MesWeb.Model.T_HumanEfficience(); object ojb; ojb = dataReader["HumanEfficienceID"]; if (ojb != null && ojb != DBNull.Value) { model.HumanEfficienceID = (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; } ojb = dataReader["EmplouyeeID"]; if (ojb != null && ojb != DBNull.Value) { model.EmplouyeeID = (int)ojb; } ojb = dataReader["EfficienceValue"]; if (ojb != null && ojb != DBNull.Value) { model.EfficienceValue = (int)ojb; } ojb = dataReader["DateTime"]; if (ojb != null && ojb != DBNull.Value) { model.DateTime = (DateTime)ojb; } return(model); }