Exemple #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        private thesis.model.IndexSystem GetModelByCondition(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select   ");
            strSql.Append(" ID,NAME,INDEX_,PINDEX,THRESHOLD ");
            strSql.Append(" from IndexSystem ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            thesis.model.IndexSystem model = new thesis.model.IndexSystem();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ID"].ToString() != "")
                {
                    model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                model.NAME      = ds.Tables[0].Rows[0]["NAME"].ToString();
                model.INDEX_    = ds.Tables[0].Rows[0]["INDEX_"].ToString();
                model.PINDEX    = ds.Tables[0].Rows[0]["PINDEX"].ToString();
                model.THRESHOLD = int.Parse(ds.Tables[0].Rows[0]["THRESHOLD"].ToString());
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemple #2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        private List <IndexSystem> GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,NAME,INDEX_,PINDEX,THRESHOLD");
            strSql.Append(" FROM IndexSystem ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            DataSet            ds   = DbHelperSQL.Query(strSql.ToString());
            List <IndexSystem> list = new List <IndexSystem>();

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                thesis.model.IndexSystem model = new thesis.model.IndexSystem();
                if (ds.Tables[0].Rows[i]["ID"].ToString() != "")
                {
                    model.ID = int.Parse(ds.Tables[0].Rows[i]["ID"].ToString());
                }
                model.NAME      = ds.Tables[0].Rows[0]["NAME"].ToString();
                model.INDEX_    = ds.Tables[0].Rows[0]["INDEX_"].ToString();
                model.PINDEX    = ds.Tables[0].Rows[0]["PINDEX"].ToString();
                model.THRESHOLD = int.Parse(ds.Tables[0].Rows[0]["THRESHOLD"].ToString());
                list.Add(model);
            }
            return(list);
        }
Exemple #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(thesis.model.IndexSystem model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update IndexSystem set ");
            strSql.Append("NAME='" + model.NAME + "',");
            strSql.Append("INDEX_='" + model.INDEX_ + "',");
            strSql.Append("PINDEX='" + model.PINDEX + "',");
            strSql.Append("DIAGRAM='" + model.THRESHOLD + "',");
            strSql.Append(" where ID=" + model.ID + " ");
            DbHelperSQL.ExecuteSql(strSql.ToString());
        }
Exemple #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(thesis.model.IndexSystem model)
        {
            model.ID = GetMaxID() + 1;
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Component(");
            strSql.Append("ID,NAME,INDEX_,PINDEX,THRESHOLD");
            strSql.Append(")");
            strSql.Append(" values (");
            strSql.Append("" + model.ID + ",");
            strSql.Append("'" + model.NAME + "',");
            strSql.Append("'" + model.INDEX_ + "',");
            strSql.Append("'" + model.PINDEX + "',");
            strSql.Append("" + model.THRESHOLD + "");
            strSql.Append(")");
            DbHelperSQL.ExecuteSql(strSql.ToString());
        }
Exemple #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(thesis.model.IndexSystem model)
 {
     dal.Update(model);
 }
Exemple #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(thesis.model.IndexSystem model)
 {
     dal.Add(model);
 }