Ejemplo n.º 1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (Session["TenDN"] == null)
            {
                lbThongBao.Text = "Vui lòng đăng nhập trước khi bình luận!!!";
            }
            else
            {
                string nd = HttpUtility.HtmlEncode(Request.Form["tbND"]);
                if (nd == "")
                {
                    lbThongBao.Text = "Chưa nhập nội dung!!!";
                }
                else
                {
                    string    tendn = Session["TenDN"].ToString();
                    string    sql   = "SELECT [MaTK], [TenDN] FROM [TaiKhoan] where TenDN=N'" + tendn + "'";
                    DataTable dt    = XLDL.GetData(sql);
                    string    matk  = dt.Rows[0]["MaTK"].ToString();

                    string mablog = Request.QueryString["MaSP"].ToString();


                    DateTime dateTime = DateTime.Now;
                    string   ngay     = dateTime.ToString("dd/MM/yyyy HH:mm:ss");
                    string   sql1     = "Insert into BinhLuanSP values (" + mablog + "," + matk + ",'" + ngay + "',N'" + nd + "')";
                    XLDL.Excute(sql1);
                    Response.Redirect("~/ChiTietSanPham.aspx?MaSP=" + mablog);
                }
            }
        }
Ejemplo n.º 2
0
        protected void btnLuu_Click(object sender, EventArgs e)
        {
            try

            {
                string MaBlog = Session["MaTK"].ToString();

                string mkc = tbMK.Text;
                string mkm = tbMKM.Text;
                string str = @"Select Matkhau from taikhoan where matk=" + MaBlog;
                if (XLDL.GetData(str).Rows[0]["MatKhau"].ToString() == mkc)
                {
                    string sql = "update TaiKhoan set matkhau='" + mkm + "' where MaTK=" + MaBlog;
                    XLDL.Excute(sql);

                    Response.Redirect("DoiMatKhau.Aspx");
                }
                else
                {
                    lbThongBao.Text = "Mật khẩu cũ không chính xác.";
                }
            }
            catch
            {
                Response.Redirect("Default.aspx");
            }
        }
Ejemplo n.º 3
0
        protected void btnLuu_Click(object sender, EventArgs e)
        {
            string   mblog       = Request.QueryString["MaBlog"].ToString();
            DateTime datetime    = DateTime.Now;
            string   ngaycapnhat = datetime.ToString("MM/dd/yyyy");

            string tieude   = tbTieuDe.Text;
            string nd       = tbND.Text;
            string ngdang   = tbNguoiDang.Text;
            int    slx      = int.Parse(tbSoLanXem.Text);
            string savePath = MapPath("~/Anh/Blog/");

            if (FileUpload1.HasFile)
            {
                savePath += FileUpload1.FileName;

                FileUpload1.SaveAs(savePath);


                lbThongBao.Text = "Upload ảnh thành công.";
            }
            else
            {
                lbThongBao.Text = "Ảnh chưa được upload.";
            }
            string ha = FileUpload1.FileName;

            string tbnd = tbTTND.Text;
            string sql  = "update Blog set hinhanh=N'" + ha + "',Tieude=N'" + tieude + "',TTND=N'" + tbnd + "',NoiDung=N'" + nd + "',SoLanXem=" + slx + ",NgayDang='" + ngaycapnhat + "',NguoiDang=N'" + ngdang + "' where MaBlog=" + mblog;

            XLDL.Excute(sql);

            Response.Redirect("DanhSachBlog.Aspx");
        }
Ejemplo n.º 4
0
        protected void btnLuu_Click(object sender, EventArgs e)
        {
            try

            {
                string MaBlog = Request.QueryString["Ma"].ToString();
                string tendn  = tbDN.Text;
                string tentk  = tbTenKH.Text;
                string dc     = tbDiaChi.Text;
                string sdt    = tbSDT.Text;
                string email  = tbEmail.Text;
                string mk     = tbMK.Text;



                string sql = "update TaiKhoan set tendn='" + tendn + "',tentk=N'" + tentk + "',DiaChi=N'" + dc + "',sdt='" + sdt + "',email='" + email + "',matkhau='" + mk + "' where MaTK=" + MaBlog;
                XLDL.Excute(sql);

                Response.Redirect("QuanTriTaiKhoan.Aspx");
            }
            catch
            {
                Response.Redirect("QuanTriTaiKhoan.Aspx");
            }
        }
