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