Пример #1
0
    protected void KiemTraTheTonTai()
    {
        string tenloaithe = XL_CHUOI.Nhap(Request, "tenloaithe").ToString();

        string   sothe      = XL_CHUOI.Nhap(Request, "sothe");
        DateTime ngayhethan = DateTime.Parse(XL_CHUOI.Nhap(Request, "ngayhethan").ToString());

        WS_CardSystem.CardDTO cardDto = new WS_CardSystem.CardDTO();
        cardDto.Code         = sothe;
        cardDto.Expried_date = ngayhethan;
        cardDto.Type         = tenloaithe;

        WS_CardSystem.Service ws = new WS_CardSystem.Service();

        XL_THE Kq = new XL_THE("goc");
        bool   kt = ws.KiemTraHopLe(cardDto);

        if (kt)
        {
            Kq.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("kq", "true"));
        }
        else
        {
            Kq.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("kq", "false"));
        }

        XL_CHUOI.XuatChuoi(Response, Kq.Chuoi());
    }
Пример #2
0
    private void LayThamSo()
    {
        ThamSoBUS bus = new ThamSoBUS();

        ThamSoDTO dto = bus.LayThamSo();

        XL_THE kq = new XL_THE("ThamSo");

        XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("GiaTriDiemSo", ((int)dto.GiaTriDiemSo).ToString());

        kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

        Thuoc_tinh = new XL_THUOC_TINH("DiemKhachHangThanThiet", ((int)dto.DiemKhachHangThanThiet).ToString());
        kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

        Thuoc_tinh = new XL_THUOC_TINH("TiLeGiamGiaThucDon", ((int)(dto.TiLeGiamGiaThucDon * 100)).ToString());
        kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

        Thuoc_tinh = new XL_THUOC_TINH("Thue", ((int)(dto.Thue * 100)).ToString());
        kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

        Thuoc_tinh = new XL_THUOC_TINH("GiaTriDoiDiemKhuyenMai", ((int)dto.GiaTriDoiDiemKhuyenMai).ToString());
        kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

        Thuoc_tinh = new XL_THUOC_TINH("GioiHanDoiDiemKhuyenMai", ((int)(dto.GioiHanDoiDiemKhuyenMai * 100)).ToString());
        kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

        XL_CHUOI.XuatXML(Response, kq.Chuoi());
    }
Пример #3
0
    private void GuiLaiMatKhau()
    {
        string Username = (string)Request["Username"];

        byte[] arr = new byte[10];
        Random r   = new Random((int)DateTime.Now.ToBinary());

        r.NextBytes(arr);
        string pass = Utilities.ConvertToHexa(arr);

        NguoiDungBUS ndBus       = new NguoiDungBUS();
        NguoiDungDTO dto         = ndBus.LayThongTinNguoiDung(Username);
        int          maNguoiDung = dto.Ma_nguoi_dung;
        bool         flag        = Utilities.SendMail("*****@*****.**", dto.Email, "(OFFS) Reset mật khẩu", "Mật khẩu mới: <strong>" + pass + "</strong>") == "";
        string       passSHA1    = Utilities.SHA1(pass).ToLower();
        bool         kq          = ndBus.CapNhatThongTinMatKhau(passSHA1, maNguoiDung);

        XL_THE        the       = new XL_THE("goc");
        XL_THUOC_TINH thuoctinh = new XL_THUOC_TINH("kq", flag && kq ? "1" : "0");

        the.Danh_sach_thuoc_tinh.Add(thuoctinh);
        string chuoi = the.Chuoi();

        XL_CHUOI.XuatChuoi(Response, chuoi);
    }
