Exemplo n.º 1
0
 //private object GetDataFromDataRow2(DataTable dt, int i)
 //{
 //     hDTO = new HoaDonDTO();
 //    hDTO.MaHoaDon = dt.Rows[i]["MaHoaDon"].ToString();
 //    hDTO.NgayLap = DateTime.Parse(dt.Rows[i]["NgayLap"].ToString());
 //    hDTO.TriGia = float.Parse(dt.Rows[i]["TriGia"].ToString().Equals("") ? "0" : dt.Rows[i]["TriGia"].ToString());
 //    hDTO.ThanhToan = dt.Rows[i]["ThanhToan"].ToString();
 //}
 public HoaDonDTO[] getlistHoaDon()
 {
     string sql = "select HOADON.MaHoaDon,HOADON.NgayLap,HOADON.TriGia,HOADON.ThanhToan from HOADON";
     DataTable dt =  ExecuteQuery(sql);
     HoaDonDTO[] hDTOArr = new HoaDonDTO[dt.Rows.Count];
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         object hDTO = GetDataFromDataRow(dt, i);
         hDTOArr[i] = (HoaDonDTO)hDTO;
     }
     return hDTOArr;
 }
 public bool LapHoaDon(HoaDonDTO dtoHD)
 {
     return new HoaDonDAO().LapHoaDon(dtoHD);
 }
Exemplo n.º 3
0
 public bool LapHoaDon(HoaDonDTO dtoHD)
 {
     dtoHD.ThanhToan = "0";
     string sql = "insert into HOADON(MaHoaDon,NgayLap,TriGia,ThanhToan) values('" + dtoHD.MaHoaDon + "','" + dtoHD.NgayLap + "','" + dtoHD.TriGia + "','" + dtoHD.ThanhToan + "')";
     return ExecuteNonQuery(sql);
 }
Exemplo n.º 4
0
 protected override object GetDataFromDataRow(DataTable dt, int i)
 {
     HoaDonDTO hDTO = new HoaDonDTO();
     //hDTO.DiaChi = dt.Rows[i]["DiaChi"].ToString();
     hDTO.MaHoaDon = dt.Rows[i]["MaHoaDon"].ToString();
     hDTO.NgayLap = DateTime.Parse(dt.Rows[i]["NgayLap"].ToString());
     hDTO.TriGia = float.Parse(dt.Rows[i]["TriGia"].ToString().Equals("")?"0":dt.Rows[i]["TriGia"].ToString());
     hDTO.ThanhToan = dt.Rows[i]["ThanhToan"].ToString();
     return (object)hDTO;
 }