Ejemplo n.º 5
0
 protected void btnDN_Click(object sender, EventArgs e)
 {
     try
     {
         string ktr = @"select 1 from taikhoan where tendn=N'" + tbTK.Text + "'";
         if (XLDL.GetData(ktr).Rows.Count > 0)
         {
             lbThongBao.Text = "Tên tài khoản đã tồn tại!!!";
             tbTK.Focus();
         }
         else
         {
             string tentk = tbTenTK.Text;
             string email = tbEmail.Text;
             string dc    = tbDiaChi.Text;
             string sdt   = tbSDT.Text;
             string tendn = tbTK.Text;
             string mk    = tbMK.Text;
             string sql   = "insert into Taikhoan  values (N'" + tentk + "','" + email + "',N'" + dc + "','" + sdt + "','" + tendn + "','" + mk + "',2)";
             XLDL.Excute(sql);
             Response.Redirect("DangNhap.aspx");
         }
     }
     catch
     {
         lbThongBao.Text = "Thất bại";
     }
 }
Ejemplo n.º 6
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (tbTenNgBL.Text == "" || tbNoiDung.Text == "")
     {
         lbThongBao.Text = "Bạn chưa nhập tên hoặc nội dung!!!";
     }
     else
     {
         string   mablog   = Request.QueryString["MaBlog"].ToString();
         string   ten      = tbTenNgBL.Text;
         string   nd       = tbNoiDung.Text;
         DateTime dateTime = DateTime.Now;
         string   ngay     = dateTime.ToString("dd/MM/yyyy HH:mm:ss");
         string   sql1     = "Insert into BinhLuanBLog values (" + mablog + ",N'" + ten + "','" + ngay + "',N'" + nd + "')";
         XLDL.Excute(sql1);
         Response.Redirect("ChiTietTinTuc.aspx?MaBlog=" + mablog);
     }
 }
Ejemplo n.º 7
0
        protected void btnLuu_Click(object sender, EventArgs e)
        {
            string MaBlog = Request.QueryString["MaDH"].ToString();
            string ngay   = DateTime.Now.ToString("MM/dd/yyyy");

            string ten  = tbTenKH.Text;
            string dc   = tbDiaChi.Text;
            string sdt  = tbSDT.Text;
            string pttt = tbPTTT.Text;
            int    tt   = int.Parse(tbThanhTien.Text);



            string sql = "update DonHang set NgayLapDH='" + ngay + "',TenKH=N'" + ten + "',DiaChi=N'" + dc + "',SDT='" + sdt + "',PTTT=N'" + pttt + "',ThanhTien=" + tt + " where MaDH=" + MaBlog;

            XLDL.Excute(sql);

            Response.Redirect("DonHang.Aspx");
        }
Ejemplo n.º 8
0
        protected void btnLuu_Click(object sender, EventArgs e)
        {
            try
            {
                string   mblog       = Request.QueryString["MaBlog"].ToString();
                DateTime datetime    = DateTime.Now;
                string   ngaycapnhat = datetime.ToString("MM/dd/yyyy hh:mm:ss");

                string tieude = tbTieuDe.Text;
                string nd     = HttpUtility.HtmlEncode(Request.Form["tbND"]);


                string ngdang   = tbNguoiDang.Text;
                int    slx      = int.Parse(tbSoLanXem.Text);
                string savePath = MapPath("~/Anh/Blog/");
                if (FileUpload1.HasFile)
                {
                    savePath += FileUpload1.FileName;

                    FileUpload1.SaveAs(savePath);


                    lbThongBao.Text = "Upload ảnh thành công.";
                }
                else
                {
                    lbThongBao.Text = "Ảnh chưa được upload.";
                }
                string ha = FileUpload1.FileName;

                string tbnd = tbTTND.Text;

                string matk = Session["MaTK"].ToString();
                string sql  = "update Blog set hinhanh=N'" + ha + "',Tieude=N'" + tieude + "',TTND=N'" + tbnd + "',NoiDung=N'" + nd + "',SoLanXem=" + slx + ",NgayDang='" + ngaycapnhat + "',MaTK=" + matk + " where MaBlog=" + mblog;
                XLDL.Excute(sql);

                Response.Redirect("Quanlibaiviet.Aspx");
            }
            catch
            {
                Response.Write("<script>alert('Sửa Thất Bại !!!');</script>");
            }
        }
