示例#1
0
        private void PictureBox3_Click(object sender, EventArgs e)
        {
            string       Ngsinh   = TranDateFormat.Trans(dateNgSinh.Text);
            string       NgVaoLam = TranDateFormat.Trans(dateNgVaoLam.Text);
            DTO_NhanVien NV       = new DTO_NhanVien(txtMaNV.Text, txtHoTen.Text, Ngsinh, txtChucVu.Text,
                                                     NgVaoLam, txtGioiTinh.Text, txtLuong.Text, "0", "0");

            string error = CheckThongTin.check_Nhap(NV);

            if (error != "")
            {
                MessageBox.Show(error);
                return;
            }

            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            if (bus.themData(NV) == false)
            {
                MessageBox.Show("Thêm nhân viên không thành công");
                return;
            }
            else
            {
                MessageBox.Show("Bạn đã thêm nhân viên thành công");
            }
            Close();
        }
示例#2
0
        private void PictureBox3_Click(object sender, EventArgs e)
        {
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            DTO_KhachHang         KH  = new DTO_KhachHang();

            KH.HOTEN    = txtHoTen.Text;
            KH.MAKH     = txtMaKH.Text;
            KH.GIOITINH = cbxGioiTinh.Text;
            KH.LOAIKH   = cbxLoaiThe.Text;
            //KH.NGDK = TranDateFormat.Trans(dateNgDK.Text);
            //KH.NGSINH = TranDateFormat.Trans(dateNgSinh.Text);
            KH.NGDK   = DateChange.ToString(dateNgDK.DateTime);
            KH.NGSINH = DateChange.ToString(dateNgSinh.DateTime);
            KH.DIACHI = txtDiaChi.Text;
            KH.DIEMTL = txtDiemTL.Text;
            string error = CheckThongTin.check_Nhap(KH);

            if (error != "")
            {
                PushNoti noti1 = new PushNoti("Error", error);
                noti1.Width = this.Width;
                this.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
                return;
            }
            if (bus.themData(KH) == false)
            {
                PushNoti noti = new PushNoti("Error", "Có lỗi xảy ra, thêm khách hàng không thành công!");
                noti.Width = 800;
                this.Controls.Add(noti);
                noti.Show();
                noti.ShowNoti();
                return;
            }
            string desAnh = Application.StartupPath + "/HinhKhachHang/" + KH.MAKH + ".jpg";

            if (fileAnh != "")
            {
                if (File.Exists(desAnh))
                {
                    File.Delete(desAnh);
                }
                File.Copy(fileAnh, desAnh);
            }
            if (txtMatKhau.Text == "")
            {
                txtMatKhau.Text = "111111";
            }
            DTO_TaiKhoan tk = new DTO_TaiKhoan(KH.MAKH, txtMatKhau.Text);

            bus.themData(tk);
            MaKH         = KH.MAKH;
            DialogResult = DialogResult.OK;
            Close();
        }
示例#3
0
        private void PicThemMoi_Click(object sender, EventArgs e)
        {
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            DTO_SanPham           sp  = new DTO_SanPham();

            sp.MASP  = txtMaSP.Text;
            sp.TENSP = txtTenSP.Text;
            DTO_NhaCungCap[] ncc = bus.search_NhaCungCap(sp.TENSP);
            sp.MANCC     = ncc[0].MANCC;
            sp.DONGIA    = txtGiaBan.Text;
            sp.LOINHUAN  = txtLoiNhuan.Text;
            sp.SLUONG    = txtSoLuong.Text;
            sp.TRANGTHAI = txtTrangThai.Text;

            string error = CheckThongTin.check_Nhap(sp);

            if (error != "")
            {
                PushNoti noti1 = new PushNoti("Error", error);
                noti1.Width = this.Width;
                this.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
                return;
            }

            if (bus.themData(sp) == false)
            {
                PushNoti noti1 = new PushNoti("Error", "Có lỗi xảy ra, thêm không thành công!");
                noti1.Width  = this.Width;
                noti1.Height = 30;
                this.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
                //MessageBox.Show("Bạn đã cập nhật thành công");
                return;
            }
            else
            {
            }
            string desAnh = Application.StartupPath + "/HinhSanPham/" + sp.MASP + ".jpg";

            if (fileAnh != "")
            {
                if (File.Exists(desAnh))
                {
                    File.Delete(desAnh);
                }
                File.Copy(fileAnh, desAnh);
            }
            DialogResult = DialogResult.OK;
            Close();
        }
