示例#1
0
 public bool add(SBJDX sbjdx)
 {
     int row = 0;
     using (DbConnection conn = new SqlConnection(SQLString.connString))
     {
         conn.Open();
         using (DbCommand cmd = conn.CreateCommand())
         {
             cmd.CommandText = ADD;
             cmd.CommandType = CommandType.Text;
             DbParameter[] param = new SqlParameter[4];
             param[0] = new SqlParameter("@SBJDD_ID", sbjdx.SbjddId);
             param[1] = new SqlParameter("@CS", sbjdx.Cs);
             param[2] = new SqlParameter("@JZFW", sbjdx.Jzfw);
             param[3] = new SqlParameter("@ZQDDJ", sbjdx.Zqddj);
             foreach (DbParameter p in param)
                 cmd.Parameters.Add(p);
             row = cmd.ExecuteNonQuery();
         }
     }
     return row > 0;
 }
示例#2
0
 public SBJDX getEntity(int id)
 {
     SBJDX sbjdx = null;
     using (DbConnection conn = new SqlConnection(SQLString.connString))
     {
         conn.Open();
         using (DbCommand cmd = conn.CreateCommand())
         {
             cmd.CommandText = GET_ENTITY;
             cmd.CommandType = CommandType.Text;
             DbParameter[] param = new SqlParameter[1];
             param[0] = new SqlParameter("@ID", id);
             foreach (DbParameter p in param)
                 cmd.Parameters.Add(p);
             DbDataReader reader = cmd.ExecuteReader();
             using (reader)
             {
                 if (reader.Read())
                 {
                     sbjdx = new SBJDX();
                     sbjdx.SbjddId = int.Parse(reader["SBJDD_ID"].ToString());
                     sbjdx.Cs = reader["CS"].ToString();
                     sbjdx.Jzfw = reader["JZFW"].ToString();
                     sbjdx.Zqddj = reader["ZQDDJ"].ToString();
                     sbjdx.Id = id;
                 }
             }
         }
     }
     return sbjdx;
 }
示例#3
0
 public bool update(SBJDX entity)
 {
     return dao.update(entity);
 }
示例#4
0
 public bool add(SBJDX entity)
 {
     return dao.add(entity);
 }