Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>

        public static bool Update(EtNet_Models.AusTypeInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update AusTypeInfo set ");
            strSql.Append(" typename=@typename,");
            strSql.Append(" iscy=@iscy");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@typename", SqlDbType.VarChar, 20),
                new SqlParameter("@id",       SqlDbType.Int,      4),
                new SqlParameter("@iscy",     SqlDbType.VarChar, 20)
            };
            parameters[0].Value = model.typename;
            parameters[1].Value = model.id;
            parameters[2].Value = model.iscy;

            int result = DBHelper.ExecuteCommand(strSql.ToString(), parameters);

            if (result >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public static bool Add(EtNet_Models.AusTypeInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into AusTypeInfo(");
            strSql.Append("typename,iscy)");
            strSql.Append(" values (");
            strSql.Append("@typename,@iscy)");

            SqlParameter[] parameters =
            {
                new SqlParameter("@typename", SqlDbType.VarChar, 20),
                new SqlParameter("@iscy",     SqlDbType.VarChar, 20)
            };
            parameters[0].Value = model.typename;
            parameters[1].Value = model.iscy;
            int result = DBHelper.ExecuteCommand(strSql.ToString(), parameters);

            if (result >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static EtNet_Models.AusTypeInfo GetModelByTypename(string typename)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  id,typename,iscy from AusTypeInfo ");
            strSql.Append(" where typename=@typename");
            SqlParameter[] parameters =
            {
                new SqlParameter("@typename", SqlDbType.VarChar, 20)
            };
            parameters[0].Value = typename;

            EtNet_Models.AusTypeInfo model = null;

            SqlDataReader rad = DBHelper.ExecuteReader(strSql.ToString(), parameters);

            if (rad.Read())
            {
                model          = new EtNet_Models.AusTypeInfo();
                model.id       = rad.GetInt32(0);
                model.typename = rad.GetString(1);
                if (Convert.IsDBNull(rad.GetValue(2)))
                {
                    model.iscy = "";
                }
                else
                {
                    model.iscy = rad.GetString(2);
                }
                rad.Close();
                return(model);
            }
            else
            {
                return(model);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static bool Update(EtNet_Models.AusTypeInfo model)
 {
     return(EtNet_DAL.AusTypeInfoService.Update(model));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static bool Add(EtNet_Models.AusTypeInfo model)
 {
     return(EtNet_DAL.AusTypeInfoService.Add(model));
 }