Пример #1
0
 public bool add(LC lc)
 {
     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("@LCMC", lc.Lcmc);
             param[1] = new SqlParameter("@SS_ID", lc.SsId);
             param[2] = new SqlParameter("@BZR_ID", lc.BzrId);
             param[3] = new SqlParameter("@PXH", lc.Pxh);
             param[4] = new SqlParameter("@SFDQLC", lc.Sfdqlc);
             param[5] = new SqlParameter("@SSLX", lc.Sslx);
             foreach (DbParameter p in param)
                 cmd.Parameters.Add(p);
             row = cmd.ExecuteNonQuery();
         }
     }
     return row > 0;
 }
Пример #2
0
 public bool update(LC lc)
 {
     return dao.update(lc);
 }
Пример #3
0
 public bool add(LC lc)
 {
     return dao.add(lc);
 }
Пример #4
0
 public LC getEntity(int id)
 {
     LC lc = 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())
                 {
                     lc = new LC();
                     lc.Lcmc = reader["LCMC"].ToString();
                     lc.Sslx = int.Parse(reader["SS_ID"].ToString());
                     lc.BzrId = reader["BZR_ID"].ToString();
                     lc.Pxh = int.Parse(reader["PXH"].ToString());
                     lc.Sfdqlc = bool.Parse(reader["SFDQLC"].ToString());
                     lc.Sslx = int.Parse(reader["SSLX"].ToString());
                     lc.Id = id;
                 }
             }
         }
     }
     return lc;
 }