示例#1
0
 protected void btnGui_Click(object sender, EventArgs e)
 {
     if (taBinhLuan.Text.Trim() != "")
     {
         string    tendn = XLDL.MaHoa(Session["TenDN"].ToString());
         DataTable dt    = XLDL.LayDuLieu("select * from khachhang where TenDN='" + tendn + "'");
         if (dt.Rows.Count > 0)
         {
             int makh = int.Parse(dt.Rows[0][0].ToString());
             try
             {
                 SqlConnection con = new SqlConnection(XLDL.strcon);
                 SqlCommand    cmd = new SqlCommand("insert into binhluan(masp,makh,binhluan,thoigian) values('" + Request.QueryString["MaSP"] + "'," + makh + ",N'" + taBinhLuan.Text.Trim() + "',@thoigian)", con);
                 cmd.Parameters.Add("@thoigian", SqlDbType.DateTime);
                 cmd.Parameters["@thoigian"].Value = DateTime.Now;
                 con.Open();
                 cmd.ExecuteNonQuery();
                 con.Close();
             }
             catch { }
             taBinhLuan.Text = "";
             binhluan();
             slbl();
             CreateBanner();
         }
     }
     else
     {
         taBinhLuan.Text = "";
         CreateBanner();
     }
 }
示例#2
0
    protected void dlTongQuat_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        CheckBox     cbTraGop  = (CheckBox)e.Item.FindControl("cbTraGop");
        DropDownList ddlHangSX = (DropDownList)e.Item.FindControl("ddlHangSX");
        DataTable    dt1       = XLDL.LayDuLieu("select tencty from congty");

        if (dt1.Rows.Count > 0)
        {
            for (int i = 0; i < dt1.Rows.Count; i++)
            {
                ddlHangSX.Items.Add(dt1.Rows[i][0].ToString());
            }
        }
        DataTable dt = XLDL.LayDuLieu("select tragop,dienthoai.macty,tencty from dienthoai,congty where congty.macty=dienthoai.macty and masp='" + Request.QueryString["MaSP"] + "'");

        if (dt.Rows.Count > 0)
        {
            string bit = dt.Rows[0][0].ToString();
            if (bit == "True")
            {
                cbTraGop.Checked = true;
            }
            else
            {
                cbTraGop.Checked = false;
            }
            ddlHangSX.SelectedValue = dt.Rows[0][2].ToString();
        }
    }
示例#3
0
    private void aTimKiem()
    {
        DataTable dt = XLDL.LayDuLieu("select * from DIENTHOAI where TenSP like N'%" + XLDL.Timkiem + "%'");

        if (dt.Rows.Count > 0)
        {
            dlTimKiem.DataSource = XLDL.LayDuLieu("select * from DIENTHOAI where TenSP like N'%" + XLDL.Timkiem + "%'");
            dlTimKiem.DataBind();
            kq.Controls.Add(new LiteralControl("Kết quả tìm kiếm cho từ khóa \"<span style=\"color:#F00\">" + XLDL.Timkiem + "</span>\""));
            lbThongBao.Visible = false;
        }
        else
        {
            kq.Controls.Add(new LiteralControl("Không tìm thấy kết quả nào phù hợp cho từ khóa \"<span style=\"color:#F00\">" + XLDL.Timkiem + "</span>\""));
            lbThongBao.Controls.Add(new LiteralControl("<div style=\"padding-left: 20px\">"));
            lbThongBao.Controls.Add(new LiteralControl("<div>Để tìm được kết quả chính xác hơn, bạn vui lòng:</div>"));
            lbThongBao.Controls.Add(new LiteralControl("<ul style=\"font-size: 13px; padding-left: 20px\">"));
            lbThongBao.Controls.Add(new LiteralControl("<li>Kiểm tra lỗi chính tả của từ khóa đã nhập</li>"));
            lbThongBao.Controls.Add(new LiteralControl("<li>Thử lại bằng từ khóa khác</li>"));
            lbThongBao.Controls.Add(new LiteralControl("<li>Thử lại bằng những từ khóa tổng quát hơn</li>"));
            lbThongBao.Controls.Add(new LiteralControl("<li>Thử lại bằng những từ khóa ngắn gọn hơn</li>"));
            lbThongBao.Controls.Add(new LiteralControl("</ul>"));
            lbThongBao.Controls.Add(new LiteralControl("</div>"));
        }
    }
