public async Task <IActionResult> UpdateBaoCao(int id, [FromBody] BaoCaoDTO baoCaoDTO) { var baoCao = baoCaoDTO.ToEntity(); await _baoCaoService.UpdateBaoCao(baoCao); return(Ok(baoCao)); }
public async Task <IActionResult> CreateBaoCao(BaoCaoDTO baoCaoDTO) { var baoCao = baoCaoDTO.ToEntity(); await _baoCaoService.CreateBaoCao(baoCao); return(Ok(baoCao)); }
public async Task <IActionResult> GetBaoCaoById(int id) { var baoCao = await _baoCaoService.GetBaoCaoById(id); var result = BaoCaoDTO.FromEntity(baoCao); return(Ok(result)); }
private void button1_Click(object sender, EventArgs e) { if (this.radioButton_BaoCaoTheoTheLoai.Checked == true) { bcBus = new BaoCaoBUS(); List <TheLoaiDTO> list; list = bcBus.select(); tlBUS = new TheLoaiBUS(); listTheLoai = tlBUS.select(""); listBaoCao = new List <BaoCaoDTO>(); pmBus = new PhieuMuonBUS(); int countnow = 0; listPhieuMuon = pmBus.select(); foreach (PhieuMuonDTO tl in listPhieuMuon) { if (tl.NgayMuon.Month == this.dateTimePicker1.Value.Month) { countnow++; } } foreach (TheLoaiDTO tl in listTheLoai) { int count = 0; foreach (TheLoaiDTO theloaimuon in list) { if (theloaimuon.Ngay.Month == this.dateTimePicker1.Value.Month) { if (tl.MaTheLoai == theloaimuon.MaTheLoai) { count++; } } } BaoCaoDTO temp = new BaoCaoDTO(); temp.MaTheLoai = tl.MaTheLoai; temp.SoLuotMuong = count; Console.WriteLine(countnow); if (countnow == 0) { temp.TyLe = "0%"; } else { temp.TyLe = "" + (count / countnow) * 100 + "%"; } temp.TenTheLoai = tl.TenTheLoai; listBaoCao.Add(temp); } this.label_TongSoLuotMuon.Text = countnow.ToString(); loadBaoCaoTheLoai_Vao_GridView(listBaoCao); } }
public string selectAllBCCN(List <BaoCaoDTO> lsObj, int time) { string query = string.Empty; query += " SELECT distinct hd.[makh],pt.[sotienthu],s.[dongia],hd.[soluong]"; query += " FROM [tblhoadon] hd,[tblsach] s, [tblphieuthu] pt"; query += " WHERE MONTH(hd.ngaylap)='" + time + "' and hd.mahd=pt.mahd and MONTH(pt.ngaythutien)='" + time + "'"; using (SqlConnection conn = new SqlConnection(connectionString)) { using (SqlCommand comm = new SqlCommand()) { comm.Connection = conn; comm.CommandType = CommandType.Text; comm.CommandText = query; try { conn.Open(); SqlDataReader reader = comm.ExecuteReader(); if (reader.HasRows == true) { lsObj.Clear(); while (reader.Read()) { BaoCaoDTO obj = new BaoCaoDTO(); obj.MaKhachHang = reader["makh"].ToString(); obj.NoDau = 0; obj.NoPhatSinh = reader.GetInt32(2) * reader.GetInt32(3); if ((reader.GetInt32(1) - (reader.GetInt32(2) * reader.GetInt32(3))) > 0) { obj.NoCuoi = 0; } else { obj.NoCuoi = reader.GetInt32(1) - (reader.GetInt32(2) * reader.GetInt32(3)); } lsObj.Add(obj); } } } catch (Exception ex) { conn.Close(); return("Lấy báo cáo thất bại\n" + ex.Message + "\n" + ex.StackTrace); } } } return("0"); }
public string selectAllBCT(List <BaoCaoDTO> lsObj, int time) { string query = string.Empty; query += " SELECT s.[masach],pn.[soluong],s.[soluong]"; query += " FROM [tblphieunhap] pn,[tblsach] s"; query += " WHERE pn.masach=s.masach and MONTH(ngaynhap)='" + time + "'"; using (SqlConnection conn = new SqlConnection(connectionString)) { using (SqlCommand comm = new SqlCommand()) { comm.Connection = conn; comm.CommandType = CommandType.Text; comm.CommandText = query; try { conn.Open(); SqlDataReader reader = comm.ExecuteReader(); if (reader.HasRows == true) { lsObj.Clear(); while (reader.Read()) { BaoCaoDTO obj = new BaoCaoDTO(); obj.MaSach = reader["masach"].ToString(); obj.TonCuoi = reader.GetInt32(2); obj.PhatSinh = reader.GetInt32(1); obj.TonDau = obj.TonCuoi - obj.PhatSinh; lsObj.Add(obj); } } } catch (Exception ex) { conn.Close(); return("Lấy báo cáo thất bại\n" + ex.Message + "\n" + ex.StackTrace); } } } return("0"); }
public bool them(BaoCaoDTO baoCaoDTO) { throw new NotImplementedException(); }
public bool them(BaoCaoDTO bc) { return(bdal.them(bc)); }