private void AddMaDichvuCompo() { madichvu = DBAcess.ExecuteQuery("SP_LAYMADICHVU"); comboBox1.DataSource = madichvu; comboBox1.ValueMember = "MADV"; }
private void button1_Click(object sender, EventArgs e) { if (textBox2.Text.Trim() == "" || textBox1.Text.Trim() == "" || textBox3.Text.Trim() == "") { MessageBox.Show("Mật khẩu phải chứa kí tự hoặc số. Không chứa khoảng trắng."); return; } if (textBox1.Text != textBox3.Text) { MessageBox.Show("New password phải giống confirm password"); return; } string[] name = { "@newpassword", "@oldpassword", "@login" }; object[] param = { textBox1.Text, textBox2.Text, DBAcess.USERNAME }; int x = DBAcess.ExecuteNonQuery("SP_DoiMatKhau", name, param, 3); if (x == 0) { MessageBox.Show("Đổi mật khẩu thành công"); this.Close(); } else { MessageBox.Show("Đổi mật khẩu thất bại"); } }
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { string maphieu = comboBox2.SelectedValue.ToString(); string[] name = { "@MAPHIEU" }; object[] param = { maphieu }; DataTable thongtinkhachhang = DBAcess.ExecuteQuery("SP_LAYTHONGTINKHACHANG", name, param, 1); textBox4.DataBindings.Add("TEXT", thongtinkhachhang, "HOTEN"); textBox4.DataBindings.Clear(); textBox5.DataBindings.Add("TEXT", thongtinkhachhang, "DIACHI"); textBox5.DataBindings.Clear(); /*textBox6.DataBindings.Add("TEXT", thongtinkhachhang, "NGAYCAP"); * textBox6.DataBindings.Clear();*/ dateTimePicker2.DataBindings.Clear(); dateTimePicker2.DataBindings.Add("Value", thongtinkhachhang, "NGAYCAP"); textBox7.DataBindings.Add("TEXT", thongtinkhachhang, "CMNDAN"); textBox7.DataBindings.Clear(); comboBox1.DataBindings.Add("TEXT", thongtinkhachhang, "MDV"); comboBox1.DataBindings.Clear(); }
private void button3_Click(object sender, EventArgs e) { string madv = comboBox1.Text.ToString(); string tendv = textBox1.Text.ToString(); string kyhan = textBox2.Text.ToString(); string laisuat = textBox3.Text.ToString(); string[] name = { "@MADV", "@TENDV", "@KYHAN", "@LAISUAT" }; object[] param = { madv, tendv, kyhan, laisuat }; int x = DBAcess.ExecuteNonQuery("SP_SUADICHVU", name, param, 4); if (x == 0) { MessageBox.Show("Sua dich vu thành công"); Capnhatdichvu_Load(sender, e); } if (x != 0) { MessageBox.Show("Sua dich vu thất bại"); } comboBox1.DataBindings.Clear(); textBox1.DataBindings.Clear(); textBox2.DataBindings.Clear(); textBox3.DataBindings.Clear(); }
private void AddMaPhieutoCompo() { MaPhieu = DBAcess.ExecuteQuery("SP_LAYMAPHIEU"); comboBox2.DataSource = MaPhieu; comboBox2.ValueMember = "MAPHIEU"; }
private void button1_Click(object sender, EventArgs e) { DateTime fromdate = DateTime.Parse(dateTimePicker1.Value.ToString()); DateTime todate = DateTime.Parse(dateTimePicker2.Value.ToString()); string[] name = { "@FROMDATE", "@TODATE" }; object[] param = { fromdate, todate }; DataTable phieutrongkhoang = DBAcess.ExecuteQuery("SP_LIETKEPHIEUGUI", name, param, 2); reportViewer1.ProcessingMode = ProcessingMode.Local; reportViewer1.LocalReport.ReportPath = "Thongkephieugui.rdlc"; if (phieutrongkhoang.Rows.Count > 0) { ReportDataSource rds = new ReportDataSource(); rds.Name = "DataSet1"; rds.Value = phieutrongkhoang; reportViewer1.LocalReport.DataSources.Clear(); reportViewer1.LocalReport.DataSources.Add(rds); reportViewer1.RefreshReport(); } }
private void btnTienlai_Click(object sender, EventArgs e) { try { /* Chuyen kieu string sang date time */ DateTime ngGUI = DateTime.Parse(ngayguiTBOX.Text.ToString()); ngayguiTBOX.Text = ngGUI.ToString("dd/MM/yyyy"); DateTime ngDenHan = DateTime.Parse(ngaydenhanTBOX.Text.ToString()); ngaydenhanTBOX.Text = ngDenHan.ToString("dd/MM/yyyy"); DateTime ngRut = DateTime.Parse(dateTimePicker1.Value.ToString()); dateTimePicker1.Text = ngRut.ToShortDateString(); string maPH = comboBox1.SelectedItem.ToString(); /* DateTime ngGUI = DateTime.Parse(DateTime.Now.ToShortDateString()); * string ngayguiTBOX = ngGUI.Day + "/" + ngGUI.Month + "/" + ngGUI.Year; * MessageBox.Show(ngayguiTBOX);*/ /*string maDV = madichvuTBOX.Text.ToString();*/ /*string ngGUI = ngayguiTBOX.Text.ToString();*/ /*string ngDenHan = ngaydenhanTBOX.Text.ToString();*/ /*string laiSuat = laisuatTBOX.Text.ToString(); * string sotienGui = sotienguiTBOX.Text.ToString();*/ /*string ngRut = dateTimePicker1.Value.ToString();*/ /*string kyHan = kyhanTBOX.Text.ToString();*/ // truyen bien vao thuoc tinh khai bao trong sp string[] name = { "@MAPHIEU" }; object[] param = { maPH }; DataTable tien_lai = DBAcess.ExecuteQuery("SP_TINHTIENLAI", name, param, 1); ngayguiTBOX.DataBindings.Clear(); ngaydenhanTBOX.DataBindings.Clear(); dateTimePicker1.DataBindings.Clear(); tienlaiTBOX.DataBindings.Add("TEXT", tien_lai, "TIENLAI"); tienlaiTBOX.DataBindings.Clear(); tienlaiTBOX.Enabled = false; btnGhi.Enabled = true; } catch { MessageBox.Show("co loi"); } }
private void AddMaPhieutoCompo() { maphieu = DBAcess.ExecuteQuery("SP_LAYMAPHIEU"); comboBox1.Items.Clear(); foreach (DataRow s in maphieu.Rows) { comboBox1.Items.Add(s[1]); } comboBox1.SelectedIndex = 0; }
private bool DangNhap_GDV(string username, string password) { DBAcess.USERNAME = username; DBAcess.PASSWORD = password; DBAcess.Refresh(); string[] name = { "@LOGINNAME" }; object[] param = { username }; SqlDataReader reader = DBAcess.ExecSqlDataReader("SP_DANGNHAP", name, param, 1); if (reader == null) { return(false); } reader.Read(); if (reader.HasRows) { /*Console.WriteLine(reader["MAGDV"].ToString() + reader["HOTEN"].ToString() + reader["ROLE"].ToString()); * DBAcess.ROLE = reader["ROLE"].ToString(); * DBAcess.HOTEN = reader["HOTEN"].ToString(); * DBAcess.MAGDV = reader["MAGDV"].ToString(); * * string hoten = DBAcess.HOTEN = reader["HOTEN"].ToString(); * MessageBox.Show("Dang Nhap Thanh Cong! Xin Chào: " + hoten);*/ string hoten = DBAcess.HOTEN = reader["HOTEN"].ToString(); string magdv = DBAcess.MAGDV = reader["MAGDV"].ToString(); string role = DBAcess.ROLE = reader["ROLES"].ToString(); magdvTBOX.Text = magdv; //Gán giá trị của thuộc tính _textbox1 của Form1 cho thuộc tính _textbox của Form2 //Gán giá trị của thuộc tính _textbox1 của Form1 cho thuộc tính _textbox của Form2 //Hiển thị Form2 MessageBox.Show("xin chào " + hoten); this.Hide(); FrmChucNang fchucnang = new FrmChucNang(); fchucnang.Show(); DBAcess.Close(); reader.Close(); return(true); } DBAcess.Close(); return(false); }
private void btnGhi_Click(object sender, EventArgs e) { try { /*Double value; * if (Double.TryParse(tongtienrutTBOX.Text, out value)) * tongtienrutTBOX.Text = String.Format(System.Globalization.CultureInfo.CurrentCulture, "{0:C2}", value); * else * tongtienrutTBOX.Text = String.Empty; */ if (tongtienrutTBOX.Text.Length > 10) { MessageBox.Show("Số tiền rút tối đa chỉ là 1 tỷ"); } else { string maPH = comboBox1.SelectedItem.ToString(); string maGDV = magdvTBOX.Text.ToString(); /*DateTime ngRut = DateTime.Parse(dateTimePicker1.Value.ToString()); * dateTimePicker1.Text = ngRut.ToShortDateString();*/ /*string sotienGui = sotienguiTBOX.Text.ToString();*/ string tienlai = tienlaiTBOX.Text.ToString(); string sotienRut = tongtienrutTBOX.Text.ToString(); /* MessageBox.Show("toi day"); * string.Format("{#.0000}",sotienRut); * MessageBox.Show("toi day");*/ /*string sotienRut = String.Format("{0:C}", sotienRut);*/ string[] name = { "@MAPHIEU", "@MAGDV_LPRUT", "@TIENLAI", "@SOTIEN_RUT" }; object[] param = { maPH, maGDV, tienlai, sotienRut }; int x = DBAcess.ExecuteNonQuery("SP_THEMPHIEURUT", name, param, 4); if (x == 0) { MessageBox.Show("RUT TIEN THANH CONG"); tongtienrutTBOX.DataBindings.Clear(); tienlaiTBOX.DataBindings.Clear(); sotienguiTBOX.DataBindings.Clear(); } if (x != 0) { MessageBox.Show("TIEN BAN RUT QUA LON"); } } } catch { MessageBox.Show(" loi roi"); } }
private void button3_Click(object sender, EventArgs e) { try { if (textBox4.Text.Trim() == "" | textBox5.Text.Trim() == "" | textBox7.Text.Trim() == "" | comboBox1.Text == "") { MessageBox.Show("Không được để trống các trường trong form "); } if (textBox11.Text.Trim() == "") { MessageBox.Show("Mời bạn nhập số tiền muốn gửi"); } if (textBox4.Text.Trim() != "" && textBox5.Text.Trim() != "" && textBox7.Text.Trim() != "" && comboBox1.Text != "" && textBox7.Text.Length < 11) { string hoTen = textBox4.Text.ToString(); string diaChi = textBox5.Text.ToString(); /*DateTime ngCap = DateTime.Parse(textBox6.Text.ToString()); * textBox6.Text = ngCap.ToString("dd/MM/yyyy");*/ DateTime ngCap = DateTime.Parse(dateTimePicker2.Text.ToString()); dateTimePicker2.Text = ngCap.ToString(); string CMNDAN = textBox7.Text.ToString(); string maDV = comboBox1.Text.ToString(); string maGDV_lpgui = label14.Text.ToString(); string soTiengui = textBox11.Text.ToString(); DateTime ngDenhan = DateTime.Parse(textBox1.Text.ToString()); textBox1.Text = ngDenhan.ToString("dd/MM/yyyy"); string[] name = { "@CMND", "@HOTEN", "@DIACHI", "@NGAYCAP", "@MADV", "@SOTIEN_GUI", "@NGAYDENHAN", "@MAGDV_LPGUI" }; object[] param = { CMNDAN, hoTen, diaChi, ngCap, maDV, soTiengui, ngDenhan, maGDV_lpgui }; DataTable thongtindichvu = DBAcess.ExecuteQuery("SP_THEMPHIEUGUI", name, param, 8); label15.DataBindings.Add("TEXT", thongtindichvu, "MAPHIEU"); MessageBox.Show("Đã thêm thành công " + textBox11.Text + " " + "VDN vào phiếu gửi " + " " + label15.Text.ToUpper()); textBox4.DataBindings.Clear(); textBox5.DataBindings.Clear(); /*textBox6.DataBindings.Clear();*/ dateTimePicker2.DataBindings.Clear(); textBox7.DataBindings.Clear(); comboBox1.DataBindings.Clear(); textBox11.DataBindings.Clear(); /* string laiSuat = * * string ngdenHan = * string maGDV_lpgui =*/ PhieuGuiTien_Load(sender, e); } } catch { MessageBox.Show("GUI TIEN THAT BAI ROI"); } }
private void button1_Click(object sender, EventArgs e) { string maPH = comboBox1.SelectedItem.ToString(); string[] name = { "@MAPHIEU" }; object[] param = { maPH }; DataTable thongtin = DBAcess.ExecuteQuery("SP_LAYDULIEUFORPHIEURUT", name, param, 1); /*SqlCommand cmd = new SqlCommand("SP_LAYDULIEUFORPHIEURUT", conn); * cmd.CommandType = CommandType.StoredProcedure;*/ hotenTBOX.DataBindings.Add("TEXT", thongtin, "HOTEN"); cmndTBOX.DataBindings.Add("TEXT", thongtin, "CMND"); diachiTBOX.DataBindings.Add("TEXT", thongtin, "DIACHI"); ngaycapTBOX.DataBindings.Add("TEXT", thongtin, "NGAYCAP"); madichvuTBOX.DataBindings.Add("TEXT", thongtin, "MADV"); dichvuTBOX.DataBindings.Add("TEXT", thongtin, "TENDV"); kyhanTBOX.DataBindings.Add("TEXT", thongtin, "KYHAN"); ngayguiTBOX.DataBindings.Add("TEXT", thongtin, "NGAYGUI"); ngaydenhanTBOX.DataBindings.Add("TEXT", thongtin, "NGAYDENHAN"); laisuatTBOX.DataBindings.Add("TEXT", thongtin, "LAISUAT"); sotienguiTBOX.DataBindings.Add("TEXT", thongtin, "SOTIEN_GUI"); magdvTBOX.DataBindings.Add("TEXT", thongtin, "MAGDV_LPGUI"); /* clear databindings */ hotenTBOX.DataBindings.Clear(); cmndTBOX.DataBindings.Clear(); diachiTBOX.DataBindings.Clear(); ngaycapTBOX.DataBindings.Clear(); madichvuTBOX.DataBindings.Clear(); dichvuTBOX.DataBindings.Clear(); kyhanTBOX.DataBindings.Clear(); ngayguiTBOX.DataBindings.Clear(); ngaydenhanTBOX.DataBindings.Clear(); laisuatTBOX.DataBindings.Clear(); sotienguiTBOX.DataBindings.Clear(); magdvTBOX.DataBindings.Clear(); /* enable text box */ hotenTBOX.Enabled = false; cmndTBOX.Enabled = false; diachiTBOX.Enabled = false; ngaycapTBOX.Enabled = false; madichvuTBOX.Enabled = false; dichvuTBOX.Enabled = false; kyhanTBOX.Enabled = false; ngayguiTBOX.Enabled = false; ngaydenhanTBOX.Enabled = false; laisuatTBOX.Enabled = false; sotienguiTBOX.Enabled = false; btnTienlai.Enabled = true; }
private void AddMaPhieutoCompo() { dichvu = DBAcess.ExecuteQuery("SP_LAYMADICHVU"); comboBox1.Items.Clear(); foreach (DataRow s in dichvu.Rows) { comboBox1.Items.Add(s[0]); } comboBox1.SelectedIndex = 0; }
private void button12_Click_1(object sender, EventArgs e) { DateTime year = DateTime.Parse(dateTimePicker3.Value.ToString()); string[] name = { "@YEAR" }; object[] param = { year }; DataTable table = DBAcess.ExecuteQuery("SP_LIETKETIENTHEOTHANG", name, param, 1); this.sP_LIETKETIENTHEOTHANGDataGridView.DataSource = table; }
private void button2_Click(object sender, EventArgs e) { if (MessageBox.Show("Bạn muốn xóa mã phiếu :" + " " + comboBox2.Text, "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { string maPhieu = comboBox2.Text.ToString(); string[] name = { "@MAPHIEU" }; object[] param = { maPhieu }; DataTable xoaphieugui = DBAcess.ExecuteQuery("SP_XOAPHIEUGUI", name, param, 1); MessageBox.Show("Đã xóa mã phiếu" + " " + maPhieu + " " + "thành công"); comboBox2.DataBindings.Clear(); PhieuGuiTien_Load(sender, e); } }
private void tinhngaydenhan() { DateTime ngGUI = DateTime.Parse(dateTimePicker1.Value.ToString()); dateTimePicker1.Text = ngGUI.ToShortDateString(); string kyhan = textBox8.Text.ToString(); string [] name = { "@NGAYGUI", "@KYHAN" }; object[] param = { ngGUI, kyhan }; DataTable ngaydenhan = DBAcess.ExecuteQuery("SP_TINHNGAYDENHAN", name, param, 2); textBox1.DataBindings.Add("TEXT", ngaydenhan, "NGAYDENHAN"); textBox1.DataBindings.Clear(); }
private void button5_Click_1(object sender, EventArgs e) { DateTime fromdate = DateTime.Parse(dateTimePicker2.Value.ToString()); DateTime todate = DateTime.Parse(dateTimePicker1.Value.ToString()); string[] name = { "@FROMDATE", "@TODATE" }; object[] param = { fromdate, todate }; DataTable phieutrongkhoang = DBAcess.ExecuteQuery("SP_LIETKEPHIEUGUI", name, param, 2); this.sP_LIETKEPHIEUGUIDataGridView.DataSource = phieutrongkhoang; }
private void button1_Click_1(object sender, EventArgs e) { int reinit = checkBox1.Checked ? 1 : 0; string[] name = { "@reinit" }; object[] param = { reinit }; int code = DBAcess.ExecuteNonQuery("SP_BACKUP", name, param, 1); if (code > 0) { MessageBox.Show("Sao lưu thành công"); } else { MessageBox.Show("Sao lưu thất bại."); } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { string maDV = comboBox1.SelectedValue.ToString(); string[] name = { "@MADV" }; object[] param = { maDV }; DataTable thongtindichvu = DBAcess.ExecuteQuery("SP_LAYTHONGTINDICHVU", name, param, 1); textBox9.DataBindings.Add("TEXT", thongtindichvu, "TENDV"); textBox9.DataBindings.Clear(); textBox8.DataBindings.Add("TEXT", thongtindichvu, "KYHAN"); textBox8.DataBindings.Clear(); textBox10.DataBindings.Add("TEXT", thongtindichvu, "LAISUAT"); textBox10.DataBindings.Clear(); tinhngaydenhan(); }
private void ReportDV_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'TKBUUDIENDataSet2.SP_LAYTHONGTINDICHVU' table. You can move, or remove it, as needed. this.reportViewer1.RefreshReport(); dichvu = DBAcess.ExecuteQuery("SP_LIETKEDICHVU"); reportViewer1.ProcessingMode = ProcessingMode.Local; reportViewer1.LocalReport.ReportPath = "Thongkedichvu.rdlc"; if (dichvu.Rows.Count > 0) { ReportDataSource rds = new ReportDataSource(); rds.Name = "DataSet2"; rds.Value = dichvu; reportViewer1.LocalReport.DataSources.Clear(); reportViewer1.LocalReport.DataSources.Add(rds); reportViewer1.RefreshReport(); } }
private void button1_Click(object sender, EventArgs e) { try { if (comboBox1.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "" || textBox6.Text == "" || nhanvienrRBTON.Checked == false && adminRBTON.Checked == false) { MessageBox.Show("ban chua nhập đầy đủ"); } else { string hoten = comboBox1.Text.ToString(); string diachi = textBox2.Text.ToString(); string cmndan = textBox3.Text.ToString(); string soDT = textBox4.Text.ToString(); string tenDnhap = textBox5.Text.ToString(); string mAtkhau = textBox6.Text.ToString(); string Role = getRole(); string[] name = { "@LGNAME", "@PASS", "@ROLE", "@HOTEN", "@DIACHI", "@CMND", "@SODT" }; object[] param = { tenDnhap, mAtkhau, Role, hoten, diachi, cmndan, soDT }; int x = DBAcess.ExecuteNonQuery("TAO_LOGIN", name, param, 7); comboBox1.Text = string.Empty; textBox2.Text = string.Empty; textBox3.Text = string.Empty; textBox4.Text = string.Empty; textBox5.Text = string.Empty; textBox6.Text = string.Empty; if (x == 0) { MessageBox.Show("TẠO TÀI KHÒAN" + Role + "THÀNH CÔNG"); } if (x != 0) { MessageBox.Show("Chưa tạo được tài khoản"); } } } catch { MessageBox.Show(" loi roi"); } }
private void ReportPhieuGuiquahan_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'TKBUUDIENDataSet2.SP_LIETKEPHIEUGUIQUAHAN' table. You can move, or remove it, as needed. this.reportViewer1.RefreshReport(); pguiquahan = DBAcess.ExecuteQuery("SP_LIETKEPHIEUGUIQUAHAN"); reportViewer1.ProcessingMode = ProcessingMode.Local; reportViewer1.LocalReport.ReportPath = "Thongkephieuguiquahan.rdlc"; if (pguiquahan.Rows.Count > 0) { ReportDataSource rds = new ReportDataSource(); rds.Name = "DataSet3"; rds.Value = pguiquahan; reportViewer1.LocalReport.DataSources.Clear(); reportViewer1.LocalReport.DataSources.Add(rds); reportViewer1.RefreshReport(); } }
private void DANHSACH_LOAD() { DataTable dsbackup = DBAcess.ExecuteQuery("SP_DANHSACHBACKUP"); sP_DANHSACHBACKUPBindingSource.DataSource = dsbackup; }
private void load_dichvu(object sender, EventArgs e) { DataTable dichvu = DBAcess.ExecuteQuery("SP_LIETKEDICHVU"); sP_LIETKEDICHVUBindingSource1.DataSource = dichvu; }
private void load_phieuguiquahan() { DataTable pguiquahan = DBAcess.ExecuteQuery("SP_LIETKEPHIEUGUIQUAHAN"); sP_LIETKEPHIEUGUIQUAHANBindingSource.DataSource = pguiquahan; }