/// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.T_User_Role model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_User_Role set ");
            strSql.Append("id_user=@id_user,");
            strSql.Append("id_role=@id_role");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id_user", SqlDbType.Int, 4),
                new SqlParameter("@id_role", SqlDbType.Int, 4),
                new SqlParameter("@id",      SqlDbType.Int, 4)
            };
            parameters[0].Value = model.id_user;
            parameters[1].Value = model.id_role;
            parameters[2].Value = model.id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Maticsoft.Model.T_User_Role model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_User_Role(");
            strSql.Append("id_user,id_role)");
            strSql.Append(" values (");
            strSql.Append("@id_user,@id_role)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id_user", SqlDbType.Int, 4),
                new SqlParameter("@id_role", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.id_user;
            parameters[1].Value = model.id_role;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.T_User_Role DataRowToModel(DataRow row)
 {
     Maticsoft.Model.T_User_Role model=new Maticsoft.Model.T_User_Role();
     if (row != null)
     {
         if(row["id"]!=null && row["id"].ToString()!="")
         {
             model.id=int.Parse(row["id"].ToString());
         }
         if(row["id_user"]!=null && row["id_user"].ToString()!="")
         {
             model.id_user=int.Parse(row["id_user"].ToString());
         }
         if(row["id_role"]!=null && row["id_role"].ToString()!="")
         {
             model.id_role=int.Parse(row["id_role"].ToString());
         }
     }
     return model;
 }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.T_User_Role DataRowToModel(DataRow row)
 {
     Maticsoft.Model.T_User_Role model = new Maticsoft.Model.T_User_Role();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["id_user"] != null && row["id_user"].ToString() != "")
         {
             model.id_user = int.Parse(row["id_user"].ToString());
         }
         if (row["id_role"] != null && row["id_role"].ToString() != "")
         {
             model.id_role = int.Parse(row["id_role"].ToString());
         }
     }
     return(model);
 }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.T_User_Role GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,id_user,id_role from T_User_Role ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            Maticsoft.Model.T_User_Role model = new Maticsoft.Model.T_User_Role();
            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 Maticsoft.Model.T_User_Role GetModel(int id)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 id,id_user,id_role from T_User_Role ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int,4)
            };
            parameters[0].Value = id;

            Maticsoft.Model.T_User_Role model=new Maticsoft.Model.T_User_Role();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }