Пример #1
0
 public bool add(SBJDD sbjdd)
 {
     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[6];
             param[0] = new SqlParameter("@SB_ID", sbjdd.SbId);
             param[1] = new SqlParameter("@CLFW", sbjdd.Clfw);
             param[2] = new SqlParameter("@JDDW", sbjdd.Jddw);
             param[3] = new SqlParameter("@SQR_ID", sbjdd.SqrId);
             param[4] = new SqlParameter("@SQSJ", sbjdd.Sqsj);
             param[5] = new SqlParameter("@WJ", sbjdd.Wj);
             foreach (DbParameter p in param)
                 cmd.Parameters.Add(p);
             row = cmd.ExecuteNonQuery();
         }
     }
     return row > 0;
 }
Пример #2
0
 public bool update(SBJDD entity)
 {
     return dao.update(entity);
 }
Пример #3
0
 public SBJDD getEntity(int id)
 {
     SBJDD sbjdd = 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())
                 {
                     sbjdd = new SBJDD();
                     sbjdd.SbId = int.Parse(reader["SB_ID"].ToString());
                     sbjdd.Clfw = reader["CLFW"].ToString();
                     sbjdd.Jddw = reader["JDDW"].ToString();
                     sbjdd.SqrId = reader["SQR_ID"].ToString();
                     if (reader["SQSJ"] != null && reader["SQSJ"].ToString().Length > 0)
                         sbjdd.Sqsj = DateTime.Parse(reader["SQSJ"].ToString());
                     sbjdd.Wj = reader["WJ"].ToString();
                     sbjdd.Id = id;
                 }
             }
         }
     }
     return sbjdd;
 }
Пример #4
0
 public bool add(SBJDD entity)
 {
     return dao.add(entity);
 }