示例#4
0
    protected void dlDonHang_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        int       sodh        = int.Parse(dlDonHang.DataKeys[e.Item.ItemIndex].ToString());
        Label     lbthanhtoan = (Label)e.Item.FindControl("lbthanhtoan");
        CheckBox  cb          = (CheckBox)e.Item.FindControl("CheckBox1");
        DataTable dt          = XLDL.LayDuLieu("select thanhtoan,dagiao from donhang where sodh=" + sodh);

        if (dt.Rows.Count > 0)
        {
            if (dt.Rows[0][0].ToString() == "True")
            {
                lbthanhtoan.Text = "Chuyển Khoản";
            }
            else
            {
                lbthanhtoan.Text = "Tiền Mặt";
            }
            if (dt.Rows[0][1].ToString() == "True")
            {
                cb.Checked = true;
            }
            else
            {
                cb.Checked = false;
            }
        }
    }
示例#5
0
    protected void dtMota_UpdateCommand(object source, DataListCommandEventArgs e)
    {
        TextBox   txtTen = (TextBox)e.Item.FindControl("txtTen");
        TextBox   txtQuocGia = (TextBox)e.Item.FindControl("txtQuocGia");
        TextBox   txtMota = (TextBox)e.Item.FindControl("txtMota");
        string    oldurl = "", newurl = "";
        DataTable dt = XLDL.LayDuLieu("select tencty from congty where macty=" + int.Parse(Request.QueryString["macty"].ToString()));

        if (dt.Rows.Count > 0)
        {
            oldurl = "~/images/" + dt.Rows[0][0];
        }
        try
        {
            XLDL.Chaylenh("update congty set tencty=N'" + txtTen.Text.Trim() + "',quocgia=N'" + txtQuocGia.Text.Trim() + "',mota=N'" + txtMota.Text.Trim() + "' where macty = " + Request.QueryString["macty"]);
            newurl = "~/images/" + txtTen.Text.Trim();
            if (Directory.Exists(Server.MapPath(oldurl)) && txtTen.Text.Trim() != dt.Rows[0][0].ToString())
            {
                Directory.Move(Server.MapPath(oldurl), Server.MapPath(newurl));
            }
            Response.Redirect("~/congty.aspx");
        }
        catch
        {
            Response.Write("<script>alert('Lỗi trong quá trình ghi dữ liệu, vui lòng thử lại sau')</script>");
        }
    }
示例#6
0
    protected void dlHang_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        DataList dlDienThoai = (DataList)e.Item.FindControl("dlDienThoai");
        int      macty       = int.Parse(dlHang.DataKeys[e.Item.ItemIndex].ToString());

        dlDienThoai.DataSource = XLDL.LayDuLieu("select * from dienthoai where macty=" + macty + " order by masp desc");
        dlDienThoai.DataBind();
    }
示例#7
0
    protected void dlBinhLuan_ItemCommand(object source, DataListCommandEventArgs e)
    {
        Label      Label35 = (Label)e.Item.FindControl("Label35");
        LinkButton lThich  = (LinkButton)e.Item.FindControl("lThich");
        string     sl      = Label35.Text.Trim();

        if (e.CommandName == "Thich")
        {
            string chuoi;
            if (Session["TenDN"] != null)
            {
                DataTable dt = XLDL.LayDuLieu("select maKH from khachhang where tendn='" + XLDL.MaHoa(Session["TenDN"].ToString()) + "'");
                string[]  a  = sl.Split(',');
                if (sl.Contains(dt.Rows[0][0].ToString()) == false)
                {
                    chuoi = dt.Rows[0][0].ToString();
                }
                else
                {
                    chuoi = "";
                }
                if (a.Length > 1)
                {
                    for (int i = 0; i < a.Length; i++)
                    {
                        if (a[i] == dt.Rows[0][0].ToString())
                        {
                            continue;
                        }
                        if (chuoi == "")
                        {
                            chuoi = a[i];
                            continue;
                        }
                        chuoi = chuoi + "," + a[i];
                    }
                }
                else
                {
                    if (a[0] != "")
                    {
                        if (chuoi != "")
                        {
                            chuoi = chuoi + "," + a[0];
                        }
                        else
                        {
                            chuoi = "";
                        }
                    }
                }
                XLDL.Chaylenh("update binhluan set thich='" + chuoi + "' where ID=" + (int)dlBinhLuan.DataKeys[e.Item.ItemIndex]);
            }
            binhluan();
            CreateBanner();
        }
    }
