code Quản lý bài hát C#

1
2 using
System;
3 using
System.Collections.Generic;
4 using
System.Linq;
5 using
System.Text;
6 using
System.Data;
7 using
DATA_Tier;
8
9 namespace
BUS_Tier
10 {
11     
public class BaiHat_BUS
12     {
13         BaiHat_DATA objBaiHat =
new BaiHat_DATA();
14
15         
#region khai báo đối tượng BaiHat và kiểm tra hợp lệ
16
17         
private string mabaihat;
18         
private string tenbaihat;
19         
private string matheloai;
20         
private string maalbum;
21         
private string macasi;
22         
private string matacgia;
23         
private string mahangsanxuat;
24         
private string loibaihat;
25
26         
public string MABAIHAT
27         {
28             
get { return mabaihat; }
29
30             
set
31             {
32                 
if (value.Trim().Equals(""))
33                     
throw new Exception("Nhập mã bài hát !");
34                 
else
35                     mabaihat =
value;
36             }
37         }
38
39         
public string TENBAIHAT
40         {
41             
get { return tenbaihat; }
42
43             
set
44             {
45                 
if (value.Trim().Equals(""))
46                     
throw new Exception("Nhập tên bài hát !");
47                 
else
48                     tenbaihat =
value;
49             }
50         }
51         
public string LOIBAIHAT
52         {
53             
get { return loibaihat; }
54
55             
set
56             {
57                 
if (value.Trim().Equals(""))
58                     
throw new Exception("Chưa nhập lời cho bài hát !");
59                 
else
60                     
if (value == "Chưa có lời cho bài hát !! == > bấm [Đồng ý] lần nữa để lưu bài hát này !")
61                         loibaihat =
"";
62                     
else
63                         loibaihat =
value;
64             }
65         }
66         
#endregion
67
68         
#region các hàm khởi tạo (contructor)
69         
public BaiHat_BUS() { }
70
71         
public BaiHat_BUS(string ma, string ten, string matheloai, string maalbum, string macasi, string matacgia, string mahangsanxuat, string loibaihat)
72         {
73             
this.MABAIHAT = ma;
74             
this.TENBAIHAT = ten;
75             
this.matheloai = matheloai;
76             
this.maalbum = maalbum;
77             
this.macasi = macasi;
78             
this.matacgia = matacgia;
79             
this.mahangsanxuat = mahangsanxuat;
80             
this.LOIBAIHAT = loibaihat;
81         }
82
83         
public BaiHat_BUS(string ma)
84         {
85             
this.mabaihat = ma;
86         }
87
88         
#endregion
89
90         
#region các phương thức xử lý
91         
public int themBaiHat()
92         {
93             
return objBaiHat.themBaiHat(mabaihat, tenbaihat, matheloai, maalbum, macasi, matacgia, mahangsanxuat, loibaihat);
94         }
95         
public int xoaBaiHat()
96         {
97             
return objBaiHat.xoaBaiHat(mabaihat);
98         }
99         
public int capnhatBaiHat()
100         {
101             
return objBaiHat.capnhatBaiHat(mabaihat, tenbaihat, matheloai, maalbum, macasi, matacgia, mahangsanxuat, loibaihat);
102         }
103         
#endregion
104
105         
#region các hàm lấy dử liệu bài hát (table)
106
107         ///
<summary>
108         ///
hàm lấy tất cả bảng BaiHat
109         ///
</summary>
110         ///
<returns>trả về bảng bài hát</returns>
111         
public DataTable getBaiHat()
112         {
113             
return objBaiHat.getBaiHat();
114         }

115
116         ///
<summary>
117         ///
lấy bảng bài hát có tên album, tên thể loại,... (dùng cho tab Home)
118         ///
</summary>
119         ///
<returns>trả về bảng có đầy đủ tên album, tên thể loại (nối bảng)</returns>
120         
public DataTable getBaiHat_home()
121         {
122             
return objBaiHat.getBaiHat_Home();
123         }

124
125         ///
<summary>
126         ///
lấy bài hát theo mã album
127         ///
</summary>
128         ///
<param name="maalbum">mã album cần lấy bài hát</param>
129         ///
<returns>trả về bảng bài hát của album đc truyền vào</returns>
130         
public DataTable getBaiHat_by_album(string maalbum)
131         {
132             
return objBaiHat.getBaiHat_by_Album(maalbum);
133         }

134
135         ///
<summary>
136         ///
lấy bài hát theo mã thể loại
137         ///
</summary>
138         ///
<param name="matheloai">mã thể loại cần lấy bài hát trong nó</param>
139         ///
<returns>trả về bảng các bài hát thuộc 1 thểloại đc truyền vào</returns>
140         
public DataTable getBaiHat_by_TheLoai(string matheloai)
141         {
142             
return objBaiHat.getBaiHat_by_TheLoai(matheloai);
143         }

144
145         ///
<summary>
146         ///
lấy thông tin bài hát dựa vào mã bài hát
147         ///
</summary>
148         ///
<param name="mabaihat">mã bài hát cần lấy</param>
149         ///
<returns>trả về bảng thông tin của bài hát đc truyền vào</returns>
150         
public DataTable getBaiHat_by_mabaihat(string mabaihat)
151         {
152             
return objBaiHat.getBaiHat_by_mabaihat(mabaihat);
153         }
154
155         
156         
public DataTable getBaiHat_cbo(string matheloai, string maalbum, string macasi, string matacgia, string mahangsanxuat)
157         {
158             
return objBaiHat.getBaiHat_by_cbo(matheloai, maalbum, macasi, matacgia, mahangsanxuat);
159         }
160
161         
public DataTable getBaiHat_cbo(string matheloai, string maalbum)
162         {
163             
return objBaiHat.getBaiHat_by_cbo(matheloai, maalbum);
164         }
165         
#endregion
166
167
168     }
169 }



code Quản lý bài hát C# 8.241 lượt xem

Gõ tìm kiếm nhanh...