Пример #4
0
    protected void LayDSThucDon()
    {
        ThucDonBUS ThucDonBUS = new ThucDonBUS();

        ThucDonDTO[] DsThucDon = ThucDonBUS.DSThucDonThuocLoaiThucDon(int.Parse(Request["MaLoaiThucDon"].ToString()));

        XL_THE Kq = new XL_THE("DANH_SACH");

        for (int i = 0; i < DsThucDon.Length; i++)
        {
            XL_THE Kq1 = new XL_THE("ThucDon");

            ThucDonDTO ThucDon = DsThucDon[i];

            XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("Ma_thuc_don", ThucDon.Ma_thuc_don.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Ten_thuc_don", ThucDon.Ten_thuc_don);
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Hinh_anh_minh_hoa", ThucDon.Hinh_anh_minh_hoa);
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Gia", ThucDon.Gia.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Ma_loai_thuc_don", ThucDon.Ma_loai_thuc_don.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Tinh_trang", ThucDon.Tinh_trang.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Trang_thai_hien_thi", ThucDon.Trang_thai_hien_thi.ToString());

            Kq.Danh_sach_the.Add(Kq1);
        }

        XL_CHUOI.XuatXML(Response, Kq.Chuoi());
    }
    private void Cong_ty_cap_nhat()
    {
        Session["Ten_cong_ty"] = Request["Ten_cong_ty"];
        XL_THE The = new XL_THE("Goc");

        XL_CHUOI.XuatXML(Response, The.Chuoi());
    }
    private void Thong_Tin_Cong_Ty()
    {
        XmlDocument Tai_lieu = new XmlDocument();
        XmlElement  Cong_ty  = null;

        Tai_lieu.Load(Server.MapPath("CONG_TY.xml"));
        Cong_ty = Tai_lieu.DocumentElement;


        XL_THE Kq = new XL_THE("CONG_TY");


        XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("Ten_cong_ty", Cong_ty.GetAttribute("Ten_cong_ty"));

        Kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
        Thuoc_tinh = new XL_THUOC_TINH("Dien_thoai", Cong_ty.GetAttribute("Dien_thoai"));
        Kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
        Thuoc_tinh = new XL_THUOC_TINH("Dien_thoai_admin", Cong_ty.GetAttribute("Dien_thoai_admin"));
        Kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
        Thuoc_tinh = new XL_THUOC_TINH("Dia_chi", Cong_ty.GetAttribute("Dia_chi"));
        Kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
        Thuoc_tinh = new XL_THUOC_TINH("Logo", Cong_ty.GetAttribute("Logo"));
        Kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
        Thuoc_tinh = new XL_THUOC_TINH("Banner", Cong_ty.GetAttribute("Banner"));
        Kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
        Thuoc_tinh = new XL_THUOC_TINH("Mo_ta", Cong_ty.GetAttribute("Mo_ta"));
        Kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

        XL_CHUOI.XuatXML(Response, Kq.Chuoi());
    }
Пример #7
0
    void LayDanhSach()
    {
        // Lấy thông tin toàn bộ người dùng (nhân viên, quản lý, quản trị, ...)
        NoiDungEmailBUS bus = new NoiDungEmailBUS();

        NoiDungEmailDTO[] kq = bus.LayDanhSach();


        XL_THE Kq = new XL_THE("DANH_SACH");

        foreach (NoiDungEmailDTO dto in kq)
        {
            XL_THE the = new XL_THE("TaiKhoan");

            XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("MaMail", dto.MaMail.ToString());
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Thuoc_tinh = new XL_THUOC_TINH("Username", dto.Username);
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Thuoc_tinh = new XL_THUOC_TINH("Email", dto.Email);
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Thuoc_tinh = new XL_THUOC_TINH("NgayGui", dto.NgayGui.ToString());
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Thuoc_tinh = new XL_THUOC_TINH("TieuDe", dto.TieuDe);
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Kq.Danh_sach_the.Add(the);
        }

        XL_CHUOI.XuatXML(Response, Kq.Chuoi());
    }
    private void Lay_danh_sach_website()
    {
        XmlDocument Tai_lieu = new XmlDocument();
        XmlElement  Website  = null;

        Tai_lieu.Load(Server.MapPath("WEBSITE.xml"));
        Website = Tai_lieu.DocumentElement;

        XL_THE Kq = new XL_THE("WEBSITE");

        foreach (XmlElement Thong_tin in Website.ChildNodes)
        {
            if (Thong_tin.GetAttribute("TinhTrang").ToString() == "0")
            {
                continue;
            }

            XL_THE Kq1 = new XL_THE("ThongTin");

            XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("Ten_website", Thong_tin.GetAttribute("Ten"));
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Kq.Danh_sach_the.Add(Kq1);
        }

        XL_CHUOI.XuatXML(Response, Kq.Chuoi());
    }
    private bool ThanhToan(decimal giatri, XL_THE the, WS_CardSystem.CardDTO cardDto1)
    {
        WS_CardSystem.Service cardsys = new WS_CardSystem.Service();
        bool kq = cardsys.KiemTraHopLe(cardDto1);

        if (kq == false)
        {
            return(false);
        }
        else
        {
            WS_CardSystem.CardDTO cardDto2 = new WS_CardSystem.CardDTO();
            cardDto2.Code = soTheOFFS; //test
            cardDto2.Type = loaiTheOFFS;

            kq = cardsys.KiemTraHopLe(cardDto2);
            if (kq == false)
            {
                return(false);
            }
            else
            {
                WS_Paypal.CardDTO cardsend = new WS_Paypal.CardDTO();
                WS_Paypal.CardDTO cardreci = new WS_Paypal.CardDTO();
                cardsend.Code = cardDto1.Code;
                cardsend.Type = cardDto1.Type;
                cardreci.Code = soTheOFFS; //test
                cardreci.Type = loaiTheOFFS;

                WS_Paypal.Service paypal = new WS_Paypal.Service();
                kq = paypal.ThanhToan(cardsend, cardreci, giatri);
                return(kq);
            }
        }
    }
    protected void Lay_trang_thai_form()
    {
        if (Session["FormDatHang"] != null)
        {
            FormDatHang form = (FormDatHang)Session["FormDatHang"];
            XL_THE      the  = new XL_THE("Goc");

            the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("cmbDiemSD", form.cmbDiemSD.ToString()));
            the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("lbSoTien", form.lbSoTien));
            the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("cmbHTKM", form.cmbHTKM.ToString()));
            the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("cmbHTTT", form.cmbHTTT.ToString()));
            the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("rdThe", form.rdThe));
            if (form.rdThe == "rdKhac")
            {
                the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("nodeLoaiThe", form.nodeLoaiThe.ToString()));
                the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("nodeSoThe", form.nodeSoThe));
                the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("nodeNgayHH", form.nodeNgayHH.ToString()));
                the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("nodeThangHH", form.nodeThangHH.ToString()));
                the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("nodeNamHH", form.nodeNamHH.ToString()));
            }
            the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("txtNguoiNhan", form.txtNguoiNhan));
            the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("txtDiaChiNhan", form.txtDiaChiNhan));
            the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("cmbNgayGH", form.cmbNgayGH.ToString()));
            the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("cmbThangGH", form.cmbThangGH.ToString()));
            the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("cmbNamGH", form.cmbNamGH.ToString()));
            the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("cmbGioGH", form.cmbGioGH.ToString()));
            the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("cmbPhutGH", form.cmbPhutGH.ToString()));
            the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("cmbBuoiGH", form.cmbBuoiGH.ToString()));

            string chuoi = the.Chuoi();
            XL_CHUOI.XuatChuoi(Response, chuoi);
        }
    }
    protected void ThemLoaiMonMoi()
    {
        LoaiMonDTO lmDto = new LoaiMonDTO();

        //Lấy tham số client truyền xuống
        lmDto.Ten_loai_mon    = XL_CHUOI.Nhap(Request, "tenloaimon");
        lmDto.Ma_loai_mon_cha = int.Parse(XL_CHUOI.Nhap(Request, "maloaimoncha"));
        lmDto.La_loai_mon_la  = bool.Parse(XL_CHUOI.Nhap(Request, "laloaimonla"));

        //Thêm loại món mới
        LoaiMonBUS khBus = new LoaiMonBUS();
        bool       kq    = new LoaiMonBUS().ThemLoaiMon(lmDto);


        XL_THE        the = new XL_THE("goc");
        XL_THUOC_TINH thuoc_tinh;

        //Them thanh cong
        if (kq == true)
        {
            thuoc_tinh = new XL_THUOC_TINH("kq", "True");
        }
        else
        {
            thuoc_tinh = new XL_THUOC_TINH("kq", "False");
        }

        //Trả kết quả về client
        the.Danh_sach_thuoc_tinh.Add(thuoc_tinh);
        string chuoi = the.Chuoi();

        XL_CHUOI.XuatChuoi(Response, chuoi);
    }
