示例#1
0
    private bool CheckExistCuaHang(int id)
    {
        CuaHang ch = new CuaHang();
        DataSet ds = ch.SelectByNguoiDungID(id);
        if (ds.Tables[0].Rows.Count > 0)
            return true;

        return false;
    }
示例#2
0
 private void LoadHoTro()
 {
     CuaHang ch = new CuaHang();
     DataSet ds = ch.SelectByNguoiDungID(Common.NguoiDungID());
     if (ds.Tables[0].Rows.Count != 1)
     {
         Response.Redirect("../message.aspx?msg=You haven't got a store yet");
     }
     else
     {
         DataRow dr = ds.Tables[0].Rows[0];
         lblTenCuaHang.Text = dr["TenCuaHang"].ToString();
         lblCoDinh.Text = dr["DienThoaiCoDinh"].ToString();
         lblDiDong.Text = dr["DienThoaiDiDong"].ToString();
         CuaHangID = int.Parse(dr["CuaHangID"].ToString());
     }
 }
示例#3
0
 private void LoadCuaHang()
 {
     try
     {
         CuaHang ch = new CuaHang();
         DataSet ds = ch.SelectByNguoiDungID(Common.NguoiDungID());
         if (ds.Tables[0].Rows.Count == 1)
         {
             DataRow dr = ds.Tables[0].Rows[0];
             Session["CuaHangID"] = dr["CuaHangID"].ToString();
         }
        }
     catch (Exception ex)
     {
         Response.Write(ex.ToString());
     }
 }
示例#4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Common.LoaiNguoiDungID() == 2)
            {
                LoadCuaHang();
            }
            lbluser.Text = Page.User.Identity.Name;
            if (Common.LoaiNguoiDungID() == 3)
            {
                //Administrator
                mnuChoNet.Items[0].Hidden = false;
                mnuChoNet.Items[7].Hidden = false;
                //mnuChoNet.Items[1].Hidden = true;
                //mnuChoNet.Items[7].Hidden = true;

                mnuChoNet.Items[2].Items[1].Hidden = false;
                //mnuChoNet.Items[2].Items[2].Hidden = false;
                mnuChoNet.Items[2].Items[3].Hidden = false;
                mnuChoNet.Items[6].Items[0].Hidden = false;
                mnuChoNet.Items[6].Items[1].Hidden = false;
                mnuChoNet.Items[6].Items[2].Hidden = true;
                mnuChoNet.Items[6].Items[3].Hidden = false;
                mnuChoNet.Items[6].Items[4].Hidden = true;
                mnuChoNet.Items[6].Items[5].Hidden = true;
                mnuChoNet.Items[6].Items[6].Hidden = true;
            }
            else if (Common.LoaiNguoiDungID() == 2)
            {
                //e-Store
                mnuChoNet.Items[0].Hidden = true;
                //mnuChoNet.Items[8].Hidden = true;
                //mnuChoNet.Items[1].Hidden = false;
                mnuChoNet.Items[7].Hidden = true;

                mnuChoNet.Items[2].Items[1].Hidden = true;
                //mnuChoNet.Items[2].Items[2].Hidden = true;
                mnuChoNet.Items[2].Items[3].Hidden = true;
                mnuChoNet.Items[6].Items[0].Hidden = true;
                mnuChoNet.Items[6].Items[1].Hidden = true;
                mnuChoNet.Items[6].Items[2].Hidden = true;
                mnuChoNet.Items[6].Items[3].Hidden = true;
                mnuChoNet.Items[6].Items[4].Hidden = false;
                mnuChoNet.Items[6].Items[5].Hidden = false;
                mnuChoNet.Items[6].Items[6].Hidden = false;
                CuaHang ch = new CuaHang();
                DataSet ds = ch.SelectByNguoiDungID(Common.NguoiDungID());

                if ((ds.Tables[0].Rows.Count > 0) &&
                    ((ds.Tables[0].Rows[0]["LoaiCuaHang"].ToString() == "1") ||
                     (ds.Tables[0].Rows[0]["LoaiCuaHang"].ToString() == "2")))
                {
                    mnuChoNet.Items[3].Hidden = false;
                }
                else
                {
                    mnuChoNet.Items[3].Hidden = true;
                }
                lblTenCongTy.Text = "<b>CÔNG TY TNHH TM quảng cáo trực tuyến CN</b><br/>TEL: 09808080808";
            }
            else
            {
                Response.Redirect("../message.aspx?msg=Access denied");
            }
        }
    }
