-
Notifications
You must be signed in to change notification settings - Fork 1
/
UKategori.pas
105 lines (91 loc) · 2.37 KB
/
UKategori.pas
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
unit UKategori;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, DBGrids, ExtCtrls;
type
TFKategori = class(TForm)
Panel1: TPanel;
Label1: TLabel;
Shape1: TShape;
Label2: TLabel;
Edit1: TEdit;
DBGrid1: TDBGrid;
Panel2: TPanel;
Panel3: TPanel;
Panel4: TPanel;
Panel5: TPanel;
GroupBox1: TGroupBox;
Edit5: TEdit;
procedure Panel5Click(Sender: TObject);
procedure Panel3Click(Sender: TObject);
procedure Panel4Click(Sender: TObject);
procedure DBGrid1CellClick(Column: TColumn);
procedure Edit5Change(Sender: TObject);
procedure Panel2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FKategori: TFKategori;
implementation
uses
UDataModule;
{$R *.dfm}
procedure TFKategori.Panel5Click(Sender: TObject);
begin
if Edit1.Text = '' then MessageDlg('Nama Kategori Kosong',mtinformation,[mbok],0) else
begin
DM.ADOQKategori.Append;
DM.ADOQKategori['kategori'] := Edit1.Text;
DM.ADOQKategori.Post;
Edit1.Clear;
end;
end;
procedure TFKategori.Panel3Click(Sender: TObject);
begin
if Dm.ADOQKategori.IsEmpty then MessageDlg('Data Kosong',mtInformation,[mbok],0) else
if Application.MessageBox('Yakin Hapus Data ??','Pesan',Mb_YesNo or Mb_IconQuestion)=MrYes then
Begin
Dm.ADOQKategori.Delete;
Edit1.Clear;
End;
end;
procedure TFKategori.Panel4Click(Sender: TObject);
begin
if Edit1.Text = '' then MessageDlg('Nama Kategori Kosong',mtinformation,[mbok],0) else
begin
DM.ADOQKategori.Edit;
DM.ADOQKategori['kategori'] := Edit1.Text;
DM.ADOQKategori.Post;
Edit1.Clear;
end;
end;
procedure TFKategori.DBGrid1CellClick(Column: TColumn);
begin
if Dm.ADOQKategori.IsEmpty then MessageDlg('Data Kategori Kosong',mtInformation,[mbok],0) else
begin
Edit1.Text := DM.ADOQKategori['kategori'] ;
end;
end;
procedure TFKategori.Edit5Change(Sender: TObject);
begin
if Edit5.Text <> '' then
begin
Dm.ADOQKategori.Filtered := False;
DM.ADOQKategori.Filter :='kategori LIKE '+Quotedstr('%'+Edit5.Text+'%');
Dm.ADOQKategori.Filtered := True;
end
else
begin
Dm.ADOQKategori.Filtered := False;
end;
end;
procedure TFKategori.Panel2Click(Sender: TObject);
begin
Edit1.Clear;
Edit5.Clear;
end;
end.