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);
    }
Esempio n. 2
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());
    }
    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);
    }
    public static void Main()
    {
        String Ho_ten;
        String Loi_chao;

        Ho_ten   = XL_CHUOI.Nhap("Ho va ten:");
        Loi_chao = "Xin chao" + Ho_ten + "\n";
        Loi_chao = Loi_chao + "Cam on vi da su dung chuong trinh nay";
        XL_CHUOI.Xuat(Loi_chao);
    }
Esempio n. 5
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);
    }
    private static Double Nhap_cuc_bo(String Ghi_chu)
    {
        Double kq;
        String Chuoi;

        do
        {
            Chuoi = XL_CHUOI.Nhap(Ghi_chu);
        } while (!Kiem_tra(Chuoi));
        kq = Double.Parse(Chuoi);
        return(kq);
    }
    public static long Nhap(String Ghi_chu)
    {
        long   kq;
        String Chuoi;

        do
        {
            Chuoi = XL_CHUOI.Nhap(Ghi_chu);
        } while (!Kiem_tra(Chuoi));
        kq = long.Parse(Chuoi);
        return(kq);
    }
    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);
    }
    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);
    }
    public static ArrayList Nhap(String Ghi_chu)
    {
        ArrayList kq = new ArrayList();
        String    Chuoi;

        do
        {
            Chuoi = XL_CHUOI.Nhap(Ghi_chu);
        } while (!Kiem_tra(Chuoi));
        String[] M = Chuoi.Split(new char[] { Ky_tu_phan_cach });
        for (int i = 0; i < M.Length; i++)
        {
            kq.Add(XL_PHAN_SO.Tao(M[i]));
        }
        return(kq);
    }
    public void TaoTaiKhoan()
    {
        NguoiDungDTO nguoidung = new NguoiDungDTO();

        nguoidung.Ma_loai_nguoi_dung = int.Parse(XL_CHUOI.Nhap(Request, "loai"));
        nguoidung.Ho_ten             = XL_CHUOI.Nhap(Request, "hoten");
        nguoidung.Username           = XL_CHUOI.Nhap(Request, "username");
        nguoidung.Password           = XL_CHUOI.Nhap(Request, "password");

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

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

        try
        {
            //oFFS_BUS_WS.WebService service = new oFFS_BUS_WS.WebService();
            NguoiDungBUS nguoidungBUS = new NguoiDungBUS();
            manguoidung = nguoidungBUS.ThemNguoiDung(nguoidung);

            if (manguoidung != 0)
            {
                thuoctinh = new XL_THUOC_TINH("kq", "true");
            }
            else
            {
                thuoctinh = new XL_THUOC_TINH("kq", "false");
            }
        }
        catch
        {
            thuoctinh = new XL_THUOC_TINH("kq", "false");
        }

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

        XL_CHUOI.XuatChuoi(Response, chuoi);
    }
    private void NVCapNhatThongTinCaNhan()
    {
        NguoiDungDTO vkhDto     = (NguoiDungDTO)Session["nguoidung"];
        NguoiDungDTO vkhDto_new = new NguoiDungDTO(vkhDto);

        //Lấy tham số client truyền xuống
        vkhDto_new.Ho_ten    = XL_CHUOI.Nhap(Request, "hoten");
        vkhDto_new.Ngay_sinh = DateTime.Parse(Request["ngaysinh"]);

        vkhDto_new.Gioi_tinh  = bool.Parse((XL_CHUOI.Nhap(Request, "gioitinh")));
        vkhDto_new.Dia_chi    = XL_CHUOI.Nhap(Request, "diachi");
        vkhDto_new.Dien_thoai = XL_CHUOI.Nhap(Request, "dienthoai");
        vkhDto_new.Email      = XL_CHUOI.Nhap(Request, "email");

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

        if (vkhDto_new.Ho_ten != vkhDto.Ho_ten || vkhDto_new.Ngay_sinh != vkhDto.Ngay_sinh || vkhDto_new.Gioi_tinh != vkhDto.Gioi_tinh || vkhDto_new.Dia_chi != vkhDto.Dia_chi || vkhDto_new.Dien_thoai != vkhDto.Dien_thoai || vkhDto_new.Email != vkhDto.Email)
        {
            NguoiDungBUS ndBus = new NguoiDungBUS();
            kq = ndBus.CapNhatThongTinNguoiDung(vkhDto_new);
        }

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

        //Cập nhật thành công
        if (kq == true)
        {
            Session["nguoidung"] = vkhDto_new;

            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);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        int    SoCauDaChat = (int)Application["SoCauDaChat"];
        String NoiDung;

        NoiDung = XL_CHUOI.Nhap(Request, "NoiDung");

        if (NoiDung != null)
        {
            String HoTen   = (String)Session["HoTen"];
            int    SoNguoi = (int)Application["SoNguoiDung"];
            Application.Lock();
            ArrayList   lst = (ArrayList)Application["DanhSachNoiDung"];
            NoiDungChat nd  = new NoiDungChat(NoiDung, HoTen, SoNguoi);
            lst.Add(nd);
            SoCauDaChat++;
            Application["SoCauDaChat"] = SoCauDaChat;
            Application.UnLock();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        int ConCo;
        int ViTri;

        try
        {
            ConCo = int.Parse(XL_CHUOI.Nhap(Request, "ConCo"));
            ViTri = int.Parse(XL_CHUOI.Nhap(Request, "ViTri"));

            QUANLY ql = (QUANLY)Application["QUANLY"];
            Application.Lock();
            ql.BanCo.ViTriCacQuanCo[ConCo] = ViTri;
            ql.XiNgau       = -1;
            ql.DangDoXiNgau = false;
            Application.UnLock();
        }
        catch (Exception _e)
        {
        }
    }
Esempio n. 15
0
    public static void Main()
    {
        String   Ho_ten;
        DateTime Ngay_sinh;
        int      Tuoi;

        Ho_ten = XL_CHUOI.Nhap("Ho va ten:");
        DateTime Ngay_toi_thieu = XL_NGAY.Ngay_sinh(1, 1, 20);
        DateTime Ngay_toi_da    = XL_NGAY.Ngay_sinh(31, 12, 15);

        Ngay_sinh = XL_NGAY.Nhap("Ngay sinh:", Ngay_toi_thieu, Ngay_toi_da);
        int Nam_hien_hanh = DateTime.Today.Year;
        int Nam_sinh      = Ngay_sinh.Year;

        Tuoi = Nam_hien_hanh - Nam_sinh;
        String Chuoi;

        Chuoi = "Hoc sinh " + Ho_ten;
        Chuoi = Chuoi + " sinh ngay " + Ngay_sinh;
        Chuoi = Chuoi + " co tuoi la " + Tuoi;
        XL_CHUOI.Xuat(Chuoi);
    }
Esempio n. 16
0
    public static TOAN_TU Nhap(String Ghi_chu)
    {
        TOAN_TU kq = TOAN_TU.Tru;
        String  Chuoi;

        do
        {
            Chuoi = XL_CHUOI.Nhap(Ghi_chu);
        } while (!Kiem_tra(Chuoi));
        char c = char.Parse(Chuoi);

        if (c == '+')
        {
            kq = TOAN_TU.Cong;
        }
        else
        if (c == '-')
        {
            kq = TOAN_TU.Tru;
        }
        return(kq);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        int    SoCauDaChat = (int)Application["SoCauDaChat"];
        String NoiDung;

        NoiDung = XL_CHUOI.Nhap(Request, "NoiDung");

        if (NoiDung != null)
        {
            QUANLY ql           = (QUANLY)Application["QUANLY"];
            int    nguoichoithu = int.Parse(Session["NguoiChoiThu"].ToString());
            String HoTen        = (String)ql.arrNguoiChoi[nguoichoithu].Username;
            int    SoNguoi      = ql.SoNguoiChoi + ql.SoNguoiXem;
            Application.Lock();
            ArrayList   lst = (ArrayList)Application["DanhSachNoiDung"];
            NoiDungChat nd  = new NoiDungChat(NoiDung, HoTen, SoNguoi);
            lst.Add(nd);
            SoCauDaChat++;
            Application["SoCauDaChat"] = SoCauDaChat;
            Application.UnLock();
        }
    }
Esempio n. 18
0
    protected void ThemThucDon()
    {
        ThucDonDTO dto = new ThucDonDTO();

        dto.Ten_thuc_don      = XL_CHUOI.Nhap(Request, "ten");
        dto.Ma_loai_thuc_don  = int.Parse(XL_CHUOI.Nhap(Request, "maloai"));
        dto.Mo_ta             = XL_CHUOI.Nhap(Request, "mota");
        dto.Hinh_anh_minh_hoa = XL_CHUOI.Nhap(Request, "hinhanh");
        dto.Gia                 = decimal.Parse(XL_CHUOI.Nhap(Request, "gia"));
        dto.Tinh_trang          = bool.Parse(XL_CHUOI.Nhap(Request, "tinhtrang"));
        dto.Trang_thai_hien_thi = bool.Parse(XL_CHUOI.Nhap(Request, "hienthi"));

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

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

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

        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);
    }
    private void CapNhatThongTinMatKhau()
    {
        viewKhachHangDTO vkhDto = (viewKhachHangDTO)Session["khachhang"];

        //Lấy tham số client truyền xuống
        string mkcu  = XL_CHUOI.Nhap(Request, "mkcu");
        string mkmoi = XL_CHUOI.Nhap(Request, "mkmoi");

        XL_THE the = new XL_THE("goc");

        if (mkcu != vkhDto.Password)
        {
            the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("kq", "False"));
            XL_CHUOI.XuatChuoi(Response, the.Chuoi());
            return;
        }

        //Cập nhật
        int Ma_nguoi_dung = vkhDto.Ma_nguoi_dung;

        NguoiDungBUS ndBus = new NguoiDungBUS();
        bool         kq    = ndBus.CapNhatThongTinMatKhau(mkmoi, Ma_nguoi_dung);

        if (kq == true)
        {
            vkhDto.Password      = mkmoi;
            Session["khachhang"] = vkhDto;   //Lưu thông tin cho biến trong session
            the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("kq", "True"));
        }
        else
        {
            the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("kq", "False"));
        }

        XL_CHUOI.XuatChuoi(Response, the.Chuoi());
    }
