示例#1
0
        public int LaySoLuongNhanVien()
        {
            SqlConnection con  = ThaoTacDuLieu.TaoVaMoKetNoi();
            int           slnv = ThaoTacDuLieu.LaySoLuong("NHANVIEN", con);

            ThaoTacDuLieu.DongKetNoi(con);
            return(slnv);
        }
示例#2
0
        public int LaySoLuongTN()
        {
            SqlConnection conn = ThaoTacDuLieu.TaoVaMoKetNoi();
            int           SL   = ThaoTacDuLieu.LaySoLuong("THANNHAN", conn);

            ThaoTacDuLieu.DongKetNoi(conn);
            return(SL);
        }
        public bool ThemHopDong(clsHopDong_DTO HD)
        {
            SqlConnection conn = ThaoTacDuLieu.TaoVaMoKetNoi();
            string        sql  = "";
            DateTime      dt   = new DateTime(1900, 1, 1);

            if (HD.NgayKetThuc == dt.Date)
            {
                sql = string.Format("INSERT INTO HOPDONGLAODONG(MAHDLD,MANV,LOAIHD,TUNGAY,DIADIEMLAM,CONGVIEC,THOIGIANLAM,TRANGBILAODONG,NGAYKY,DENNGAY) VALUES  ('{0}','{1}',N'{2}','{3}',N'{4}',N'{5}',N'{6}','{7}',N'{8}',{9},{10},'{11}')", "HDLD" + (ThaoTacDuLieu.LaySoLuong("HOPDONGLAODONG", conn) + 1).ToString(), HD.MaNV, HD.LoaiHD, HD.NgayBatDau, HD.DiaDiemLam, HD.CongViec, HD.ThoiGianLam, HD.TrangBi, HD.NgayKy, HD.NgayKetThuc);
            }
            else
            {
                sql = string.Format("INSERT INTO HOPDONGLAODONG(MAHDLD,MANV,LOAIHD,TUNGAY,DENNGAY,DIADIEMLAM,CONGVIEC,THOIGIANLAM,TRANGBILAODONG,NGAYKY) VALUES  ('{0}','{1}',N'{2}','{3}','{4}',N'{5}',N'{6}',{7},N'{8}','{9}')", "HDLD" + (ThaoTacDuLieu.DemSoLuong("SELECT COUNT(*) FROM HOPDONGLAODONG") + 1).ToString(), HD.MaNV, HD.LoaiHD, HD.NgayBatDau, dt.Date, HD.DiaDiemLam, HD.CongViec, HD.ThoiGianLam, HD.TrangBi, HD.NgayKy);
            }
            SqlCommand cmd = ThaoTacDuLieu.TaoDoiTuongTruyVan(sql, conn);
            int        kq  = cmd.ExecuteNonQuery();

            ThaoTacDuLieu.DongKetNoi(conn);
            return(kq > 0);
        }