Exemple #1
0
        private void cboManv_SelectedIndexChanged(object sender, EventArgs e)
        {
            string TK;

            if (cboManv.SelectedIndex != -1)
            {
                TK = cboManv.Text;
                NHANVIEN NV = db.NHANVIENs.Find(TK);
                txtTennv.Text = NV.HOTEN;
                LUONGCANHAN LCN = db.LUONGCANHANs.Find(NV.MANV);
                if (LCN == null)
                {
                    txtLCB.Text        = "";
                    txtHeso.Text       = "";
                    txtTienphucap.Text = "";
                    ClearTien();
                    MessageBox.Show("Bạn chưa thêm bản lương cho nhân viên này.", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Information); return;
                }
                txtLCB.Text        = LCN.LUONGCB.ToString();
                txtHeso.Text       = LCN.HESO.ToString();
                txtTienphucap.Text = LCN.TIENPHUCAP.ToString();
            }
            ClearTien();
            Reset();
        }
Exemple #2
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            if (cboManv.SelectedIndex == -1 || txtLuongcoban.Text == "" || txtHeso.Text == "" || txtTienphucap.Text == "")
            {
                MessageBox.Show("Bạn cần điền đầy đủ thông tin.", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Information); return;
            }
            if (float.Parse(txtHeso.Text) > 10)
            {
                MessageBox.Show("Hệ số lương chỉ tối đa là 10", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Information); return;
            }
            if (float.Parse(txtHeso.Text) < 1)
            {
                MessageBox.Show("Hệ số lương nhỏ nhất là 1", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Information); return;
            }
            LUONGCANHAN TK = db.LUONGCANHANs.Find(Convert.ToString(cboManv.Text));

            if (TK != null)
            {
                MessageBox.Show("Nhân viên đã có bản lương cơ bản của mình.", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Information); return;
            }
            LUONGCANHAN LCB = new LUONGCANHAN();

            LCB.MANV       = cboManv.Text;
            LCB.LUONGCB    = float.Parse(txtLuongcoban.Text);
            LCB.HESO       = float.Parse(txtHeso.Text);
            LCB.TIENPHUCAP = float.Parse(txtTienphucap.Text);
            db.LUONGCANHANs.Add(LCB);
            db.SaveChanges();
            MessageBox.Show("Thêm thành công.", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            fmLuongcanhan_Load(sender, e);
        }
Exemple #3
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            if (Manv == null)
            {
                MessageBox.Show("Bạn chưa chọn dữ liệu.", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Information); return;
            }
            LUONGCANHAN LCB = db.LUONGCANHANs.Find(Manv);

            db.LUONGCANHANs.Remove(LCB);
            db.SaveChanges();
            MessageBox.Show("Xóa dữ liệu thành công.", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            fmLuongcanhan_Load(sender, e);
        }
Exemple #4
0
        private void btnTiemkiem_Click(object sender, EventArgs e)
        {
            if (txtTiemkiemNV.Text == "")
            {
                MessageBox.Show("Bạn cần nhập Mã nhân viên để tìm kiếm.", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Information); return;
            }
            LVLCN.Items.Clear();
            LUONGCANHAN LCN = db.LUONGCANHANs.Find(Convert.ToString(txtTiemkiemNV.Text));

            if (LCN != null)
            {
                LVLCN.Items.Add(LCN.MANV);
                NHANVIEN NV = db.NHANVIENs.Find(LCN.MANV);
                LVLCN.Items[0].SubItems.Add(NV.HOTEN);
                LVLCN.Items[0].SubItems.Add(LCN.LUONGCB.ToString());
                LVLCN.Items[0].SubItems.Add(LCN.HESO.ToString());
                LVLCN.Items[0].SubItems.Add(LCN.TIENPHUCAP.ToString());
            }
        }
Exemple #5
0
        private void btnCapnhat_Click(object sender, EventArgs e)
        {
            if (Manv == null)
            {
                MessageBox.Show("Bạn chưa chọn dữ liệu.", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Information); return;
            }
            if (float.Parse(txtHeso.Text) > 10)
            {
                MessageBox.Show("Hệ số lương chỉ tối đa là 10", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Information); return;
            }
            if (float.Parse(txtHeso.Text) < 1)
            {
                MessageBox.Show("Hệ số lương nhỏ nhất là 1", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Information); return;
            }
            LUONGCANHAN LCB = db.LUONGCANHANs.Find(Manv);

            LCB.LUONGCB    = float.Parse(txtLuongcoban.Text);
            LCB.HESO       = float.Parse(txtHeso.Text);
            LCB.TIENPHUCAP = float.Parse(txtTienphucap.Text);
            db.SaveChanges();
            MessageBox.Show("Cập nhật dữ liệu thành công.", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            fmLuongcanhan_Load(sender, e);
        }