示例#5
0
    private void LoadSanPhamTheoMau(int spmid)
    {
        try
        {
            SanPhamMau spm = new SanPhamMau();
            DataSet ds = spm.SelectByID(spmid);

            if (ds.Tables[0].Rows.Count > 0)
            {
                DataRow dr = ds.Tables[0].Rows[0];

                int NhomSanPhamID = int.Parse(dr["NhomSanPhamID"].ToString());
                CuaHang ch = new CuaHang();
                DataSet dsch = ch.SelectByNguoiDungID(Common.NguoiDungID());
                int CuaHangID = int.Parse(dsch.Tables[0].Rows[0]["CuaHangID"].ToString());

                if (checkNhomSanPham(NhomSanPhamID, CuaHangID) == false)
                {
                    AddNhomSanPhamToCuaHang(NhomSanPhamID, CuaHangID);
                    ddlNhomSanPham.Items.Clear();
                    LoadDanhMucConForDropDown(0, CuaHangID, 0);
                    ddlNhomSanPham.SelectedValue = NhomSanPhamID.ToString();
                }

                ddlNhomSanPham.SelectedValue = dr["NhomSanPhamID"].ToString();

                txtTenSanPham.Text = dr["TenSanPham"].ToString();
                //txtMaSoSanPham.Text = dr["MaSoSanPham"].ToString();
                txtGiaSanPham.Text = dr["GiaSanPham"].ToString();
                ddlHangSanXuat.SelectedValue = dr["HangSanXuatID"].ToString();
                ddlKhuVuc.SelectedValue = dr["KhuVucID"].ToString();
                chkKhuyenMai.Checked = dr["KhuyenMai"].ToString() != "" ? bool.Parse(dr["KhuyenMai"].ToString()) : false;
                chkGiamGia.Checked = dr["GiamGia"].ToString() != "" ? bool.Parse(dr["GiamGia"].ToString()) : false;
                //txtMoTaSanPham.Text = dr["MoTaSanPham"].ToString();
                wheMoTaSanPham.Text = dr["MoTaSanPham"].ToString();
                imgAnhChinh.ImageUrl = "." + dr["AnhSanPham"];
                wheThongTinSanPham.Text = dr["ThongTinSanPham"].ToString();
                hidAnhChinh.Value = dr["AnhSanPham"].ToString();

                if (chkGiamGia.Checked)
                {
                    cvGiaMoi.Enabled = true;
                    txtGiaMoi.Enabled = true;
                    txtGiaMoi.Text = dr["GiaKhuyenMai"].ToString();
                }
                else
                {
                    txtGiaMoi.Enabled = false;
                }

                //txtDonViTienTe.Text = dr["DonViTienTe"].ToString();
                //txtThongTinSanPham.Text = dr["ThongTinSanPham"].ToString();

                LoadAnhPhuTheoMau(spmid);
                LoadThuocTinhCha();
                LoadThuocTinh();

                if (chkKhuyenMai.Checked)
                {
                    wdcBatDauKM.Enabled = true;
                    wdcBatDauKM.Value = DateTime.Parse(dr["BatDauKhuyenMai"].ToString());
                    wdcKetThucKM.Enabled = true;
                    wdcKetThucKM.Value = DateTime.Parse(dr["KetThucKhuyenMai"].ToString());
                    txtMoTaKhuyenMai.Enabled = true;
                    txtMoTaKhuyenMai.Text = dr["MoTaKhuyenMai"].ToString();
                    cvKhuyenMai.Enabled = true;
                }
                else
                {
                    txtMoTaKhuyenMai.Enabled = false;
                    wdcBatDauKM.Enabled = false;
                    wdcKetThucKM.Enabled = false;
                }
            }
        }
        catch (Exception ex)
        {
            Response.Write(ex.ToString());
        }
    }
