示例#1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ERM.MDL.Vars Find(int varID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  ");
            strSql.Append(" varID,varName,varTitle ");
            strSql.Append(" from Vars ");
            strSql.Append(" where varID=" + varID + " ");
            ERM.MDL.Vars model = new ERM.MDL.Vars();
            DataSet      ds    = DbHelperOleDb.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["varID"].ToString() != "")
                {
                    model.varID = int.Parse(ds.Tables[0].Rows[0]["varID"].ToString());
                }
                model.varName  = ds.Tables[0].Rows[0]["varName"].ToString();
                model.varTitle = ds.Tables[0].Rows[0]["varTitle"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
示例#2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(ERM.MDL.Vars model)
        {
            StringBuilder strSql  = new StringBuilder();
            StringBuilder strSql1 = new StringBuilder();
            StringBuilder strSql2 = new StringBuilder();

            if (model.varID != null)
            {
                strSql1.Append("varID,");
                strSql2.Append("" + model.varID + ",");
            }
            if (model.varName != null)
            {
                strSql1.Append("varName,");
                strSql2.Append("'" + model.varName + "',");
            }
            if (model.varTitle != null)
            {
                strSql1.Append("varTitle,");
                strSql2.Append("'" + model.varTitle + "',");
            }
            strSql.Append("insert into Vars(");
            strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
            strSql.Append(")");
            strSql.Append(" values (");
            strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
            strSql.Append(")");
            DbHelperOleDb.ExecuteSql(strSql.ToString());
        }
示例#3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(ERM.MDL.Vars model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Vars set ");
            strSql.Append("varID=" + model.varID + ",");
            strSql.Append("varName='" + model.varName + "',");
            strSql.Append("varTitle='" + model.varTitle + "'");
            strSql.Append(" where varID=" + model.varID + " ");
            DbHelperOleDb.ExecuteSql(strSql.ToString());
        }
示例#4
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <ERM.MDL.Vars> GetModelList(string strWhere)
        {
            DataSet             ds        = dal.GetList(strWhere);
            List <ERM.MDL.Vars> modelList = new List <ERM.MDL.Vars>();
            int rowsCount = ds.Tables[0].Rows.Count;

            if (rowsCount > 0)
            {
                ERM.MDL.Vars model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ERM.MDL.Vars();
                    if (ds.Tables[0].Rows[n]["varID"].ToString() != "")
                    {
                        model.varID = int.Parse(ds.Tables[0].Rows[n]["varID"].ToString());
                    }
                    model.varName  = ds.Tables[0].Rows[n]["varName"].ToString();
                    model.varTitle = ds.Tables[0].Rows[n]["varTitle"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
示例#5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(ERM.MDL.Vars model)
 {
     dal.Update(model);
 }
示例#6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(ERM.MDL.Vars model)
 {
     dal.Add(model);
 }