Ejemplo n.º 9
0
        protected void btnCapNhat_Click(object sender, EventArgs e)
        {
            string   malsp       = rdlMaLoaiSP.SelectedValue.ToString();
            string   msp         = Request.QueryString["Ma"].ToString();
            DateTime datetime    = DateTime.Now;
            string   ngaycapnhat = datetime.ToShortDateString();
            int      slb         = int.Parse(tbSoLuongBan.Text);
            int      slx         = int.Parse(tbSoLanXem.Text);
            string   tensp       = tbTenSP.Text;
            string   ncc         = tbNCC.Text;
            int      sl          = int.Parse(tbSoLuong.Text);
            string   mt          = tbMoTa.Text;
            int      dg          = int.Parse(tbDonGia.Text);
            string   sql         = "update SanPham set MaLoaiSP=" + malsp + ",TenSP=N'" + tensp + "',SoLuongSP=" + sl + ",NhaCC=N'" + ncc + "',TienSP=" + dg + ",NgayCapNhat='" + ngaycapnhat + "',SoLuongBan=" + slb + ",SoLanXem=" + slx + ",Mota=N'" + mt + "' where MaSP=" + msp;

            XLDL.Excute(sql);

            Response.Redirect("QuanTri.Aspx");
        }
Ejemplo n.º 10
0
        protected void gvBlog_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Xoa")
            {
                try
                {
                    int chiso = int.Parse(e.CommandArgument.ToString());

                    string ma = gvBlog.Rows[chiso].Cells[0].Text;

                    string str = "Delete from BLog where MaBlog=" + ma;

                    XLDL.Excute(str);
                    Response.Write("<script>alert('Xóa Thành Công!!!');</script>");
                    Response.Redirect("DanhSachBlog.aspx");
                }
                catch
                {
                    Response.Write("<script>alert('Xóa Thất Bại!!!');</script>");
                }
            }
        }
Ejemplo n.º 11
0
        protected void btnLuu_Click(object sender, EventArgs e)
        {
            string TenSP  = tbTenSP.Text;
            string LoaiSP = rdLSP.SelectedValue.ToString();
            int    TienSP = int.Parse(tbDonGia.Text);
            string NCC    = HttpUtility.HtmlEncode(tbNCC.Text);

            string    mota      = HttpUtility.HtmlEncode(Request.Form["tbND"]);
            DataTable dt1       = XLDL.GetData("Select TenLoaiSP from LOAISANPHAM where MaLoaiSP=" + LoaiSP);
            string    tenthumuc = dt1.Rows[0]["TenLoaiSP"].ToString();
            string    savePath  = MapPath("~/Anh/CayCanh/" + tenthumuc + "/");

            if (FileUpload1.HasFile)
            {
                savePath += FileUpload1.FileName;

                FileUpload1.SaveAs(savePath);


                lbThongBao.Text = "Upload ảnh thành công.";
            }
            else
            {
                lbThongBao.Text = "Ảnh chưa được upload.";
            }
            string ha      = FileUpload1.FileName;
            string HinhAnh = FileUpload1.FileName;


            DateTime datetime = DateTime.Now;
            string   Ngay     = datetime.ToString("MM/dd/yyyy");
            int      SL       = int.Parse(tbSoLuong.Text);
            int      SLX      = 0;
            string   str      = "insert into SanPham values (" + LoaiSP + ",N'" + TenSP + "'," + SL + ",'" + HinhAnh + "',N'" + NCC + "'," + TienSP + ",'" + Ngay + "',1," + SLX + ",N'" + mota + "'" + ")";

            XLDL.Excute(str);
            Response.Write("<script>alert('Them thanh cong !!!');</script>");
            Response.Redirect("QuanTri.aspx");
        }