示例#6
0
    private void LoadDropDownDaTa()
    {
        try
        {
            CuaHang ch = new CuaHang();
            DataSet dsch;
            string cacheCh = "ch" + Common.NguoiDungID();
            if (Cache[cacheCh] == null)
            {
                dsch = ch.SelectByNguoiDungID(Common.NguoiDungID());
                Cache.Insert(cacheCh, dsch);
            }
            else
            {
                dsch = (DataSet) Cache[cacheCh];
            }
            if (dsch.Tables[0].Rows.Count > 0)
            {
                LoadDanhMucConForDropDown(0, int.Parse(dsch.Tables[0].Rows[0]["CuaHangID"].ToString()), 0);
            }
            HangSanXuat hangsanxuat = new HangSanXuat();
            DataSet dsHangSanXuat = hangsanxuat.SelectAll();
            if (Cache["hsx"] == null)
            {
                dsHangSanXuat = hangsanxuat.SelectAll();
                Cache.Insert("hsx", dsHangSanXuat);
            }
            else
            {
                dsHangSanXuat = (DataSet) Cache["hsx"];
            }
            DataTable dtHangSanXuat = dsHangSanXuat.Tables[0];

            ddlHangSanXuat.DataSource = dtHangSanXuat;
            ddlHangSanXuat.DataTextField = "TenHangSanXuat";
            ddlHangSanXuat.DataValueField = "HangSanXuatID";
            ddlHangSanXuat.DataBind();

            KhuVuc khuvuc = new KhuVuc();
            DataSet dsKhuVuc;

            if (Cache["kv"] == null)
            {
                dsKhuVuc = khuvuc.SelectAll();
                Cache.Insert("kv", dsKhuVuc);
            }
            else
            {
                dsKhuVuc = (DataSet) Cache["kv"];
            }

            DataTable dtKhuVuc = dsKhuVuc.Tables[0];

            ddlKhuVuc.DataSource = dtKhuVuc;
            ddlKhuVuc.DataTextField = "TenKhuVuc";
            ddlKhuVuc.DataValueField = "KhuVucID";
            ddlKhuVuc.DataBind();
        }
        catch (Exception ex)
        {
            Response.Write(ex.ToString());
        }
    }
示例#7
0
    private string GetThongTinCuaHang(int NguoiDungID, out int chid, out string tench)
    {
        CuaHang ch = new CuaHang();
        DataSet ds = ch.SelectByNguoiDungID(NguoiDungID);
        string strThongTin = "";
        chid = 0;
        tench = "";

        if (ds.Tables[0].Rows.Count > 0)
        {
            DataRow dr = ds.Tables[0].Rows[0];

            chid = int.Parse(dr["CuaHangID"].ToString());
            tench = dr["TenCuaHang"].ToString();
            strThongTin = "<p><b>Giỏ hàng của bạn tại công ty: <a class=pathway href='EStore.aspx?sid=" +
                          dr["CuaHangID"] + "'>" + dr["TenCuaHang"] + "</a><br>";
            strThongTin += "Liên hệ theo số điện thoại: " + dr["DienThoaiCoDinh"] + ", " + dr["DienThoaiDiDong"] +
                           " </b></p>";
        }
        return strThongTin;
    }
示例#8
0
 private void LoadCuaHang()
 {
     CuaHang ch = new CuaHang();
     DataSet ds = ch.SelectByNguoiDungID(Common.NguoiDungID());
     if (ds.Tables[0].Rows.Count != 1)
     {
         Response.Redirect("../message.aspx?msg=You haven't got a store yet");
     }
     else
     {
         DataRow dr = ds.Tables[0].Rows[0];
         //lblTenCuaHang.Text = dr["TenCuaHang"].ToString();
         CuaHangID = int.Parse(dr["CuaHangID"].ToString());
         imgLogo.Src = "." + dr["Anh"].ToString();
     }
 }