3.4.3.1. Đăng nhập
KẾT LUẬN
Qua tìm hiểu nghiên cứu em thấy được tính thiết thực của hệ thống và nhu cầu ứng dụng của hệ thống, được hướng dẫn nhiệt tình của thầy Trịnh Phú Cường, em đã nhận đề tài “Xây dựng phần mềm quản trị quan hệ khách hàng cho công ty phần mềm quản lí doanh nghiệp Fast ”. Đề tài đã đạt được những mục tiêu sau:
- Hiểu rõ nghiệp vụ về quản trị quan hệ khách hàng
- Xây dựng được hệ thống thông tin quản lí hồ sơ khách hàng, hồ sơ hợp đồng và các giao dịch giữa khách hàng và công ty.
- Phần mềm được xây dựng đã có các báo cáo giúp các nhà quản trị trong việc quản trị quan hệ khách hàng củ mình.
Như vậy, đề tài của em đã làm sáng tỏ được bài toán quản trị quan hệ khách hàng và đạt được mục đích ban đầu khi xây dựng.
Em cũng rất mong nhận được những lời góp ý và chỉ bảo của thầy cô giáo tạo điều kiện nâng cao kiến thức của mình và phát triển đề tài trong tương lai.
Em xin chân thành cảm ơn !
Hà nội, Ngày tháng năm 2013 Sinh Viên
PHỤ LỤC 1:
DANH MỤC TÀI LIỆU THAM KHẢO
1. TS Trương Văn Tú - TS Trần Thị Song Minh , khoa Tin học kinh tế, trường Đại học Kinh Tế Quốc Dân, năm 2000 – Giáo trình hệ thống thông tin quản lí
2. Th.S Trần Công Uẩn, khoa Tin học kinh tế, trường Đại học Kinh Tế Quốc Dân, năm 2005 - Giáo trình Cơ sở dữ liệu 1,2 ( Dùng cho sinh viên chuyên ngành Hệ thống thông tin kinh tế )
3. PGS.TS: Hàn Viết Thuận - Giáo trình Kỹ nghệ phần mềm
4. Th.S. Trịnh Phú Cường – Baig giảng Môn phát triển hệ thống thông tin của thầy
Và một số môn khác trong khoa Tin học kinh tế, trường Đại học Kinh tế Quốc dân
3. Tài liệu của công ty phần mềm quản lí doanh nghiệp Fast
Các tài liệu mà nhân viên của công ty Fast cung cấp
4. Một số Website
- www.tailieu.vn
PHỤ LỤC 2:
CODE ĐƯỢC SỬ DỤNG 1. Form đăng nhập
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Partial Class frmLogin
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try
If disposing AndAlso components IsNot Nothing Then components.Dispose() End If Finally MyBase.Dispose(disposing) End Try End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label()
Me.GroupBox1 = New System.Windows.Forms.GroupBox() Me.Label3 = New System.Windows.Forms.Label()
Me.TextBox2 = New System.Windows.Forms.TextBox() Me.TextBox1 = New System.Windows.Forms.TextBox() Me.Button1 = New System.Windows.Forms.Button() Me.Button2 = New System.Windows.Forms.Button()
Me.LinkLabel1 = New System.Windows.Forms.LinkLabel() Me.PictureBox1 = New System.Windows.Forms.PictureBox() Me.GroupBox1.SuspendLayout() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'Label1 ' Me.Label1.Dock = System.Windows.Forms.DockStyle.Top
Me.Label1.Font = New System.Drawing.Font("Times New Roman", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.Location = New System.Drawing.Point(0, 0)
Me.Label1.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(615, 72) Me.Label1.TabIndex = 1
Me.Label1.Text = "PHẦN MỀM QUẢN LÝ QUAN HỆ KHÁCH HÀNG" Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter ' 'GroupBox1 ' Me.GroupBox1.Anchor= CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ Or System.Windows.Forms.AnchorStyles.Left) _ Or System.Windows.Forms.AnchorStyles.Right),
System.Windows.Forms.AnchorStyles)
Me.GroupBox1.Controls.Add(Me.Label3) Me.GroupBox1.Controls.Add(Me.Label2) Me.GroupBox1.Controls.Add(Me.TextBox2) Me.GroupBox1.Controls.Add(Me.TextBox1)
Me.GroupBox1.Location = New System.Drawing.Point(13, 76) Me.GroupBox1.Margin = New System.Windows.Forms.Padding(4) Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Padding = New System.Windows.Forms.Padding(4) Me.GroupBox1.Size = New System.Drawing.Size(587, 101)
Me.GroupBox1.TabIndex = 0 Me.GroupBox1.TabStop = False Me.GroupBox1.Text = "Đăng nhập" ' 'Label3 ' Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(192, 68) Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(70, 19) Me.Label3.TabIndex = 3 Me.Label3.Text = "Mật khẩu:" ' 'Label2 ' Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(192, 36) Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(35, 19) Me.Label2.TabIndex = 2
Me.Label2.Text = "Tên:" '
'TextBox2 '
Me.TextBox2.Location = New System.Drawing.Point(319, 65) Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(144, 26) Me.TextBox2.TabIndex = 1 Me.TextBox2.Text = "123" Me.TextBox2.UseSystemPasswordChar = True ' 'TextBox1 ' Me.TextBox1.CharacterCasing= System.Windows.Forms.CharacterCasing.Upper
Me.TextBox1.Location = New System.Drawing.Point(319, 33) Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(144, 26) Me.TextBox1.TabIndex = 0 Me.TextBox1.Text = "ADMIN" ' 'Button1 ' Me.Button1.Anchor= CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Button1.Location = New System.Drawing.Point(313, 182) Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(86, 33) Me.Button1.TabIndex = 1
Me.Button1.Text = "Đăng &nhập"
Me.Button1.UseVisualStyleBackColor = True ' 'Button2 ' Me.Button2.Anchor= CType((System.Windows.Forms.AnchorStyles.Bottom
Or
System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Button2.Location = New System.Drawing.Point(405, 182) Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(86, 33) Me.Button2.TabIndex = 2 Me.Button2.Text = "&Hủy" Me.Button2.UseVisualStyleBackColor = True ' 'LinkLabel1 ' Me.LinkLabel1.Anchor= CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.LinkLabel1.AutoSize = True
Me.LinkLabel1.Location = New System.Drawing.Point(540, 189) Me.LinkLabel1.Name = "LinkLabel1"
Me.LinkLabel1.Size = New System.Drawing.Size(60, 19) Me.LinkLabel1.TabIndex = 3 Me.LinkLabel1.TabStop = True Me.LinkLabel1.Text = "Đăng ký" ' 'PictureBox1 ' Me.PictureBox1.Image= Global.CRM_SoftWare.My.Resources.Resources.users_unlock
Me.PictureBox1.Location = New System.Drawing.Point(69, 104) Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(107, 115)
Me.PictureBox1.SizeMode= System.Windows.Forms.PictureBoxSizeMode.StretchImage
Me.PictureBox1.TabIndex = 5 Me.PictureBox1.TabStop = False '
'frmLogin '
Me.AutoScaleDimensions = New System.Drawing.SizeF(9.0!, 19.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(615, 227)
Me.Controls.Add(Me.PictureBox1) Me.Controls.Add(Me.LinkLabel1) Me.Controls.Add(Me.Button2) Me.Controls.Add(Me.Button1) Me.Controls.Add(Me.Label1) Me.Controls.Add(Me.GroupBox1)
Me.Font = New System.Drawing.Font("Times New Roman", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Margin = New System.Windows.Forms.Padding(4) Me.Name = "frmLogin" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Đăng nhập" Me.GroupBox1.ResumeLayout(False) Me.GroupBox1.PerformLayout() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() End Sub
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox Friend WithEvents TextBox2 As System.Windows.Forms.TextBox Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents LinkLabel1 As System.Windows.Forms.LinkLabel Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox End Class
2. Form danh mục khách hàng
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Partial Class frm_Customer
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try
If disposing AndAlso components IsNot Nothing Then components.Dispose() End If Finally MyBase.Dispose(disposing) End Try End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent()
Me.GroupBox1 = New System.Windows.Forms.GroupBox() Me.txtemail = New System.Windows.Forms.TextBox() Me.Label5 = New System.Windows.Forms.Label()
Me.txtDien_thoai = New System.Windows.Forms.TextBox() Me.txtDia_chi = New System.Windows.Forms.TextBox() Me.txtTen_kh = New System.Windows.Forms.TextBox() Me.txtMa_kh = New System.Windows.Forms.TextBox() Me.Label4 = New System.Windows.Forms.Label() Me.Label3 = New System.Windows.Forms.Label() Me.Label2 = New System.Windows.Forms.Label() Me.Label1 = New System.Windows.Forms.Label() Me.Button1 = New System.Windows.Forms.Button() Me.Button2 = New System.Windows.Forms.Button() Me.GroupBox1.SuspendLayout() Me.SuspendLayout() ' 'GroupBox1 ' Me.GroupBox1.Anchor= CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ Or System.Windows.Forms.AnchorStyles.Left) _ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.GroupBox1.Controls.Add(Me.txtemail) Me.GroupBox1.Controls.Add(Me.Label5) Me.GroupBox1.Controls.Add(Me.txtDien_thoai) Me.GroupBox1.Controls.Add(Me.txtDia_chi) Me.GroupBox1.Controls.Add(Me.txtTen_kh) Me.GroupBox1.Controls.Add(Me.txtMa_kh) Me.GroupBox1.Controls.Add(Me.Label4) Me.GroupBox1.Controls.Add(Me.Label3) Me.GroupBox1.Controls.Add(Me.Label2) Me.GroupBox1.Controls.Add(Me.Label1)
Me.GroupBox1.Location = New System.Drawing.Point(13, 3) Me.GroupBox1.Margin = New System.Windows.Forms.Padding(4) Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Padding = New System.Windows.Forms.Padding(4) Me.GroupBox1.Size = New System.Drawing.Size(773, 194)
Me.GroupBox1.TabIndex = 0 Me.GroupBox1.TabStop = False Me.GroupBox1.Text = "Khách hàng" ' 'txtemail '
Me.txtemail.Location = New System.Drawing.Point(189, 159) Me.txtemail.Name = "txtemail"
Me.txtemail.Size = New System.Drawing.Size(561, 26) Me.txtemail.TabIndex = 9
'
'Label5 '
Me.Label5.AutoSize = True
Me.Label5.Location = New System.Drawing.Point(35, 163) Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(42, 19) Me.Label5.TabIndex = 8
Me.Label5.Text = "Email" '
'txtDien_thoai '
Me.txtDien_thoai.Location = New System.Drawing.Point(189, 127) Me.txtDien_thoai.Name = "txtDien_thoai"
Me.txtDien_thoai.Size = New System.Drawing.Size(173, 26) Me.txtDien_thoai.TabIndex = 7
'
'txtDia_chi '
Me.txtDia_chi.Location = New System.Drawing.Point(189, 95) Me.txtDia_chi.Name = "txtDia_chi"
Me.txtDia_chi.Size = New System.Drawing.Size(561, 26) Me.txtDia_chi.TabIndex = 6
'
'txtTen_kh '
Me.txtTen_kh.Location = New System.Drawing.Point(189, 63) Me.txtTen_kh.Name = "txtTen_kh"
Me.txtTen_kh.Size = New System.Drawing.Size(561, 26) Me.txtTen_kh.TabIndex = 5 ' 'txtMa_kh ' Me.txtMa_kh.CharacterCasing= System.Windows.Forms.CharacterCasing.Upper
Me.txtMa_kh.Location = New System.Drawing.Point(189, 31) Me.txtMa_kh.Name = "txtMa_kh"
Me.txtMa_kh.Size = New System.Drawing.Size(173, 26) Me.txtMa_kh.TabIndex = 4
'
'Label4 '
Me.Label4.AutoSize = True
Me.Label4.Location = New System.Drawing.Point(35, 131) Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(70, 19) Me.Label4.TabIndex = 3
Me.Label4.Text = "Điện thoại" '
'Label3 '
Me.Label3.AutoSize = True
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(51, 19) Me.Label3.TabIndex = 2 Me.Label3.Text = "Địa chỉ" ' 'Label2 ' Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(35, 67) Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(104, 19) Me.Label2.TabIndex = 1 Me.Label2.Text = "Tên khách hàng" ' 'Label1 ' Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(35, 35) Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(102, 19) Me.Label1.TabIndex = 0 Me.Label1.Text = "Mã khách hàng" ' 'Button1 ' Me.Button1.Anchor= CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) Me.Button1.DialogResult = System.Windows.Forms.DialogResult.OK Me.Button1.Location = New System.Drawing.Point(13, 210)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 1 Me.Button1.Text = "&Lưu" Me.Button1.UseVisualStyleBackColor = True ' 'Button2 ' Me.Button2.Anchor= CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.Button2.Location = New System.Drawing.Point(110, 210) Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(91, 32) Me.Button2.TabIndex = 2 Me.Button2.Text = "&Hủy" Me.Button2.UseVisualStyleBackColor = True ' 'frm_Customer '
Me.AutoScaleDimensions = New System.Drawing.SizeF(9.0!, 19.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(799, 244)
Me.Controls.Add(Me.Button2) Me.Controls.Add(Me.Button1) Me.Controls.Add(Me.GroupBox1)
Me.Font = New System.Drawing.Font("Times New Roman", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Margin = New System.Windows.Forms.Padding(4) Me.Name = "frm_Customer"
Me.StartPosition= System.Windows.Forms.FormStartPosition.CenterParent
Me.GroupBox1.PerformLayout() Me.ResumeLayout(False)
End Sub
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents txtDien_thoai As System.Windows.Forms.TextBox Friend WithEvents txtDia_chi As System.Windows.Forms.TextBox Friend WithEvents txtTen_kh As System.Windows.Forms.TextBox Friend WithEvents txtMa_kh As System.Windows.Forms.TextBox Friend WithEvents Label4 As System.Windows.Forms.Label Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents txtemail As System.Windows.Forms.TextBox Friend WithEvents Label5 As System.Windows.Forms.Label End Class
3. Form đăng kí
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Partial Class frmRegedit
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try
If disposing AndAlso components IsNot Nothing Then components.Dispose() End If Finally MyBase.Dispose(disposing) End Try End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent()
Me.GroupBox1 = New System.Windows.Forms.GroupBox() Me.Label4 = New System.Windows.Forms.Label()
Me.cboAdmin_yn = New System.Windows.Forms.ComboBox() Me.txtpassconfim = New System.Windows.Forms.TextBox() Me.Label3 = New System.Windows.Forms.Label()
Me.txtPassword = New System.Windows.Forms.TextBox() Me.Label2 = New System.Windows.Forms.Label()
Me.txtUser = New System.Windows.Forms.TextBox() Me.Label1 = New System.Windows.Forms.Label() Me.Button1 = New System.Windows.Forms.Button() Me.Button2 = New System.Windows.Forms.Button() Me.GroupBox1.SuspendLayout() Me.SuspendLayout() ' 'GroupBox1 ' Me.GroupBox1.Anchor= CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ Or System.Windows.Forms.AnchorStyles.Left) _ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.GroupBox1.Controls.Add(Me.Label4)
Me.GroupBox1.Controls.Add(Me.cboAdmin_yn) Me.GroupBox1.Controls.Add(Me.txtpassconfim) Me.GroupBox1.Controls.Add(Me.Label3) Me.GroupBox1.Controls.Add(Me.txtPassword) Me.GroupBox1.Controls.Add(Me.Label2) Me.GroupBox1.Controls.Add(Me.txtUser) Me.GroupBox1.Controls.Add(Me.Label1)
Me.GroupBox1.Location = New System.Drawing.Point(36, 18) Me.GroupBox1.Margin = New System.Windows.Forms.Padding(4) Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Padding = New System.Windows.Forms.Padding(4) Me.GroupBox1.Size = New System.Drawing.Size(443, 186)
Me.GroupBox1.TabIndex = 0 Me.GroupBox1.TabStop = False Me.GroupBox1.Text = "Đăng ký" ' 'Label4 ' Me.Label4.AutoSize = True
Me.Label4.Location = New System.Drawing.Point(44, 144)
Me.Label4.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(49, 19) Me.Label4.TabIndex = 8 Me.Label4.Text = "Vai trò" ' 'cboAdmin_yn ' Me.cboAdmin_yn.DropDownStyle= System.Windows.Forms.ComboBoxStyle.DropDownList Me.cboAdmin_yn.FormattingEnabled = True
Me.cboAdmin_yn.Items.AddRange(New Object() {"User", "Admin"}) Me.cboAdmin_yn.Location = New System.Drawing.Point(177, 140) Me.cboAdmin_yn.Name = "cboAdmin_yn"
Me.cboAdmin_yn.Size = New System.Drawing.Size(188, 27) Me.cboAdmin_yn.TabIndex = 7
'
'txtpassconfim '
Me.txtpassconfim.Location = New System.Drawing.Point(177, 108) Me.txtpassconfim.Name = "txtpassconfim"
Me.txtpassconfim.Size = New System.Drawing.Size(188, 26) Me.txtpassconfim.TabIndex = 5 Me.txtpassconfim.UseSystemPasswordChar = True ' 'Label3 ' Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(44, 111)
Me.Label3.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(125, 19) Me.Label3.TabIndex = 4
Me.Label3.Text = "Xác nhận mật khẩu" '
'txtPassword '
Me.txtPassword.Location = New System.Drawing.Point(177, 76) Me.txtPassword.Name = "txtPassword"
Me.txtPassword.Size = New System.Drawing.Size(188, 26) Me.txtPassword.TabIndex = 3 Me.txtPassword.Tag = "S" Me.txtPassword.UseSystemPasswordChar = True ' 'Label2 ' Me.Label2.AutoSize = True
Me.Label2.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(67, 19) Me.Label2.TabIndex = 2 Me.Label2.Text = "Mật khẩu" ' 'txtUser ' Me.txtUser.CharacterCasing= System.Windows.Forms.CharacterCasing.Upper
Me.txtUser.Location = New System.Drawing.Point(177, 44) Me.txtUser.Name = "txtUser"
Me.txtUser.Size = New System.Drawing.Size(188, 26) Me.txtUser.TabIndex = 1 Me.txtUser.Tag = "S" ' 'Label1 ' Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(44, 47)
Me.Label1.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(98, 19) Me.Label1.TabIndex = 0
Me.Label1.Text = "Tên đăng nhập" ' 'Button1 ' Me.Button1.Anchor= CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.Button1.DialogResult = System.Windows.Forms.DialogResult.OK
Me.Button1.Location = New System.Drawing.Point(260, 211) Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(102, 35) Me.Button1.TabIndex = 1 Me.Button1.Text = "Đăn&g ký" Me.Button1.UseVisualStyleBackColor = True ' 'Button2 ' Me.Button2.Anchor= CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Button2.Location = New System.Drawing.Point(377, 211) Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(102, 35) Me.Button2.TabIndex = 2 Me.Button2.Text = "&Hủy" Me.Button2.UseVisualStyleBackColor = True ' 'frmRegedit '
Me.AutoScaleDimensions = New System.Drawing.SizeF(9.0!, 19.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(504, 258)
Me.Controls.Add(Me.Button2) Me.Controls.Add(Me.Button1) Me.Controls.Add(Me.GroupBox1)
Me.Font = New System.Drawing.Font("Times New Roman", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Margin = New System.Windows.Forms.Padding(4) Me.Name = "frmRegedit"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
Me.Text = "Đăng ký người sử dụng" Me.GroupBox1.ResumeLayout(False) Me.GroupBox1.PerformLayout() Me.ResumeLayout(False)
End Sub
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox Friend WithEvents txtpassconfim As System.Windows.Forms.TextBox Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents txtPassword As System.Windows.Forms.TextBox Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents txtUser As System.Windows.Forms.TextBox Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents Button2 As System.Windows.Forms.Button Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents cboAdmin_yn As System.Windows.Forms.ComboBox End Class
4. Form thêm mới khách hàng
Public Class frm_Customer Private _action As String
Public Sub New(ByVal action As String) ' This call is required by the designer. InitializeComponent()
_action = action
' Add any initialization after the InitializeComponent() call. End Sub
Private Ma_kh_Old As String
As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed cusDataview = GetDataset(cusStructure).Tables(0).DefaultView frmMain.cus_Grid.DataSource = cusDataview
frmMain.cus_Grid.Select() End Sub
Private Sub frm_Customer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If _action = "New" Then
GroupBox1.Text = "Thêm mới" Else
GroupBox1.Text = "Sửa" End If
GroupBox1.Text += " khách hàng" Me.CancelButton = Button2
If _action <> "New" Then
For Each eControl As Control In GroupBox1.Controls
If eControl.GetType.ToString.EndsWith("TextBox") Then Dim ir As Integer = frmMain.cus_Grid.CurrentRow.Index
If Not IsDBNull(cusDataview(ir)(eControl.Name.Remove(0, 3))) Then eControl.Text = cusDataview(ir)(eControl.Name.Remove(0, 3)) End If End If Next End If Ma_kh_Old = txtMa_kh.Text End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If txtMa_kh.Text.Trim = "" Then
Return
ElseIf txtTen_kh.Text.Trim = "" Then
MsgBox("Tên khách không được để trống") Return
End If
Dim file As String = "", val As String = ""
For Each eControl As Control In GroupBox1.Controls
If eControl.GetType.ToString.EndsWith("TextBox") Then file += "," + eControl.Name.Remove(0, 3) val += ",'" + eControl.Text.Trim + "'" End If Next If file <> "" Then file = file.Remove(0, 1) val = val.Remove(0, 1) If _action = "Edit" Then
ExeSQL("delete from dmkh where ma_kh ='" + Ma_kh_Old.Trim + "'")
End If
If Ma_kh_Old.Trim <> txtMa_kh.Text.Trim Then
If GetDataset("select 1 from dmkh where ma_kh ='" + txtMa_kh.Text.Trim + "'").Tables(0).Rows.Count > 0 Then
MsgBox("Mã đã có, không thể thêm mới") Exit Sub
End If End If
ExeSQL("insert into dmkh (" + file + ") values (" + val + ")") End If
Me.Close() End Sub
5. Kết nối CSDL
Imports System.Data.OleDb Module M_Connect
Private oleconn As OleDbConnection Private olecmd As OleDbCommand Public Sub Connect()
' Mở Kết Nối Try
oleconn = New OleDbConnection
oleconn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Application.StartupPath & "\data\CRMDB.mdb;"
oleconn.Open() Catch
MsgBox("Không tìm được csdl <đường dẫn:" & Application.StartupPath & "\data\CRMDB.mdb > không chính xác")
End End Try End Sub
Public Sub Disconnect() oleconn.Close() oleconn = Nothing End Sub
Public Function GetDataset(ByVal sqlString As String, Optional ByVal name As String = "XXX") As DataSet
' đổ dữ liệu vào dataset Connect()
Dim ds As DataSet = New DataSet Try
Dim cmd As New OleDbCommand cmd.Connection = oleconn
cmd.CommandText = sqlString Dim da As New OleDbDataAdapter da.SelectCommand = cmd da.Fill(ds, name) Catch ex As Exception MsgBox(ex.ToString) End Try Return ds End Function
Public Function FindDetail(ByVal ColumnName As String, ByVal TabName As String, _
ByVal Condition As String, ByVal Word As String) As DataTable
Connect()
Dim sql As String = "select " & ColumnName & " from " & TabName _ & " where " & Condition & "='" + Word + "'"
Dim dt As New DataTable Try
Dim da As New OleDbDataAdapter(sql, oleconn) da.Fill(dt) Disconnect() Catch End Try Return dt End Function
Public Function FindExtand(ByVal ColumnName As String, ByVal TabName As String, _
ByVal Condition As String, ByVal Word As String) As DataTable
Dim sql As String = "select " & ColumnName & " from " & TabName _ & " where " & Condition & " like '%" & Word & "%'"
Try
Connect()
Dim da As New OleDbDataAdapter(sql, oleconn) da.Fill(dt) Catch ex As Exception End Try Disconnect() Return dt End Function
Public Sub ExeSQL(ByVal sql As String) Connect()
Try
olecmd = New OleDbCommand(sql, oleconn) olecmd.ExecuteNonQuery() Catch ex As Exception MsgBox(ex.ToString) End Try Disconnect() End Sub End Module