Пример #12
0
    //Hàm của Nghi, truyền mã thực đơn lên từ client, chứ không gán vào session
    private void ChiTietThucDon()
    {
        int ma_thuc_don = int.Parse(Request["mathucdon"].ToString());

        ThucDonBUS thucdonBUS = new ThucDonBUS();
        MonAnBUS   monanBUS   = new MonAnBUS();
        XL_THE     Kq         = new XL_THE("DANH_SACH");

        ArrayList arr = thucdonBUS.ThongTinThucDon(ma_thuc_don);

        for (int i = 0; i < arr.Count; i++)
        {
            MonAnDTO MonAn = monanBUS.ChiTietMonAn(int.Parse(arr[i].ToString()));

            XL_THE Kq1 = new XL_THE("MonAn");

            XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("Ma_mon", MonAn.Ma_mon.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Ten_mon", MonAn.Ten_mon);
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Hinh_anh_minh_hoa", MonAn.Hinh_anh_minh_hoa);
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Gia", MonAn.Gia.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Kq.Danh_sach_the.Add(Kq1);
        }
        XL_CHUOI.XuatXML(Response, Kq.Chuoi());
    }
    private void Thong_tin_chinh_gio_hang()
    {
        XL_THE          Kq       = new XL_THE("THONGTIN");
        Gio_hang_online gio_hang = new Gio_hang_online();


        if (Session["Gio_hang"] == null)
        {
            return;
        }
        else
        {
            gio_hang = (Gio_hang_online)Session["Gio_hang"];
            int so_items = 0;
            for (int i = 0; i < gio_hang.DsMonAn.Count; i++)
            {
                Item_online ma = (Item_online)gio_hang.DsMonAn[i];
                so_items += ma.So_luong;
            }
            XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("So_items", so_items.ToString());
            Kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Tong_gia_tri", gio_hang.gia_tri.ToString());
            Kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            XL_CHUOI.XuatXML(Response, Kq.Chuoi());
        }
    }
    protected void XoaLoaiMon()
    {
        //Lấy tham số client truyền xuống
        int maloaimon = int.Parse(XL_CHUOI.Nhap(Request, "maloaimon"));

        //Xóa loại món
        LoaiMonBUS khBus = new LoaiMonBUS();
        bool       kq    = new LoaiMonBUS().XoaLoaiMon(maloaimon);


        XL_THE        the = new XL_THE("goc");
        XL_THUOC_TINH thuoc_tinh;

        //Them thanh cong
        if (kq == true)
        {
            thuoc_tinh = new XL_THUOC_TINH("kq", "1");
        }
        else
        {
            thuoc_tinh = new XL_THUOC_TINH("kq", "0");
        }

        //Trả kết quả về client
        the.Danh_sach_thuoc_tinh.Add(thuoc_tinh);
        string chuoi = the.Chuoi();

        XL_CHUOI.XuatChuoi(Response, chuoi);
    }
Пример #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Application.Lock();
        QUANLY    ql               = (QUANLY)Application["QUANLY"];
        ArrayList lst              = (ArrayList)Application["DanhSachNoiDung"];
        int       SoNguoi          = ql.SoNguoiChoi + ql.SoNguoiXem;
        int       CauLuuTruHienTai = (int)Application["CauLuuTruHienTai"];
        int       SoCauDaChat      = (int)Application["SoCauDaChat"];
        int       SoCauDaLay       = (int)Session["SoCauDaLay"];

        XL_THE The = new XL_THE("Goc");

        for (int i = Math.Max(SoCauDaLay, CauLuuTruHienTai); i < SoCauDaChat; ++i)
        {
            NoiDungChat   ndc       = (NoiDungChat)lst[i - CauLuuTruHienTai];
            String        NoiDung   = ndc.NoiDung;
            String        NguoiGui  = ndc.TenNguoiGui;
            XL_THE        TheCon    = new XL_THE("Cau");
            XL_THUOC_TINH ThuocTinh = new XL_THUOC_TINH("NoiDung", NoiDung);
            TheCon.Danh_sach_thuoc_tinh.Add(ThuocTinh);
            ThuocTinh = new XL_THUOC_TINH("NguoiGui", NguoiGui);
            TheCon.Danh_sach_thuoc_tinh.Add(ThuocTinh);
            The.Danh_sach_the.Add(TheCon);

            ndc.SoLanLay++;
        }
        Session["SoCauDaLay"] = SoCauDaChat;
        DonDep();
        String Chuoi = The.Chuoi();

        XL_CHUOI.Xuat(Response, Chuoi);
        Application.UnLock();
    }
    private void Cap_Nhat_Tinh_Trang()
    {
        XmlDocument Tai_lieu  = new XmlDocument();
        XmlElement  Quang_cao = null;

        Tai_lieu.Load(Server.MapPath("QUANG_CAO.xml"));
        Quang_cao = Tai_lieu.DocumentElement;

        foreach (XmlElement Thong_tin in Quang_cao.ChildNodes)
        {
            if (Thong_tin.GetAttribute("Ten").CompareTo(Request["Ten_cong_ty"]) == 0)
            {
                if (Request["Loai"] == "1")
                {
                    Thong_tin.SetAttribute("TinhTrang", "1");
                }
                else if (Request["Loai"] == "0")
                {
                    Thong_tin.SetAttribute("TinhTrang", "0");
                }
                break;
            }
        }

        Tai_lieu.Save(Server.MapPath("QUANG_CAO.xml"));
        XL_THE Kq = new XL_THE("Goc");

        XL_CHUOI.XuatXML(Response, Kq.Chuoi());
    }
    private void Cap_Nhat_Thong_Tin()
    {
        XmlDocument Tai_lieu = new XmlDocument();
        XmlElement  Cong_ty  = null;

        Tai_lieu.Load(Server.MapPath("CONG_TY.xml"));
        Cong_ty = Tai_lieu.DocumentElement;

        Cong_ty.SetAttribute("Ten_cong_ty", Request["Ten_cong_ty"]);
        Cong_ty.SetAttribute("Dia_chi", Request["Dia_chi"]);
        Cong_ty.SetAttribute("Dien_thoai", Request["Dien_thoai"]);
        Cong_ty.SetAttribute("Dien_thoai_admin", Request["Dien_thoai_admin"]);
        if (Request["Logo"] != null)
        {
            Cong_ty.SetAttribute("Logo", Request["Logo"]);
        }
        if (Request["Banner"] != null)
        {
            Cong_ty.SetAttribute("Banner", Request["Banner"]);
        }
        Cong_ty.SetAttribute("Mo_ta", Request["Mo_ta"]);

        Tai_lieu.Save(Server.MapPath("CONG_TY.xml"));
        XL_THE Kq = new XL_THE("Goc");

        XL_CHUOI.XuatXML(Response, Kq.Chuoi());
    }
