Example #1
0
        public List <DTO_Tour> DanhSachTourdieukien(string dieukien)
        {
            List <DTO_Tour> list = new List <DTO_Tour>();

            if (base.conn.State == ConnectionState.Closed)
            {
                base.conn.Open();
            }
            string        sql    = "Select * From tour where " + dieukien + "";
            SqlCommand    cmd    = new SqlCommand(sql, base.conn);
            SqlDataReader reader = cmd.ExecuteReader();

            if (reader.FieldCount <= 0)
            {
                MessageBox.Show("Không có kết quả nào!!", "Không có kết quả", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                while (reader.Read())
                {
                    DTO_Tour x = new DTO_Tour(reader[0].ToString(), reader[1].ToString(), reader[2].ToString(), reader[3].ToString(), reader[4].ToString(), reader[5].ToString(), reader[6].ToString(), reader[7].ToString(), int.Parse(reader[8].ToString()), reader[9].ToString(), reader[10].ToString());
                    list.Add(x);
                }
            }
            if (base.conn.State == ConnectionState.Open)
            {
                base.conn.Close();
            }
            return(list);
        }
Example #2
0
        public bool UpdateTour(DTO_Tour obj)
        {
            bool   check;
            String sql = "update tour set maKhuVuc = @maKhuVuc, tenTour = @tenTour, diemXuatPhat = @diemXuatPhat, diemDenCuoi = @diemDenCuoi, dichVu = @dichVu, ngayKhoiHanh = @ngayKhoiHanh, thoiGianTour = @thoiGianTour, giaTour = @giaTour, linkAnh = @linkAnh, lichTrinh = @lichTrinh where maTour = @maTour";

            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            SqlCommand cmd = new SqlCommand(sql, base.conn);

            cmd.Parameters.AddWithValue("@maTour", obj.MaTour);
            cmd.Parameters.AddWithValue("@maKhuVuc", obj.MaKhuVuc);
            cmd.Parameters.AddWithValue("@tenTour", obj.TenTour);
            cmd.Parameters.AddWithValue("@diemXuatPhat", obj.DiemXuatPhat);
            cmd.Parameters.AddWithValue("@diemDenCuoi", obj.DiemDenCuoi);
            cmd.Parameters.AddWithValue("@dichVu", obj.DichVu);
            cmd.Parameters.AddWithValue("@ngayKhoiHanh", obj.NgayKhoiHanh);
            cmd.Parameters.AddWithValue("@thoiGianTour", obj.ThoiGianTour);
            cmd.Parameters.AddWithValue("@giaTour", obj.GiaTour);
            cmd.Parameters.AddWithValue("@linkAnh", obj.LinkAnh);
            cmd.Parameters.AddWithValue("@lichTrinh", obj.LichTrinh);

            check = base.ThucThi(cmd);
            if (conn.State == ConnectionState.Open)
            {
                conn.Close();
            }
            return(check);
        }
Example #3
0
        public bool InsertTour(DTO_Tour obj)
        {
            bool check;

            if (base.conn.State == ConnectionState.Closed)
            {
                base.conn.Open();
            }
            String     sql = "insert into tour(maTour, maKhuVuc, tenTour, diemXuatPhat, diemDenCuoi, dichVu, ngayKhoiHanh, thoiGianTour, giaTour, linkAnh, lichTrinh) values(@maTour, @maKhuVuc, @tenTour, @diemXuatPhat, @diemDenCuoi, @dichVu, @ngayKhoiHanh, @thoiGianTour, @giaTour, @linkAnh, @lichTrinh)";
            SqlCommand cmd = new SqlCommand(sql, base.conn);

            cmd.Parameters.AddWithValue("@maTour", obj.MaTour);
            cmd.Parameters.AddWithValue("@maKhuVuc", obj.MaKhuVuc);
            cmd.Parameters.AddWithValue("@tenTour", obj.TenTour);
            cmd.Parameters.AddWithValue("@diemXuatPhat", obj.DiemXuatPhat);
            cmd.Parameters.AddWithValue("@diemDenCuoi", obj.DiemDenCuoi);
            cmd.Parameters.AddWithValue("@dichVu", obj.DichVu);
            cmd.Parameters.AddWithValue("@ngayKhoiHanh", obj.NgayKhoiHanh);
            cmd.Parameters.AddWithValue("@thoiGianTour", obj.ThoiGianTour);
            cmd.Parameters.AddWithValue("@giaTour", obj.GiaTour);
            cmd.Parameters.AddWithValue("@linkAnh", obj.LinkAnh);
            cmd.Parameters.AddWithValue("@lichTrinh", obj.LichTrinh);

            check = base.ThucThi(cmd);
            if (base.conn.State == ConnectionState.Open)
            {
                base.conn.Close();
            }
            return(check);
        }
Example #4
0
        public bool checkmaTour(DTO_Tour obj)
        {
            String    sql = "Select * From tour where maTour = '" + obj.MaTour + "'";
            DataTable t   = base.GetTable(sql);

            return(t.Rows.Count > 0);
        }
Example #5
0
 public GUI_ADMIN_HoTro_SuaBook(DTO_Booked b, DTO_Tour t, DTO_KhachHang k, DTO_TaiKhoan taikhoan) : this()
 {
     InitializeComponent();
     bk                = b;
     tr                = t;
     kh                = k;
     nhantaikhoan      = taikhoan;
     lbNgayHomNay.Text = DateTime.Now.ToString("dd/MMM/yy").Trim();
     laydata();
 }
Example #6
0
 public GUI_DatTour(DTO_Tour obj) : this()
 {
     tour                = obj;
     lbTenTour.Text      = tour.TenTour.Trim();
     lbDiemXuatPhat.Text = tour.DiemXuatPhat.Trim();
     lbDiemDenCuoi.Text  = tour.DiemDenCuoi.Trim();
     lbDichVu.Text       = tour.DichVu.Trim();
     lbNgayKhoiHanh.Text = tour.NgayKhoiHanh.Trim();
     lbThoiGIanTour.Text = tour.ThoiGianTour.Trim();
     lbGiaTour.Text      = tour.GiaTour.ToString().Trim();
     piclinkAnh.Image    = System.Drawing.Image.FromFile(tour.LinkAnh.ToString().Trim());
     piclinkAnh.SizeMode = PictureBoxSizeMode.StretchImage;
 }
Example #7
0
        public bool DeleteTour(DTO_Tour obj)
        {
            bool check;

            if (base.conn.State == ConnectionState.Closed)
            {
                base.conn.Open();
            }
            String     sql = "delete From tour where maTour = @maTour";
            SqlCommand cmd = new SqlCommand(sql, base.conn);

            cmd.Parameters.AddWithValue("@maTour", obj.MaTour);
            check = base.ThucThi(cmd);
            if (base.conn.State == ConnectionState.Open)
            {
                base.conn.Close();
            }
            return(check);
        }
Example #8
0
        void themnhieu(List <DTO_Tour> danhsach)
        {
            int n = danhsach.Count;

            string[] picturebox = new string[n]; picturebox[0] = "pic0";

            string[] lbTenTour      = new string[n]; lbTenTour[0] = "lbTenTour0";
            string[] lbthoigiantour = new string[n]; lbthoigiantour[0] = "lbthoigiantour0";
            string[] lbNgayKhoiHanh = new string[n]; lbNgayKhoiHanh[0] = "lbNgayKhoiHanh0";
            string[] lbGia          = new string[n]; lbGia[0] = "lbGia0";

            string[] btnchitiet = new string[n]; btnchitiet[0] = "btnChiTiet0";
            string[] btndatngay = new string[n]; btndatngay[0] = "btnName0";
            int[]    y          = new int[n]; y[0] = 3;
            DTO_Tour tour0      = danhsach[0];

            them(picturebox[0], lbTenTour[0], lbthoigiantour[0], lbNgayKhoiHanh[0], lbGia[0], btnchitiet[0], btndatngay[0], 3, y[0], tour0);

            for (int i = 1; i < n; i++)
            {
                picturebox[i]     = "pic" + i;
                lbTenTour[i]      = "lbTenTour" + i;
                lbthoigiantour[i] = "lbthoigiantour" + i;
                lbNgayKhoiHanh[i] = "lbNgayKhoiHanh" + i;
                lbGia[i]          = "lbGia" + i;
                btnchitiet[i]     = "btnChiTiet" + i;
                btndatngay[i]     = "btnName" + i;

                DTO_Tour tour = danhsach[i];

                if (i % 2 != 0)
                {
                    y[i] = y[i - 1];
                    them(picturebox[i], lbTenTour[i], lbthoigiantour[i], lbNgayKhoiHanh[i], lbGia[i], btnchitiet[i], btndatngay[i], 460, y[i], tour);
                }
                else
                {
                    y[i] = y[i - 1] + 193;
                    them(picturebox[i], lbTenTour[i], lbthoigiantour[i], lbNgayKhoiHanh[i], lbGia[i], btnchitiet[i], btndatngay[i], 3, y[i], tour);
                }
            }
        }
Example #9
0
        public List <DTO_Tour> DanhSachTour()
        {
            List <DTO_Tour> list = new List <DTO_Tour>();

            if (base.conn.State == ConnectionState.Closed)
            {
                base.conn.Open();
            }
            string        sql    = "Select * From tour";
            SqlCommand    cmd    = new SqlCommand(sql, base.conn);
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                DTO_Tour x = new DTO_Tour(reader[0].ToString(), reader[1].ToString(), reader[2].ToString(), reader[3].ToString(), reader[4].ToString(), reader[5].ToString(), reader[6].ToString(), reader[7].ToString(), int.Parse(reader[8].ToString()), reader[9].ToString(), reader[10].ToString());
                list.Add(x);
            }
            if (base.conn.State == ConnectionState.Open)
            {
                base.conn.Close();
            }
            return(list);
        }
