/// <summary> /// 更新一条数据 /// </summary> public bool Update(Matisoft.Model.Authoirty_dir model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Authoirty_dir set "); strSql.Append("Operation=@Operation"); strSql.Append(" where AuthorityID=@AuthorityID "); SqlParameter[] parameters = { new SqlParameter("@Operation", SqlDbType.NVarChar, 100), new SqlParameter("@AuthorityID", SqlDbType.Int, 4) }; parameters[0].Value = model.Operation; parameters[1].Value = model.AuthorityID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Matisoft.Model.Authoirty_dir model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Authoirty_dir("); strSql.Append("AuthorityID,Operation)"); strSql.Append(" values ("); strSql.Append("@AuthorityID,@Operation)"); SqlParameter[] parameters = { new SqlParameter("@AuthorityID", SqlDbType.Int, 4), new SqlParameter("@Operation", SqlDbType.NVarChar, 100) }; parameters[0].Value = model.AuthorityID; parameters[1].Value = model.Operation; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Matisoft.Model.Authoirty_dir DataRowToModel(DataRow row) { Matisoft.Model.Authoirty_dir model = new Matisoft.Model.Authoirty_dir(); if (row != null) { if (row["AuthorityID"] != null && row["AuthorityID"].ToString() != "") { model.AuthorityID = int.Parse(row["AuthorityID"].ToString()); } if (row["Operation"] != null) { model.Operation = row["Operation"].ToString(); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public Matisoft.Model.Authoirty_dir DataRowToModel(DataRow row) { Matisoft.Model.Authoirty_dir model=new Matisoft.Model.Authoirty_dir(); if (row != null) { if(row["AuthorityID"]!=null && row["AuthorityID"].ToString()!="") { model.AuthorityID=int.Parse(row["AuthorityID"].ToString()); } if(row["Operation"]!=null) { model.Operation=row["Operation"].ToString(); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public Matisoft.Model.Authoirty_dir GetModel(int AuthorityID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 AuthorityID,Operation from Authoirty_dir "); strSql.Append(" where AuthorityID=@AuthorityID "); SqlParameter[] parameters = { new SqlParameter("@AuthorityID", SqlDbType.Int, 4) }; parameters[0].Value = AuthorityID; Matisoft.Model.Authoirty_dir model = new Matisoft.Model.Authoirty_dir(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Matisoft.Model.Authoirty_dir GetModel(int AuthorityID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 AuthorityID,Operation from Authoirty_dir "); strSql.Append(" where AuthorityID=@AuthorityID "); SqlParameter[] parameters = { new SqlParameter("@AuthorityID", SqlDbType.Int,4) }; parameters[0].Value = AuthorityID; Matisoft.Model.Authoirty_dir model=new Matisoft.Model.Authoirty_dir(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }