Пример #1
0
 /// <summary>
 /// vuong hung =================lay bang kiem ke thao ma kiem ke================
 /// </summary>
 /// <returns></returns>
 public Entities.ThongTinKiemKeKho[] sp_LayKiemKeKhoTheoMa(Entities.TruyenGiaTri giatri)
 {
     Entities.ThongTinKiemKeKho[] arrC = null;
     try
     {
         string sql = "exec sp_LayTheoMaKiemKeKho @MaPhieuKiemKe";
         conn = new Connection();
         cn   = conn.openConnection();
         cmd  = new SqlCommand(sql, cn);
         cmd.Parameters.Add("MaPhieuKiemKe", SqlDbType.NVarChar, 20).Value = giatri.Giatritruyen;
         dr  = cmd.ExecuteReader(CommandBehavior.CloseConnection);
         arr = new ArrayList();
         while (dr.Read())
         {
             Entities.ThongTinKiemKeKho chitietkiemkekho = new Entities.ThongTinKiemKeKho();
             chitietkiemkekho.Mahang       = dr[0].ToString();
             chitietkiemkekho.Tenhang      = dr[1].ToString();
             chitietkiemkekho.Tonsosach    = dr[2].ToString();
             chitietkiemkekho.Tonthucte    = dr[3].ToString().ToString();
             chitietkiemkekho.Chenhlech    = dr[4].ToString().ToString();
             chitietkiemkekho.Lydo         = dr[5].ToString();
             chitietkiemkekho.Giavon       = dr[6].ToString();
             chitietkiemkekho.Giachechlech = dr[7].ToString();
             arr.Add(chitietkiemkekho);
         }
         int n = arr.Count;
         if (n == 0)
         {
             arrC = null;
         }
         arrC = new Entities.ThongTinKiemKeKho[n];
         for (int i = 0; i < n; i++)
         {
             arrC[i] = (Entities.ThongTinKiemKeKho)arr[i];
         }
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); arrC = null; }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
     }
     return(arrC);
 }
Пример #2
0
 /// <summary>
 /// vuong hung =================lay bang kiem ke thao ma kiem ke================
 /// </summary>
 /// <returns></returns>
 public Entities.ThongTinKiemKeKho[] sp_LayKiemKeKhoTheoMa(Entities.TruyenGiaTri giatri)
 {
     Entities.ThongTinKiemKeKho[] arrC = null;
     try
     {
         string sql = "exec sp_LayTheoMaKiemKeKho @MaPhieuKiemKe";
         conn = new Connection();
         cn = conn.openConnection();
         cmd = new SqlCommand(sql, cn);
         cmd.Parameters.Add("MaPhieuKiemKe", SqlDbType.NVarChar, 20).Value = giatri.Giatritruyen;
         dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
         arr = new ArrayList();
         while (dr.Read())
         {
             Entities.ThongTinKiemKeKho chitietkiemkekho = new Entities.ThongTinKiemKeKho();
             chitietkiemkekho.Mahang = dr[0].ToString();
             chitietkiemkekho.Tenhang = dr[1].ToString();
             chitietkiemkekho.Tonsosach = dr[2].ToString();
             chitietkiemkekho.Tonthucte = dr[3].ToString().ToString();
             chitietkiemkekho.Chenhlech = dr[4].ToString().ToString();
             chitietkiemkekho.Lydo = dr[5].ToString();
             chitietkiemkekho.Giavon = dr[6].ToString();
             chitietkiemkekho.Giachechlech = dr[7].ToString();
             arr.Add(chitietkiemkekho);
         }
         int n = arr.Count;
         if (n == 0) { arrC = null; }
         arrC = new Entities.ThongTinKiemKeKho[n];
         for (int i = 0; i < n; i++)
         {
             arrC[i] = (Entities.ThongTinKiemKeKho)arr[i];
         }
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); arrC = null; }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
     }
     return arrC;
 }