Example #10
0
        void them(string picturebox, string lbTenTour, string lbthoigiantour, string lbNgayKhoiHanh, string lbGia, string btnchitiet, string btndatngay, int x, int y, DTO_Tour tour)
        {
            System.Windows.Forms.GroupBox   groupBox          = new GroupBox();
            System.Windows.Forms.PictureBox pic               = new PictureBox();
            System.Windows.Forms.Label      LabelGia          = new Label();
            System.Windows.Forms.Label      LabelNgayKhoiHanh = new Label();
            System.Windows.Forms.Label      Labelthoigiantour = new Label();
            System.Windows.Forms.Label      LabelTenTour      = new Label();
            System.Windows.Forms.Button     buttonchitiet     = new Button();
            System.Windows.Forms.Button     buttondatngay     = new Button();

            this.panelDSTour.Controls.Add(groupBox);
            groupBox.Controls.Add(pic);
            groupBox.Controls.Add(LabelTenTour);
            groupBox.Controls.Add(Labelthoigiantour);
            groupBox.Controls.Add(LabelNgayKhoiHanh);
            groupBox.Controls.Add(LabelGia);
            groupBox.Controls.Add(buttonchitiet);
            groupBox.Controls.Add(buttondatngay);

            groupBox.Location = new System.Drawing.Point(x, y);
            groupBox.Size     = new System.Drawing.Size(450, 187);

            pic.Location = new System.Drawing.Point(6, 13);
            pic.Name     = picturebox;
            pic.Size     = new System.Drawing.Size(211, 168);
            pic.Image    = System.Drawing.Image.FromFile(tour.LinkAnh.Trim());
            pic.SizeMode = PictureBoxSizeMode.StretchImage;

            LabelTenTour.AutoSize = true;
            LabelTenTour.Location = new System.Drawing.Point(223, 18);
            LabelTenTour.Name     = lbTenTour;
            LabelTenTour.Size     = new System.Drawing.Size(53, 17);
            LabelTenTour.Text     = tour.TenTour.Trim();

            Labelthoigiantour.AutoSize = true;
            Labelthoigiantour.Location = new System.Drawing.Point(223, 51);
            Labelthoigiantour.Name     = lbthoigiantour;
            Labelthoigiantour.Size     = new System.Drawing.Size(130, 17);
            Labelthoigiantour.Text     = tour.ThoiGianTour.Trim();

            LabelNgayKhoiHanh.AutoSize = true;
            LabelNgayKhoiHanh.Location = new System.Drawing.Point(223, 84);
            LabelNgayKhoiHanh.Name     = lbNgayKhoiHanh;
            LabelNgayKhoiHanh.Size     = new System.Drawing.Size(109, 17);
            LabelNgayKhoiHanh.Text     = "Ngày Khởi Hành: " + tour.NgayKhoiHanh.Trim();

            LabelGia.AutoSize = true;
            LabelGia.Location = new System.Drawing.Point(223, 117);
            LabelGia.Name     = lbGia;
            LabelGia.Size     = new System.Drawing.Size(30, 17);
            LabelGia.Text     = tour.GiaTour.ToString().Trim() + " / cho 1 vé";

            buttonchitiet.Location = new System.Drawing.Point(226, 143);
            buttonchitiet.Name     = btnchitiet;
            buttonchitiet.Size     = new System.Drawing.Size(75, 38);
            buttonchitiet.Text     = "Chi Tiết";
            buttonchitiet.Click   += Buttonchitiet_Click;

            buttondatngay.Location = new System.Drawing.Point(307, 143);
            buttondatngay.Name     = btndatngay;
            buttondatngay.Size     = new System.Drawing.Size(99, 38);
            buttondatngay.Text     = "Đặt Ngay";
            buttondatngay.Click   += Buttondatngay_Click;

            void Buttondatngay_Click(object sender, EventArgs e)
            {
                //buttondatngay = sender as Button;
                GUI_DatTour giaodien = new GUI_DatTour(tour);

                this.Hide();
                giaodien.ShowDialog();
            }

            void Buttonchitiet_Click(object sender, EventArgs e)
            {
                //buttonchitiet = sender as Button;
                GUI_ChiTietTour giaodien = new GUI_ChiTietTour(tour);

                this.Hide();
                giaodien.ShowDialog();
            }
        }