Ejemplo n.º 12
0
        protected void btnLuu_Click(object sender, EventArgs e)
        {
            try
            {
                string TieuDe  = tbTieuDe.Text;
                string NoiDung = HttpUtility.HtmlEncode(Request.Form["tbND"]);

                string TTND     = tbTTND.Text;
                string savePath = MapPath("~/Anh/Blog/");
                if (FileUpload1.HasFile)
                {
                    savePath += FileUpload1.FileName;

                    FileUpload1.SaveAs(savePath);


                    lbThongBao.Text = "Upload ảnh thành công.";
                }
                else
                {
                    lbThongBao.Text = "Ảnh chưa được upload.";
                }
                string HinhAnh = FileUpload1.FileName;


                DateTime datetime = DateTime.Now;
                string   Ngay     = datetime.ToString("MM/dd/yyyy hh:mm:ss");

                string str = "insert into Blog values (N'" + HinhAnh + "',N'" + TieuDe + "',N'" + TTND + "',N'" + NoiDung + "',0,'" + Ngay + "',1)";
                XLDL.Excute(str);
                Response.Write("<script>alert('Them thanh cong !!!');</script>");
                Response.Redirect("DanhSachBlog.aspx");
            }
            catch
            {
                Response.Write("<script>alert('Them That Bai !!!');</script>");
            }
        }
Ejemplo n.º 13
0
        protected void btnCapNhat_Click(object sender, EventArgs e)
        {
            string   malsp       = rdlMaLoaiSP.SelectedValue.ToString();
            string   msp         = Request.QueryString["Ma"].ToString();
            DateTime datetime    = DateTime.Now;
            string   ngaycapnhat = datetime.ToShortDateString();
            int      slb         = int.Parse(tbSoLuongBan.Text);
            int      slx         = int.Parse(tbSoLanXem.Text);
            string   tensp       = tbTenSP.Text;
            string   ncc         = tbNCC.Text;
            int      sl          = int.Parse(tbSoLuong.Text);

            string savePath = MapPath("~/Anh/CayCanh/");

            if (FileUpload1.HasFile)
            {
                savePath += FileUpload1.FileName;

                FileUpload1.SaveAs(savePath);


                lbThongBao.Text = "Upload ảnh thành công.";
            }
            else
            {
                lbThongBao.Text = "Ảnh chưa được upload.";
            }
            string ha = FileUpload1.FileName;

            string mt  = HttpUtility.HtmlEncode(Request.Form["tbND"]);
            int    dg  = int.Parse(tbDonGia.Text);
            string sql = "update SanPham set HinhAnh='" + ha + "',MaLoaiSP=" + malsp + ",TenSP=N'" + tensp + "',SoLuongSP=" + sl + ",NhaCC=N'" + ncc + "',TienSP=" + dg + ",NgayCapNhat='" + ngaycapnhat + "',SoLuongBan=" + slb + ",SoLanXem=" + slx + ",Mota=N'" + mt + "' where MaSP=" + msp;

            XLDL.Excute(sql);

            Response.Redirect("QuanTri.Aspx");
        }
Ejemplo n.º 14
0
        protected void btnLuu_Click(object sender, EventArgs e)
        {
            try

            {
                string MaBlog = Session["MaTK"].ToString();

                string tentk = tbTenKH.Text;
                string dc    = tbDiaChi.Text;
                string sdt   = tbSDT.Text;
                string email = tbEmail.Text;



                string sql = "update TaiKhoan set 'tentk=N'" + tentk + "',DiaChi=N'" + dc + "',sdt='" + sdt + "',email='" + email + "' where MaTK=" + MaBlog;
                XLDL.Excute(sql);

                Response.Redirect("QuanLiThongTin.Aspx");
            }
            catch
            {
                Response.Redirect("Default.aspx");
            }
        }
Ejemplo n.º 15
0
        protected void btnLuu_Click(object sender, EventArgs e)
        {
            try
            {
                string TieuDe  = tbTieuDe.Text;
                string NoiDung = tbND.Text;

                string TTND    = tbTTND.Text;
                string HinhAnh = FileUpload1.FileName;

                string   NguoiDang = tbNguoiDang.Text;
                DateTime datetime  = DateTime.Now;
                string   Ngay      = datetime.ToString("MM/dd/yyyy");

                string str = "insert into Blog values (N'" + HinhAnh + "',N'" + TieuDe + "',N'" + TTND + "',N'" + NoiDung + "',0,'" + Ngay + "',N'" + NguoiDang + "')";
                XLDL.Excute(str);
                Response.Write("<script>alert('Them thanh cong !!!');</script>");
                Response.Redirect("DanhSachBlog.aspx");
            }
            catch
            {
                Response.Write("<script>alert('Them That Bai !!!');</script>");
            }
        }
