Ejemplo n.º 1
0
 public bool add(SBBFDPZJL sbbfdpzjl)
 {
     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[5];
             param[0] = new SqlParameter("@SBBFD_ID", sbbfdpzjl.SbbfdId);
             param[1] = new SqlParameter("@PZR_ID", sbbfdpzjl.PzrId);
             param[2] = new SqlParameter("@SFTY", sbbfdpzjl.Sfty);
             param[3] = new SqlParameter("@YJ", sbbfdpzjl.Yj);
             param[4] = new SqlParameter("@SPSJ", sbbfdpzjl.Spsj);
             foreach (DbParameter p in param)
                 cmd.Parameters.Add(p);
             row = cmd.ExecuteNonQuery();
         }
     }
     return row > 0;
 }
Ejemplo n.º 2
0
 public bool update(SBBFDPZJL entity)
 {
     return dao.update(entity);
 }
Ejemplo n.º 3
0
 public bool add(SBBFDPZJL entity)
 {
     return dao.add(entity);
 }
Ejemplo n.º 4
0
 public SBBFDPZJL getEntity(int id)
 {
     SBBFDPZJL sbbfdpzjl = 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())
                 {
                     sbbfdpzjl = new SBBFDPZJL();
                     sbbfdpzjl.SbbfdId = int.Parse(reader["SBBFD_ID"].ToString());
                     sbbfdpzjl.PzrId = reader["PZR_ID"].ToString();
                     sbbfdpzjl.Sfty = bool.Parse(reader["SFTY"].ToString());
                     sbbfdpzjl.Yj = reader["YJ"].ToString();
                     if (reader["SPSJ"] != null && reader["SPSJ"].ToString().Length > 0)
                         sbbfdpzjl.Spsj = DateTime.Parse(reader["SPSJ"].ToString());
                     sbbfdpzjl.Id = id;
                 }
             }
         }
     }
     return sbbfdpzjl;
 }