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

            strSql.Append("select   ");
            strSql.Append(" ID,FM_NAME,INDEX_NAME,INDEX_VALUE");
            strSql.Append(" from FM_Indexs ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            thesis.model.FM_Indexs model = new thesis.model.FM_Indexs();
            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.FM_NAME     = ds.Tables[0].Rows[0]["FM_NAME"].ToString();
                model.INDEX_NAME  = ds.Tables[0].Rows[0]["INDEX_NAME"].ToString();
                model.INDEX_VALUE = ds.Tables[0].Rows[0]["INDEX_VALUE"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        private List <FM_Indexs> GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,FM_NAME,INDEX_NAME,INDEX_VALUE");
            strSql.Append(" FROM FM_Indexs ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            DataSet          ds   = DbHelperSQL.Query(strSql.ToString());
            List <FM_Indexs> list = new List <FM_Indexs>();

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                thesis.model.FM_Indexs model = new thesis.model.FM_Indexs();
                if (ds.Tables[0].Rows[i]["ID"].ToString() != "")
                {
                    model.ID = int.Parse(ds.Tables[0].Rows[i]["ID"].ToString());
                }
                model.FM_NAME     = ds.Tables[0].Rows[0]["FM_NAME"].ToString();
                model.INDEX_NAME  = ds.Tables[0].Rows[0]["INDEX_NAME"].ToString();
                model.INDEX_VALUE = ds.Tables[0].Rows[0]["INDEX_VALUE"].ToString();
                list.Add(model);
            }
            return(list);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(thesis.model.FM_Indexs model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update FM_Indexs set ");
            strSql.Append("FM_NAME='" + model.FM_NAME + "',");
            strSql.Append("INDEX_NAME='" + model.INDEX_NAME + "',");
            strSql.Append("INDEX_VALUE='" + model.INDEX_VALUE + "',");
            strSql.Append(" where ID=" + model.ID + " ");
            DbHelperSQL.ExecuteSql(strSql.ToString());
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(thesis.model.FM_Indexs model)
        {
            model.ID = GetMaxID() + 1;
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into FM_Indexs(");
            strSql.Append("ID,FM_NAME,INDEX_NAME,INDEX_VALUE");
            strSql.Append(")");
            strSql.Append(" values (");
            strSql.Append("" + model.ID + ",");
            strSql.Append("'" + model.FM_NAME + "',");
            strSql.Append("'" + model.INDEX_NAME + "',");
            strSql.Append("" + model.INDEX_VALUE + "");
            strSql.Append(")");
            DbHelperSQL.ExecuteSql(strSql.ToString());
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(thesis.model.FM_Indexs model)
 {
     dal.Update(model);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(thesis.model.FM_Indexs model)
 {
     dal.Add(model);
 }