Exemple #1
0
 public NhanVien()
 {
     InitializeComponent();
     try
     {
         NhatKyHeThongBUS.ThemNhatKyHeThong("Nhân Viên", "Xem", "");
     }
     catch
     {
     }
 }
Exemple #2
0
 public NhomHang()
 {
     InitializeComponent();
     try
     {
         NhatKyHeThongBUS.ThemNhatKyHeThong("Nhóm Hàng", "Xem", "");
     }
     catch
     {
     }
 }
Exemple #3
0
 public KhuVuc()
 {
     InitializeComponent();
     try
     {
         NhatKyHeThongBUS.ThemNhatKyHeThong("Khu Vực", "Xem", "");
     }
     catch
     {
     }
 }
Exemple #4
0
 private void NapLaiDL(object sender, EventArgs e)
 {
     try
     {
         NhatKyHeThongBUS.ThemNhatKyHeThong("Bộ Phận", "Nạp lại", "");
     }
     catch
     {
     }
     LoadData();
 }
Exemple #5
0
 public PhanQuyen()
 {
     try
     {
         nhatKyHeThongBUS.ThemNhatKyHeThong("Phân quyền", "Xem", "");
     }
     catch
     {
     }
     InitializeComponent();
 }
Exemple #6
0
 public TyGia()
 {
     InitializeComponent();
     try
     {
         NhatKyHeThongBUS.ThemNhatKyHeThong("Tỷ Giá", "Xem", "");
     }
     catch
     {
     }
 }
Exemple #7
0
 public HangHoa()
 {
     InitializeComponent();
     try
     {
         NhatKyHeThongBUS.ThemNhatKyHeThong("Hàng Hóa", "Xem", "");
     }
     catch
     {
     }
 }
Exemple #8
0
 public NhaCungCap()
 {
     InitializeComponent();
     try
     {
         NhatKyHeThongBUS.ThemNhatKyHeThong("Nhà Cung Cấp", "Xem", "");
     }
     catch
     {
     }
 }
Exemple #9
0
 public KhachHang()
 {
     InitializeComponent();
     try
     {
         NhatKyHeThongBUS.ThemNhatKyHeThong("Khách Hàng", "Xem", "");
     }
     catch
     {
     }
 }
Exemple #10
0
 public DonViTnh()
 {
     try
     {
         nhatKyHeThongBUS.ThemNhatKyHeThong("Đơn vị tính", "Xem", "");
     }
     catch
     {
     }
     InitializeComponent();
 }
Exemple #11
0
 public DoiMatKhau(string tk)
 {
     InitializeComponent();
     tkdn = tk;
     pictureEdit1.Image = Image.FromFile(@"Resources\key_1.png");
     pictureEdit1.Properties.SizeMode = DevExpress.XtraEditors.Controls.PictureSizeMode.Stretch;
     try
     {
         nhatKyHeThongBUS.ThemNhatKyHeThong("Hệ Thống", "Thay đổi mật khẩu", "Xem");
     }
     catch
     {
     }
 }
Exemple #12
0
 public NhatKyHeThong()
 {
     InitializeComponent();
     LoadData();
     columdatetime.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.DateTime;
     columdatetime.Properties.Mask.EditMask = "dd/MM/yyyy HH:mm:ss";
     columdatetime.Properties.Mask.UseMaskAsDisplayFormat = true;
     try
     {
         NhatKyHeThongBUS.ThemNhatKyHeThong("Nhật Ký Hệ Thống", "Xem", "");
     }
     catch
     {
     }
 }
Exemple #13
0
 public KhoHang()
 {
     try
     {
         NhatKyHeThongBUS.ThemNhatKyHeThong("Kho Hàng", "Xem", "");
     }
     catch
     {
     }
     InitializeComponent();
     uc_DanhMuc1.Controls["ucbtnnaplai"].Click += NapLaiDL;
     uc_DanhMuc1.Controls["ucbtnthem"].Click   += ThemKhoHang;
     uc_DanhMuc1.Controls["ucbtnsua"].Click    += SuaThongTinKhoHang;
     uc_DanhMuc1.Controls["ucbtnxoa"].Click    += XoaKhoHang;
     uc_DanhMuc1.Controls["ucbtndong"].Click   += DongBieuMau;
     uc_DanhMuc1.Controls["ucbtnxuat"].Click   += XuatFile;
     grvctkhohang.DataSource = khoHangBUS.LayThongTinKhoHang();
 }
