Esempio n. 1
0
 public bool add(WJLB wjlb)
 {
     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[1];
             param[0] = new SqlParameter("@LBMC", wjlb.Lbmc);
             foreach (DbParameter p in param)
                 cmd.Parameters.Add(p);
             row = cmd.ExecuteNonQuery();
         }
     }
     return row > 0;
 }
Esempio n. 2
0
 public WJLB getEntity(int id)
 {
     WJLB wjlb = 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())
                 {
                     wjlb = new WJLB();
                     wjlb.Lbmc = reader["LBMC"].ToString();
                     wjlb.Id = id;
                 }
             }
         }
     }
     return wjlb;
 }
Esempio n. 3
0
 public bool update(WJLB entity)
 {
     return dao.update(entity);
 }
Esempio n. 4
0
 public bool add(WJLB entity)
 {
     return dao.add(entity);
 }