Пример #18
0
    void CapNhatTrangThai()
    {
        string strMaDonHang = (string)Request["MaDonHang"];
        int    trangThai    = int.Parse(Request["TrangThai"]);
        int    maDonHang    = int.Parse(strMaDonHang);

        DonHangBUS bus  = new DonHangBUS();
        bool       flag = false;

        DateTime now = DateTime.Now;

        if (trangThai == 0) // Cập nhật đã thanh toán
        {
            flag = bus.CapNhatTrangThaiDaThanhToan(maDonHang, true);
        }
        else if (trangThai == 1) // Cập nhật đã giao hàng (hoàn tất)
        {
            flag = bus.CapNhatTrangThaiDaThanhToan(maDonHang, true) && bus.CapNhatTrangThaiDaGiaoHang(maDonHang, true) &&
                   bus.CapNhatNgayGioGiaoHang(maDonHang, now);
        }

        XL_THE        the       = new XL_THE("goc");
        XL_THUOC_TINH thuoctinh = new XL_THUOC_TINH("kq", flag ? "1" : "0");

        the.Danh_sach_thuoc_tinh.Add(thuoctinh);
        thuoctinh = new XL_THUOC_TINH("NgayGioGiaoHang", now.ToString());
        the.Danh_sach_thuoc_tinh.Add(thuoctinh);

        string chuoi = the.Chuoi();

        XL_CHUOI.XuatChuoi(Response, chuoi);
    }
    private void Hien_thi_cap_nhat()
    {
        if (Session["Ten_cong_ty"].ToString() != "")
        {
            XmlDocument Tai_lieu  = new XmlDocument();
            XmlElement  Quang_cao = null;

            Tai_lieu.Load(Server.MapPath("QUANG_CAO.xml"));
            Quang_cao = Tai_lieu.DocumentElement;

            XL_THE Kq = new XL_THE("THONG_TIN");

            foreach (XmlElement Thong_tin in Quang_cao.ChildNodes)
            {
                if (Thong_tin.GetAttribute("Ten").CompareTo(Session["Ten_cong_ty"]) == 0)
                {
                    XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("Ten_cong_ty", Thong_tin.GetAttribute("Ten"));
                    Kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
                    Thuoc_tinh = new XL_THUOC_TINH("Dia_chi", Thong_tin.GetAttribute("DiaChi"));
                    Kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
                    Thuoc_tinh = new XL_THUOC_TINH("Website", Thong_tin.GetAttribute("Website"));
                    Kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
                    Thuoc_tinh = new XL_THUOC_TINH("Logo", Thong_tin.GetAttribute("Logo"));
                    Kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

                    string website_the_hien = "";

                    XmlDocument Tai_lieu1 = new XmlDocument();
                    XmlElement  website   = null;

                    Tai_lieu1.Load(Server.MapPath("WEBSITE.xml"));
                    website = Tai_lieu1.DocumentElement;
                    String      strExp  = "//WEBSITE//ThongTin/QuangCao[@Ten='" + Thong_tin.GetAttribute("Ten") + "']";
                    XmlNodeList nodeAdv = website.SelectNodes(strExp);
                    int         i       = 0;
                    foreach (XmlNode node in nodeAdv)
                    {
                        XmlNode parent = node.ParentNode;
                        website_the_hien += parent.Attributes["Ten"].Value;
                        if (i < nodeAdv.Count - 1)
                        {
                            website_the_hien += '-';
                        }
                        i++;
                    }

                    Thuoc_tinh = new XL_THUOC_TINH("WebsiteTheHien", website_the_hien);
                    Kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

                    Thuoc_tinh = new XL_THUOC_TINH("Tinh_trang", Thong_tin.GetAttribute("TinhTrang"));
                    Kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

                    break;
                }
            }

            XL_CHUOI.XuatXML(Response, Kq.Chuoi());
        }
    }
    private void Them_quang_cao()
    {
        //them bao quang cao
        XmlDocument Tai_lieu  = new XmlDocument();
        XmlElement  Quang_cao = null;

        Tai_lieu.Load(Server.MapPath("QUANG_CAO.xml"));
        Quang_cao = Tai_lieu.DocumentElement;

        XmlElement Thong_tin = Tai_lieu.CreateElement("ThongTin");

        Thong_tin.SetAttribute("Ten", Request["Ten_quang_cao"]);
        Thong_tin.SetAttribute("DiaChi", Request["Dia_chi"]);
        if (Request["Logo"] != null)
        {
            Thong_tin.SetAttribute("Logo", Request["Logo"]);
        }
        Thong_tin.SetAttribute("Website", Request["Website"]);
        Thong_tin.SetAttribute("TinhTrang", Request["Tinh_trang"]);
        //Thong_tin.SetAttribute("TrangXuatHien", Request["WebsiteTheHien"]);

        Quang_cao.AppendChild(Thong_tin);
        Tai_lieu.Save(Server.MapPath("QUANG_CAO.xml"));

        //them vao tung website
        string website_the_hien = Request["WebsiteTheHien"].ToString();

        string[]    arr       = website_the_hien.Split('-');
        XmlDocument Tai_lieu1 = new XmlDocument();
        XmlElement  website   = null;

        Tai_lieu1.Load(Server.MapPath("WEBSITE.xml"));
        website = Tai_lieu1.DocumentElement;

        for (int i = 0; i < arr.Length; i++)
        {
            foreach (XmlElement Thong_tin1 in website.ChildNodes)
            {
                if (Thong_tin1.GetAttribute("Ten").CompareTo(arr[i]) == 0)
                {
                    XmlElement _quangcao = Tai_lieu1.CreateElement("QuangCao");
                    _quangcao.SetAttribute("Ten", Request["Ten_quang_cao"]);
                    Thong_tin1.AppendChild(_quangcao);
                }
                if (Thong_tin1.ChildNodes.Count >= 4)
                {
                    Thong_tin1.SetAttribute("TinhTrang", "0");
                }
            }
        }

        Tai_lieu1.Save(Server.MapPath("WEBSITE.xml"));

        Session["Ten_quang_cao"] = Request["Ten_quang_cao"];

        XL_THE Kq = new XL_THE("Goc");

        XL_CHUOI.XuatXML(Response, Kq.Chuoi());
    }