Exemple #14
0
        public TonKho()
        {
            InitializeComponent();
            grvroottonkho.GroupPanelText = "Hãy kéo thả các cột vào đây";
            grvcttonkho.DataSource       = tonKhoBUS.LayThongTinTonKho();
            GridGroupSummaryItem item = new GridGroupSummaryItem();

            item.FieldName = "SoLuong";
            item.ShowInGroupColumnFooter = grvroottonkho.Columns["SoLuong"];
            item.SummaryType             = DevExpress.Data.SummaryItemType.Sum;
            item.DisplayFormat           = "{0}";
            grvroottonkho.GroupSummary.Add(item);
            try
            {
                NhatKyHeThongBUS.ThemNhatKyHeThong("Tồn Kho", "Xem", "");
            }
            catch
            {
            }
        }
Exemple #15
0
 private void Btndangnhap_Click(object sender, EventArgs e)
 {
     // xử lý nếu người dùng không điền vô textbox taikkhoan
     if (txtuser.Text == "")
     {
         MessageBox.Show("Tài khoản không được rỗng.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         if (dangNhapBUS.CheckLogin(txtuser.Text, txtmatkhau.Text, ref RoldeId))
         {
             NhatKyHeThongBUS nhatKyHeThongBUS = new NhatKyHeThongBUS();
             try
             {
                 nhatKyHeThongBUS.ThemNhatKyHeThong("Hệ Thống", "Đăng Nhập", " ");
             }
             catch
             {
             }
             if (checksave.Checked)
             {
                 Quan_Ly_Ban_Hang.Properties.Settings.Default.UserName = txtuser.Text;
                 Quan_Ly_Ban_Hang.Properties.Settings.Default.Password = txtmatkhau.Text;
                 Quan_Ly_Ban_Hang.Properties.Settings.Default.Save();
             }
             GlobalVar.tendn = txtuser.Text;
             var list = dangNhapBUS.GetListRolform(RoldeId);
             // Đưa vô distionary
             foreach (var RoleForm in list)
             {
                 GlobalVar.distRoleForm.Add(RoleForm.FormId, RoleForm);
             }
             this.Hide();
             TrangChu trangChu = new TrangChu(RoldeId, txtuser.Text);
             if (trangChu.ShowDialog() != DialogResult.OK)
             {
                 Application.Exit();
             }
             else
             {
                 trangChu.ShowDialog();
             }
         }
         else
         {
             MessageBox.Show("Đăng nhập thất bại.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Exemple #16
0
 private void btnluu_Click(object sender, EventArgs e)
 {
     if (txttk.Text != "")
     {
         if (themNguoiDungBUS.CheckUserName(txttk.Text))
         {
             if (txtpass.Text == txtxacnhan.Text)
             {
                 if (themNguoiDungBUS.ThemNguoiDungBTN(txttk.Text.ToString(), txtpass.Text.ToString(), cbnhanvien.SelectedValue.ToString(), int.Parse(cbvaitro.SelectedValue.ToString()), ckconquanly.Checked) > 0)
                 {
                     try
                     {
                         nhatKyHeThongBUS.ThemNhatKyHeThong("Phân quyền", "Thêm người dùng", txttk.Text);
                     }
                     catch
                     {
                     }
                     MessageBox.Show("Thêm người dùng thành công.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     whenInsertSuccessed();
                 }
                 else
                 {
                     MessageBox.Show("Thêm người dùng thất bại.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else
             {
                 MessageBox.Show("Mật khẩu xác nhận không hợp lê.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             MessageBox.Show("Tên người dùng đã tồn tại", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         MessageBox.Show("Tài Khoản không được rỗng", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemple #17
0
        private void btnsave_Click(object sender, EventArgs e)
        {
            int       vt   = int.Parse(cbvaitro.SelectedValue.ToString());
            DataTable dt   = capNhatNguoiDungBUS.LayMaNVTuTenNV(cbnhanvien.SelectedText.ToString());
            string    manv = dt.Rows[0]["MaNV"].ToString();

            if (txttaikhoan.Text != "")
            {
                if (txtpass.Text == txtxacnhan.Text)
                {
                    if (capNhatNguoiDungBUS.CapNhatNguoiDungBUSbtn(txttaikhoan.Text, manv, txtpass.Text, vt, txtdiengiai.Text, ckquanly.Checked) > 0)
                    {
                        try
                        {
                            nhatKyHeThongBUS.ThemNhatKyHeThong("Phân quyền", "Cập nhật người dùng", txttaikhoan.Text);
                        }
                        catch
                        {
                        }
                        MessageBox.Show("Cập nhật người dùng thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        whenInsertSuccessed();
                        txttaikhoan.Text = "";
                    }
                    else
                    {
                        MessageBox.Show("Cập nhật người dùng thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Xác nhận mật khẩu sai, mời nhập lại.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Tài khoản không được rỗng.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 private void btnluu_Click(object sender, EventArgs e)
 {
     if (check == "-1")
     {
         if (txtmanhomhang.Text != "" && txtenhomhang.Text != "")
         {
             // kiểm tra mã ton tai
             if (!capNhatNhomHangBUS.KiemTraMaDonViTinhTonTai(txtmanhomhang.Text))
             {
                 // thêm
                 if (capNhatNhomHangBUS.ThemNhomHangBTN(txtmanhomhang.Text, txtenhomhang.Text, txtghichu.Text, ckconquanly.Checked.ToString()) > 0)
                 {
                     try
                     {
                         NhatKyHeThongBUS.ThemNhatKyHeThong("Nhóm Hàng", "Thêm", txtmanhomhang.Text);
                     }
                     catch
                     {
                     }
                     MessageBox.Show("Thêm nhóm hàng  thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     whenInsertSuccessed();
                 }
                 else
                 {
                     MessageBox.Show("Thêm nhóm hàng thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else
             {
                 MessageBox.Show("Mã nhóm hàng đã tồn tại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         else
         {
             MessageBox.Show("Vui lòng nhập đủ thông tin.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     else
     {
         if (txtmanhomhang.Text != "")
         {
             // cap nhật
             if (capNhatNhomHangBUS.CapNhatNhomHangBTN(txtmanhomhang.Text, txtenhomhang.Text, txtghichu.Text, ckconquanly.Checked.ToString()) > 0)
             {
                 try
                 {
                     NhatKyHeThongBUS.ThemNhatKyHeThong("Nhóm Hàng", "Cập nhật", txtmanhomhang.Text);
                 }
                 catch
                 {
                 }
                 MessageBox.Show("Cập nhật nhóm hàng  thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 whenInsertSuccessed();
             }
             else
             {
                 MessageBox.Show("Cập nhật nhóm hàng thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             MessageBox.Show("Vui lòng nhập đủ thông tin.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }
Exemple #19
0
 private void btnluu_Click(object sender, EventArgs e)
 {
     if (vt != 1)
     {
         if (pl == -1)// thêm
         {
             if (txtma.Text != "" && txtten.Text != "")
             {
                 if (capNhaVaiTroBUS.KiemTraVaiTroTonTai(txtten.Text))
                 {
                     MessageBox.Show("Tên vai trò đã tồn tại.", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 }
                 else
                 {
                     // them vai trò
                     if (capNhaVaiTroBUS.ThemVaiTro(txtma.Text, txtten.Text, txtdiengiai.Text, ckconquanly.Checked) > 0)
                     {
                         try
                         {
                             nhatKyHeThongBUS.ThemNhatKyHeThong("Phân quyền", "Thêm vai trò", txtma.Text);
                         }
                         catch
                         {
                         }
                         // thêm vao rolemenubar
                         if (ckhethong.Checked)
                         {
                             capNhaVaiTroBUS.ThemQuyenMotChucNangTrenThanhMeNu(id1 + 1, 1, 1);
                         }
                         else
                         {
                             capNhaVaiTroBUS.ThemQuyenMotChucNangTrenThanhMeNu(id1 + 1, 1, 0);
                         }
                         if (ckdanhmuc.Checked)
                         {
                             capNhaVaiTroBUS.ThemQuyenMotChucNangTrenThanhMeNu(id1 + 1, 2, 1);
                         }
                         else
                         {
                             capNhaVaiTroBUS.ThemQuyenMotChucNangTrenThanhMeNu(id1 + 1, 1, 0);
                         }
                         if (ckchucnang.Checked)
                         {
                             capNhaVaiTroBUS.ThemQuyenMotChucNangTrenThanhMeNu(id1 + 1, 3, 1);
                         }
                         else
                         {
                             capNhaVaiTroBUS.ThemQuyenMotChucNangTrenThanhMeNu(id1 + 1, 1, 0);
                         }
                         capNhaVaiTroBUS.ThemQuyenMotChucNangTrenThanhMeNu(id1 + 1, 4, 1);
                         // Thêm bảng phân quyền
                         for (int i = 0; i < gridView1.RowCount; i++)
                         {
                             capNhaVaiTroBUS.ThemBangPhanQuyen(id1 + 1, i + 1, bool.Parse(gridView1.GetRowCellValue(i, "TruyCap").ToString()), bool.Parse(gridView1.GetRowCellValue(i, "Them").ToString()),
                                                               bool.Parse(gridView1.GetRowCellValue(i, "Sua").ToString()), bool.Parse(gridView1.GetRowCellValue(i, "Xoa").ToString()), bool.Parse(gridView1.GetRowCellValue(i, "In_DL").ToString()),
                                                               bool.Parse(gridView1.GetRowCellValue(i, "Nhap").ToString()), bool.Parse(gridView1.GetRowCellValue(i, "Xuat").ToString()));
                         }
                         whenInsertSuccessed();
                         txtma.Text = "";
                     }
                     else
                     {
                         MessageBox.Show("Thêm vai trò thất bại.", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                     }
                 }
             }
             else
             {
                 MessageBox.Show("Dữ liệu không được rỗng", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         else// update
         {
             if (txtten.Text != "")
             {
                 // update vai trò
                 if (capNhaVaiTroBUS.CapNhatVaiTro(txtma.Text, txtten.Text, txtdiengiai.Text, ckconquanly.Checked) > 0)
                 {
                     if (ckhethong.Checked)
                     {
                         capNhaVaiTroBUS.UpadateRoleMeNuBar(vt, 1, 1);
                     }
                     else
                     {
                         capNhaVaiTroBUS.UpadateRoleMeNuBar(vt, 1, 0);
                     }
                     if (ckdanhmuc.Checked)
                     {
                         capNhaVaiTroBUS.UpadateRoleMeNuBar(vt, 2, 1);
                     }
                     else
                     {
                         capNhaVaiTroBUS.UpadateRoleMeNuBar(vt, 2, 0);
                     }
                     if (ckchucnang.Checked)
                     {
                         capNhaVaiTroBUS.UpadateRoleMeNuBar(vt, 3, 1);
                     }
                     else
                     {
                         capNhaVaiTroBUS.UpadateRoleMeNuBar(vt, 3, 0);
                     }
                     // cập nhật quyền
                     for (int i = 0; i < gridView1.RowCount; i++)
                     {
                         capNhaVaiTroBUS.CapNhatBangPhanQuyen(vt, i + 1, bool.Parse(gridView1.GetRowCellValue(i, "TruyCap").ToString()), bool.Parse(gridView1.GetRowCellValue(i, "Them").ToString()),
                                                              bool.Parse(gridView1.GetRowCellValue(i, "Sua").ToString()), bool.Parse(gridView1.GetRowCellValue(i, "Xoa").ToString()), bool.Parse(gridView1.GetRowCellValue(i, "In_DL").ToString()),
                                                              bool.Parse(gridView1.GetRowCellValue(i, "Nhap").ToString()), bool.Parse(gridView1.GetRowCellValue(i, "Xuat").ToString()));
                     }
                     txtten.Text = "";
                     try
                     {
                         nhatKyHeThongBUS.ThemNhatKyHeThong("Phân quyền", "Cập nhật vai trò", txtma.Text);
                     }
                     catch
                     {
                     }
                     whenInsertSuccessed();
                 }
                 else
                 {
                     MessageBox.Show("Cập nhật thất bại", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else
             {
                 MessageBox.Show("Ten vai trò không được rỗng.", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     else
     {
         MessageBox.Show("Bạn Không thể sửa đổi quyền admin", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Exemple #20
0
 private void btnluu_Click(object sender, EventArgs e)
 {
     if (check == "-1")
     {
         if (txtmabp.Text != "" && txttenbp.Text != "")
         {
             // kiểm tra mã ton tai
             if (!CapNhatBoPhanBUS.KiemTraMaBoPhanTonTai(txtmabp.Text))
             {
                 // thêm
                 if (CapNhatBoPhanBUS.ThemDonViTinhBTN(txtmabp.Text, txttenbp.Text, txtghichu.Text, ckconquanly.Checked.ToString()) > 0)
                 {
                     try
                     {
                         NhatKyHeThongBUS.ThemNhatKyHeThong("Bộ Phận", "Thêm", txtmabp.Text);
                     }
                     catch
                     {
                     }
                     MessageBox.Show("Thêm bộ phận thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     whenInsertSuccessed();
                 }
                 else
                 {
                     MessageBox.Show("Thêm bộ phận thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else
             {
                 MessageBox.Show("Mã đơn vị tính đã tồn tại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         else
         {
             MessageBox.Show("Vui lòng nhập đủ thông tin.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     else
     {
         if (txttenbp.Text != "")
         {
             // cap nhật
             if (CapNhatBoPhanBUS.CapNhatDonViTinhBTN(txtmabp.Text, txttenbp.Text, txtghichu.Text, ckconquanly.Checked.ToString()) > 0)
             {
                 try
                 {
                     NhatKyHeThongBUS.ThemNhatKyHeThong("Bộ Phận", "Cập nhật", txtmabp.Text);
                 }
                 catch
                 {
                 }
                 MessageBox.Show("Cập nhật bộ phận  thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 whenInsertSuccessed();
             }
             else
             {
                 MessageBox.Show("Cập nhật bộ phận thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             MessageBox.Show("Vui lòng nhập đủ thông tin.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }
 private void btnluu_Click(object sender, EventArgs e)
 {
     if (check == "-1")
     {
         if (txtmancc.Text != "" && txttenncc.Text != "")
         {
             // kiểm tra mã nhà cung cấp
             if (!capNhatNhaCungCapBUS.KiemTraMaNhaCungCap(txtmancc.Text))
             {
                 NhaCungCapDTO = GanGiaTri();
                 if (capNhatNhaCungCapBUS.ThemNhaCungCap(NhaCungCapDTO) > 0)
                 {
                     try
                     {
                         NhatKyHeThongBUS.ThemNhatKyHeThong("Nhà Cung Cấp", "Thêm", txtmancc.Text);
                     }
                     catch
                     {
                     }
                     MessageBox.Show("Thêm nhà cung cấp thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     whenInsertSuccessed();
                 }
                 else
                 {
                     MessageBox.Show("Thêm nhà cung cấp thất bại.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else
             {
                 MessageBox.Show("Mã nhà cũng cấp đã tồn tại.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         else
         {
             MessageBox.Show("Vui lòng điền đủ thông tin.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     else
     {
         if (txttenncc.Text != "")
         {
             NhaCungCapDTO = GanGiaTri();
             if (capNhatNhaCungCapBUS.CapNhatNhaCungCapBTN(NhaCungCapDTO) > 0)
             {
                 try
                 {
                     NhatKyHeThongBUS.ThemNhatKyHeThong("Nhà Cung Cấp", "Cập nhật", txtmancc.Text);
                 }
                 catch
                 {
                 }
                 MessageBox.Show("Cập nhật nhà cung cấp thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 whenInsertSuccessed();
             }
             else
             {
                 MessageBox.Show("Cập nhật nhà cung cấp thất bại.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             MessageBox.Show("Vui lòng điền đủ thông tin", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }
Exemple #22
0
 private void btnluu_Click(object sender, EventArgs e)
 {
     if (check == "-1")
     {
         if (txtmahang.Text != "" && txttenhanghoa.Text != "" && cbloaihanghoa.EditValue.ToString() != null &&
             cbkho.EditValue.ToString() != null && cbdonvi.EditValue.ToString() != null && cbphanloai.EditValue.ToString() != null)
         {
             // Kiểm tra MaKH đã tồn tại
             if (capNhatHangHoaBUS.KiemTrMaHangHoaDaTonTai(txtmahang.Text) == 0)
             {
                 int temp = 0;
                 hangHoaDTO = SetGiaTri();
                 temp       = capNhatHangHoaBUS.ThemHangHoaBTN(hangHoaDTO);
                 if (temp > 0)
                 {
                     try
                     {
                         NhatKyHeThongBUS.ThemNhatKyHeThong("Hàng Hóa", "Thêm", txtmahang.Text);
                     }
                     catch
                     {
                     }
                     MessageBox.Show("Thêm hàng hóa thành công.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     whenInsertSuccessed();
                 }
                 else
                 {
                     MessageBox.Show("Thêm hàng hóa thất bại.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else
             {
                 MessageBox.Show("Mã hàng hóa đã tồn tại.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         else
         {
             MessageBox.Show("Vui lòng nhập thêm thông tin những ô có dấu * màu đỏ.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     else
     {
         if (txttenhanghoa.Text != "" && cbloaihanghoa.EditValue.ToString() != null &&
             cbkho.EditValue.ToString() != null && cbdonvi.EditValue.ToString() != null && cbphanloai.EditValue.ToString() != null)
         {
             int temp = 0;
             hangHoaDTO = SetGiaTri();
             temp       = capNhatHangHoaBUS.CapNhatHangHoaBTN(hangHoaDTO);
             hangHoaDTO = SetGiaTri();
             if (temp > 0)
             {
                 try
                 {
                     NhatKyHeThongBUS.ThemNhatKyHeThong("Hàng Hóa", "Cập nhật", txtmahang.Text);
                 }
                 catch
                 {
                 }
                 MessageBox.Show("Cập nhật hàng hóa thành công.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 whenInsertSuccessed();
             }
             else
             {
                 MessageBox.Show("Cập nhật hàng hóa thất bại.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             MessageBox.Show("Vui lòng nhập thêm thông tin những ô có dấu * màu đỏ.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }
Exemple #23
0
 private void btnluu_Click(object sender, EventArgs e)
 {
     if (check == "-1")
     {
         if (txtten.Text != "" && txtma.Text != "")
         {
             // Kiểm tra MaKH đã tồn tại
             if (capNhatTyGiaBUS.KiemTraMaTGTonTai(txtma.Text) == 0)
             {
                 int temp = 0;
                 try
                 {
                     temp = capNhatTyGiaBUS.ThemTyGiaBTN(txtma.Text, txtten.Text, float.Parse(txtqdtygia.Text), ckconquanly.Checked.ToString());
                     if (temp > 0)
                     {
                         try
                         {
                             NhatKyHeThongBUS.ThemNhatKyHeThong("Tỷ Giá", "Thêm", txtma.Text);
                         }
                         catch
                         {
                         }
                         MessageBox.Show("Thêm tỷ giá thành công.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         whenInsertSuccessed();
                     }
                     else
                     {
                         MessageBox.Show("Thêm tỷ giá  thất bại.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
                 }
                 catch
                 {
                     MessageBox.Show("Thêm tỷ giá  thất bại.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else
             {
                 MessageBox.Show("Mã tỷ giá đã tồn tại.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         else
         {
             MessageBox.Show("Vui lòng nhập thêm thông tin.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     else
     {
         if (txtten.Text != "")
         {
             bool x    = ckconquanly.Checked;
             int  temp = 0;
             temp = capNhatTyGiaBUS.CapNhatTyGiaBTN(txtma.Text, txtten.Text, float.Parse(txtqdtygia.Text), ckconquanly.Checked.ToString());
             if (temp > 0)
             {
                 try
                 {
                     NhatKyHeThongBUS.ThemNhatKyHeThong("Tỷ Giá", "Cập nhật", txtma.Text);
                 }
                 catch
                 {
                 }
                 MessageBox.Show("Cập nhật tỷ giá thành công.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 whenInsertSuccessed();
             }
             else
             {
                 MessageBox.Show("Cập nhật tỷ giá thất bại.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             MessageBox.Show("Vui lòng nhập thêm thông tin.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }
Exemple #24
0
 private void btnluu_Click(object sender, EventArgs e)
 {
     if (vt == -1)
     {
         if (txtma.Text != "" && txtten.Text != "")
         {
             // Kiểm tra mã Khu vực đã tồn tại
             if (capNhatKhuVucBUS.KiemTraMaKhuVucDaTonTai(txtma.Text) == 0)
             {
                 // Thêm khu vực
                 if (capNhatKhuVucBUS.ThemKhuVuc(txtma.Text, txtten.Text, txtghichu.Text, ckconquanly.Checked.ToString()) > 0)
                 {
                     try
                     {
                         NhatKyHeThongBUS.ThemNhatKyHeThong("Khu Vực", "Thêm", txtma.Text);
                     }
                     catch
                     {
                     }
                     MessageBox.Show("Thêm khu vực thành công.", "Thông tin", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     txtma.Text = "";
                     whenInsertSuccessed();
                 }
                 else
                 {
                     MessageBox.Show("Thêm khu vực thất bại.", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else
             {
                 MessageBox.Show("Mã khu vực này đã tồn tại.", "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         else
         {
             MessageBox.Show("Vui lòng nhập thông tin.", "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     else //update
     {
         if (txtten.Text != "")
         {
             // cap nhật khu vực
             if (capNhatKhuVucBUS.CapNhatKhuVucBTN(txtma.Text, txtten.Text, txtghichu.Text, ckconquanly.Checked.ToString()) > 0)
             {
                 try
                 {
                     NhatKyHeThongBUS.ThemNhatKyHeThong("Khu Vực", "Cập nhật", txtma.Text);
                 }
                 catch
                 {
                 }
                 MessageBox.Show("Cập nhật khu vực thành công.", "Thông tin", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 whenInsertSuccessed();
             }
             else
             {
                 MessageBox.Show("Cập nhật khu vực thất bại.", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             MessageBox.Show("Vui lòng nhập thông tin.", "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }
        private void btnluu_Click(object sender, EventArgs e)
        {
            KhoHangDTO kho = GanGiaTri();

            if (check == "-1")
            {
                if (txtmakho.Text != "" && txtenkho.Text != "")
                {
                    //Kiểm tra mã kho hàng đã tồn tại
                    if (!capNhatKhoHangBUS.KiemTraMaKhoHangDaTonTai(txtmakho.Text))
                    {
                        if (capNhatKhoHangBUS.ThemKhoHangBTN(kho) > 0)
                        {
                            try
                            {
                                NhatKyHeThongBUS.ThemNhatKyHeThong("Kho Hàng", "Thêm", txtmakho.Text);
                            }
                            catch
                            {
                            }
                            MessageBox.Show("Thêm kho hàng thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            whenInsertSuccessed();
                        }
                        else
                        {
                            MessageBox.Show("Thêm kho hàng thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Mã Kho Hàng Đã Tồn Tại.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("Vui lòng điền đủ thông tin.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                if (txtenkho.Text != "")
                {
                    if (capNhatKhoHangBUS.CapNhatKhoHangBTN(kho) > 0)
                    {
                        try
                        {
                            NhatKyHeThongBUS.ThemNhatKyHeThong("Kho Hàng", "Cập nhật", txtmakho.Text);
                        }
                        catch
                        {
                        }
                        MessageBox.Show("Cập nhật kho hàng thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        whenInsertSuccessed();
                    }
                    else
                    {
                        MessageBox.Show("Cập nhật kho hàng thất bại kho hàng thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Vui lòng điền đủ thông tin.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
 private void btnluu_Click(object sender, EventArgs e)
 {
     if (check == "-1")
     {
         if (txtmakh.Text != "" && txttenkh.Text != "")
         {
             // Kiểm tra MaKH đã tồn tại
             if (CapNhatKhachHangBUS.KiemTraMaKhachHangTonTai(txtmakh.Text) == 0)
             {
                 bool x    = ckconquanly.Checked;
                 int  temp = 0;
                 // nếu là đại lý
                 if (rddaily.Checked)
                 {
                     temp = CapNhatKhachHangBUS.ThemKhachHangBTN(txtmakh.Text, txttenkh.Text, cbkhuvuc.EditValue.ToString(), txtdiachi.Text, txtmasothue.Text,
                                                                 txtfax.Text, txtdienthoai.Text, txtdidong.Text, txtemail.Text, txtwebsite.Text, txtsotaikhoan.Text,
                                                                 txttennganhang.Text, txtgioihanno.Text, "0", txtchietkhau.Text, txtyahoo.Text, txtnguoilienhe.Text, txtnickskype.Text, "DL", ckconquanly.Checked.ToString());
                 }
                 else
                 {
                     temp = CapNhatKhachHangBUS.ThemKhachHangBTN(txtmakh.Text, txttenkh.Text, cbkhuvuc.EditValue.ToString(), txtdiachi.Text, txtmasothue.Text,
                                                                 txtfax.Text, txtdienthoai.Text, txtdidong.Text, txtemail.Text, txtwebsite.Text, txtsotaikhoan.Text,
                                                                 txttennganhang.Text, txtgioihanno.Text, "0", txtchietkhau.Text, txtyahoo.Text, txtnguoilienhe.Text, txtnickskype.Text, "KL", ckconquanly.Checked.ToString());
                 }
                 if (temp > 0)
                 {
                     try
                     {
                         NhatKyHeThongBUS.ThemNhatKyHeThong("Khách Hàng", "Thêm khách hàng", txtmakh.Text);
                     }
                     catch
                     {
                     }
                     MessageBox.Show("Thêm khách hàng thành công.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     try
                     {
                         whenInsertSuccessed();
                     }
                     catch { }
                 }
                 else
                 {
                     MessageBox.Show("Thêm khách hàng  thất bại.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else
             {
                 MessageBox.Show("Mã khách hàng đã tồn tại.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         else
         {
             MessageBox.Show("Vui lòng nhập thêm thông tin.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     else
     {
         if (txttenkh.Text != "")
         {
             bool x    = ckconquanly.Checked;
             int  temp = 0;
             // nếu là đại lý
             if (rddaily.Checked)
             {
                 temp = CapNhatKhachHangBUS.CapNhatKhachHangBTN(txtmakh.Text, txttenkh.Text, cbkhuvuc.EditValue.ToString(), txtdiachi.Text, txtmasothue.Text,
                                                                txtfax.Text, txtdienthoai.Text, txtdidong.Text, txtemail.Text, txtwebsite.Text, txtsotaikhoan.Text,
                                                                txttennganhang.Text, txtgioihanno.Text, "0", txtchietkhau.Text, txtyahoo.Text, txtnguoilienhe.Text, txtnickskype.Text, "DL", ckconquanly.Checked.ToString());
             }
             else
             {
                 temp = CapNhatKhachHangBUS.CapNhatKhachHangBTN(txtmakh.Text, txttenkh.Text, cbkhuvuc.EditValue.ToString(), txtdiachi.Text, txtmasothue.Text,
                                                                txtfax.Text, txtdienthoai.Text, txtdidong.Text, txtemail.Text, txtwebsite.Text, txtsotaikhoan.Text,
                                                                txttennganhang.Text, txtgioihanno.Text, "0", txtchietkhau.Text, txtyahoo.Text, txtnguoilienhe.Text, txtnickskype.Text, "KL", ckconquanly.Checked.ToString());
             }
             if (temp > 0)
             {
                 try
                 {
                     NhatKyHeThongBUS.ThemNhatKyHeThong("Khách Hàng", "Cập Nhật Khách Hàng", txtmakh.Text);
                 }
                 catch
                 {
                 }
                 MessageBox.Show("Cập nhật khách hàng thành công.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 whenInsertSuccessed();
             }
             else
             {
                 MessageBox.Show("Cập nhật khách hàng  thất bại.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             MessageBox.Show("Vui lòng nhập thêm thông tin.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }
Exemple #27
0
        private void btnluu_Click(object sender, EventArgs e)
        {
            NhanVienDTO tempdto = SetGiaTri();

            if (check == "-1")
            {
                if (txtten.Text != "" && txtma.Text != "")
                {
                    // Kiểm tra MaKH đã tồn tại
                    if (capNhatNhanVienBUS.KiemTraMaNVTonTai(txtma.Text) == 0)
                    {
                        int temp = 0;
                        temp = capNhatNhanVienBUS.ThemNhanVienBTN(tempdto);
                        if (temp > 0)
                        {
                            try
                            {
                                NhatKyHeThongBUS.ThemNhatKyHeThong("Nhân Viên", "Thêm", txtma.Text);
                            }
                            catch
                            {
                            }
                            MessageBox.Show("Thêm nhân viên thành công.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            whenInsertSuccessed();
                        }
                        else
                        {
                            MessageBox.Show("Thêm nhân viên  thất bại.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Mã nhân viên đã tồn tại.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("Vui lòng nhập thêm thông tin.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                if (txtten.Text != "")
                {
                    bool x    = ckconquanly.Checked;
                    int  temp = 0;
                    temp = capNhatNhanVienBUS.CapNhatNhanVienBTN(tempdto);
                    if (temp > 0)
                    {
                        try
                        {
                            NhatKyHeThongBUS.ThemNhatKyHeThong("Nhân Viên", "Cập nhật", txtma.Text);
                        }
                        catch
                        {
                        }
                        MessageBox.Show("Cập nhật nhân viên thành công.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        whenInsertSuccessed();
                    }
                    else
                    {
                        MessageBox.Show("Cập nhật nhân viên thất bại.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Vui lòng nhập thêm thông tin.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }