Esempio n. 1
0
        public static void Sua(LoaiVeDTO loaive)
        {
            // mở kết nối
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();

            // tạo câu lệnh Thêm
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            //command.CommandText = "INSERT INTO NHANVIEN VALUES(@MANV,@HOTEN,@CHUCVU,@SDT,@GIOITINH,@NGAYSINH,@DIACHI,@LUONG,@NGAYVL)";
            command.CommandText = "EXEC SuaLoaiVe @MALV,@TENLV,@LOAICHONGOI,@GIA";

            command.Parameters.Add("@MALV", SqlDbType.VarChar, 10);
            command.Parameters.Add("@TENLV", SqlDbType.NVarChar, 100);
            command.Parameters.Add("@LOAICHONGOI", SqlDbType.NVarChar, 100);
            command.Parameters.Add("@GIA", SqlDbType.Money);

            // gán giá trị
            command.Parameters["@MALV"].Value        = loaive.MaLV;
            command.Parameters["@TENLV"].Value       = loaive.TenLV;
            command.Parameters["@LOAICHONGOI"].Value = loaive.LoaiChoNgoi;
            command.Parameters["@GIA"].Value         = loaive.Gia;


            command.ExecuteNonQuery();

            // đóng kết nối
            connection.Close();
        }
Esempio n. 2
0
        public static void Them(VeDTO ve)
        {
            // mở kết nối
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();

            // tạo câu lệnh Thêm
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            //command.CommandText = "INSERT INTO PHIM VALUES(@MALV,@TENLV,@LOAICHONGOI,@GIA,@MALP,@NOIDUNG,@NAMSX,@NUOCSX,@THOILUONG)";
            command.CommandText = "EXEC ThemVe @MAPHIM,@MAPC,@MALV,@SOLUONG";

            command.Parameters.Add("@MAPHIM", SqlDbType.VarChar, 10);
            command.Parameters.Add("@MAPC", SqlDbType.VarChar, 10);
            command.Parameters.Add("@MALV", SqlDbType.VarChar, 10);
            command.Parameters.Add("@SOLUONG", SqlDbType.Int);

            // gán giá trị
            command.Parameters["@MAPHIM"].Value  = ve.MaPhim;
            command.Parameters["@MAPC"].Value    = ve.MaPC;
            command.Parameters["@MALV"].Value    = ve.MaLV;
            command.Parameters["@SOLUONG"].Value = ve.SoLuong;

            command.ExecuteNonQuery();

            // đóng kết nối
            connection.Close();
        }
Esempio n. 3
0
        public static void Them(NguoiDungDTO nguoidung)
        {
            // mở kết nối
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();

            // tạo câu lệnh Thêm
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            //command.CommandText = "INSERT INTO NHANVIEN VALUES(@MANV,@HOTEN,@CHUCVU,@SDT,@GIOITINH,@NGAYSINH,@DIACHI,@LUONG,@NGAYVL)";
            command.CommandText = "EXEC ThemNguoiDung @MAND,@HOTEN,@CHUCVU,@PHANQUYEN";
            command.Parameters.Add("@MAND", SqlDbType.VarChar, 10);
            command.Parameters.Add("@HOTEN", SqlDbType.NVarChar, 40);
            command.Parameters.Add("@CHUCVU", SqlDbType.VarChar, 100);
            command.Parameters.Add("@PHANQUYEN", SqlDbType.VarChar, 100);

            // gán giá trị
            command.Parameters["@MANV"].Value   = nguoidung.MaND;
            command.Parameters["@HOTEN"].Value  = nguoidung.HoTen;
            command.Parameters["@CHUCVU"].Value = nguoidung.ChucVu;
            command.Parameters["@SDT"].Value    = nguoidung.PhanQuyen;

            command.ExecuteNonQuery();

            // đóng kết nối
            connection.Close();
        }
Esempio n. 4
0
        public static void Sua(LoaiPhimDTO loaiphim)
        {
            // mở kết nối
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();

            // tạo câu lệnh Thêm
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            //command.CommandText = "INSERT INTO NHANVIEN VALUES(@MANV,@HOTEN,@CHUCVU,@SDT,@GIOITINH,@NGAYSINH,@DIACHI,@LUONG,@NGAYVL)";
            command.CommandText = "EXEC Sualoaiphim @MALP,@TENLP,@MOTA";
            command.Parameters.Add("@MALP", SqlDbType.VarChar, 10);
            command.Parameters.Add("@TENLP", SqlDbType.NVarChar, 40);
            command.Parameters.Add("@MOTA", SqlDbType.NVarChar, 1000);


            // gán giá trị
            command.Parameters["@MALP"].Value  = loaiphim.MaLP;
            command.Parameters["@TENLP"].Value = loaiphim.TenLP;
            command.Parameters["@MOTA"].Value  = loaiphim.MoTa;

            command.ExecuteNonQuery();

            // đóng kết nối
            connection.Close();
        }
        public static void Them(DangNhapKhachHangDTO khachhang)
        {
            // mở kết nối
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();

            // tạo câu lệnh Thêm
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            command.CommandText = "EXEC TaoTaiKhoanKH @MAKH,@USER,@PASS";
            //command.CommandText = "INSERT INTO KHACHHANGTHANTHIET VALUES(@MAKH,@HOTEN,@DIACHI,@NGAYSINH,@GIOITINH,@SDT,@LOAIKH,@NGAYDK)";

            command.Parameters.Add("@MAKH", SqlDbType.VarChar, 10);
            command.Parameters.Add("@USER", SqlDbType.VarChar, 50);
            command.Parameters.Add("@PASS", SqlDbType.VarChar, 50);

            // gán giá trị
            command.Parameters["@MAKH"].Value = khachhang.MaKH;
            command.Parameters["@USER"].Value = khachhang.TAIKHOAN;
            command.Parameters["@PASS"].Value = khachhang.MATKHAU;
            command.ExecuteNonQuery();

            // đóng kết nối
            connection.Close();
        }
        public static bool Login(string user, string pass)
        {
            using (var connection = SQLConnectionData.HamKetNoi())
            {
                connection.Open();

                using (var command = new SqlCommand())
                {
                    command.Connection  = connection;
                    command.CommandText = "EXEC Dangnhapnhanvien '" + user + "','" + pass + "'";
                    // command.CommandText = "SELECT * FROM NGUOIDUNG WHERE TAIKHOAN=@user AND MATKHAU=@pass";
                    command.Parameters.AddWithValue("@user", user);
                    command.Parameters.AddWithValue("@pass", pass);
                    command.CommandType = CommandType.Text;
                    SqlDataReader reader = command.ExecuteReader();
                    if (reader.HasRows == true)
                    {
                        while (reader.Read())
                        {
                            tk     = user;
                            Mk     = pass;
                            HoTen  = reader.GetString(0);
                            ChucVu = reader.GetString(1);
                        }
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
Esempio n. 7
0
        public static void Sua(KhachHangDTO khachhang)
        {
            // mở kết nối
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();

            // tạo câu lệnh Sửa
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            //command.CommandText = "EXEC SuaKhachHang @MAKH,@HOTEN,@DIACHI,@NGAYSINH,@GIOITINH,@SDT,@LOAIKH,@NGAYDK";
            command.CommandText = "set dateformat dmy\n EXEC SuaKhachHang '" + khachhang.MaKH + "'" + ",N'"
                                  + khachhang.HoTen + "'" + ",N'"
                                  + khachhang.DiaChi + "'" + ",'"
                                  + khachhang.NgaySinh_String + "'" + ",N'"
                                  + khachhang.GioiTinh + "'" + ",'"
                                  + khachhang.SDT + "'" + ",N'"
                                  + khachhang.LoaiKH + "'" + ",'"
                                  + khachhang.NgayDK_String + "'";

            command.ExecuteNonQuery();

            // đóng kết nối
            connection.Close();
        }
Esempio n. 8
0
        public static void Them(VeDTO ve)
        {
            // mở kết nối
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();

            // tạo câu lệnh Thêm
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;

            command.CommandText = "EXEC ThemVe @MAVE,@MALC,@NGAY_GIO_MUA,@TONGCONG,@MAKH";

            command.Parameters.Add("@MAVE", SqlDbType.VarChar, 10);
            command.Parameters.Add("@MALC", SqlDbType.VarChar, 10);
            command.Parameters.Add("@NGAY_GIO_MUA", SqlDbType.DateTime);
            command.Parameters.Add("@TONGCONG", SqlDbType.Money);
            command.Parameters.Add("@MAKH", SqlDbType.VarChar, 10);

            // gán giá trị
            command.Parameters["@MAVE"].Value         = ve.MaVe;
            command.Parameters["@MALC"].Value         = ve.MaLC;
            command.Parameters["@NGAY_GIO_MUA"].Value = ve.Ngay_Gio_Mua;
            command.Parameters["@TONGCONG"].Value     = ve.TongCong;
            command.Parameters["@MAKH"].Value         = ve.MaKH;

            command.ExecuteNonQuery();
            connection.Close();
        }
        public static bool Login(string user, string pass)
        {
            using (var connection = SQLConnectionData.HamKetNoi())
            {
                connection.Open();

                using (var command = new SqlCommand())
                {
                    command.Connection  = connection;
                    command.CommandText = "SELECT NV.HOTEN,NV.CHUCVU,NV.SDT,DN.TAIKHOAN,DN.MATKHAU FROM DANGNHAP_NHANVIEN DN INNER JOIN NHANVIEN NV ON DN.MANV=NV.MANV" +
                                          " WHERE DN.TAIKHOAN=@user AND DN.MATKHAU=@pass";
                    // command.CommandText = "SELECT * FROM NGUOIDUNG WHERE TAIKHOAN=@user AND MATKHAU=@pass";
                    command.Parameters.AddWithValue("@user", user);
                    command.Parameters.AddWithValue("@pass", pass);
                    command.CommandType = CommandType.Text;
                    SqlDataReader reader = command.ExecuteReader();
                    if (reader.HasRows == true)
                    {
                        while (reader.Read())

                        {
                            //// UserLoginCache.MaNV = reader.GetString(0);
                            //DangNhapNhanVienDTO = reader.GetString(0);
                            //UserLoginCache.ChucVu = reader.GetString(1);
                            //UserLoginCache.SDT = reader.GetString(2);
                        }
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
Esempio n. 10
0
        public static void Sua(VeDTO ve)
        {
            // mở kết nối
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();

            // tạo câu lệnh Thêm
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            //command.CommandText = "INSERT INTO NHANVIEN VALUES(@MANV,@HOTEN,@CHUCVU,@SDT,@GIOITINH,@NGAYSINH,@DIACHI,@LUONG,@NGAYVL)";
            command.CommandText = "EXEC SuaVe @MAPHIM,@MAPC,@MALV,@SOLUONG";

            command.Parameters.Add("@MAPHIM", SqlDbType.VarChar, 10);
            command.Parameters.Add("@MAPC", SqlDbType.VarChar, 10);
            command.Parameters.Add("@MALV", SqlDbType.VarChar, 10);
            command.Parameters.Add("@SOLUONG", SqlDbType.Int);

            // gán giá trị
            command.Parameters["@MAPHIM"].Value  = ve.MaPhim;
            command.Parameters["@MAPC"].Value    = ve.MaPC;
            command.Parameters["@MALV"].Value    = ve.MaLV;
            command.Parameters["@SOLUONG"].Value = ve.SoLuong;

            command.ExecuteNonQuery();
            // đóng kết nối
            connection.Close();
        }
Esempio n. 11
0
        public static void Sua(CaChieuDTO cachieu)
        {
            // mở kết nối
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();

            // tạo câu lệnh Thêm
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;

            command.CommandText = "EXEC SuaCaChieu @MACC,@TENCC,@BATDAU,@KETTHUC";
            command.Parameters.Add("@MACC", SqlDbType.VarChar, 10);
            command.Parameters.Add("@TENCC", SqlDbType.NVarChar, 100);
            command.Parameters.Add("@BATDAU", SqlDbType.DateTime);
            command.Parameters.Add("@KETTHUC", SqlDbType.DateTime);

            // gán giá trị
            command.Parameters["@MACC"].Value    = cachieu.MaCC;
            command.Parameters["@TENCC"].Value   = cachieu.TenCC;
            command.Parameters["@BATDAU"].Value  = cachieu.BatDau.ToLongTimeString();
            command.Parameters["@KETTHUC"].Value = cachieu.KetThuc.ToLongTimeString();

            command.ExecuteNonQuery();

            // đóng kết nối
            connection.Close();
        }
Esempio n. 12
0
        public static void Them(KhachHangDTO khachhang)
        {
            // mở kết nối
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();

            // tạo câu lệnh Thêm
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            //command.CommandText = "EXEC Them_khachhang @MAKH,@HOTEN,@DIACHI,@NGAYSINH,@GIOITINH,@SDT,@LOAIKH,@NGAYDK";
            // 'KH5',N'pham quoc trung',N'123123','1/7/2021 12:00:00 AM',N'Nam','1231232','1/7/2021 9:04:22 AM'
            command.CommandText = "set dateformat dmy\n EXEC Them_khachhang '" + khachhang.MaKH + "'" + ",N'"
                                  + khachhang.HoTen + "'" + ",N'"
                                  + khachhang.DiaChi + "'" + ",'"
                                  + khachhang.NgaySinh_String + "',N'"
                                  + khachhang.GioiTinh + "','"
                                  + khachhang.SDT + "','"
                                  + khachhang.Ngaydk + "'";

            command.ExecuteNonQuery();
            // đóng kết nối
            connection.Close();
        }
Esempio n. 13
0
        public static void Them(LichChieuDTO lichchieu)
        {
            // mở kết nối
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();

            // tạo câu lệnh Thêm
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;

            command.CommandText = " EXEC ThemLichChieu @NGAYCHIEU,@MAPHIM,@MACC,@MAPC ";
            command.Parameters.Add("@NGAYCHIEU", SqlDbType.Date);
            command.Parameters.Add("@MAPHIM", SqlDbType.VarChar, 10);
            command.Parameters.Add("@MACC", SqlDbType.VarChar, 10);
            command.Parameters.Add("@MAPC", SqlDbType.VarChar, 10);


            // gán giá trị
            command.Parameters["@NGAYCHIEU"].Value = lichchieu.NgayChieu;
            command.Parameters["@MAPHIM"].Value    = lichchieu.MaPhim;
            command.Parameters["@MACC"].Value      = lichchieu.MaCC;
            command.Parameters["@MAPC"].Value      = lichchieu.MaPC;

            command.ExecuteNonQuery();

            // đóng kết nối
            connection.Close();
        }
Esempio n. 14
0
        public static void Them(LoaiVeDTO loaive)
        {
            // mở kết nối
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();

            // tạo câu lệnh Thêm
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            //command.CommandText = "INSERT INTO PHIM VALUES(@MALV,@TENLV,@LOAICHONGOI,@GIA,@MALP,@NOIDUNG,@NAMSX,@NUOCSX,@THOILUONG)";
            command.CommandText = "EXEC ThemLoaiVe @MALV,@TENLV,@LOAICHONGOI,@GIA";

            command.Parameters.Add("@MALV", SqlDbType.VarChar, 10);
            command.Parameters.Add("@TENLV", SqlDbType.NVarChar, 100);
            command.Parameters.Add("@LOAICHONGOI", SqlDbType.NVarChar, 100);
            command.Parameters.Add("@GIA", SqlDbType.Money);

            // gán giá trị
            command.Parameters["@MALV"].Value        = loaive.MaLV;
            command.Parameters["@TENLV"].Value       = loaive.TenLV;
            command.Parameters["@LOAICHONGOI"].Value = loaive.LoaiChoNgoi;
            command.Parameters["@GIA"].Value         = loaive.Gia;

            command.ExecuteNonQuery();

            // đóng kết nối
            connection.Close();
        }
Esempio n. 15
0
        public static DataTable TimTheoMaKH(string makh)
        {
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();

            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            command.CommandText = "SELECT HD.STT,HD.SOHD,HD.NGAYHD,HD.GIOHD,KH.HOTEN,QTN.TENQTN,NV.HOTEN,HD.TONGCONG " +
                                  " FROM HOADON HD JOIN KHACHHANGTHANTHIET KH ON KH.MAKH=HD.MAKH " +
                                  " JOIN QUAYTN QTN ON QTN.MAQTN=HD.MAQTN " +
                                  " JOIN NHANVIEN NV ON NV.MANV=QTN.MANV " +
                                  " WHERE MAKH LIKE '" + makh + "%'";

            // gán giá trị

            command.ExecuteNonQuery();
            SqlDataAdapter dataAdapter = new SqlDataAdapter(command);
            DataTable      dataTable   = new DataTable();

            dataAdapter.Fill(dataTable);
            connection.Close();
            return(dataTable);
        }
Esempio n. 16
0
        public List <NhanVienDTO> GetAll()
        {
            List <NhanVienDTO> list_nv = new List <NhanVienDTO>();
            // string query = "SelectAllNhanVien";
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;

            command.CommandText = " EXEC LoadNhanVien ";
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                NhanVienDTO nv = new NhanVienDTO();
                nv.MaNV     = reader.GetString(1);
                nv.HoTen    = reader.GetString(2);
                nv.ChucVu   = reader.GetString(3);
                nv.SDT      = reader.GetString(4);
                nv.GioiTinh = reader.GetString(5);
                nv.NgaySinh = reader.GetDateTime(6);
                nv.DiaChi   = reader.GetString(7);
                nv.Luong    = reader.GetDecimal(8).ToString();
                nv.NgayVL   = reader.GetDateTime(9);

                list_nv.Add(nv);
            }

            return(list_nv);
        }
Esempio n. 17
0
        public static void Xoa(string macc)
        {
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            command.CommandText = "EXEC XoaCaChieu '" + macc + "'";
            command.ExecuteNonQuery();
            connection.Close();
        }
Esempio n. 18
0
        public static int Phanquyen(string user, string pass)
        {
            using (var connection = SQLConnectionData.HamKetNoi())
            {
                connection.Open();

                // using (SqlCommand cmd = new SqlCommand("EXEC Phanquyennhanvien '"+user+"','"+pass+"'", connection))
                using (SqlCommand cmd = new SqlCommand("EXEC PhanQuyen '" + user + "','" + pass + "'", connection))
                {
                    cmd.CommandType = CommandType.Text;
                    using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
                    {
                        DataSet ds = new DataSet();
                        sda.Fill(ds);
                        string a = "";

                        foreach (DataRow row in ds.Tables[0].Rows)
                        {
                            //a = row["CHUCVU"].ToString();
                            a = row["PHANQUYEN"].ToString();
                        }

                        if (a == "Quản trị")
                        {
                            return(1);
                        }
                        // else if (a == "Nhân viên quản lý phim")
                        else if (a == "Quản lý phim, Quản lý loại phim")
                        {
                            return(2);
                        }
                        // else if (a == "Nhân viên quản lý phòng chiếu")
                        else if (a == "Quản lý phòng chiếu")
                        {
                            return(3);
                        }
                        //     else if (a == "Nhân viên quản lý lịch chiếu")
                        else if (a == "Quản lý lịch chiếu")
                        {
                            return(4);
                        }
                        // else if (a == "Nhân viên bán vé")
                        else if (a == "Quản lý loại vé, Quản lý vé")
                        {
                            return(5);
                        }

                        return(0);
                    }
                }
            }
        }
Esempio n. 19
0
        public static void Xoa(DateTime ngaychieu, string maphim, string macc, string mapc)
        {
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            command.CommandText = "EXEC XoaLichChieu " + "'" + ngaychieu + "','" + maphim + "','" + macc + "','" + mapc + "'";

            command.ExecuteNonQuery();
            connection.Close();
        }
Esempio n. 20
0
        public static void Xoa(string maphim, string mapc, string malv)
        {
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            command.CommandText = "EXEC XoaVe " + "'" + maphim + "','" + mapc + "','" + malv + "'";


            command.ExecuteNonQuery();
            connection.Close();
        }
Esempio n. 21
0
        public static void Sua(NhanVienDTO nhanvien)
        {
            // mở kết nối
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();

            // tạo câu lệnh Sửa
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            command.CommandText = "EXEC Suanhanvien @MANV,@HOTEN,@CHUCVU,@SDT,@GIOITINH,@NGAYSINH,@DIACHI,@LUONG,@NGAYVL";
            //command.CommandText = "UPDATE NHANVIEN " +
            //    "SET MANV=@MANV ," +
            //    "HOTEN=@HOTEN," +
            //    "CHUCVU=@CHUCVU," +
            //    "SDT=@SDT," +
            //    "GIOITINH=@GIOITINH," +
            //    "NGAYSINH=@NGAYSINH," +
            //    "DIACHI=@DIACHI," +
            //    "LUONG=@LUONG," +
            //    "NGAYVL=@NGAYVL " +
            //    "WHERE MANV=@MANV";
            command.Parameters.Add("@MANV", SqlDbType.VarChar, 10);
            command.Parameters.Add("@HOTEN", SqlDbType.NVarChar, 40);
            command.Parameters.Add("@CHUCVU", SqlDbType.NVarChar, 100);
            command.Parameters.Add("@SDT", SqlDbType.VarChar, 20);
            command.Parameters.Add("@GIOITINH", SqlDbType.NVarChar, 4);
            command.Parameters.Add("@NGAYSINH", SqlDbType.DateTime);
            command.Parameters.Add("@DIACHI", SqlDbType.NVarChar, 100);
            command.Parameters.Add("@LUONG", SqlDbType.Money);
            command.Parameters.Add("@NGAYVL", SqlDbType.DateTime);

            // gán giá trị
            command.Parameters["@MANV"].Value     = nhanvien.MaNV;
            command.Parameters["@HOTEN"].Value    = nhanvien.HoTen;
            command.Parameters["@CHUCVU"].Value   = nhanvien.ChucVu;
            command.Parameters["@SDT"].Value      = nhanvien.SDT;
            command.Parameters["@GIOITINH"].Value = nhanvien.GioiTinh;
            command.Parameters["@NGAYSINH"].Value = nhanvien.NgaySinh;
            command.Parameters["@DIACHI"].Value   = nhanvien.DiaChi;
            command.Parameters["@LUONG"].Value    = nhanvien.Luong;
            command.Parameters["@NGAYVL"].Value   = nhanvien.NgayVL;

            // thực hiện câu lệnh
            command.ExecuteNonQuery();

            // đóng kết nối
            connection.Close();
        }
Esempio n. 22
0
        public static void Xoa(string sohd)
        {
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            command.CommandText = "DELETE FROM HOADON " +
                                  "WHERE SOHD=@SOHD";
            command.Parameters.Add("@SOHD", SqlDbType.VarChar, 10);
            // gán giá trị
            command.Parameters["@SOHD"].Value = sohd;
            command.ExecuteNonQuery();
            connection.Close();
        }
Esempio n. 23
0
        public static DataTable LichSuDatVe_LayDSGhe(string makh, string mave)
        {
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            command.CommandText = "EXEC LichSuDatVe_LayDSGhe '" + makh + "','" + mave + "'";

            DataTable      dataTable   = new DataTable();
            SqlDataAdapter dataAdapter = new SqlDataAdapter(command);

            dataAdapter.Fill(dataTable);
            connection.Close();
            return(dataTable);
        }
Esempio n. 24
0
        public static void Xoa(string makh)
        {
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            command.CommandText = "EXEC Xoakhachhang '" + makh + "'";
            //command.CommandText = "DELETE KH FROM KHACHHANGTHANTHIET KH " +
            //                      "WHERE KH.MAKH='" + makh + "'";
            //command.Parameters.Add("@MANV", SqlDbType.VarChar, 10);
            // gán giá trị
            //command.Parameters["@MANV"].Value = manv;
            command.ExecuteNonQuery();
            connection.Close();
        }
Esempio n. 25
0
        public static void Xoa(string malp)
        {
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            command.CommandText = "EXEC Xoaloaiphim '" + malp + "'";
            //command.CommandText = "DELETE NV FROM NHANVIEN NV " +
            //                      "WHERE NV.MANV='" + manv + "'";
            //command.Parameters.Add("@MANV", SqlDbType.VarChar, 10);
            // gán giá trị
            //command.Parameters["@MANV"].Value = manv;
            command.ExecuteNonQuery();
            connection.Close();
        }
Esempio n. 26
0
        public static DataTable LoadDSHoaDon()
        {
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "LoadDSVe";

            DataTable      dataTable   = new DataTable();
            SqlDataAdapter dataAdapter = new SqlDataAdapter(command);

            dataAdapter.Fill(dataTable);
            connection.Close();
            return(dataTable);
        }
Esempio n. 27
0
        public static DataTable LoadTheLoaiPhim(string maphim)
        {
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            command.CommandText = "EXEC LoadTheLoaiPhim '" + maphim + "'";
            command.ExecuteNonQuery();
            SqlDataAdapter dataAdapter = new SqlDataAdapter(command);
            DataTable      dataTable   = new DataTable();

            dataAdapter.Fill(dataTable);
            connection.Close();
            return(dataTable);
        }
Esempio n. 28
0
        //Load danh sách sv từ database
        public static DataTable LoadDSPC()
        {
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            command.CommandText = "EXEC LoadDSPhongChieu ";

            DataTable      dataTable   = new DataTable();
            SqlDataAdapter dataAdapter = new SqlDataAdapter(command);

            dataAdapter.Fill(dataTable);
            connection.Close();
            return(dataTable);
        }
Esempio n. 29
0
        public static DataTable HienLichChieuPhim_NgayChieu_MaCC_MaPC(DateTime ngaychieu, string macc, string mapc)
        {
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            command.CommandText = " EXEC HienLichChieuPhim_NgayChieu_MaCC_MaPC '" + ngaychieu + "'" + ",'" + macc + "'" + ",'" + mapc + "'";

            DataTable      dataTable   = new DataTable();
            SqlDataAdapter dataAdapter = new SqlDataAdapter(command);

            dataAdapter.Fill(dataTable);
            connection.Close();
            return(dataTable);
        }
        public static int Phanquyen(string user, string pass)
        {
            using (var connection = SQLConnectionData.HamKetNoi())
            {
                connection.Open();

                using (SqlCommand cmd = new SqlCommand("EXEC Phanquyenkhachhang '" + user + "', '" + pass + "'", connection))
                {
                    cmd.CommandType = CommandType.Text;
                    using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
                    {
                        DataSet ds = new DataSet();
                        sda.Fill(ds);
                        string a = "";

                        foreach (DataRow row in ds.Tables[0].Rows)
                        {
                            a = row["LOAIKH"].ToString();
                        }
                        /// quanly :1   nhanvien ban hang :2
                        if (a == "Đồng")
                        {
                            return(1);
                        }
                        else if (a == "Bạc")
                        {
                            return(2);
                        }
                        else if (a == "Vàng")
                        {
                            return(3);
                        }
                        else if (a == "Bạch kim")
                        {
                            return(4);
                        }
                        else if (a == "Kim cương")
                        {
                            return(5);
                        }
                        return(0);
                    }
                }
            }
        }