Пример #21
0
    private void Lay_ma_thuc_don()
    {
        XL_THE        Kq         = new XL_THE("DANH_SACH");
        XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("Ma_thuc_don", Session["MaThucDon"].ToString());

        Kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
        XL_CHUOI.XuatXML(Response, Kq.Chuoi());
    }
Пример #22
0
    protected void Page_Load(object sender, EventArgs e)
    {
        QUANLY  ql           = (QUANLY)Application["QUANLY"];
        int     luotdi       = ql.LuotDi;
        int     XiNgau       = ql.XiNgau;
        Boolean DangDoXiNgau = ql.DangDoXiNgau;

        int[]         vitri     = ql.BanCo.ViTriCacQuanCo;
        XL_THE        The       = new XL_THE("Goc");
        XL_THE        TheCon    = new XL_THE("LuotDi");
        XL_THUOC_TINH ThuocTinh = new XL_THUOC_TINH("GiaTri", luotdi.ToString());

        // Them luot di vao xml
        TheCon.Danh_sach_thuoc_tinh.Add(ThuocTinh);
        The.Danh_sach_the.Add(TheCon);

        TheCon    = new XL_THE("XiNgau");
        ThuocTinh = new XL_THUOC_TINH("GiaTri", XiNgau.ToString());
        // Them Xi Ngau vao xml
        TheCon.Danh_sach_thuoc_tinh.Add(ThuocTinh);
        The.Danh_sach_the.Add(TheCon);

        TheCon    = new XL_THE("DangDoXiNgau");
        ThuocTinh = new XL_THUOC_TINH("GiaTri", (DangDoXiNgau ? 1 : 0).ToString());
        // Them DangDoXiNgau vao xml
        TheCon.Danh_sach_thuoc_tinh.Add(ThuocTinh);
        The.Danh_sach_the.Add(TheCon);

        int SoNguoiChoi = ql.SoNguoiChoi;
        int SoNguoiXem  = ql.SoNguoiXem;

        TheCon    = new XL_THE("SoNguoiChoi");
        ThuocTinh = new XL_THUOC_TINH("GiaTri", SoNguoiChoi.ToString());
        // Them SoNguoiChoi vao xml
        TheCon.Danh_sach_thuoc_tinh.Add(ThuocTinh);
        The.Danh_sach_the.Add(TheCon);

        TheCon    = new XL_THE("SoNguoiXem");
        ThuocTinh = new XL_THUOC_TINH("GiaTri", SoNguoiXem.ToString());
        // Them SoNguoiXem vao xml
        TheCon.Danh_sach_thuoc_tinh.Add(ThuocTinh);
        The.Danh_sach_the.Add(TheCon);

        // Vi tri cac quan co
        for (int i = 0; i < 16; ++i)
        {
            TheCon    = new XL_THE("Co");
            ThuocTinh = new XL_THUOC_TINH("ViTri", vitri[i].ToString());
            TheCon.Danh_sach_thuoc_tinh.Add(ThuocTinh);
            The.Danh_sach_the.Add(TheCon);
        }
        String Chuoi = The.Chuoi();

        XL_CHUOI.Xuat(Response, Chuoi);
    }
