示例#1
0
 public bool add(SBJDJG sbjdjg)
 {
     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[7];
             param[0] = new SqlParameter("@SBJDD_ID", sbjdjg.SbjddId);
             param[1] = new SqlParameter("@JG", sbjdjg.Jg);
             param[2] = new SqlParameter("@SFTG", sbjdjg.Sftg);
             param[3] = new SqlParameter("@JZWJ", sbjdjg.Jzwj);
             param[4] = new SqlParameter("@JZSJ", sbjdjg.Jzsj);
             param[5] = new SqlParameter("@CJSJ", sbjdjg.Cjsj);
             param[6] = new SqlParameter("@SYBMQDR_ID", sbjdjg.SybmqdrId);
             foreach (DbParameter p in param)
                 cmd.Parameters.Add(p);
             row = cmd.ExecuteNonQuery();
         }
     }
     return row > 0;
 }
示例#2
0
 public bool update(SBJDJG entity)
 {
     return dao.update(entity);
 }
示例#3
0
 public SBJDJG getEntity(int id)
 {
     SBJDJG sbjdjg = 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())
                 {
                     sbjdjg = new SBJDJG();
                     sbjdjg.SbjddId = int.Parse(reader["SBJDD_ID"].ToString());
                     sbjdjg.Jg = reader["JG"].ToString();
                     sbjdjg.Sftg = bool.Parse(reader["SFTG"].ToString());
                     sbjdjg.Jzwj = reader["JZWJ"].ToString();
                     if (reader["JZSJ"] != null && reader["JZSJ"].ToString().Length > 0)
                         sbjdjg.Jzsj = DateTime.Parse(reader["JZSJ"].ToString());
                     if (reader["CJSJ"] != null && reader["CJSJ"].ToString().Length > 0)
                         sbjdjg.Cjsj = DateTime.Parse(reader["CJSJ"].ToString());
                     sbjdjg.SybmqdrId = reader["SYBMQDR_ID"].ToString();
                     sbjdjg.Id = id;
                 }
             }
         }
     }
     return sbjdjg;
 }
示例#4
0
 public bool add(SBJDJG entity)
 {
     return dao.add(entity);
 }