Example #11
0
 bool checktrong()
 {
     if (txtMaTour.Text.Trim().Equals(""))
     {
         MessageBox.Show("Vui lòng điền thông tin vào trường Mã Tour!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
     else if (cbKhuVuc.Text.Trim().Equals(""))
     {
         MessageBox.Show("Vui lòng chọn giá trị trường Khu vực!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
     else if (txtTenTour.Text.Trim().Equals(""))
     {
         MessageBox.Show("Vui lòng điền thông tin vào trường Tên Tour!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
     else if (txtDiemXuatPhat.Text.Trim().Equals(""))
     {
         MessageBox.Show("Vui lòng điền thông tin vào trường Điểm xuất phát!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
     else if (txtDiemDenCuoi.Text.Trim().Equals(""))
     {
         MessageBox.Show("Vui lòng điền thông tin vào trường Điểm đến cuối!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
     else if (txtDichVu.Text.Trim().Equals(""))
     {
         MessageBox.Show("Vui lòng điền thông tin vào trường Dịch vụ!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
     else if (txtThoiGianTour.Text.Trim().Equals(""))
     {
         MessageBox.Show("Vui lòng điền thông tin vào trường Thời gian Tour!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
     else if (txtGiaTour.Text.Trim().Equals(""))
     {
         MessageBox.Show("Vui lòng điền thông tin vào trường Giá Tour!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
     else if (!tour.checkso(txtGiaTour.Text))
     {
         MessageBox.Show("Giá tour phải là số!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
     else if (int.Parse(txtGiaTour.Text) < 0)
     {
         MessageBox.Show("Giá tour phải dương!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
     else
     {
         obj              = new DTO_Tour();
         obj.MaTour       = txtMaTour.Text;
         obj.MaKhuVuc     = cbKhuVuc.SelectedValue.ToString().Trim();
         obj.TenTour      = txtTenTour.Text;
         obj.DiemXuatPhat = txtDiemXuatPhat.Text;
         obj.DiemDenCuoi  = txtDiemDenCuoi.Text;
         obj.DichVu       = txtDichVu.Text;
         obj.NgayKhoiHanh = dtpNgayKhoiHanh.Text;
         obj.ThoiGianTour = txtThoiGianTour.Text;
         obj.GiaTour      = int.Parse(txtGiaTour.Text);
         obj.LinkAnh      = txtLinkAnh.Text;
         obj.LichTrinh    = rtextLichTrinh.Text;
         return(true);
     }
 }
Example #12
0
 public bool checkmaTour(DTO_Tour obj)
 {
     return(dal.checkmaTour(obj));
 }
Example #13
0
 public bool DeleteTour(DTO_Tour obj)
 {
     return(dal.DeleteTour(obj));
 }
Example #14
0
 public bool UpdateTour(DTO_Tour obj)
 {
     return(dal.UpdateTour(obj));
 }
Example #15
0
 public bool InsertTour(DTO_Tour obj)
 {
     return(dal.InsertTour(obj));
 }