Пример #23
0
    protected void ThemThucDonTuTao()
    {
        //if(Session["User"] == null)
        //    return; //không đc dùng chức năng

        //test : gán
        //Session["User"] = "******";


        String Username = Session["User"].ToString();

        ThucDonCaNhanDTO dto = new ThucDonCaNhanDTO();

        dto.Ten_thuc_don = XL_CHUOI.Nhap(Request, "ten");
        dto.Gia          = decimal.Parse(XL_CHUOI.Nhap(Request, "gia"));
        dto.Hinh_anh     = XL_CHUOI.Nhap(Request, "hinh_anh");

        //lấy mã khách hàng
        if (Session["khachhang"] != null) //đã có thông tin trong session khách hàng
        {
            dto.Ma_khach_hang = ((viewKhachHangDTO)Session["khachhang"]).Ma_nguoi_dung;
        }
        else
        {       //chưa có thông tin -> đọc thông tin về kh từ username
            KhachHangBUS     khBus  = new KhachHangBUS();
            viewKhachHangDTO viewKH = khBus.LayThongTinKhachHang(Username);
            dto.Ma_khach_hang = viewKH.Ma_nguoi_dung;
        }


        String strDsMaMonAn = XL_CHUOI.Nhap(Request, "dsmamonan");

        String[] M = strDsMaMonAn.Split(new String[] { "-" }, StringSplitOptions.RemoveEmptyEntries);

        ThucDonCaNhanBUS bus = new ThucDonCaNhanBUS();
        int Kq = bus.ThemThucDon(dto, M);

        XL_THE        the = new XL_THE("goc");
        XL_THUOC_TINH thuoc_tinh;

        if (Kq != 0)
        {
            thuoc_tinh = new XL_THUOC_TINH("kq", "true");
        }
        else
        {
            thuoc_tinh = new XL_THUOC_TINH("kq", "false");
        }

        the.Danh_sach_thuoc_tinh.Add(thuoc_tinh);
        string chuoi = the.Chuoi();

        XL_CHUOI.XuatChuoi(Response, chuoi);
    }
    protected void LayTiLeGiamGiaThucDon()
    {
        ThamSoBUS bus = new ThamSoBUS();
        ThamSoDTO dto = bus.LayThamSo();

        XL_THE Kq = new XL_THE("THAM_SO");

        Kq.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("TiLeGiam", dto.TiLeGiamGiaThucDon.ToString()));

        XL_CHUOI.XuatChuoi(Response, Kq.Chuoi());
    }
    protected void ThemKhachHang()
    {
        KhachHangDTO khachhangdto = new KhachHangDTO();

        khachhangdto.Ho_ten   = XL_CHUOI.Nhap(Request, "hoten");
        khachhangdto.Username = XL_CHUOI.Nhap(Request, "username");

        khachhangdto.Password = XL_CHUOI.Nhap(Request, "password"); //hex string

        khachhangdto.Email      = XL_CHUOI.Nhap(Request, "email");
        khachhangdto.Dia_chi    = XL_CHUOI.Nhap(Request, "diachi");
        khachhangdto.Dien_thoai = XL_CHUOI.Nhap(Request, "dienthoai");
        khachhangdto.Gioi_tinh  = bool.Parse(XL_CHUOI.Nhap(Request, "gioitinh"));
        khachhangdto.Ngay_sinh  = DateTime.Parse(XL_CHUOI.Nhap(Request, "date").ToString());

        TheThanhToanDTO thedto = new TheThanhToanDTO();

        thedto.Ma_loai_the  = int.Parse(XL_CHUOI.Nhap(Request, "loaithe").ToString());
        thedto.So_the       = XL_CHUOI.Nhap(Request, "mathe");
        thedto.Ngay_het_han = DateTime.Parse(XL_CHUOI.Nhap(Request, "dateHH").ToString());

        int           manguoidung = 0;
        XL_THE        the         = new XL_THE("goc");
        XL_THUOC_TINH thuoctinh   = new XL_THUOC_TINH("Kq", "false");

        try
        {
            KhachHangBUS khachhangBUS = new KhachHangBUS();
            manguoidung = khachhangBUS.ThemKhachHang(khachhangdto, thedto);

            if (manguoidung != 0)
            {
                thuoctinh = new XL_THUOC_TINH("kq", "true");
            }
            else
            {
                thuoctinh = new XL_THUOC_TINH("kq", "error");
            }
        }
        catch (SqlException ex)
        {
            if (ex.Number == 2627)
            {
                thuoctinh = new XL_THUOC_TINH("kq", "false");
            }
        }

        the.Danh_sach_thuoc_tinh.Add(thuoctinh);
        string chuoi = the.Chuoi();

        XL_CHUOI.XuatChuoi(Response, chuoi);
    }
    protected void Tinh_tien_khuyen_mai()
    {
        int     diem = int.Parse(Request["DiemKhuyenMai"].ToString());
        decimal tien = (new DonHangBUS()).TinhTienKhuyenMai(diem);

        XL_THE        the       = new XL_THE("goc");
        XL_THUOC_TINH thuoctinh = new XL_THUOC_TINH("Kq", tien.ToString());

        the.Danh_sach_thuoc_tinh.Add(thuoctinh);
        string chuoi = the.Chuoi();

        XL_CHUOI.XuatChuoi(Response, chuoi);
    }
    protected void ChiTietLoaiMon()
    {
        LoaiMonBUS loaimonBUS = new LoaiMonBUS();
        LoaiMonDTO LoaiMonAn  = loaimonBUS.ChiTietLoaiMon(int.Parse(Request["MaLoaiMon"].ToString()));

        XL_THE Kq1 = new XL_THE("Loai_Mon_An");

        Kq1.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("MaLoaiMon", LoaiMonAn.Ma_loai_mon.ToString()));
        Kq1.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("TenLoaiMon", LoaiMonAn.Ten_loai_mon));
        Kq1.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("MaLoaiMonCha", LoaiMonAn.Ma_loai_mon_cha.ToString()));
        Kq1.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("LaLoaiMonLa", LoaiMonAn.La_loai_mon_la.ToString()));

        XL_CHUOI.XuatXML(Response, Kq1.Chuoi());
    }
    protected void Tinh_tien_thue()
    {
        Gio_hang_online gio_hang  = (Gio_hang_online)Session["Gio_hang"];
        decimal         giatri    = gio_hang.gia_tri;
        decimal         a         = (new DonHangBUS()).TinhTienThue(giatri);
        double          tienthue  = double.Parse(a.ToString());
        XL_THE          the       = new XL_THE("goc");
        XL_THUOC_TINH   thuoctinh = new XL_THUOC_TINH("Kq", tienthue.ToString());

        the.Danh_sach_thuoc_tinh.Add(thuoctinh);
        string chuoi = the.Chuoi();

        XL_CHUOI.XuatChuoi(Response, chuoi);
    }
