/// <summary> /// 更新一条数据 /// </summary> public void Update(MesWeb.Model.T_AxisTask model) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("T_AxisTask_Update"); db.AddInParameter(dbCommand, "AxisTaskID", DbType.Int32, model.AxisTaskID); db.AddInParameter(dbCommand, "JobSheetItemDetailID", DbType.Int32, model.JobSheetItemDetailID); db.AddInParameter(dbCommand, "SpecificationID", DbType.Int32, model.SpecificationID); db.AddInParameter(dbCommand, "Color", DbType.String, model.Color); db.AddInParameter(dbCommand, "UnitLenth", DbType.Int32, model.UnitLenth); db.AddInParameter(dbCommand, "Num", DbType.Int32, model.Num); db.AddInParameter(dbCommand, "Weight", DbType.Int32, model.Weight); db.ExecuteNonQuery(dbCommand); }
/// <summary> /// 得到一个对象实体 /// </summary> public MesWeb.Model.T_AxisTask GetModel(int AxisTaskID) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("T_AxisTask_GetModel"); db.AddInParameter(dbCommand, "AxisTaskID", DbType.Int32, AxisTaskID); MesWeb.Model.T_AxisTask model = null; using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { if (dataReader.Read()) { model = ReaderBind(dataReader); } } return(model); }
/// <summary> /// 对象实体绑定数据 /// </summary> public MesWeb.Model.T_AxisTask ReaderBind(IDataReader dataReader) { MesWeb.Model.T_AxisTask model = new MesWeb.Model.T_AxisTask(); object ojb; ojb = dataReader["AxisTaskID"]; if (ojb != null && ojb != DBNull.Value) { model.AxisTaskID = (int)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; } model.Color = dataReader["Color"].ToString(); ojb = dataReader["UnitLenth"]; if (ojb != null && ojb != DBNull.Value) { model.UnitLenth = (int)ojb; } ojb = dataReader["Num"]; if (ojb != null && ojb != DBNull.Value) { model.Num = (int)ojb; } ojb = dataReader["Weight"]; if (ojb != null && ojb != DBNull.Value) { model.Weight = (int)ojb; } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public MesWeb.Model.T_AxisTask DataRowToModel(DataRow row) { MesWeb.Model.T_AxisTask model = new MesWeb.Model.T_AxisTask(); if (row != null) { if (row["AxisTaskID"] != null && row["AxisTaskID"].ToString() != "") { model.AxisTaskID = int.Parse(row["AxisTaskID"].ToString()); } 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["Color"] != null) { model.Color = row["Color"].ToString(); } if (row["UnitLenth"] != null && row["UnitLenth"].ToString() != "") { model.UnitLenth = int.Parse(row["UnitLenth"].ToString()); } if (row["Num"] != null && row["Num"].ToString() != "") { model.Num = int.Parse(row["Num"].ToString()); } if (row["Weight"] != null && row["Weight"].ToString() != "") { model.Weight = int.Parse(row["Weight"].ToString()); } } return(model); }