/// <summary> /// 更新一条数据 /// </summary> public void Update(MesWeb.Model.T_Flow model) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("T_Flow_Update"); db.AddInParameter(dbCommand, "FlowID", DbType.Int32, model.FlowID); db.AddInParameter(dbCommand, "Axis_No", DbType.String, model.Axis_No); db.AddInParameter(dbCommand, "MachineID", DbType.Int32, model.MachineID); db.AddInParameter(dbCommand, "DateTime", DbType.DateTime, model.DateTime); db.AddInParameter(dbCommand, "CPK_OD", DbType.Double, model.CPK_OD); db.AddInParameter(dbCommand, "AVG_Thine", DbType.Double, model.AVG_Thine); db.AddInParameter(dbCommand, "EmployeeID", DbType.Int32, model.EmployeeID); db.AddInParameter(dbCommand, "MaterialID", DbType.String, model.MaterialID); db.ExecuteNonQuery(dbCommand); }
/// <summary> /// 得到一个对象实体 /// </summary> public MesWeb.Model.T_Flow GetModel(int FlowID) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("T_Flow_GetModel"); db.AddInParameter(dbCommand, "FlowID", DbType.Int32, FlowID); MesWeb.Model.T_Flow model = null; using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { if (dataReader.Read()) { model = ReaderBind(dataReader); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public MesWeb.Model.T_Flow DataRowToModel(DataRow row) { MesWeb.Model.T_Flow model = new MesWeb.Model.T_Flow(); if (row != null) { if (row["FlowID"] != null && row["FlowID"].ToString() != "") { model.FlowID = int.Parse(row["FlowID"].ToString()); } if (row["Axis_No"] != null) { model.Axis_No = row["Axis_No"].ToString(); } if (row["MachineID"] != null && row["MachineID"].ToString() != "") { model.MachineID = int.Parse(row["MachineID"].ToString()); } if (row["DateTime"] != null && row["DateTime"].ToString() != "") { model.DateTime = DateTime.Parse(row["DateTime"].ToString()); } if (row["CPK_OD"] != null && row["CPK_OD"].ToString() != "") { model.CPK_OD = decimal.Parse(row["CPK_OD"].ToString()); } if (row["AVG_Thine"] != null && row["AVG_Thine"].ToString() != "") { model.AVG_Thine = decimal.Parse(row["AVG_Thine"].ToString()); } if (row["EmployeeID"] != null && row["EmployeeID"].ToString() != "") { model.EmployeeID = int.Parse(row["EmployeeID"].ToString()); } if (row["MaterialID"] != null) { model.MaterialID = row["MaterialID"].ToString(); } } return(model); }
/// <summary> /// 对象实体绑定数据 /// </summary> public MesWeb.Model.T_Flow ReaderBind(IDataReader dataReader) { MesWeb.Model.T_Flow model = new MesWeb.Model.T_Flow(); object ojb; ojb = dataReader["FlowID"]; if (ojb != null && ojb != DBNull.Value) { model.FlowID = (int)ojb; } model.Axis_No = dataReader["Axis_No"].ToString(); ojb = dataReader["MachineID"]; if (ojb != null && ojb != DBNull.Value) { model.MachineID = (int)ojb; } ojb = dataReader["DateTime"]; if (ojb != null && ojb != DBNull.Value) { model.DateTime = (DateTime)ojb; } ojb = dataReader["CPK_OD"]; if (ojb != null && ojb != DBNull.Value) { model.CPK_OD = (decimal)ojb; } ojb = dataReader["AVG_Thine"]; if (ojb != null && ojb != DBNull.Value) { model.AVG_Thine = (decimal)ojb; } ojb = dataReader["EmployeeID"]; if (ojb != null && ojb != DBNull.Value) { model.EmployeeID = (int)ojb; } model.MaterialID = dataReader["MaterialID"].ToString(); return(model); }