Log
How do I use Log
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: ClassBLL.cs
Copy
191 public int CheckLogin(string name, string pass)
192 {
193 SqlConnection con = da.GetConnect();
194 SqlCommand cmd = new SqlCommand("select *from Users Where Username='"+name+"' and Password='"+pass+"'",con);
195 con.Open();
196 SqlDataReader dr = cmd.ExecuteReader();
197 if (dr.Read())
198 {
199 if (dr[2].ToString() == "admin")
200 {
201 return 1;
202 }
203 else
204 {
205 return 2;
206 }
207 }
208 else
209 {
210 return -1;
211 }
212 }
File name: crBaoCao.cs
Copy
119 public virtual bool ShareDBLogonInfo {
120 get {
121 return false;
122 }
123 set {
124 //
125 }
126 }
File name: FormBaoCao.cs
Copy
40 private void btnLoc_Click(object sender, EventArgs e)
41 {
42 SqlConnection con = dal.GetConnect();
43 con.Open();
44 string sql = "select *from SinhVien where MaLop=@MaLop";
45 SqlDataAdapter da = new SqlDataAdapter(sql, con);
46 da.SelectCommand.Parameters.AddWithValue("@MaLop", cmbMaLop.SelectedValue.ToString());
47 DataTable dt = new DataTable();
48 da.Fill(dt);
49 crBaoCao cr = new crBaoCao();
50 ConnectionInfo crConnectionInfo = new ConnectionInfo();
51 crConnectionInfo.ServerName = "Ty-PC";
52 crConnectionInfo.DatabaseName = "CNPM_1";
53 crConnectionInfo.UserID = "sa";
54 crConnectionInfo.Password = "04091990";
55 TableLogOnInfos crTableLogonInfos = new TableLogOnInfos();
56 foreach (CrystalDecisions.CrystalReports.Engine.Table table in cr.Database.Tables)
57 {
58 TableLogOnInfo crTableLogonInfo = new TableLogOnInfo();
59 crTableLogonInfo.TableName = table.Name;
60 crTableLogonInfo.ConnectionInfo = crConnectionInfo;
61 crTableLogonInfos.Add(crTableLogonInfo);
62 table.ApplyLogOnInfo(crTableLogonInfo);
63
64 }
65 crvHocKyHocPhan.LogOnInfo = crTableLogonInfos;
66 cr.SetDataSource(dt);
67 ParameterValues a = new ParameterValues();
68 ParameterDiscreteValue b = new ParameterDiscreteValue();
69 b.Value = cmbMaLop.SelectedValue.ToString();
70 a.Add(b);
71 cr.DataDefinition.ParameterFields["txtMaLop"].ApplyCurrentValues(a);
72 crvHocKyHocPhan.ReportSource = cr;
73 crvHocKyHocPhan.Show();
74 }
File name: FormDangNhap.cs
Copy
30 private void btnDangNhap_Click(object sender, EventArgs e)
31 {
32 int quyen=business.CheckLogin(txtTenDangNhap.Text, txtMatKhau.Text);
33 if (quyen != -1)
34 {
35 Form9.quyen = quyen;
36 Form9 f = (Form9)this.MdiParent;
37 f.PhanQuyenMenu();
38 this.Close();
39 }
40 else
41 {
42 MessageBox.Show("Sai Tên Đăng Nhập Hoặc Mật Khẩu !!");
43 }
44 }
File name: FormGiangVien.cs
Copy
57 private void btnXoa_Click(object sender, EventArgs e)
58 {
59 DialogResult result;
60 result = MessageBox.Show("Bạn có chắc chắn muốn xóa không ?","Hệ Thống", MessageBoxButtons.YesNo);
61 if (result == DialogResult.Yes)
62 {
63 string sql = "MaGV='" + txtMaGV.Text + "'";
64 business.Delete("GiangVien", sql);
65 FormGiangVien_Load(sender, e);
66 }
67 }
File name: FormHeDaoTao.cs
Copy
54 private void btnXoa_Click(object sender, EventArgs e)
55 {
56 DialogResult result;
57 result = MessageBox.Show("Bạn có chắc chắn muốn xóa không ?","Hệ Thống", MessageBoxButtons.YesNo);
58 if (result == DialogResult.Yes)
59 {
60 string sql = "MaHeDT = '" + txtMaHeDT.Text + "'";
61 business.Delete("HeDaoTao", sql);
62 FormHeDaoTao_Load(sender, e);
63 }
64 }
File name: FormHocKy.cs
Copy
40 private void btnXoa_Click(object sender, EventArgs e)
41 {
42 DialogResult result;
43 result = MessageBox.Show("Bạn có chắc chắn muốn xóa không ?","Hệ Thống", MessageBoxButtons.YesNo);
44 if (result == DialogResult.Yes)
45 {
46 string sql = "MaHK='" + txtMaHocKy.Text + "'";
47 business.Delete("HocKy", sql);
48 FormHocKy_Load(sender, e);
49 }
50 }
File name: FormHocPhan.cs
Copy
41 private void btnXoa_Click(object sender, EventArgs e)
42 {
43 DialogResult result;
44 result = MessageBox.Show("Bạn có chắc chắn muốn xóa không ?","Hệ Thống", MessageBoxButtons.YesNo);
45 if (result == DialogResult.Yes)
46 {
47 string sql = "MaHP='" + txtMaHP.Text + "'";
48 business.Delete("HocPhan", sql);
49 FormHocPhan_Load(sender, e);
50 }
51 }
File name: FormKHGD.cs
Copy
51 private void btnXoa_Click(object sender, EventArgs e)
52 {
53 DialogResult result;
54 result = MessageBox.Show("Bạn có chắc chắn muốn xóa không ?", "Hệ Thống", MessageBoxButtons.YesNo);
55 if (result == DialogResult.Yes)
56 {
57 string sql = "MaKHGD='" + txtMaKHGD.Text + "'";
58 business.Delete("KeHoachGiangDay", sql);
59 FormKHGD_Load(sender, e);
60 }
61 }
File name: FormKhoiLop.cs
Copy
60 private void btnXoa_Click(object sender, EventArgs e)
61 {
62 DialogResult result;
63 result = MessageBox.Show("Bạn có chắc chắn muốn xóa không ?","Hệ Thống", MessageBoxButtons.YesNo);
64 if (result == DialogResult.Yes)
65 {
66 string sql = "MaKhoiLop='" + txtMaKhoiLop.Text + "'";
67 business.Delete("KhoiLop", sql);
68 FormKhoiLop_Load(sender, e);
69 }
70 }
Download file with original file name:Log
Log 1.232 lượt xem
Gõ tìm kiếm nhanh...