示例#8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Title();
         motaCty();
         TenCT.Text = XLDL.LayDuLieu("select tencty from congty where macty='" + Request.QueryString["MaCty"] + "'").Rows[0][0].ToString();
     }
 }
    protected void ddlHangSX_Load(object sender, EventArgs e)
    {
        DataTable dt = XLDL.LayDuLieu("select tencty from congty");

        if (dt.Rows.Count > 0)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ddlHangSX.Items.Add(dt.Rows[i][0].ToString());
            }
        }
    }
示例#10
0
    private void Title()
    {
        DataTable dt = XLDL.LayDuLieu("select TenCty from congty where MaCty=" + Request.QueryString["MaCty"]);

        if (dt.Rows.Count > 0)
        {
            lbTitle.Controls.Add(new LiteralControl(dt.Rows[0][0].ToString() + " - Cập Nhật Thông Tin"));
        }
        else
        {
            Response.Redirect("~/congty.aspx");
        }
    }
示例#11
0
    private void tendt()
    {
        DataTable dt = XLDL.LayDuLieu("select tensp from dienthoai where masp='" + Request.QueryString["MaSP"] + "'");

        if (dt.Rows.Count > 0)
        {
            TenDT.Text = dt.Rows[0][0].ToString();
        }
        else
        {
            Response.Redirect("~/dienthoai.aspx");
        }
    }
示例#12
0
    public static List <countrydetails> dienthoai()
    {
        DataTable             dt       = XLDL.LayDuLieu("SELECT tensp,soluongban from dienthoai left join kho on dienthoai.masp=kho.masp");
        List <countrydetails> dataList = new List <countrydetails>();

        foreach (DataRow dtrow in dt.Rows)
        {
            countrydetails details = new countrydetails();
            details.Countryname = dtrow[0].ToString();
            details.Total       = Convert.ToInt32(dtrow[1]);
            dataList.Add(details);
        }
        return(dataList);
    }
示例#13
0
    public static List <countrydetails> congty()
    {
        DataTable             dt       = XLDL.LayDuLieu("select tencty,count(masp) from congty,dienthoai where congty.macty=dienthoai.macty group by tencty");
        List <countrydetails> dataList = new List <countrydetails>();

        foreach (DataRow dtrow in dt.Rows)
        {
            countrydetails details = new countrydetails();
            details.Countryname = dtrow[0].ToString();
            details.Total       = Convert.ToInt32(dtrow[1]);
            dataList.Add(details);
        }
        return(dataList);
    }
