Example #1
0
    private void GuiMail()
    {
        string Username = (string)Request["Username"];
        string subject  = (string)Request["subject"];
        string body     = (string)Request["msgpost"];

        NguoiDungBUS ndBus = new NguoiDungBUS();
        NguoiDungDTO dto   = ndBus.LayThongTinNguoiDung(Username);

        bool            flag   = Utilities.SendMail("*****@*****.**", dto.Email, subject, body) == "";
        NoiDungEmailDTO ndedto = new NoiDungEmailDTO();
        NoiDungEmailBUS bus    = new NoiDungEmailBUS();

        ndedto.TieuDe   = subject;
        ndedto.NoiDung  = body;
        ndedto.Email    = dto.Email;
        ndedto.NgayGui  = DateTime.Now;
        ndedto.Username = Username;

        bool kq = bus.ThemNoiDungEmail(ndedto);

//         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);
//         string chuoi = the.Chuoi();
        string str = flag && kq ? "Gửi mail thành công" : "Không thực hiện được do lỗi server";

        Response.Write("<script type=\"text/javascript\"> alert('" + str + "'); </script>");
    }
Example #2
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);
    }
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            nd.TaiKhoan = txtTaiKhoan.Text;
            nd.MatKhau  = txtMatKhau.Text;
            DataTable dt = ndbus.LayThongTinNguoiDung(nd);

            if (dt.Rows.Count > 0)
            {
                frmMain main = new frmMain();
                main.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Đăng nhập thất bại");
            }
        }
Example #4
0
    private void GuiMail()
    {
        string Username = (string)Request["Username"];
        string subject  = (string)Request["subject"];
        string body     = (string)Request["body"];

        NguoiDungBUS ndBus = new NguoiDungBUS();
        NguoiDungDTO dto   = ndBus.LayThongTinNguoiDung(Username);

        //bool flag = Utilities.SendMail("*****@*****.**", dto.Email, subject, body) == "";
        bool          flag      = true;
        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);
        string chuoi = the.Chuoi();

        XL_CHUOI.XuatChuoi(Response, chuoi);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["LoaiNguoiDung"] != "QuanLy" && Session["LoaiNguoiDung"] != "NhanVien")
        {
            Response.Redirect("ErrorPage.aspx");
            return;
        }

        string username = (string)Session["User"];

        //Nếu khách hàng mới đăng nhập -> kết nối csdl lấy đầy đủ thông tin
        //Nếu không -> hiển thị thông tin hiện có trong session
        NguoiDungDTO ndDto = (NguoiDungDTO)Session["nguoidung"];

        if (ndDto == null)
        {
            NguoiDungBUS ndBus = new NguoiDungBUS();
            ndDto = ndBus.LayThongTinNguoiDung(username);
            Session["nguoidung"] = ndDto;
        }

        Hien_Thi_Thong_Tin_Ca_Nhan();
    }