private void TxbHsLuong_Click(object sender, EventArgs e)
        {
            string ma = "HS" + cbNgach.SelectedValue.ToString() + cbBac.SelectedValue.ToString();
            HESOLUONGNHANVIEN_DTO gettt = HESOLUONGNHANVIEN_DAL.Instance.getHS(ma);

            txbHsLuong.Text = gettt.HSLuong.ToString();
        }
        public HESOLUONGNHANVIEN_DTO getHS(string MaHSLuong)
        {
            string                query  = "SELECT * FROM dbo.HESOLUONGNHANVIEN WHERE MaHSLuong = N'" + MaHSLuong + "' ";
            DataTable             result = DataProvider.Instance.ExecuteQuery(query);
            HESOLUONGNHANVIEN_DTO heso   = new HESOLUONGNHANVIEN_DTO("no", "no", "no", 0.0001f);

            foreach (DataRow item in result.Rows)
            {
                HESOLUONGNHANVIEN_DTO heso1 = new HESOLUONGNHANVIEN_DTO(item);
                return(heso1);
            }
            return(heso);
        }
Exemple #3
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            int currentRowIndex = dtgdanhsach.CurrentCellAddress.Y;

            HESOLUONGNHANVIEN_DTO newdt = new HESOLUONGNHANVIEN_DTO(dtgdanhsach.CurrentRow.Cells[0].Value.ToString(), txbMaNgach.Text, txbMaBac.Text, float.Parse(txbHeSo.Text));


            if (-1 < currentRowIndex && currentRowIndex < dtgdanhsach.RowCount)
            {
                MessageBox.Show("Cập nhập Thành Công " + newdt.MaHSLuong);
                HESOLUONGNHANVIEN_DAL.Instance.UpdateHeSo(newdt);
            }
            loaddanhsach();
        }
        public List <HESOLUONGNHANVIEN_DTO> HSL(string ma)
        {
            List <HESOLUONGNHANVIEN_DTO> Heso = new List <HESOLUONGNHANVIEN_DTO>();
            string    query = string.Format("SELECT * FROM dbo.HESOLUONGNHANVIEN WHERE MaHSLuong = N'{0}'", ma);
            DataTable data  = DataProvider.Instance.ExecuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                HESOLUONGNHANVIEN_DTO heso = new HESOLUONGNHANVIEN_DTO(item);
                Heso.Add(heso);
            }

            return(Heso);
        }
Exemple #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            HESOLUONGNHANVIEN_DTO newheso = new HESOLUONGNHANVIEN_DTO(txbMaHS.Text, cbMaNgach.SelectedValue.ToString(), cbMaBac.SelectedValue.ToString(), float.Parse(txbHeSo.Text));

            if (HESOLUONGNHANVIEN_DAL.Instance.checkIsExist(newheso.MaHSLuong))
            {
                MessageBox.Show(" đã tồn tại, thêm thất bại");
            }
            else
            {
                HESOLUONGNHANVIEN_DAL.Instance.addHSLuong(newheso);
                MessageBox.Show("Thêm thành công ");
            }
        }
Exemple #6
0
        private void LoadTienLuong()
        {
            //1
            List <NhanVien_DTO>          DsNhanVien  = NHANVIEN_DAL.Instance.LoadListNHANVIEN();
            List <TienLuongDTO>          dsTienLuong = new List <TienLuongDTO>();
            List <HESOLUONGNHANVIEN_DTO> dsHeSoLuong = new List <HESOLUONGNHANVIEN_DTO>();

            //2
            for (int i = 0; i < DsNhanVien.Count; i++)
            {
                //3
                List <Cong_DTO> dsCong      = Cong_DAL.Instance.Load(DsNhanVien[i].MaNhanVien, int.Parse(DateTime.Now.Month.ToString()), int.Parse(DateTime.Now.Year.ToString()));
                string          MaNhanVien  = DsNhanVien[i].MaNhanVien;
                string          TenNhanVien = DsNhanVien[i].TenNhanVien;
                string          HeSoLuong   = DsNhanVien[i].MaHSLuong;
                if (Cong_DAL.Instance.check(int.Parse(DateTime.Now.Month.ToString()), int.Parse(DateTime.Now.Year.ToString()), MaNhanVien))
                {
                    HeSoPhuCap_DTO        dshspc = HeSoPhuCap_DAL.Instance.Load(dsCong[0].MaHSPC.ToString());
                    HESOLUONGNHANVIEN_DTO gettt  = HESOLUONGNHANVIEN_DAL.Instance.getHS(HeSoLuong);
                    float        TienLuong       = float.Parse(gettt.HSLuong.ToString()) * 10000 * dsCong[0].NgayCong + 10000 * dshspc.TenHSPC;
                    int          thang           = int.Parse(DateTime.Now.Month.ToString());
                    int          nam             = int.Parse(DateTime.Now.Year.ToString());
                    TienLuongDTO tienluong       = new TienLuongDTO(MaNhanVien, TenNhanVien, HeSoLuong, TienLuong, thang, nam, "");
                    dsTienLuong.Add(tienluong);
                    //4
                    if (!TienLuongDAL.Instance.checkIsExist(tienluong.MaNhanVien, tienluong.Thang, tienluong.Nam))
                    {
                        //5
                        TienLuongDAL.Instance.add(tienluong);
                    }
                }
                else
                {
                    float        TienLuong = 0;
                    int          thang     = int.Parse(DateTime.Now.Month.ToString());
                    int          nam       = int.Parse(DateTime.Now.Year.ToString());
                    TienLuongDTO tienluong = new TienLuongDTO(MaNhanVien, TenNhanVien, HeSoLuong, TienLuong, thang, nam, "Chưa Chấm Công");
                    dsTienLuong.Add(tienluong);
                    //4
                    if (!TienLuongDAL.Instance.checkIsExist(tienluong.MaNhanVien, tienluong.Thang, tienluong.Nam))
                    {
                        //5
                        TienLuongDAL.Instance.add(tienluong);
                    }
                }
            }
            //6
            dgvtienluong.DataSource = dsTienLuong;
        }
        public List <HESOLUONGNHANVIEN_DTO> LoadListHeSo()
        {
            List <HESOLUONGNHANVIEN_DTO> Heso = new List <HESOLUONGNHANVIEN_DTO>();

            string query = "SELECT * FROM dbo.HESOLUONGNHANVIEN ";

            DataTable data = DataProvider.Instance.ExecuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                HESOLUONGNHANVIEN_DTO heso = new HESOLUONGNHANVIEN_DTO(item);
                Heso.Add(heso);
            }

            return(Heso);
        }
        public void UpdateHeSo(HESOLUONGNHANVIEN_DTO heso)
        {
            string query = string.Format("UPDATE dbo.DANTOC SET MaNgachLuong = N'{0}', MaBac = N'{1}', HSLuong = {2} WHERE MaDT = N'{3}' ", heso.MaNgachLuong, heso.MaBac, heso.HSLuong, heso.MaHSLuong);

            DataProvider.Instance.ExecuteNonQuery(query);
        }
 public void addHSLuong(HESOLUONGNHANVIEN_DTO heso)
 {
     string    query  = string.Format("INSERT INTO dbo.HESOLUONGNHANVIEN (MaHSLuong,MaNgachLuong,MaBac,HSLuong) VALUES (N'{0}',N'{1}',N'{2}',{3} )", heso.MaHSLuong, heso.MaNgachLuong, heso.MaBac, heso.HSLuong);
     DataTable result = DataProvider.Instance.ExecuteQuery(query);
 }