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