コード例 #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(IPSP.Model.DZSQ_KHD_GJXZQH model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into DZSQ_KHD_GJXZQH(");
            strSql.Append("GJXZQH_ID,GJXZQHDM,GJXZQHMC,GJXZQHSJ,GJXZQHYZBM,ZHUANTAI)");
            strSql.Append(" values (");
            strSql.Append("@GJXZQH_ID,@GJXZQHDM,@GJXZQHMC,@GJXZQHSJ,@GJXZQHYZBM,@ZHUANTAI)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@GJXZQH_ID",  SqlDbType.NVarChar,  64),
                new SqlParameter("@GJXZQHDM",   SqlDbType.NVarChar,  16),
                new SqlParameter("@GJXZQHMC",   SqlDbType.NVarChar, 255),
                new SqlParameter("@GJXZQHSJ",   SqlDbType.NVarChar,  64),
                new SqlParameter("@GJXZQHYZBM", SqlDbType.NVarChar,  64),
                new SqlParameter("@ZHUANTAI",   SqlDbType.NVarChar, 4)
            };
            parameters[0].Value = model.GJXZQH_ID;
            parameters[1].Value = model.GJXZQHDM;
            parameters[2].Value = model.GJXZQHMC;
            parameters[3].Value = model.GJXZQHSJ;
            parameters[4].Value = model.GJXZQHYZBM;
            parameters[5].Value = model.ZHUANTAI;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.DZSQ_KHD_GJXZQH DataRowToModel(DataRow row)
 {
     IPSP.Model.DZSQ_KHD_GJXZQH model = new IPSP.Model.DZSQ_KHD_GJXZQH();
     if (row != null)
     {
         if (row["GJXZQH_ID"] != null)
         {
             model.GJXZQH_ID = row["GJXZQH_ID"].ToString();
         }
         if (row["GJXZQHDM"] != null)
         {
             model.GJXZQHDM = row["GJXZQHDM"].ToString();
         }
         if (row["GJXZQHMC"] != null)
         {
             model.GJXZQHMC = row["GJXZQHMC"].ToString();
         }
         if (row["GJXZQHSJ"] != null)
         {
             model.GJXZQHSJ = row["GJXZQHSJ"].ToString();
         }
         if (row["GJXZQHYZBM"] != null)
         {
             model.GJXZQHYZBM = row["GJXZQHYZBM"].ToString();
         }
         if (row["ZHUANTAI"] != null)
         {
             model.ZHUANTAI = row["ZHUANTAI"].ToString();
         }
     }
     return(model);
 }
コード例 #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPSP.Model.DZSQ_KHD_GJXZQH model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update DZSQ_KHD_GJXZQH set ");
            strSql.Append("GJXZQHDM=@GJXZQHDM,");
            strSql.Append("GJXZQHMC=@GJXZQHMC,");
            strSql.Append("GJXZQHSJ=@GJXZQHSJ,");
            strSql.Append("GJXZQHYZBM=@GJXZQHYZBM,");
            strSql.Append("ZHUANTAI=@ZHUANTAI");
            strSql.Append(" where GJXZQH_ID=@GJXZQH_ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@GJXZQHDM",   SqlDbType.NVarChar,  16),
                new SqlParameter("@GJXZQHMC",   SqlDbType.NVarChar, 255),
                new SqlParameter("@GJXZQHSJ",   SqlDbType.NVarChar,  64),
                new SqlParameter("@GJXZQHYZBM", SqlDbType.NVarChar,  64),
                new SqlParameter("@ZHUANTAI",   SqlDbType.NVarChar,   4),
                new SqlParameter("@GJXZQH_ID",  SqlDbType.NVarChar, 64)
            };
            parameters[0].Value = model.GJXZQHDM;
            parameters[1].Value = model.GJXZQHMC;
            parameters[2].Value = model.GJXZQHSJ;
            parameters[3].Value = model.GJXZQHYZBM;
            parameters[4].Value = model.ZHUANTAI;
            parameters[5].Value = model.GJXZQH_ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.DZSQ_KHD_GJXZQH GetModel(string GJXZQH_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 GJXZQH_ID,GJXZQHDM,GJXZQHMC,GJXZQHSJ,GJXZQHYZBM,ZHUANTAI from DZSQ_KHD_GJXZQH ");
            strSql.Append(" where GJXZQH_ID=@GJXZQH_ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@GJXZQH_ID", SqlDbType.NVarChar, 64)
            };
            parameters[0].Value = GJXZQH_ID;

            IPSP.Model.DZSQ_KHD_GJXZQH model = new IPSP.Model.DZSQ_KHD_GJXZQH();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
コード例 #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(IPSP.Model.DZSQ_KHD_GJXZQH model)
 {
     return(dal.Update(model));
 }
コード例 #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(IPSP.Model.DZSQ_KHD_GJXZQH model)
 {
     return(dal.Add(model));
 }