示例#14
0
 protected void dlTongQuat_UpdateCommand(object source, DataListCommandEventArgs e)
 {
     try
     {
         string       masp       = dlTongQuat.DataKeys[e.Item.ItemIndex].ToString();
         TextBox      txtTenSP   = (TextBox)e.Item.FindControl("txtTenSP");
         DropDownList ddlHangSX  = (DropDownList)e.Item.FindControl("ddlHangSX");
         TextBox      txtGiaBan  = (TextBox)e.Item.FindControl("txtGiaBan");
         CheckBox     cbTraGop   = (CheckBox)e.Item.FindControl("cbTraGop");
         TextBox      txtGiamGia = (TextBox)e.Item.FindControl("txtGiamGia");
         TextBox      txtSLTon   = (TextBox)e.Item.FindControl("txtSLTon");
         FileUpload   fuHinh     = (FileUpload)e.Item.FindControl("fuHinh");
         int          tragop     = 0;
         double       giamgia    = 0;
         if (cbTraGop.Checked == true)
         {
             tragop = 1;
         }
         int       macty = 1;
         DataTable dt    = XLDL.LayDuLieu("select macty from congty where tencty='" + ddlHangSX.SelectedItem + "'");
         if (dt.Rows.Count > 0)
         {
             macty = int.Parse(dt.Rows[0][0].ToString());
         }
         if (txtGiamGia.Text.Trim() != "")
         {
             giamgia = double.Parse(txtGiamGia.Text.Trim());
         }
         if (fuHinh.HasFile)
         {
             if (XLDL.CheckFileType(fuHinh.FileName))
             {
                 string tenhinh = "~/images/home/" + DateTime.Now.ToString("ddMMyyyy_hhmmss_tt_") + fuHinh.FileName;
                 fuHinh.SaveAs(Server.MapPath(tenhinh));
                 XLDL.Chaylenh("update dienthoai set tensp=N'" + txtTenSP.Text.Trim() + "',giaban=" + double.Parse(txtGiaBan.Text.Trim()) + ",hinhanh='" + fuHinh.FileName + "',macty=" + macty + ",tragop=" + tragop + ",giamgia=" + giamgia + " where masp='" + masp + "'");
             }
         }
         else
         {
             XLDL.Chaylenh("update dienthoai set tensp=N'" + txtTenSP.Text.Trim() + "',giaban=" + double.Parse(txtGiaBan.Text.Trim()) + ",macty=" + macty + ",tragop=" + tragop + ",giamgia=" + giamgia + " where masp='" + masp + "'");
         }
         XLDL.Chaylenh("update kho set soluongton=" + int.Parse(txtSLTon.Text.Trim()) + " where masp='" + masp + "'");
         tongquat();
         alert.Visible = true;
     }
     catch
     {
         error.Visible = true;
     }
 }
示例#15
0
 private void thongtin()
 {
     if (Session["TenDN"] != null)
     {
         DataTable dt = XLDL.LayDuLieu("select hoten, diachi, dienthoai, email from khachhang where tendn='" + XLDL.MaHoa(Session["TenDN"].ToString()) + "'");
         if (dt.Rows.Count > 0)
         {
             txtTen.Text    = dt.Rows[0][0].ToString();
             txtDiaChi.Text = dt.Rows[0][1].ToString();
             txtSDT.Text    = dt.Rows[0][2].ToString();
             txtEmail.Text  = dt.Rows[0][3].ToString();
         }
     }
 }
示例#16
0
    protected void dlHinh_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        int      id     = int.Parse(dlHinh.DataKeys[e.Item.ItemIndex].ToString());
        CheckBox cbHinh = (CheckBox)e.Item.FindControl("cbHinh");
        string   bit    = XLDL.LayDuLieu("select hien from bannersp where id=" + id).Rows[0][0].ToString();

        if (bit == "True")
        {
            cbHinh.Checked = true;
        }
        else
        {
            cbHinh.Checked = false;
        }
    }
示例#17
0
 protected void dlHinh_DeleteCommand(object source, DataListCommandEventArgs e)
 {
     try
     {
         int       ID      = int.Parse(dlHinh.DataKeys[e.Item.ItemIndex].ToString());
         DataTable dt      = XLDL.LayDuLieu("select tencty,dienthoai.masp,hinh from bannersp,dienthoai,congty where bannersp.masp=dienthoai.masp and dienthoai.macty=congty.macty and id=" + ID);
         string    tenhinh = "~/images/" + dt.Rows[0][0].ToString() + "/" + dt.Rows[0][1].ToString() + "/" + dt.Rows[0][2].ToString();
         if (File.Exists(Server.MapPath(tenhinh)) == true)
         {
             File.Delete(Server.MapPath(tenhinh));
         }
         XLDL.Chaylenh("delete from bannersp where id=" + ID);
         Hinh();
     }
     catch { }
 }