Ejemplo n.º 16
0
        protected void btDongY_Click(object sender, EventArgs e)
        {
            //int httt;
            ////int htgh;
            //string TenNguoiNhan, DiaChiNhan, DienThoaiNhan;
            //TenNguoiNhan = txtTenNguoiNhan.Text;
            //DiaChiNhan = txtDiaChiNhan.Text;
            //DienThoaiNhan = txtDienThoaiNhan.Text;
            //float tongThanhTien = float.Parse(lbTongTien.Text);
            //httt = Convert.ToInt32(rblHinhThucThanhToan.SelectedItem.Value);
            //htgh = Convert.ToInt32(rblHinhThucGiaoHang.SelectedItem.Value);
            try
            {
                //SqlConnection con = new SqlConnection(XLDL.strCon);
                //con.Open();
                //SqlCommand cmd = new SqlCommand();
                //cmd.CommandType = CommandType.Text;
                //cmd.Connection = con;

                //cmd.CommandText = @"INSERT INTO DONDATHANG (MaKH,TriGia,TenNguoiNhan,DiaChiNhan,DienThoaiNhan,HTThanhToan) Values(" + MaKH + ", @ngaydathang," + tongThanhTien + ",@ngaygiaohang,'" + TenNguoiNhan + "','" + DiaChiNhan + "','" + DienThoaiNhan + "','" + httt + ")";
                ////cmd.Parameters.Add("@ngaydathang", SqlDbType.SmallDateTime);
                ////cmd.Parameters["@ngaydathang"].Value = DateTime.Today;
                ////cmd.Parameters.Add("@ngaygiaohang", SqlDbType.SmallDateTime);
                ////cmd.Parameters["@ngaygiaohang"].Value = DateTime.Today;
                //cmd.ExecuteNonQuery();
                //con.Close();

                //string s = "SELECT max(SoDH) from DONDATHANG Where MaKH=" + MaKH;
                //int SoDonHang = int.Parse(XLDL.GetData(s).Rows[0][0].ToString());
                //DataTable dt = new DataTable();
                //dt = (DataTable)Session["GioHang"];
                //int MaSach, SoLuong;
                //float DonGia;

                //for(int i=0;i< dt.Rows.Count; i++)
                //{
                //    MaSach = int.Parse(dt.Rows[i]["MaSach"].ToString());
                //    SoLuong = int.Parse(dt.Rows[i]["SoLuong"].ToString());
                //    DonGia = int.Parse(dt.Rows[i]["DonGia"].ToString());
                //    s = "INSERT INTO CTDATHANG(SoDH, MaSach, SoLuong, DonGia) VALUES (" + SoDonHang + "," + MaSach + "," + SoLuong + "," + DonGia + ")";
                //    XLDL.Excute(s);

                //}
                string ten  = txtTenNguoiNhan.Text;
                string dc   = txtDiaChiNhan.Text;
                string sdt  = txtDienThoaiNhan.Text;
                string pttt = rblHinhThucThanhToan.SelectedValue.ToString();
                string ngay = DateTime.Now.ToString("MM/dd/yyyy");
                string matk = Session["MaTK"].ToString();
                string sql  = "insert into DonHang  values(" + matk + ",'" + ngay + "',N'" + ten + "',N'" + dc + "','" + sdt + "',N'" + pttt + "'," + tt + ")";

                XLDL.Excute(sql);



                string s = " SELECT Max(MaDH) from DonHang ";



                int SoDonHang = int.Parse(XLDL.GetData(s).Rows[0][0].ToString());
                Response.Write(SoDonHang);
                DataTable dt = new DataTable();
                dt = (DataTable)Session["GioHang"];
                int MaSP, SoLuong;


                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    MaSP    = int.Parse(dt.Rows[i]["MaSP"].ToString());
                    SoLuong = int.Parse(dt.Rows[i]["SoLuong"].ToString());

                    s = "INSERT INTO ChiTietDonHang VALUES (" + SoDonHang + "," + MaSP + "," + SoLuong + ")";

                    XLDL.Excute(s);
                }

                Session["GioHang"] = null;

                Response.Redirect("~/XacNhanDonHang.aspx");
            }
            catch
            {
                lbThongBaoLoi.Text = "Loi trong qua trinh cap nhat du lieu";
            }
        }