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