protected void ButtonDoi_Click(object sender, EventArgs e)
        {
            String    sql   = string.Format("Select * from NguoiDung where TaiKhoan ='{0}'", Session["ten"]);
            DataTable table = DungChung.XemQuery(sql);
            string    sqlmatkhau;
            String    matkhaucu = table.Rows[0]["matkhau"].ToString();

            if (TextBoxCu.Text != null && TextBoxMoi.Text != null && TextBoxNhapLai.Text != null)
            {
                if (TextBoxCu.Text == matkhaucu)
                {
                    if (TextBoxMoi.Text == TextBoxNhapLai.Text)
                    {
                        sqlmatkhau = String.Format("Update NguoiDung Set MatKhau = '{0}' where TaiKhoan = '{1}'", TextBoxMoi.Text, Session["ten"].ToString());
                        DungChung.ThemSuaXoaQuery(sqlmatkhau);
                        LabelBaoLoi.Visible = false;
                        Response.Write("<script>alert('Đổi thành công')</script>");
                    }
                    else
                    {
                        LabelBaoLoi.Text = "Mật khẩu mới và nhập lại mật khẩu không khớp";
                    }
                }
                else
                {
                    LabelBaoLoi.Text = "Mật khẩu cũ không đúng";
                }
            }
        }
Beispiel #2
0
        protected void ButtonDoi_Click(object sender, EventArgs e)
        {
            String sql = String.Format("Update NguoiDung set TenNguoiDung = '{0}', Email = '{1}', DiaChi = '{2}' Where TaiKhoan = '{3}'", TextBoxTen.Text, TextBoxEmail.Text, TextBoxDiaChi.Text, Session["ten"].ToString());

            DungChung.ThemSuaXoaQuery(sql);
            Response.Write("<script>alert('Đổi thành công')</script>");
        }
Beispiel #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         if (System.Web.HttpContext.Current.Session["ten"] == null)
         {
             Response.Redirect("DangNhap.aspx");
         }
         String    sql = String.Format("Select * from NguoiDung where TaiKhoan ='{0}'", Session["ten"].ToString());
         DataTable tbl = DungChung.XemQuery(sql);
         TextBoxTen.Text    = tbl.Rows[0]["TenNguoiDung"].ToString();
         TextBoxEmail.Text  = tbl.Rows[0]["Email"].ToString();
         TextBoxDiaChi.Text = tbl.Rows[0]["DiaChi"].ToString();
     }
 }
Beispiel #4
0
        protected void ButtonDangNhap_Click(object sender, EventArgs e)
        {
            String    sql = String.Format("Select * from NguoiDung where TaiKhoan = '{0}' and MatKhau = '{1}'", TXTTenDangNhap.Text, TXTPassword.Text);
            DataTable tbl = DungChung.XemQuery(sql);

            if (tbl.Rows.Count > 0)
            {
                Session["Ten"] = TXTTenDangNhap.Text;
                Response.Redirect("TrangChu.aspx");
            }
            else
            {
                LabelStatus.Text = "Sai tài khoản hoặc mật khẩu!";
            }
        }
Beispiel #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(Request.QueryString["sql"]))
     {
         String    sql = Request.QueryString["sql"].ToString();
         DataTable tbl = DungChung.XemQuery(sql);
         GridViewHoaDon.DataSource = tbl;
         GridViewHoaDon.DataBind();
         //xuat docx
         Response.ClearContent();
         Response.AppendHeader("content-disposition", "attachment; filename=Khach_Hang.doc");
         Response.ContentType = "application/word";
         StringWriter   stringWriter = new StringWriter();
         HtmlTextWriter htw          = new HtmlTextWriter(stringWriter);
         GridViewHoaDon.RenderControl(htw);
         Response.Write(stringWriter.ToString());
         Response.End();
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (System.Web.HttpContext.Current.Session["ten"] == null)
            {
                Response.Redirect("DangNhap.aspx");
            }
            String sql = "Select * from KhachHang";

            table = DungChung.XemQuery(sql);
            GridViewKhachHang.DataSource = table;
            GridViewKhachHang.DataBind();
            String    doublequote = "\"'',''\"";
            String    sqlincome   = @"SELECT Sum(HoaDon.TongSoTien) AS SumOfTongSoTien, Format([NgayDi],'mm" + doublequote + @"yyyy') AS thoigian
                                FROM DatPhong INNER JOIN HoaDon ON DatPhong.ID = HoaDon.IDDatPhong
                                GROUP BY Format([NgayDi],'mm" + doublequote + @"yyyy');";
            DataTable tableincome = DungChung.XemQuery(sqlincome);

            Chart1.DataSource = tableincome;
            Chart1.DataBind();
        }