Exemplo n.º 1
0
        public bool deleteTK(string ID)
        {
            db = new CMART8Entities();
            TAIKHOAN TK = db.TAIKHOANs.ToList().Single(st => st.MATK.Equals(ID));

            db.TAIKHOANs.Remove(TK);
            db.SaveChanges();
            return(true);
        }
Exemplo n.º 2
0
 public GUI_Thongke(TAIKHOAN tmp)
 {
     TK  = tmp;
     ctl = new BUS_ThongKe();
     vl  = new ValidationExtension();
     InitializeComponent();
     rdNgay.Checked = true;
     controlFunction(TK.QUYEN);
 }
Exemplo n.º 3
0
        public PHIEUNHAPHANGCHINHANH createNHCN(TAIKHOAN tk)
        {
            db = new CMART8Entities();
            PHIEUNHAPHANGCHINHANH pnh = new PHIEUNHAPHANGCHINHANH();

            pnh.SOPHIEU  = autoID();
            pnh.NGAYNHAP = DateTime.Now;
            pnh.MATK     = tk.MATK;
            db.PHIEUNHAPHANGCHINHANHs.Add(pnh);
            db.SaveChanges();
            return(pnh);
        }
Exemplo n.º 4
0
 public GUI_NhaCungCap(TAIKHOAN tmp)
 {
     TK  = tmp;
     ctl = new BUS_NhaCungCap();
     vl  = new ValidationExtension();
     InitializeComponent();
     controlFunction(TK.QUYEN);
     controlFunction("enableAll");
     btnAdd.Click    += btnAdd_Click;
     btnEdit.Click   += btnEdit_Click;
     btnSave.Click   += btnSave_Click;
     btnCancel.Click += btnCancel_Click;
     btnSearch.Click += btnSearch_Click;
     btnDelete.Click += btnDelete_Click;
     lstNCC.Click    += lstNCC_Click;
 }
Exemplo n.º 5
0
 public GUI_QLTK(TAIKHOAN tmp)
 {
     TK  = tmp;
     ctl = new BUS_QLTK();
     vl  = new ValidationExtension();
     InitializeComponent();
     controlFunction(TK.QUYEN);
     btnSearch.Click += btnSearch_Click;
     btnAdd.Click    += btnAdd_Click;
     btnEdit.Click   += btnEdit_Click;
     btnDelete.Click += btnDelete_Click;
     lstTK.Click     += lstTK_Click;
     btnSave.Click   += btnSave_Click;
     btnCancel.Click += btnCancel_Click;
     controlFunction("enableAll");
     cboQuyen.SelectedIndex = 0;
 }
Exemplo n.º 6
0
 public GUI_LichSuGia(TAIKHOAN tmp)
 {
     TK    = tmp;
     ctl   = new BUS_LichSuGia();
     ctlSP = new BUS_SanPham();
     db    = new CMART8Entities();
     vl    = new ValidationExtension();
     InitializeComponent();
     controlFunction(TK.QUYEN);
     btnAdd.Click    += btnAdd_Click;
     btnEdit.Click   += btnEdit_Click;
     lstLSG.Click    += lstLSG_Click;
     btnSearch.Click += btnSearch_Click;
     btnCancel.Click += btnCancel_Click;
     btnSave.Click   += btnSave_Click;
     btnDelete.Click += btnDelete_Click;
 }
Exemplo n.º 7
0
        public void addCTNHTS(string tmp, PHIEUNHAPHANGTRUSO PN, TAIKHOAN TK)
        {
            db = new CMART8Entities();
            var ctpdx = db.CTPHIEUDEXUATs.Where(x => x.SOPHIEU.Equals(tmp)).ToList();

            foreach (var item in ctpdx)
            {
                CTPHIEUNHAPHANGTRUSO nhts = new CTPHIEUNHAPHANGTRUSO();
                nhts.SOPHIEUNHTS = PN.SOPHIEU;
                nhts.MASP        = item.MASP;
                nhts.SOLUONG     = item.SOLUONG;
                nhts.GIANHAP     = 0;
                nhts.HANSD       = DateTime.Now.AddMonths(6);
                nhts.TINHTRANG   = "Đủ";
                db.CTPHIEUNHAPHANGTRUSOes.Add(nhts);
                db.SaveChanges();
            }
        }
