Ejemplo n.º 1
0
        private void xoathanhvien(string manv)
        {
            NGDUNG ngdung = new NGDUNG();

            ngdung.ID = manv;
            if (bus.Delete(ngdung))
            {
                MessageBox.Show("Xóa Thành công!");
                nhanviendgv.DataSource = bus.GetList();
            }
        }
Ejemplo n.º 2
0
        public short dangnhap(string id, string pass)
        {
            NGDUNG login = new NGDUNG();
            short  phanquyen;

            login = ngdungdao.GetSingle(x => x.ID == id && x.PASSWD == pass);
            if (login != null)
            {
                phanquyen = login.PHANQUYEN;
            }
            else
            {
                phanquyen = -1;
            }
            return(phanquyen);
        }
Ejemplo n.º 3
0
        private void btnCapnhap_Click(object sender, EventArgs e)
        {
            NGDUNG entity = new NGDUNG();

            entity.ID        = txtsuaidnhanvien.Text;
            entity.TENNGDUNG = suatxtten.Text;
            entity.PASSWD    = suatxtmatkhau.Text;
            entity.NGAYSINH  = dateTimePicker1.Value.Date;

            entity.SDT = txtsuasdt.Text;
            //  entity.PHANQUYEN = cbphanquyen..;
            if (cbphanquyen.SelectedItem.Equals("Quản lý"))
            {
                entity.PHANQUYEN = 2;
            }
            else if (cbphanquyen.SelectedItem.Equals("Nhân viên"))
            {
                entity.PHANQUYEN = 1;
            }
            else if (cbphanquyen.SelectedItem.Equals("Thủ kho"))
            {
                entity.PHANQUYEN = 0;
            }


            bool success = bus.Update(entity);

            common.successorerror(success);
            if (success)
            {
                common.ClearTextBoxes(tabPage17);
                //   nhanviendgv.DataSource = bus.findall(textBox19.Text);
                nhanviendgv.Columns["PASSWD"].Visible = false;
            }

            /* else
             * {
             *   ViewErrors(bus.validatedictionary);
             * } */
        }
Ejemplo n.º 4
0
        //Thêm nhân viên
        private void btnsavenhanvien_Click(object sender, EventArgs e)
        {
            if (txtID.Text != "")
            {
                NGDUNG entity = new NGDUNG();
                entity.ID        = txtID.Text;
                entity.TENNGDUNG = txttennhanvien.Text;
                entity.SDT       = txtsdt.Text;
                entity.PASSWD    = txtpass.Text;
                if (comboBox1.SelectedItem.Equals("Quản lý"))
                {
                    entity.PHANQUYEN = 2;
                }
                else if (comboBox1.SelectedItem.Equals("Nhân viên"))
                {
                    entity.PHANQUYEN = 1;
                }
                else
                {
                    entity.PHANQUYEN = 0;
                }

                if (txtpass.Text != txtrepass.Text)
                {
                    MessageBox.Show("Mật khẩu không trùng khớp!", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    bool success = bus.Add(entity);
                    if (success)
                    {
                        common.successorerror(success);
                    }

                    /*
                     * else
                     * {
                     * ViewErrors(bus.validatedictionary);
                     * } */
                }


                if (!bus.Add(entity))
                {
                    MessageBox.Show(NGUOIDUNGDAO.error_message);
                }
                else
                {
                    MessageBox.Show("THÊM THÀNH CÔNG!!");
                    nhanviendgv.DataSource = bus.GetList();
                    nhanviendgv.Columns["ID"].HeaderText       = "ID người dùng";
                    nhanviendgv.Columns["TENGDUNG"].HeaderText = "Tên";


                    nhanviendgv.Columns["SDT"].HeaderText    = "Điện thoại";
                    nhanviendgv.Columns["PHANQUYEN"].Visible = false;
                    nhanviendgv.Columns["PASSWD"].Visible    = false;

                    nhanviendgv.Columns["ID"].Visible = false;
                }
            }
        }
Ejemplo n.º 5
0
 public bool Add(NGDUNG ngd)
 {
     return(ngdungdao.Insert(ngd));
 }
Ejemplo n.º 6
0
 public bool Delete(NGDUNG entity)
 {
     return(ngdungdao.Delete(entity));
 }
Ejemplo n.º 7
0
 public bool Update(NGDUNG entity)
 {
     return(ngdungdao.Update(entity));
 }