示例#18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.QueryString["MaSP"] != null)
         {
             string    MaSP    = Request.QueryString["MaSP"].ToString();
             DataTable dt      = XLDL.LayDuLieu("select tensp,giaban,hinhanh,giamgia from dienthoai where masp='" + MaSP + "'");
             string    TenSP   = dt.Rows[0][0].ToString();
             double    GiaBan  = double.Parse(dt.Rows[0][1].ToString());
             string    HinhAnh = dt.Rows[0][2].ToString();
             double    GiamGia;
             if (dt.Rows[0][3].ToString() != "")
             {
                 GiamGia = double.Parse(dt.Rows[0][3].ToString());
             }
             else
             {
                 GiamGia = 0;
             }
             int SoLuong = 1;
             ThemVaoGioHang(HinhAnh, TenSP, SoLuong, GiaBan, GiamGia);
             Response.Redirect("~/giohang.aspx");
         }
         if (Session["Giohang"] != null)
         {
             DataTable      dt       = (DataTable)Session["Giohang"];
             System.Decimal tongcong = 0;
             foreach (DataRow r in dt.Rows)
             {
                 r["ThanhTien"]  = Convert.ToInt32(r["SoLuong"]) * (Convert.ToDecimal(r["GiaBan"]) - Convert.ToDecimal(r["GiamGia"]));
                 tongcong       += Convert.ToDecimal(r["ThanhTien"]);
                 lbTongCong.Text = "Tổng cộng:  " + String.Format("{0:#,#₫}", tongcong);
             }
             gvGiohang.DataSource = dt;
             gvGiohang.DataBind();
             imgEmpty.Visible    = false;
             hpThanhToan.Visible = true;
         }
         else
         {
             imgEmpty.Visible    = true;
             hpThanhToan.Visible = false;
             dTien.Visible       = false;
         }
     }
 }
示例#19
0
 protected void LuuThanhToan()
 {
     try
     {
         int           makh = int.Parse(XLDL.LayDuLieu("select makh from khachhang where tendn='" + XLDL.MaHoa(Session["TenDN"].ToString()) + "'").Rows[0][0].ToString());
         SqlConnection con  = new SqlConnection(XLDL.strcon);
         SqlCommand    cmd  = new SqlCommand("insert into donhang(makh,ngaydh,tennguoinhan,diachinhan,sdtnhan,thanhtoan) values(" + makh + ",@ngaydh,N'" + txtTen.Text.Trim() + "',N'" + txtDiaChi.Text.Trim() + "','" + txtSDT.Text.Trim() + "'," + thanhtoan + ")", con);
         con.Open();
         cmd.Parameters.Add("@ngaydh", SqlDbType.DateTime);
         cmd.Parameters["@ngaydh"].Value = DateTime.Now;
         cmd.ExecuteNonQuery();
         con.Close();
         int       sodh = int.Parse(XLDL.LayDuLieu("select max(sodh) from donhang where makh=" + XLDL.LayDuLieu("select makh from khachhang where tendn='" + XLDL.MaHoa(Session["TenDN"].ToString()) + "'").Rows[0][0]).Rows[0][0].ToString());
         DataTable dt   = (DataTable)Session["Giohang"];
         string    Masp;
         int       soluong;
         double    dongia, giamgia;
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             Masp    = XLDL.LayDuLieu("select masp from dienthoai where tensp='" + dt.Rows[i]["TenSP"].ToString().Trim() + "'").Rows[0][0].ToString();
             soluong = int.Parse(dt.Rows[i]["SoLuong"].ToString());
             dongia  = double.Parse(dt.Rows[i]["GiaBan"].ToString());
             if (dt.Rows[i]["GiamGia"].ToString() != "")
             {
                 giamgia = double.Parse(dt.Rows[i]["GiamGia"].ToString());
             }
             else
             {
                 giamgia = 0;
             }
             if (i == dt.Rows.Count - 1)
             {
                 mota += soluong.ToString() + " x " + dt.Rows[i]["TenSP"].ToString().Trim();
             }
             else
             {
                 mota += soluong.ToString() + "x" + dt.Rows[i]["TenSP"].ToString().Trim() + ", ";
             }
             XLDL.Chaylenh("insert into ctdonhang(sodh,masp,soluong,dongia,giamgia) values(" + sodh + ",'" + Masp + "'," + soluong + "," + dongia + "," + giamgia + ")");
         }
     }
     catch
     {
         Response.Write("<script>alert('Không thể đặt đơn hàng này')</script>");
     }
 }