示例#4
0
        private void pictureBox3_Click(object sender, EventArgs e)
        {
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            if (dataGridView1.Rows.Count == 0)
            {
                PushNoti noti1 = new PushNoti("Error", "Chưa có chi tiết phiếu nhập!");
                noti1.Width = this.Width;
                this.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
            }
            DTO_PhieuNhap PN    = new DTO_PhieuNhap(txtMaPN.Text, txtMaNCC.Text, DateChange.ToString(dateNgNhap.DateTime), "0", "0", richTextBox1.Text);
            string        error = CheckThongTin.check_Nhap(PN);

            if (error != "")
            {
                PushNoti noti1 = new PushNoti("Error", error);
                noti1.Width = this.Width;
                this.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
                return;
            }
            if (bus.themData(PN) == false)
            {
                PushNoti noti1 = new PushNoti("Error", "Thêm phiếu nhập không thành công!");
                noti1.Width = this.Width;
                this.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
                return;
            }
            int SL = 0;
            int GT = 0;

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                DTO_CTPhieuNhap ctpn = new DTO_CTPhieuNhap(PN.MAPN, row.Cells[0].Value.ToString(), row.Cells[2].Value.ToString(), row.Cells[3].Value.ToString());
                SL += int.Parse(row.Cells[2].Value.ToString());
                GT += int.Parse(row.Cells[3].Value.ToString());
                DTO_SanPham[] sp = bus.search_SANPHAM(row.Cells[0].Value.ToString());
                sp[0].SLUONG = (int.Parse(sp[0].SLUONG) + int.Parse(row.Cells[2].Value.ToString())).ToString();
                bus.suaData(sp[0]);
                bus.themData(ctpn);
            }
            PN.TONGSL   = SL.ToString();
            PN.TONGTIEN = GT.ToString();
            bus.suaData(PN);
            DialogResult = DialogResult.OK;
            Close();
        }
示例#5
0
        private void PicThemMoi_Click(object sender, EventArgs e)
        {
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            DTO_SanPham           sp  = new DTO_SanPham();

            sp.MASP  = txtMaSP.Text;
            sp.TENSP = txtTenSP.Text;
            DTO_NhaCungCap[] ncc = bus.search_NhaCungCap(sp.TENSP);
            sp.MANCC     = ncc[0].MANCC;
            sp.DONGIA    = txtGiaBan.Text;
            sp.LOINHUAN  = txtLoiNhuan.Text;
            sp.SLUONG    = txtSoLuong.Text;
            sp.TRANGTHAI = txtTrangThai.Text;

            if (CheckThongTin.check_Nhap(sp) != "")
            {
                MessageBox.Show(CheckThongTin.check_Nhap(sp), "Sai", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (bus.themData(sp) == false)
            {
                MessageBox.Show("Có vấn đề xảy ra! Thất bại");
                return;
            }
            else
            {
                MessageBox.Show("Bạn đã thêm sản phẩm thành công");
            }
            string desAnh = Application.StartupPath + "/HinhSanPham/" + sp.MASP + ".jpg";

            if (File.Exists(desAnh))
            {
                File.Delete(desAnh);
            }
            File.Copy(fileAnh, desAnh);
        }
示例#6
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            DTO_DiemDanh          dd  = new DTO_DiemDanh(ThongTinDangNhap.Username, DateChange.ToString(DateTime.Today));
            string error = CheckThongTin.check_Nhap(dd);

            if (error != "")
            {
                PushNoti noti1 = new PushNoti("Error", error);
                noti1.Width = this.panel15.Width;
                this.panel15.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
                return;
            }
            if (bus.themData(dd))
            {
                PushNoti noti1 = new PushNoti("Success", "Điểm danh thành công!");
                noti1.Width = this.panel15.Width;
                this.panel15.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
            }
        }
示例#7
0
        private void PictureBox3_Click(object sender, EventArgs e)
        {
            //string Ngsinh = TranDateFormat.Trans(dateNgSinh.Text);
            //string NgVaoLam = TranDateFormat.Trans(dateNgVaoLam.Text);
            string Ngsinh   = DateChange.ToString(dateNgSinh.DateTime);
            string NgVaoLam = DateChange.ToString(dateNgVaoLam.DateTime);

            if ((comboBoxChucVu.Text == "Quản lí" || comboBoxChucVu.Text == "Quản lí nhân sự") && ThongTinDangNhap.ChucVu == "Quản lí nhân sự")
            {
                PushNoti noti1 = new PushNoti("Error", "Bạn không có quyền tạo nhân viên với chức vụ này. Vui lòng sử dụng một tài khoản cấp cao hơn");
                noti1.Width = this.Width;
                this.labelControl.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
                return;
            }
            if (comboBoxChucVu.Text == "Quản lí" && ThongTinDangNhap.ChucVu == "Quản lí")
            {
                PushNoti noti1 = new PushNoti("Error", "Bạn không có quyền tạo nhân viên với chức vụ này. Vui lòng sử dụng một tài khoản cấp cao hơn");
                noti1.Width = this.Width;
                this.labelControl.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
                return;
            }
            DTO_NhanVien NV = new DTO_NhanVien(txtMaNV.Text, txtHoTen.Text, Ngsinh, comboBoxChucVu.SelectedItem.ToString(),
                                               NgVaoLam, txtGioiTinh.Text, txtLuong.Text, "0", "0");

            string error = CheckThongTin.check_Nhap(NV);

            if (error != "")
            {
                PushNoti noti1 = new PushNoti("Error", error);
                noti1.Width = this.Width;
                this.labelControl.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
                return;
            }

            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            if (bus.themData(NV) == false)
            {
                PushNoti noti1 = new PushNoti("Error", "Thêm nhân viên không thành công!");
                noti1.Width = this.Width;
                this.labelControl.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
                return;
            }
            else
            {
            }
            string desAnh = Application.StartupPath + "/HinhNhanVien/" + txtMaNV.Text + ".jpg";

            if (fileAnh != "")
            {
                if (File.Exists(desAnh))
                {
                    File.Delete(desAnh);
                }
                File.Copy(fileAnh, desAnh);
            }
            DialogResult = DialogResult.OK;
            Close();
        }