コード例 #1
0
 /// <summary>
 /// khoi tao gia tri
 /// </summary>
 public ChiTietHoaDonNhap()
 {
     dh = null;
     Sql = null;
     conn = null;
     cmd = null;
     arr = null;
     dr = null;
     hoadonnhap = null;
     cn = null;
 }
コード例 #2
0
 public Entities.ChiTietHoaDonNhap[] Select()
 {
     Entities.ChiTietHoaDonNhap[] arrC = null;
     try
     {
         dh = new Constants.ChiTietHoaDonNhap();
         Sql = new Constants.Sql();
         string sql = "Select * from ChiTietHoaDonNhap where Deleted = 0";
         conn = new Connection();
         cn = conn.openConnection();
         cmd = new SqlCommand(sql, cn);
         dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
         arr = new ArrayList();
         while (dr.Read())
         {
             hoadonnhap = new Entities.ChiTietHoaDonNhap();
             hoadonnhap.MaHoaDonNhap = dr[dh.MaHoaDonNhap].ToString();
             hoadonnhap.MaHangHoa = dr[dh.MaHangHoa].ToString();
             hoadonnhap.SoLuong = int.Parse(0 + dr[dh.SoLuong].ToString());
             hoadonnhap.PhanTramChietKhau = Double.Parse(0 + dr[dh.PhanTramChietKhau].ToString()).ToString();
             hoadonnhap.DonGia = dr[dh.DonGia].ToString();
             hoadonnhap.Thue = dr[dh.Thue].ToString();
             hoadonnhap.GhiChu = dr[dh.GhiChu].ToString();
             hoadonnhap.Deleted = Convert.ToBoolean(dr[dh.Deleted].ToString());
             arr.Add(hoadonnhap);
         }
         int n = arr.Count;
         if (n == 0) { return null; }
         arrC = new Entities.ChiTietHoaDonNhap[n];
         for (int i = 0; i < n; i++)
         {
             arrC[i] = (Entities.ChiTietHoaDonNhap)arr[i];
         }
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
     }
     return arrC;
 }
コード例 #3
0
 /// <summary>
 /// vuong hung =================xu ly don dat hang================
 /// </summary>
 /// <returns></returns>
 public int sp_XuLy_ChiTietHoaDonNhap(Entities.ChiTietHoaDonNhap ddh)
 {
     int Trave = 0;
     try
     {
         Sql = new Constants.Sql();
         string sql = Sql.sp_XuLy_ChiTietHoaDonNhap;
         conn = new Connection();
         cn = conn.openConnection();
         dh = new Constants.ChiTietHoaDonNhap();
         cmd = new SqlCommand(sql, cn);
         cmd.Parameters.Add(dh.HanhDong, SqlDbType.NVarChar, 20).Value = ddh.Hanhdong;
         cmd.Parameters.Add(dh.MaHoaDonNhap, SqlDbType.NVarChar, 20).Value = ddh.MaHoaDonNhap;
         cmd.Parameters.Add(dh.MaHangHoa, SqlDbType.NVarChar).Value = ddh.MaHangHoa;
         cmd.Parameters.Add(dh.SoLuong, SqlDbType.Int).Value = ddh.SoLuong;
         cmd.Parameters.Add(dh.PhanTramChietKhau, SqlDbType.Float, 20).Value = ddh.PhanTramChietKhau;
         cmd.Parameters.Add(dh.DonGia, SqlDbType.Float).Value = ddh.DonGia;
         cmd.Parameters.Add(dh.Thue, SqlDbType.Float).Value = ddh.Thue;
         cmd.Parameters.Add(dh.GhiChu, SqlDbType.NVarChar).Value = ddh.GhiChu;
         cmd.Parameters.Add(dh.Deleted, SqlDbType.Bit).Value = ddh.Deleted;
         Trave = cmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
     }
     return Trave;
 }