Пример #29
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["LoaiNguoiDung"] != "KhachHang")
        {
            Response.Redirect("ErrorPage.aspx");
            return;
        }
        // Xử lý request
        int        maKhachHang = (int)Session["MaNguoiDung"];
        DonHangBUS bus         = new DonHangBUS();

        XL_THE Kq = new XL_THE("DANH_SACH");

        int     soLuongDonHang;
        decimal tongTriGia;

        string[] dienGiai = new string[]
        { "Đơn hàng khách hàng đã lưu",
          "Đơn hàng đã đặt hàng nhưng chưa thanh toán",
          "Đơn hàng đã thanh toán nhưng chưa giao hàng",
          "Đơn hàng đã hoàn tất",
          "Đơn hàng trong ngày (đã đặt hàng)",
          "Đơn hàng định kỳ" };
        ThongTinDonHang[] arrFunction = new ThongTinDonHang[]
        { bus.ThongTinDonHangDaLuu, bus.ThongTinDonHangDaDatChuaThanhToan,
          bus.ThongTinDonHangDaThanhToanChuaGiao, bus.ThongTinDonHangDaHoanTat,
          bus.ThongTinDonHangTrongNgay, bus.ThongTinDonHangDinhKy };

        for (int i = 1; i <= 6; i++)
        {
            XL_THE the = new XL_THE("GiaoDich");
            arrFunction[i - 1](maKhachHang, out soLuongDonHang, out tongTriGia);

            XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("MaLoai", i.ToString());
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Thuoc_tinh = new XL_THUOC_TINH("DienGiai", dienGiai[i - 1]);
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Thuoc_tinh = new XL_THUOC_TINH("SoLuongDonHang", soLuongDonHang.ToString());
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Thuoc_tinh = new XL_THUOC_TINH("TongTriGia", tongTriGia.ToString());
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Kq.Danh_sach_the.Add(the);
        }

        XL_CHUOI.XuatXML(Response, Kq.Chuoi());
    }
    private void CapNhatThongTinTheTinDung()
    {
        viewKhachHangDTO vkhDto = (viewKhachHangDTO)Session["khachhang"];

        TheThanhToanDTO tttDto = new TheThanhToanDTO();

        tttDto.Ma_the = vkhDto.Ma_the;

        //Lấy tham số client truyền xuống
        tttDto.Ma_loai_the = int.Parse(XL_CHUOI.Nhap(Request, "maloaithe"));
        //tttDto.So_the = XL_CHUOI.Nhap(Request, "sothe").ToCharArray();
        tttDto.So_the       = XL_CHUOI.Nhap(Request, "sothe").ToString();
        tttDto.Ngay_het_han = DateTime.Parse(Request["ngayhh"].ToString());

        //Cập nhật neu co thay doi
        bool kq = true;

        if (tttDto.Ma_loai_the != vkhDto.Ma_loai_the || tttDto.So_the != vkhDto.So_the || tttDto.Ngay_het_han != vkhDto.Ngay_het_han)
        {
            kq = (new TheThanhToanBUS()).CapNhatTheThanhToan(tttDto);
        }

        XL_THE        the = new XL_THE("goc");
        XL_THUOC_TINH thuoc_tinh;

        if (kq == true)
        {
            //Lưu lại biến trong session
            vkhDto.Ma_loai_the = tttDto.Ma_loai_the;
            //vkhDto.Ten_loai_the = (new LoaiTheBUS()).Lay_Ten_Loai_The(tttDto.Ma_loai_the);
            vkhDto.Ten_loai_the = Request["tenloaithe"].ToString();
            vkhDto.So_the       = tttDto.So_the;
            vkhDto.Ngay_het_han = tttDto.Ngay_het_han;

            Session["khachhang"] = vkhDto;

            thuoc_tinh = new XL_THUOC_TINH("kq", "True");
        }
        else
        {
            thuoc_tinh = new XL_THUOC_TINH("kq", "False");
        }

        //Trả kết quả về client
        the.Danh_sach_thuoc_tinh.Add(thuoc_tinh);
        string chuoi = the.Chuoi();

        XL_CHUOI.XuatChuoi(Response, chuoi);
    }