Beispiel #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(NCPEP.Model.T_Dyjl model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_Dyjl set ");
            strSql.Append("fid=@fid,");
            strSql.Append("dysj=@dysj,");
            strSql.Append("dyr=@dyr,");
            strSql.Append("dysqid=@dysqid");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@fid",    SqlDbType.VarChar, 50),
                new SqlParameter("@dysj",   SqlDbType.VarChar, 50),
                new SqlParameter("@dyr",    SqlDbType.VarChar, 50),
                new SqlParameter("@dysqid", SqlDbType.VarChar, 50),
                new SqlParameter("@id",     SqlDbType.Int, 4)
            };
            parameters[0].Value = model.fid;
            parameters[1].Value = model.dysj;
            parameters[2].Value = model.dyr;
            parameters[3].Value = model.dysqid;
            parameters[4].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(NCPEP.Model.T_Dyjl model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_Dyjl(");
            strSql.Append("fid,dysj,dyr,dysqid)");
            strSql.Append(" values (");
            strSql.Append("@fid,@dysj,@dyr,@dysqid)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@fid",    SqlDbType.VarChar, 50),
                new SqlParameter("@dysj",   SqlDbType.VarChar, 50),
                new SqlParameter("@dyr",    SqlDbType.VarChar, 50),
                new SqlParameter("@dysqid", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.fid;
            parameters[1].Value = model.dysj;
            parameters[2].Value = model.dyr;
            parameters[3].Value = model.dysqid;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Beispiel #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public NCPEP.Model.T_Dyjl DataRowToModel(DataRow row)
 {
     NCPEP.Model.T_Dyjl model = new NCPEP.Model.T_Dyjl();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["fid"] != null)
         {
             model.fid = row["fid"].ToString();
         }
         if (row["dysj"] != null)
         {
             model.dysj = row["dysj"].ToString();
         }
         if (row["dyr"] != null)
         {
             model.dyr = row["dyr"].ToString();
         }
         if (row["dysqid"] != null)
         {
             model.dysqid = row["dysqid"].ToString();
         }
     }
     return(model);
 }
Beispiel #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public NCPEP.Model.T_Dyjl GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,fid,dysj,dyr,dysqid from T_Dyjl ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

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

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