-
Notifications
You must be signed in to change notification settings - Fork 0
/
Peminjaman_graph.cs
108 lines (87 loc) · 3.46 KB
/
Peminjaman_graph.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
using System;
using System.Data;
using System.Data.SqlClient;
using System.Windows.Forms;
namespace Aplikasi_Perpustakaan
{
public partial class Peminjaman_graph : Form
{
public Peminjaman_graph()
{
InitializeComponent();
}
public void nav(object sender, EventArgs e)
{
Page page = new Page();
this.Hide();
page.Move(sender, e);
}
private void Peminjaman_graph_FormClosing(object sender, FormClosingEventArgs e)
{
Application.Exit();
}
private void Peminjaman_graph_Load(object sender, EventArgs e)
{
lbl_nama.Text = Login.nama;
btn_user.Visible = Login.permission;
panel4.Visible = Login.permission;
panel_admin.Visible = !Login.permission;
Fill();
}
void Fill()
{
string sql = "SELECT COUNT(*) AS Peminjaman, Tanggal from [dbo].[Peminjaman] Group BY Tanggal Having(COUNT(*)>=1)";
DataTable dt = new DataTable();
SqlCommand cmd = new SqlCommand(sql, Navigasi.cnn);
Page.READ(cmd, dt);
Viewer.DataSource = dt;
Viewer.Series["Peminjaman"].XValueMember = "Tanggal";
Viewer.Series["Peminjaman"].YValueMembers = "Peminjaman";
Viewer.Titles.Add("Peminjaman Bulanan");
}
/*void fitering()
{
Viewer.DataSource = null;
string tanggal = "";
if (btn_tanggal.Checked != true)
{
tanggal = "";
}
else
{
tanggal = datepick_search.Value.ToString("yyyy/MM/dd");
}
string sql;
if (!string.IsNullOrEmpty(txt_search.Text.ToString()) || txt_search.Text != "")
{
if (tanggal != "")
{
sql = "SELECT COUNT(*) AS Peminjaman, Tanggal from [dbo].[Peminjaman] Group BY Tanggal Having(COUNT(*)>=1) WHERE [Tanggal] = '" + tanggal + "' AND [Nama]='" + txt_search.Text + "' OR [Kelas]='" + txt_search.Text + "' OR [Buku]='" + txt_search.Text + "' OR [Pengawas]='" + txt_search.Text + "' OR [Status]='" + txt_search.Text + "'";
}
else
{
sql = "SELECT COUNT(*) AS Peminjaman, Tanggal from [dbo].[Peminjaman] Group BY Tanggal Having(COUNT(*)>=1) WHERE [Nama]='" + txt_search.Text + "' OR [Kelas]='" + txt_search.Text + "' OR [Buku]='" + txt_search.Text + "' OR [Pengawas]='" + txt_search.Text + "' OR [Status]='" + txt_search.Text + "'";
}
}
else
{
if (tanggal != "")
{
sql = "SELECT COUNT(*) AS Peminjaman, Tanggal from [dbo].[Peminjaman] Group BY Tanggal Having(COUNT(*)>=1) WHERE [Tanggal] = '" + tanggal + "'";
}
else
{
sql = "SELECT COUNT(*) AS Peminjaman, Tanggal from [dbo].[Peminjaman] Group BY Tanggal Having(COUNT(*)>=1)";
}
}
DataTable dt = new DataTable();
Page.READ(sql, dt);
Viewer.DataSource = dt;
Viewer.Series["Peminjaman"].XValueMember = "Tanggal";
Viewer.Series["Peminjaman"].YValueMembers = "Peminjaman";
}*/
private void btn_filter_Click(object sender, EventArgs e)
{
}
}
}