Esempio n. 1
0
 public bool add(BZSGD bzsgd)
 {
     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("@SGYY", bzsgd.Sgyy);
             param[1] = new SqlParameter("@SGR_ID", bzsgd.SgrId);
             param[2] = new SqlParameter("@SGSJ", bzsgd.Sgsj);
             foreach (DbParameter p in param)
                 cmd.Parameters.Add(p);
             row = cmd.ExecuteNonQuery();
         }
     }
     return row > 0;
 }
Esempio n. 2
0
 public BZSGD getEntity(int id)
 {
     BZSGD bzsgd = 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())
                 {
                     bzsgd = new BZSGD();
                     bzsgd.Sgyy = reader["SGYY"].ToString();
                     bzsgd.SgrId = reader["SGR_ID"].ToString();
                     if (reader["SGSJ"] != null && reader["SGSJ"].ToString().Length > 0)
                         bzsgd.Sgsj = DateTime.Parse(reader["SGSJ"].ToString());
                     bzsgd.Id = id;
                 }
             }
         }
     }
     return bzsgd;
 }
Esempio n. 3
0
 public bool update(BZSGD bzsgd)
 {
     return dao.update(bzsgd);
 }
Esempio n. 4
0
 public bool add(BZSGD bzsgd)
 {
     return dao.add(bzsgd);
 }