コード例 #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(AOC.Perf.Model.RUNWAYTOQFUS model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update RUNWAYTOQFUS set ");
            strSql.Append("QFUCODE=@QFUCODE,");
            strSql.Append("RUNWAYCODE=@RUNWAYCODE");
            strSql.Append(" where QFUREFCODE=@QFUREFCODE ");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@QFUCODE",    OleDbType.Integer, 4),
                new OleDbParameter("@RUNWAYCODE", OleDbType.Integer, 4),
                new OleDbParameter("@QFUREFCODE", OleDbType.Integer, 4)
            };
            parameters[0].Value = model.QFUCODE;
            parameters[1].Value = model.RUNWAYCODE;
            parameters[2].Value = model.QFUREFCODE;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(AOC.Perf.Model.RUNWAYTOQFUS model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into RUNWAYTOQFUS(");
            strSql.Append("QFUREFCODE,QFUCODE,RUNWAYCODE)");
            strSql.Append(" values (");
            strSql.Append("@QFUREFCODE,@QFUCODE,@RUNWAYCODE)");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@QFUREFCODE", OleDbType.Integer, 4),
                new OleDbParameter("@QFUCODE",    OleDbType.Integer, 4),
                new OleDbParameter("@RUNWAYCODE", OleDbType.Integer, 4)
            };
            parameters[0].Value = model.QFUREFCODE;
            parameters[1].Value = model.QFUCODE;
            parameters[2].Value = model.RUNWAYCODE;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public AOC.Perf.Model.RUNWAYTOQFUS DataRowToModel(DataRow row)
 {
     AOC.Perf.Model.RUNWAYTOQFUS model = new AOC.Perf.Model.RUNWAYTOQFUS();
     if (row != null)
     {
         if (row["QFUREFCODE"] != null && row["QFUREFCODE"].ToString() != "")
         {
             model.QFUREFCODE = int.Parse(row["QFUREFCODE"].ToString());
         }
         if (row["QFUCODE"] != null && row["QFUCODE"].ToString() != "")
         {
             model.QFUCODE = int.Parse(row["QFUCODE"].ToString());
         }
         if (row["RUNWAYCODE"] != null && row["RUNWAYCODE"].ToString() != "")
         {
             model.RUNWAYCODE = int.Parse(row["RUNWAYCODE"].ToString());
         }
     }
     return(model);
 }
コード例 #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public AOC.Perf.Model.RUNWAYTOQFUS GetModel(int QFUREFCODE)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select QFUREFCODE,QFUCODE,RUNWAYCODE from RUNWAYTOQFUS ");
            strSql.Append(" where QFUREFCODE=@QFUREFCODE ");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@QFUREFCODE", OleDbType.Integer, 4)
            };
            parameters[0].Value = QFUREFCODE;

            AOC.Perf.Model.RUNWAYTOQFUS model = new AOC.Perf.Model.RUNWAYTOQFUS();
            DataSet ds = DbHelperOleDb.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }