Ejemplo n.º 1
0
 public bool add(SBZRRBGJL sbzrrbgjl)
 {
     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[3];
             param[0] = new SqlParameter("@SB_ID", sbzrrbgjl.SbId);
             param[1] = new SqlParameter("@ZRR_ID", sbzrrbgjl.ZrrId);
             param[2] = new SqlParameter("@BGSJ", sbzrrbgjl.Bgsj);
             foreach (DbParameter p in param)
                 cmd.Parameters.Add(p);
             row = cmd.ExecuteNonQuery();
         }
     }
     return row > 0;
 }
Ejemplo n.º 2
0
 public bool update(SBZRRBGJL entity)
 {
     return dao.update(entity);
 }
Ejemplo n.º 3
0
 public bool add(SBZRRBGJL entity)
 {
     return dao.add(entity);
 }
Ejemplo n.º 4
0
 public SBZRRBGJL getEntity(int id)
 {
     SBZRRBGJL sbzrrbgjl = 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())
                 {
                     sbzrrbgjl = new SBZRRBGJL();
                     sbzrrbgjl.SbId = int.Parse(reader["SB_ID"].ToString());
                     sbzrrbgjl.ZrrId = reader["ZRR_ID"].ToString();
                     if (reader["BGSJ"] != null && reader["BGSJ"].ToString().Length > 0)
                         sbzrrbgjl.Bgsj = DateTime.Parse(reader["BGSJ"].ToString());
                     sbzrrbgjl.Id = id;
                 }
             }
         }
     }
     return sbzrrbgjl;
 }