Esempio n. 20
0
    protected void ThemMonMoi()
    {
        MonAnDTO monanDTO = new MonAnDTO();

        monanDTO.Ten_mon           = XL_CHUOI.Nhap(Request, "tenmon");
        monanDTO.Ma_loai_mon       = int.Parse(XL_CHUOI.Nhap(Request, "loaimon"));
        monanDTO.Hinh_anh_minh_hoa = XL_CHUOI.Nhap(Request, "hinhanh");
        monanDTO.Mo_ta             = XL_CHUOI.Nhap(Request, "mota");
        monanDTO.Gia         = Decimal.Parse(XL_CHUOI.Nhap(Request, "gia"));
        monanDTO.Don_vi_tinh = XL_CHUOI.Nhap(Request, "donvitinh");
        String strTag = XL_CHUOI.Nhap(Request, "tag");

        monanDTO.Diem_binh_chon      = 0;
        monanDTO.Tinh_trang          = bool.Parse(XL_CHUOI.Nhap(Request, "tinhtrang"));
        monanDTO.Trang_thai_hien_thi = bool.Parse(XL_CHUOI.Nhap(Request, "hienthi"));

        MonAnBUS monanBUS = new MonAnBUS();
        int      Kq       = monanBUS.ThemMonAn(monanDTO, strTag);

        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);
    }