Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Man_WarnnigConfigModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Man_WarnnigConfig set ");
            strSql.Append("WarningLayer=@WarningLayer,");
            strSql.Append("WarningCata=@WarningCata,");
            strSql.Append("WarningExplain=@WarningExplain,");
            strSql.Append("WarningName=@WarningName");
            strSql.Append(" where WarningCode=@WarningCode ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@WarningLayer",   SqlDbType.NVarChar,  50),
                new SqlParameter("@WarningCata",    SqlDbType.NVarChar,  50),
                new SqlParameter("@WarningExplain", SqlDbType.NVarChar, 500),
                new SqlParameter("@WarningName",    SqlDbType.NChar,     10),
                new SqlParameter("@WarningCode",    SqlDbType.Int, 4)
            };
            parameters[0].Value = model.WarningLayer;
            parameters[1].Value = model.WarningCata;
            parameters[2].Value = model.WarningExplain;
            parameters[3].Value = model.WarningName;
            parameters[4].Value = model.WarningCode;

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

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

            strSql.Append("insert into Man_WarnnigConfig(");
            strSql.Append("WarningCode,WarningLayer,WarningCata,WarningExplain,WarningName)");
            strSql.Append(" values (");
            strSql.Append("@WarningCode,@WarningLayer,@WarningCata,@WarningExplain,@WarningName)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@WarningCode",    SqlDbType.Int,        4),
                new SqlParameter("@WarningLayer",   SqlDbType.NVarChar,  50),
                new SqlParameter("@WarningCata",    SqlDbType.NVarChar,  50),
                new SqlParameter("@WarningExplain", SqlDbType.NVarChar, 500),
                new SqlParameter("@WarningName",    SqlDbType.NChar, 10)
            };
            parameters[0].Value = model.WarningCode;
            parameters[1].Value = model.WarningLayer;
            parameters[2].Value = model.WarningCata;
            parameters[3].Value = model.WarningExplain;
            parameters[4].Value = model.WarningName;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Man_WarnnigConfigModel DataRowToModel(DataRow row)
        {
            Man_WarnnigConfigModel model = new Man_WarnnigConfigModel();

            if (row != null)
            {
                if (row["WarningCode"] != null && row["WarningCode"].ToString() != "")
                {
                    model.WarningCode = int.Parse(row["WarningCode"].ToString());
                }
                if (row["WarningLayer"] != null)
                {
                    model.WarningLayer = row["WarningLayer"].ToString();
                }
                if (row["WarningCata"] != null)
                {
                    model.WarningCata = row["WarningCata"].ToString();
                }
                if (row["WarningExplain"] != null)
                {
                    model.WarningExplain = row["WarningExplain"].ToString();
                }
                if (row["WarningName"] != null)
                {
                    model.WarningName = row["WarningName"].ToString();
                }
            }
            return(model);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Man_WarnnigConfigModel GetModel(int WarningCode)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 WarningCode,WarningLayer,WarningCata,WarningExplain,WarningName from Man_WarnnigConfig ");
            strSql.Append(" where WarningCode=@WarningCode ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@WarningCode", SqlDbType.Int, 4)
            };
            parameters[0].Value = WarningCode;

            Man_WarnnigConfigModel model = new Man_WarnnigConfigModel();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Man_WarnnigConfigModel model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(Man_WarnnigConfigModel model)
 {
     return(dal.Add(model));
 }