Exemple #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(ZIT.AppRouteServer.Model.Router model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Router set ");
            strSql.Append("ID=:ID,");
            strSql.Append("XZBM=:XZBM,");
            strSql.Append("PROVINCE=:PROVINCE,");
            strSql.Append("CITY=:CITY,");
            strSql.Append("AREA=:AREA,");
            strSql.Append("ISVALID=:ISVALID,");
            strSql.Append("ADDTIME=:ADDTIME,");
            strSql.Append("OPERATOR=:OPERATOR");
            strSql.Append(" where ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":ID",       OracleType.Number,    4),
                new OracleParameter(":XZBM",     OracleType.NVarChar),
                new OracleParameter(":PROVINCE", OracleType.NVarChar),
                new OracleParameter(":CITY",     OracleType.NVarChar),
                new OracleParameter(":AREA",     OracleType.NVarChar),
                new OracleParameter(":ISVALID",  OracleType.Number,    4),
                new OracleParameter(":ADDTIME",  OracleType.DateTime),
                new OracleParameter(":OPERATOR", OracleType.NVarChar)
            };
            parameters[0].Value = model.ID;
            parameters[1].Value = model.XZBM;
            parameters[2].Value = model.PROVINCE;
            parameters[3].Value = model.CITY;
            parameters[4].Value = model.AREA;
            parameters[5].Value = model.ISVALID;
            parameters[6].Value = model.ADDTIME;
            parameters[7].Value = model.OPERATOR;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public ZIT.AppRouteServer.Model.Router DataRowToModel(DataRow row)
 {
     ZIT.AppRouteServer.Model.Router model = new ZIT.AppRouteServer.Model.Router();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["XZBM"] != null)
         {
             model.XZBM = row["XZBM"].ToString();
         }
         if (row["PROVINCE"] != null)
         {
             model.PROVINCE = row["PROVINCE"].ToString();
         }
         if (row["CITY"] != null)
         {
             model.CITY = row["CITY"].ToString();
         }
         if (row["AREA"] != null)
         {
             model.AREA = row["AREA"].ToString();
         }
         if (row["ISVALID"] != null && row["ISVALID"].ToString() != "")
         {
             model.ISVALID = int.Parse(row["ISVALID"].ToString());
         }
         if (row["ADDTIME"] != null && row["ADDTIME"].ToString() != "")
         {
             model.ADDTIME = DateTime.Parse(row["ADDTIME"].ToString());
         }
         if (row["OPERATOR"] != null)
         {
             model.OPERATOR = row["OPERATOR"].ToString();
         }
     }
     return(model);
 }
Exemple #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ZIT.AppRouteServer.Model.Router GetModel()
        {
            //该表无主键信息,请自定义主键/条件字段
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,XZBM,PROVINCE,CITY,AREA,ISVALID,ADDTIME,OPERATOR from Router ");
            strSql.Append(" where ");
            OracleParameter[] parameters =
            {
            };

            ZIT.AppRouteServer.Model.Router model = new ZIT.AppRouteServer.Model.Router();
            DataSet ds = DbHelperOra.Query("", strSql.ToString(), parameters);

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