示例#20
0
 protected void LinkButton2_Click(object sender, EventArgs e)
 {
     if (Session["TenDN"] != null)
     {
         BaoKimPayment bk = new BaoKimPayment();
         thanhtoan = 1;
         LuuThanhToan();
         string   sodh      = XLDL.LayDuLieu("select max(sodh) from donhang where makh=" + XLDL.LayDuLieu("select makh from khachhang where tendn='" + XLDL.MaHoa(Session["TenDN"].ToString()) + "'").Rows[0][0]).Rows[0][0].ToString();
         string   str       = lbTongCong.Text;
         string[] a         = str.Split(' ');
         double   thanhtien = Convert.ToDouble(a[2].Substring(0, a[2].Length - 1));
         string   chuoibk   = bk.createRequestUrl(sodh, SessionKey.Business, Convert.ToString(thanhtien), "0", "0", mota, "http://nguyenhoang.ga/thanhcong.aspx", "http://nguyenhoang.ga/thanhcong.aspx", "");
         Session["MHtoTC"]  = true;
         Session["Giohang"] = null;
         Response.Redirect(chuoibk);
     }
 }
示例#21
0
    protected void dlDienThoai_DeleteCommand(object source, DataListCommandEventArgs e)
    {
        string    masp = dlDienThoai.DataKeys[e.Item.ItemIndex].ToString();
        string    url = "", urlfile = "";
        DataTable td = XLDL.LayDuLieu("select tencty,dienthoai.hinhanh from DIENTHOAI,CONGTY where DIENTHOAI.macty=CONGTY.macty and masp='" + masp + "'");

        if (td.Rows.Count > 0)
        {
            url     = "~/images/" + td.Rows[0][0] + "/" + masp;
            urlfile = "~/images/home/" + td.Rows[0][1];
        }
        DataTable dt = XLDL.LayDuLieu("select masp from CTDONHANG where masp='" + masp + "'");

        if (dt.Rows.Count > 0)
        {
            Response.Write("<script>alert('Lỗi ! Không thể xóa sản phẩm')</script>");
        }
        else
        {
            //try
            {
                if (Directory.Exists(Server.MapPath(url)))
                {
                    XLDL.DeleteFolder(Server.MapPath(url));
                }
                if (File.Exists(Server.MapPath(urlfile)))
                {
                    File.Delete(Server.MapPath(urlfile));
                }
                XLDL.Chaylenh("delete from bannersp where masp='" + masp + "'");
                XLDL.Chaylenh("delete from kho where masp='" + masp + "'");
                XLDL.Chaylenh("delete from thongso where masp='" + masp + "'");
                XLDL.Chaylenh("delete from thongsochitiet where masp='" + masp + "'");
                XLDL.Chaylenh("delete from danhgia where masp='" + masp + "'");
                XLDL.Chaylenh("delete from dienthoai where masp='" + masp + "'");
                Response.Write("<script>alert('Sản phẩm được gỡ bỏ thành công')</script>");
                dienthoai();
            }

            /*catch
             * {
             *  Response.Write("<script>alert('Lỗi ! Không thể xóa sản phẩm')</script>");
             * }*/
        }
    }
示例#22
0
    protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
    {
        string    chuoi = XLDL.MaHoa(txten.Text.Trim().ToLower());
        DataTable dt    = XLDL.LayDuLieu("select TenDN from khachhang where TenDN='" + chuoi + "'");

        if (dt.Rows.Count > 0)
        {
            string str1 = dt.Rows[0][0].ToString();
            if (chuoi == str1)
            {
                args.IsValid = false;
            }
            else
            {
                args.IsValid = true;
            }
        }
    }
示例#23
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Session["DNAdmin"] != null)
         {
             DataTable dt = XLDL.LayDuLieu("select hoten from admin where tendn='" + XLDL.MaHoa(Session["DNAdmin"].ToString()) + "'");
             if (dt.Rows.Count > 0)
             {
                 lbTenDN.Text = "Xin chào, " + dt.Rows[0][0].ToString();
             }
         }
         else
         {
             Response.Redirect("~/DangNhapAdMin.aspx");
         }
     }
 }
示例#24
0
    protected void dlHinh_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        int       id     = int.Parse(dlHinh.DataKeys[e.Item.ItemIndex].ToString());
        CheckBox  cbHinh = (CheckBox)e.Item.FindControl("cbHinh");
        DataTable dt     = XLDL.LayDuLieu("select hien from khuyenmaicty where madeal=" + id);

        if (dt.Rows.Count > 0)
        {
            if (dt.Rows[0][0].ToString() == "True")
            {
                cbHinh.Checked = true;
            }
            else
            {
                cbHinh.Checked = false;
            }
        }
    }