Exemplo n.º 8
0
 public GUI_SanPham(TAIKHOAN tmp)
 {
     TK     = tmp;
     ctlNCC = new BUS_NhaCungCap();
     ctl    = new BUS_SanPham();
     ctlLSP = new BUS_LoaiSanPham();
     db     = new CMART8Entities();
     vl     = new ValidationExtension();
     InitializeComponent();
     controlFunction(TK.QUYEN);
     controlFunction("enableAll");
     btnAdd.Click    += btnAdd_Click;
     btnEdit.Click   += btnEdit_Click;
     btnCancel.Click += btnCancel_Click;
     btnSave.Click   += btnSave_Click;
     btnSearch.Click += btnSearch_Click;
     btnDelete.Click += btnDelete_Click;
     lstSP.Click     += lstSP_Click;
 }
Exemplo n.º 9
0
        public bool editTK(string ID, string hoten, string diachi, string sdt, string cmnd, string tendn, string quyen)
        {
            db = new CMART8Entities();

            try
            {
                TAIKHOAN TK = db.TAIKHOANs.ToList().Single(st => st.MATK.Equals(ID));
                TK.HOTEN       = hoten;
                TK.DIACHI      = diachi;
                TK.SDT         = sdt;
                TK.CMND        = cmnd;
                TK.TENDANGNHAP = tendn;
                TK.QUYEN       = quyen;
                db.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 10
0
        public bool addTK(string hoten, string diachi, string sdt, string cmnd, string tendn, string matkhau, string quyen)
        {
            db = new CMART8Entities();
            TAIKHOAN TK = new TAIKHOAN();

            try
            {
                TK.MATK        = DateTime.Now.ToString();
                TK.HOTEN       = hoten;
                TK.DIACHI      = diachi;
                TK.SDT         = sdt;
                TK.CMND        = cmnd;
                TK.TENDANGNHAP = tendn;
                TK.MATKHAU     = matkhau;
                TK.QUYEN       = quyen;
                db.TAIKHOANs.Add(TK);
                db.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 11
0
        private void btnCancel_Click(object sender, EventArgs e)
        {
            string sTmp = "";
            bool   flg  = true;

            if (!vl.Required(txtUser.Text))
            {
                sTmp = sTmp + "Vui lòng điền tên đăng nhập!\n";
                flg  = false;
            }
            if (!vl.Required(txtPass.Text))
            {
                sTmp = sTmp + "Vui lòng điền mật khẩu!\n";
                flg  = false;
            }
            if (flg)
            {
                try
                {
                    TK = db.TAIKHOANs.Single(st => st.TENDANGNHAP.Equals(txtUser.Text) && st.MATKHAU.Equals(txtPass.Text));
                    if (TK.QUYEN.Equals("Giám đốc"))
                    {
                        GUI_Thongke tk = new GUI_Thongke(TK);
                        this.Hide();
                        tk.ShowDialog();
                        this.Close();
                    }
                    else if (TK.QUYEN.Equals("Nhân viên bán hàng"))
                    {
                        QLHD.GUI_POS sp = new QLHD.GUI_POS(TK, "Login");
                        this.Hide();
                        sp.ShowDialog();
                        this.Close();
                    }
                    else if (TK.QUYEN.Equals("Quản lý chi nhánh"))
                    {
                        QLNH.GUI_DX sp = new QLNH.GUI_DX(TK);
                        this.Hide();
                        sp.ShowDialog();
                        this.Close();
                    }
                    else if (TK.QUYEN.Equals("Nhân viên kiểm kho"))
                    {
                        QLNH.GUI_NHTS sp = new QLNH.GUI_NHTS(TK);
                        this.Hide();
                        sp.ShowDialog();
                        this.Close();
                    }
                    else if (TK.QUYEN.Equals("Thư ký"))
                    {
                        Dexuat.GUI_DX sp = new Dexuat.GUI_DX(TK);
                        this.Hide();
                        sp.ShowDialog();
                        this.Close();
                    }
                }
                catch
                {
                    MessageBox.Show("Tên đăng nhập hoặc mật khẩu không chính xác!");
                    txtPass.Text = "";
                }
            }
            else
            {
                MessageBox.Show(sTmp);
            }
        }