/// <summary> /// 对象实体绑定数据 /// </summary> public MesWeb.Model.T_OpenMachineCondition ReaderBind(IDataReader dataReader) { MesWeb.Model.T_OpenMachineCondition model = new MesWeb.Model.T_OpenMachineCondition(); object ojb; ojb = dataReader["OpenMachineConditionID"]; if (ojb != null && ojb != DBNull.Value) { model.OpenMachineConditionID = (int)ojb; } ojb = dataReader["MachineID"]; if (ojb != null && ojb != DBNull.Value) { model.MachineID = (int)ojb; } ojb = dataReader["IsMaterialIOK"]; if (ojb != null && ojb != DBNull.Value) { model.IsMaterialIOK = (bool)ojb; } ojb = dataReader["IsMoudOK"]; if (ojb != null && ojb != DBNull.Value) { model.IsMoudOK = (bool)ojb; } ojb = dataReader["IsMachineFree"]; if (ojb != null && ojb != DBNull.Value) { model.IsMachineFree = (bool)ojb; } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(MesWeb.Model.T_OpenMachineCondition model) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("T_OpenMachineCondition_Update"); db.AddInParameter(dbCommand, "OpenMachineConditionID", DbType.Int32, model.OpenMachineConditionID); db.AddInParameter(dbCommand, "MachineID", DbType.Int32, model.MachineID); db.AddInParameter(dbCommand, "IsMaterialIOK", DbType.Boolean, model.IsMaterialIOK); db.AddInParameter(dbCommand, "IsMoudOK", DbType.Boolean, model.IsMoudOK); db.AddInParameter(dbCommand, "IsMachineFree", DbType.Boolean, model.IsMachineFree); db.ExecuteNonQuery(dbCommand); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(MesWeb.Model.T_OpenMachineCondition model) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("T_OpenMachineCondition_ADD"); db.AddOutParameter(dbCommand, "OpenMachineConditionID", DbType.Int32, 4); db.AddInParameter(dbCommand, "MachineID", DbType.Int32, model.MachineID); db.AddInParameter(dbCommand, "IsMaterialIOK", DbType.Boolean, model.IsMaterialIOK); db.AddInParameter(dbCommand, "IsMoudOK", DbType.Boolean, model.IsMoudOK); db.AddInParameter(dbCommand, "IsMachineFree", DbType.Boolean, model.IsMachineFree); db.ExecuteNonQuery(dbCommand); return((int)db.GetParameterValue(dbCommand, "OpenMachineConditionID")); }
/// <summary> /// 得到一个对象实体 /// </summary> public MesWeb.Model.T_OpenMachineCondition DataRowToModel(DataRow row) { MesWeb.Model.T_OpenMachineCondition model = new MesWeb.Model.T_OpenMachineCondition(); if (row != null) { if (row["OpenMachineConditionID"] != null && row["OpenMachineConditionID"].ToString() != "") { model.OpenMachineConditionID = int.Parse(row["OpenMachineConditionID"].ToString()); } if (row["MachineID"] != null && row["MachineID"].ToString() != "") { model.MachineID = int.Parse(row["MachineID"].ToString()); } if (row["IsMaterialIOK"] != null && row["IsMaterialIOK"].ToString() != "") { if ((row["IsMaterialIOK"].ToString() == "1") || (row["IsMaterialIOK"].ToString().ToLower() == "true")) { model.IsMaterialIOK = true; } else { model.IsMaterialIOK = false; } } if (row["IsMoudOK"] != null && row["IsMoudOK"].ToString() != "") { if ((row["IsMoudOK"].ToString() == "1") || (row["IsMoudOK"].ToString().ToLower() == "true")) { model.IsMoudOK = true; } else { model.IsMoudOK = false; } } if (row["IsMachineFree"] != null && row["IsMachineFree"].ToString() != "") { if ((row["IsMachineFree"].ToString() == "1") || (row["IsMachineFree"].ToString().ToLower() == "true")) { model.IsMachineFree = true; } else { model.IsMachineFree = false; } } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public MesWeb.Model.T_OpenMachineCondition GetModel(int OpenMachineConditionID) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("T_OpenMachineCondition_GetModel"); db.AddInParameter(dbCommand, "OpenMachineConditionID", DbType.Int32, OpenMachineConditionID); MesWeb.Model.T_OpenMachineCondition model = null; using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { if (dataReader.Read()) { model = ReaderBind(dataReader); } } return(model); }