示例#25
0
 protected void dlHinh_DeleteCommand(object source, DataListCommandEventArgs e)
 {
     try
     {
         int       id = int.Parse(dlHinh.DataKeys[e.Item.ItemIndex].ToString());
         DataTable dt = XLDL.LayDuLieu("select hinh from bannerhome where id=" + id);
         if (dt.Rows.Count > 0)
         {
             string tenfile = "~/images/home/banner/" + dt.Rows[0][0].ToString();
             File.Delete(Server.MapPath(tenfile));
             XLDL.Chaylenh("delete from bannerhome where id=" + id);
             slide();
         }
     }
     catch
     {
         Response.Write("<script>alert('Lỗi ! Vui lòng thử lại sau')</script>");
     }
 }
示例#26
0
    private void CreateBanner()
    {
        DataTable dt     = XLDL.LayDuLieu("select hinh from BANNERHOME where Hien=1");
        int       iCount = 0;
        int       i      = 0;

        if (dt.Rows.Count > 0)
        {
            iCount = dt.Rows.Count;
            lbBanner.Controls.Add(new LiteralControl("<div id=\"demo\" class=\"carousel slide\" data-ride=\"carousel\">"));
            lbBanner.Controls.Add(new LiteralControl("<ul class=\"carousel-indicators\">"));
            for (i = 0; i < iCount; i++)
            {
                if (i == 0)
                {
                    lbBanner.Controls.Add(new LiteralControl("<li data-target=\"#demo\" data-slide-to=" + i + " class=\"active\"></li>"));
                }
                else
                {
                    lbBanner.Controls.Add(new LiteralControl("<li data-target=\"#demo\" data-slide-to=" + i + "></li>"));
                }
            }
            lbBanner.Controls.Add(new LiteralControl("</ul>"));
            lbBanner.Controls.Add(new LiteralControl("<div class=\"carousel-inner\">"));
            i = 0;
            foreach (DataRow r in dt.Rows)
            {
                if (i == 0)
                {
                    lbBanner.Controls.Add(new LiteralControl("<div class=\"carousel-item active\">"));
                }
                else
                {
                    lbBanner.Controls.Add(new LiteralControl("<div class=\"carousel-item\">"));
                }
                lbBanner.Controls.Add(new LiteralControl("<img src=\"images/Home/banner/" + r[0].ToString() + "\">"));
                lbBanner.Controls.Add(new LiteralControl("</div>"));
                i++;
            }
            lbBanner.Controls.Add(new LiteralControl("</div>"));
            lbBanner.Controls.Add(new LiteralControl("</div>"));
        }
    }
示例#27
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     try
     {
         int bit = 0;
         foreach (DataListItem item in dlHinh.Items)
         {
             int      id     = int.Parse(dlHinh.DataKeys[item.ItemIndex].ToString());
             CheckBox cbHinh = (CheckBox)item.FindControl("cbHinh");
             if (cbHinh.Checked == true)
             {
                 bit = 1;
             }
             else
             {
                 bit = 0;
             }
             XLDL.Chaylenh("update khuyenmaicty set hien=" + bit + " where madeal=" + id);
         }
         DataTable dt = XLDL.LayDuLieu("select tencty,macty from congty where tencty='" + ddlHangSX.SelectedItem + "'");
         if (dt.Rows.Count > 0)
         {
             string             tenhinh        = "~/images/" + dt.Rows[0][0].ToString() + "/";
             HttpFileCollection fileCollection = Request.Files;
             for (int i = 0; i < fileCollection.Count; i++)
             {
                 HttpPostedFile uploadfile = fileCollection[i];
                 string         fileName   = Path.GetFileName(uploadfile.FileName);
                 if (uploadfile.ContentLength > 0)
                 {
                     string hinh = DateTime.Now.ToString("ddMMyyyy_hhmmss_tt_") + fileName;
                     uploadfile.SaveAs(Server.MapPath(tenhinh) + hinh);
                     XLDL.Chaylenh("insert into khuyenmaicty(hinhanh,macty) values('" + hinh + "'," + int.Parse(dt.Rows[0][1].ToString()) + ")");
                 }
             }
         }
         deal();
     }
     catch
     {
         Response.Write("<script>alert('Lỗi ! Vui lòng thử lại sau')</script>");
     }
 }
示例#28
0
 protected void dlHinh_DeleteCommand(object source, DataListCommandEventArgs e)
 {
     try
     {
         int       id = int.Parse(dlHinh.DataKeys[e.Item.ItemIndex].ToString());
         DataTable dt = XLDL.LayDuLieu("select khuyenmaicty.hinhanh,tencty from congty,khuyenmaicty where congty.macty=khuyenmaicty.macty and madeal=" + id);
         if (dt.Rows.Count > 0)
         {
             string tenfile = "~/images/" + dt.Rows[0][1].ToString() + "/" + dt.Rows[0][0].ToString();
             File.Delete(Server.MapPath(tenfile));
             XLDL.Chaylenh("delete from khuyenmaicty where madeal=" + id);
             deal();
         }
     }
     catch
     {
         Response.Write("<script>alert('Lỗi ! Vui lòng thử lại sau')</script>");
     }
 }
示例#29
0
    private void CreateBanner()
    {
        DataTable dt     = XLDL.LayDuLieu("select TenCty,BANNERSP.MaSP,BANNERSP.Hinh from BANNERSP,DIENTHOAI,CONGTY where BANNERSP.MaSP=DIENTHOAI.MaSP and DIENTHOAI.MaCty=CONGTY.MaCty and Hien=1 and DIENTHOAI.MaSP='" + Request.QueryString["MaSP"] + "'");
        int       iCount = 0;
        int       i      = 0;

        if (dt.Rows.Count > 0)
        {
            iCount = dt.Rows.Count;
            lbBanner.Controls.Add(new LiteralControl("<div id=\"demo\" class=\"carousel slide\" data-ride=\"carousel\">"));
            lbBanner.Controls.Add(new LiteralControl("<ul class=\"carousel-indicators\">"));
            for (i = 0; i < iCount; i++)
            {
                if (i == 0)
                {
                    lbBanner.Controls.Add(new LiteralControl("<li data-target=\"#demo\" data-slide-to=" + i + " class=\"active\"></li>"));
                }
                else
                {
                    lbBanner.Controls.Add(new LiteralControl("<li data-target=\"#demo\" data-slide-to=" + i + "></li>"));
                }
            }
            lbBanner.Controls.Add(new LiteralControl("</ul>"));
            lbBanner.Controls.Add(new LiteralControl("<div class=\"carousel-inner\">"));
            i = 0;
            foreach (DataRow r in dt.Rows)
            {
                if (i == 0)
                {
                    lbBanner.Controls.Add(new LiteralControl("<div class=\"carousel-item active\">"));
                }
                else
                {
                    lbBanner.Controls.Add(new LiteralControl("<div class=\"carousel-item\">"));
                }
                lbBanner.Controls.Add(new LiteralControl("<img src=\"images/" + r[0].ToString() + "/" + r[1].ToString() + "/" + r[2].ToString() + "\" width=\"896px\" > "));
                lbBanner.Controls.Add(new LiteralControl("</div>"));
                i++;
            }
            lbBanner.Controls.Add(new LiteralControl("</div>"));
            lbBanner.Controls.Add(new LiteralControl("</div>"));
        }
    }
示例#30
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     try
     {
         DataTable dt = XLDL.LayDuLieu("select * from admin where TenDN='" + XLDL.MaHoa(txtTenDN.Value.Trim().ToLower()) + "' and MatKhau = '" + XLDL.MaHoa(txtMatKhau.Value) + "'");
         if (dt.Rows.Count > 0)
         {
             Session["DNAdmin"] = txtTenDN.Value.Trim().ToLower();
             Response.Redirect("~/home.aspx");
         }
         else
         {
             lbThongbaoloi.Text = "Sai tên đăng nhập hoặc mật khẩu";
         }
     }
     catch
     {
         lbThongbaoloi.Text = "Đăng nhập thất bại";
     }
 }