public bool Update(ThuocTinh data, out string msg) { msg = ""; string id = $"{data.id}"; data.ngay_sua = XMedia.XUtil.TimeInEpoch(DateTime.Now); var re_old = client.Get <ThuocTinh>(data.id); if (re_old.Found) { data.gia_tri = re_old.Source.gia_tri; var re = client.Search <ThuocTinh>(s => s.Query(q => q.Term(t => t.Field("app_id.keyword").Value(data.app_id)) && q.Term(t => t.Field("loai").Value(data.loai)) && q.Term(t => t.Field("type").Value(data.type)) && q.Term(t => t.Field("gia_tri").Value(data.gia_tri)) ).Size(100)); if (re.Hits.Any(x => x.Id != id)) { msg = "Giá trị thuộc tính cho đối tượng này đã tồn tại"; return(false); } return(Update(_default_index, data, id)); } else { msg = "Không tìm thấy thuộc tính để cập nhật"; return(false); } }
private void LoadData() { grdThuocTinh.DataSource = null; grdThuocTinhCon.DataSource = null; grdThuocTinh.DataBind(); grdThuocTinhCon.DataBind(); if (int.Parse("0" + tvNhomSanPham.SelectedValue) > 0) { ThuocTinh tt = new ThuocTinh(); DataSet ds; int NhomSanPhamID = int.Parse("0" + tvNhomSanPham.SelectedValue); ds = tt.SelectByThuocTinhChaID(0); ds.Tables[0].DefaultView.RowFilter = "NhomSanPhamID = " + NhomSanPhamID; ds.Tables[0].DefaultView.Sort = "ThuocTinhID DESC"; grdThuocTinh.DataSource = ds.Tables[0]; grdThuocTinh.DataBind(); if (ViewState["id"] == null) grdThuocTinh.SelectedIndex = 0; else setSelected(int.Parse(ViewState["id"].ToString())); LoadThuocTinhCon(); } if (grdThuocTinh.Rows.Count <= 0) lblThuocTinh.Visible = true; else lblThuocTinh.Visible = false; }
public IActionResult Edit(ThuocTinh tt) { try { if (is_admin) { SetMetaData(tt, true); var kq = ThuocTinhRepository.Instance.Update(tt); if (kq) { SetAlert("Sửa thuộc tính thành công", "success"); } else { SetAlert("Sửa thuộc tính thất bại", "error"); } } else { SetAlert("Bạn không có quyền ", "error"); } } catch (Exception e) { Console.WriteLine(e); } return(View()); }
public IActionResult Create(ThuocTinh tt) { try { if (is_admin) { SetMetaData(tt, false); var kq = ThuocTinhRepository.Instance.Index(tt, out string msg); if (kq) { SetAlert("Thêm thuộc tính thành công", "success"); } else { SetAlert("Thêm thuộc tính thất bại", "error"); } } else { SetAlert("Bạn không có quyền!", "error"); } } catch (Exception e) { Console.WriteLine(e); } return(View()); }
public bool Index(ThuocTinh data, out string msg) { bool need_retry = true; var gia_tri_random = Nanoid.Nanoid.Generate(alphabet: "1234567890", size: 8); msg = ""; var max_gia_tri = Convert.ToInt32(gia_tri_random); if (!string.IsNullOrEmpty(data.ten)) { if (!IsGiaTriThuocTinhExist(data.loai, data.type, data.gia_tri)) { data.gia_tri = max_gia_tri; } int retry = 0; int max_retry = 5; while (retry++ < max_retry && need_retry) { need_retry = !Index(_default_index, data, ""); if (need_retry) { Task.Delay(1000).Wait(); } } } msg = "Nhập tên thuộc tính"; return(!need_retry); }
public void Init(ThuocTinh _dtCharater) { // this._mau.SetActive(false); _thuoctinh = _dtCharater; show_charater(); show_direction_charater(); }
IEnumerator create_charater(ThuocTinh _thuoctinh) { GameObject _chrter = ControlsCharater.It.get_charater(); _chrter.GetComponent<Charater>().Init(_thuoctinh); lstCharater[_thuoctinh.chaBattleId] = _chrter; yield return 0; }
private void LoadThuocTinhCha() { ThuocTinh tt = new ThuocTinh(); DataSet ds = tt.SelectAllThuocTinhByThuocTinhChaAndNhomSanPham(int.Parse(Request.QueryString["cid"]), 0); ddlThuocChinhCha.DataSource = ds.Tables[0]; ddlThuocChinhCha.DataTextField = "TenThuocTinh"; ddlThuocChinhCha.DataValueField = "ThuocTinhID"; ddlThuocChinhCha.DataBind(); }
public bool UpdateTenNhom(ThuocTinh data) { string id = $"{data.id}"; data.id = string.Empty; data.ngay_sua = XMedia.XUtil.TimeInEpoch(DateTime.Now); var re = client.Update <ThuocTinh, object>(id, u => u.Doc(new { data.nguoi_sua, data.ten, data.loai, data.type, data.nhom })); return(re.Result == Result.Updated || re.Result == Result.Noop); }
public bool Update(ThuocTinh data) { if (!string.IsNullOrEmpty(data.ten)) { string id = $"{data.id}"; data.id = string.Empty; data.ngay_sua = XMedia.XUtil.TimeInEpoch(DateTime.Now); return(Update(_default_index, data, id)); } return(false); }
public ActionResult Create(ThuocTinh thuocTinh) { if (ModelState.IsValid) { using (var db = new BanHangEntity()) { db.ThuocTinhs.Add(thuocTinh); db.SaveChanges(); return(RedirectToAction("Index")); } } return(View(thuocTinh)); }
public ActionResult Edit(ThuocTinh thuocTinh) { if (ModelState.IsValid) { using (var db = new BanHangEntity()) { db.Entry(thuocTinh).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } return(RedirectToAction("Index")); } return(View(thuocTinh)); }
private ThuocTinh ConvertDoc(IHit <ThuocTinh> hit) { ThuocTinh u = new ThuocTinh(); try { u = hit.Source; u.id = hit.Id; } catch { } return(u); }
public ActionResult Edit(int id) { using (var db = new BanHangEntity()) { try { ThuocTinh ncc = db.ThuocTinhs.Find(id); return(View(ncc)); } catch (Exception ex) { Console.WriteLine(ex.Message); return(new HttpStatusCodeResult(404, "Error in cloud - GetPLUInfo" + ex.Message)); } } }
private void LoadData(string Id) { try { ThuocTinh tt = new ThuocTinh(); DataSet ds = tt.SelectByID(Convert.ToInt32(Id)); if (ds.Tables[0].Rows.Count > 0) { txtTenThuocTinh.Text = ds.Tables[0].Rows[0]["TenThuocTinh"].ToString(); txtThuTu.Text = ds.Tables[0].Rows[0]["ThuTu"].ToString(); } } catch (Exception ex) { Response.Write(ex.ToString()); } }
public ActionResult Delete(float id) { using (var db = new BanHangEntity()) { ThuocTinh thuocTinh = db.ThuocTinhs.Find(id); if (thuocTinh != null) { ThuocTinhSanPham thuocTinhSanPham = db.ThuocTinhSanPhams.FirstOrDefault(x => x.ThuocTinhID == thuocTinh.ThuocTinhID); if (thuocTinhSanPham != null) { db.ThuocTinhSanPhams.Remove(thuocTinhSanPham); } db.ThuocTinhs.Remove(thuocTinh); db.SaveChanges(); } } return(RedirectToAction("/Index")); }
public ActionResult Edit(ThuocTinh thuocTinh) { if (Session["username"] == null) { return(RedirectToAction("/Index", "Users")); } else { if (ModelState.IsValid) { using (var db = new BanHangEntity()) { db.Entry(thuocTinh).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } return(RedirectToAction("Index")); } return(View(thuocTinh)); } }
public ActionResult Create(ThuocTinh thuocTinh) { if (Session["username"] == null) { return(RedirectToAction("/Index", "Users")); } else { if (ModelState.IsValid) { using (var db = new BanHangEntity()) { db.ThuocTinhs.Add(thuocTinh); db.SaveChanges(); return(RedirectToAction("Index")); } } return(View(thuocTinh)); } }
public bool Index(ThuocTinh data) { //var gia_tri_random = Nanoid.Nanoid.Generate(alphabet: "1234567890", size: 8); //var max_gia_tri = Convert.ToInt32(gia_tri_random); bool need_retry = true; //data.gia_tri = max_gia_tri; int retry = 0; int max_retry = 5; while (retry++ < max_retry && need_retry) { need_retry = !Index(_default_index, data, ""); if (need_retry) { Task.Delay(1000).Wait(); } } return(!need_retry); }
private HangHoaResponse setHangHoa(HangHoa hangHoa) { HangHoaResponse response = new HangHoaResponse(); List <ThuocTinhResponse> lisTTResponse = new List <ThuocTinhResponse>(); List <ThuocTinhHangHoa> listTT = _context.ThuocTinhHangHoa.Where(a => a.IdHangHoa == hangHoa.IdHangHoa).ToList(); foreach (ThuocTinhHangHoa tthh in listTT) { ThuocTinh tt = _context.ThuocTinh.Find(tthh.IdThuocTinh); ThuocTinhResponse ttRP = new ThuocTinhResponse(); if (tt != null) { ttRP.name = tt.TenThuocTinh; } ttRP.detail = tthh.GiaTri; lisTTResponse.Add(ttRP); } response.hangHoa = hangHoa; response.listTT = lisTTResponse; return(response); }
protected void btnLuu_Click(object sender, EventArgs e) { try { ThuocTinh tt = new ThuocTinh(); if (Request.QueryString["pid"] == null) { tt.InsertFields(int.Parse(Request.QueryString["cid"]), txtTenThuocTinh.Text, 0, int.Parse(txtThuTu.Text)); } else { tt.UpdateFields(Convert.ToInt32(Request.QueryString["pid"]), int.Parse(Request.QueryString["cid"]), txtTenThuocTinh.Text, null, int.Parse(txtThuTu.Text)); } string strScript = "<script language='JavaScript'>" + "window.parent.Refresh();</script>"; ClientScript.RegisterStartupScript(GetType(), "Refresh", strScript); } catch (Exception ex) { Response.Write(ex.ToString()); } }
public ActionResult Edit(int id) { if (Session["username"] == null) { return(RedirectToAction("/Index", "Users")); } else { using (var db = new BanHangEntity()) { try { ThuocTinh ncc = db.ThuocTinhs.Find(id); return(View(ncc)); } catch (Exception ex) { Console.WriteLine(ex.Message); return(new HttpStatusCodeResult(404, "Error in cloud - GetPLUInfo" + ex.Message)); } } } }
private void tbxModel_TextChanged(object sender, EventArgs e) { Model = ""; ListThuocTinh.Clear(); foreach (string line in tbxModel.Lines) { line.Trim(); if (line.Contains("public class")) { string[] arr = line.Split(' '); Model = arr[2]; } if (line.Contains("public") & line.Contains("get")) { ThuocTinh _thuoctinh = new ThuocTinh(); string[] arr = line.Split(' '); _thuoctinh.DuLieu = arr[1]; _thuoctinh.TenThuocTinh = arr[2]; ListThuocTinh.Add(_thuoctinh); } } if (Model == "" || ListThuocTinh.Count == 0) { MessageBox.Show("Chưa đủ dữ liệu model!!!"); } else { StringBuilder DB = new StringBuilder(); DB.AppendLine("public class " + Model + "DB : BaseDB"); DB.AppendLine("{"); DB.AppendLine(" //Constant"); DB.AppendLine(" private const String TAG = \"" + Model + "DB\";"); DB.AppendLine(" //Singleton"); DB.AppendLine(" private static " + Model + "DB _instance;"); DB.AppendLine(" public static " + Model + "DB mInstance"); DB.AppendLine(" {"); DB.AppendLine(" get"); DB.AppendLine(" if (_instance == null)"); DB.AppendLine(" {"); DB.AppendLine(" _instance = new " + Model + "DB();"); DB.AppendLine(" }"); DB.AppendLine(" return _instance;"); DB.AppendLine(" }"); DB.AppendLine(" }"); //----------------------------------------------------------------------------------------------- DB.AppendLine(" public IList<" + Model + "> Get" + Model + "s(IDbConnection connection, IDbTransaction trans)"); DB.AppendLine(" {"); DB.AppendLine(" StringBuilder sql = new StringBuilder();"); DB.AppendLine(" sql.Append(\" SELECT * \");"); DB.AppendLine(" sql.Append(\" FROM tb_" + Model.ToLower() + " \"); "); DB.AppendLine(" DataTable dt = baseDAO.DoGetDataTable(connection, trans, sql.ToString());"); DB.AppendLine(" return (Make" + Model + "s(dt));"); DB.AppendLine(" }"); //----------------------------------------------------------------------------------------------- DB.AppendLine(" public " + Model + " Get" + Model + "()"); DB.AppendLine(" {"); DB.AppendLine(" StringBuilder sql = new StringBuilder();"); DB.AppendLine(" sql.Append(\" SELECT * \");"); DB.AppendLine(" sql.Append(\" FROM tb_" + Model.ToLower() + " \");"); DB.AppendLine(" DataRow row = baseDAO.DoGetDataRow(sql.ToString());"); DB.AppendLine(" return (Make" + Model + "(row));"); DB.AppendLine(" }"); //----------------------------------------------------------------------------------------------- DB.AppendLine(" public " + Model + " Get" + Model + "(int " + ListThuocTinh[0].TenThuocTinh + ")"); DB.AppendLine(" {"); DB.AppendLine(" StringBuilder sql = new StringBuilder();"); DB.AppendLine(" sql.Append(\" SELECT * \");"); DB.AppendLine(" sql.Append(\" FROM tb_" + Model.ToLower() + " \");"); DB.AppendLine(" sql.Append(\" WHERE " + ListThuocTinh[0].TenThuocTinh + " = \" + " + ListThuocTinh[0].TenThuocTinh + ".Escape());"); DB.AppendLine(" DataRow row = baseDAO.DoGetDataRow(sql.ToString());"); DB.AppendLine(" return (Make" + Model + "(row));"); DB.AppendLine(" }"); //----------------------------------------------------------------------------------------------- DB.AppendLine(" public int Update" + Model + "(IDbConnection connection, IDbTransaction trans, " + Model + " data)"); DB.AppendLine(" {"); DB.AppendLine(" lock (lockObject)"); DB.AppendLine(" {"); DB.AppendLine(" if (data == null)"); DB.AppendLine(" {"); DB.AppendLine(" return DataTypeModel.RESULT_NG;"); DB.AppendLine(" }"); DB.AppendLine(" "); DB.AppendLine(" StringBuilder sql = new StringBuilder();"); DB.AppendLine(" sql.Append(\" UPDATE tb_" + Model + " \");"); DB.AppendLine(" sql.Append(\" SET \");"); for (int i = 1; i < ListThuocTinh.Count; i++) { if (ListThuocTinh[i].DuLieu == "string") { DB.AppendLine(" sql.Append(\" IntentName = \" + data.IntentName.Escape())"); } if (ListThuocTinh[i].DuLieu == "int") { DB.AppendLine(" sql.Append(\" DM_Intent_TypeID = \" + data.DM_Intent_TypeID.Escape())"); } if (i == ListThuocTinh.Count - 1) { DB.Append(";"); } else { DB.Append(".Append(\", \");"); } } DB.AppendLine(" sql.Append(\" WHERE " + ListThuocTinh[0].TenThuocTinh + " = \" + data.IntentID);"); DB.AppendLine(" return baseDAO.DoUpdate(connection, trans, sql.ToString());"); DB.AppendLine(" }"); DB.AppendLine(" }"); DB.AppendLine(" "); DB.AppendLine(" "); DB.AppendLine(" "); DB.AppendLine(" "); DB.AppendLine(" "); DB.AppendLine(" "); DB.AppendLine(" "); DB.AppendLine(" "); DB.AppendLine(" "); tbxDB.Text = DB.ToString(); } }
private void LoadThuocTinhCon() { if (grdThuocTinh.SelectedDataKey != null) { ThuocTinh tt = new ThuocTinh(); int ThuocTinhChaID = int.Parse("0" + grdThuocTinh.SelectedDataKey.Value); DataSet ds = tt.SelectByThuocTinhChaID(ThuocTinhChaID); grdThuocTinhCon.DataSource = ds; grdThuocTinhCon.DataBind(); } }
protected void btnXoa_Click(object sender, EventArgs e) { try { switch (ViewState["TYPE"].ToString()) { case "thuoctinh": if (Common.LoaiNguoiDungID() == 3) { ThuocTinh tt = new ThuocTinh(); tt.Delete(id); } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "nhomsanpham": if (Common.LoaiNguoiDungID() == 3) { NhomSanPham nhomsanpham = new NhomSanPham(); nhomsanpham.Delete(id); } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "vitrisanpham": if ((Common.LoaiNguoiDungID() == 3) || (Common.LoaiNguoiDungID() == 2)) { ViTriSanPham vtsp = new ViTriSanPham(); vtsp.Delete(id); } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "cuahangnhomsanpham": if (Common.LoaiNguoiDungID() == 2) { deleteCuaHangNhomSanPham(id); } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "nhomsanphamcuahang": if (Common.LoaiNguoiDungID() == 2) { deleteNhomSanPhamCuaHang(id); } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "nhanxetsanpham": if (Common.LoaiNguoiDungID() != 1) { NhanXetSanPham nhanxet = new NhanXetSanPham(); nhanxet.Delete(id); } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "tintuc": if ((Common.LoaiNguoiDungID() == 3) || (Common.LoaiNguoiDungID() == 2)) { TinTuc tt = new TinTuc(); tt.Delete(id); } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "hotrotructuyen": if ((Common.LoaiNguoiDungID() == 3) || (Common.LoaiNguoiDungID() == 2)) { HoTroTrucTuyen ht = new HoTroTrucTuyen(); ht.Delete(id); } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "hoidapsanpham": if (Common.LoaiNguoiDungID() != 1) { HoiDapSanPham hoidap = new HoiDapSanPham(); hoidap.Delete(id); } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "nguoidung": if (Common.LoaiNguoiDungID() == 3) { if (CheckExistCuaHang(id) != true) { NguoiDung nguoidung = new NguoiDung(); nguoidung.Delete(id); } else { Response.Redirect("../message.aspx?msg=Không thể xóa người dùng đã có cửa hàng", false); } } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "hangsanxuat": if (Common.LoaiNguoiDungID() == 3) { HangSanXuat hsx = new HangSanXuat(); hsx.Delete(id); } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "khuvuc": if (Common.LoaiNguoiDungID() == 3) { KhuVuc kv = new KhuVuc(); kv.Delete(id); } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "quangcao": if (Common.LoaiNguoiDungID() == 2 || Common.LoaiNguoiDungID() == 3) { QuangCao qcao = new QuangCao(); DataSet ds = qcao.SelectByQuangCaoID(id); if (ds.Tables[0].Rows.Count == 1) { if (Common.LoaiNguoiDungID() == 3) { //Administrator if (ds.Tables[0].Rows[0]["LoaiNguoiDungID"].ToString() == "3") qcao.Delete(id); } else { //e-Store if (ds.Tables[0].Rows[0]["LoaiNguoiDungID"].ToString() == "2" && ds.Tables[0].Rows[0]["NguoiDungID"].ToString() == Common.NguoiDungID().ToString()) qcao.Delete(id); } } } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "sanpham": { SanPham sanpham = new SanPham(); DataSet dssp = sanpham.SelectBySanPhamID(id); if (Common.LoaiNguoiDungID() == 2) { if (dssp.Tables[0].Rows.Count == 1) { //e-Store if (dssp.Tables[0].Rows[0]["LoaiNguoiDungID"].ToString() == Common.LoaiNguoiDungID().ToString() && dssp.Tables[0].Rows[0]["NguoiDungID"].ToString() == Common.NguoiDungID().ToString()) { sanpham.Delete(id); } } } else if (Common.LoaiNguoiDungID() == 3) { if (dssp.Tables[0].Rows.Count == 1) { sanpham.Delete(id); } } else { Response.Redirect("../message.aspx?msg=Access denied"); } } break; case "sanphammau": { SanPhamMau sanpham = new SanPhamMau(); DataSet dssp = sanpham.SelectByID(id); if (Common.LoaiNguoiDungID() == 3) { if (dssp.Tables[0].Rows.Count == 1) { sanpham.Delete(id); } } else { Response.Redirect("../message.aspx?msg=Access denied"); } } break; case "anhsanpham": if ((Common.LoaiNguoiDungID() == 2) || (Common.LoaiNguoiDungID() == 3)) { Anh anhsanpham = new Anh(); DataSet dssp = anhsanpham.SelectByID(id); if (dssp.Tables[0].Rows.Count == 1) { anhsanpham.Delete(id); if (File.Exists(Server.MapPath(Request.QueryString["src"]))) { File.Delete(Server.MapPath(Request.QueryString["src"])); } } } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; } string strScript = "<script language='JavaScript'>" + "window.parent.Refresh();</script>"; ClientScript.RegisterStartupScript(Type.GetType("System.String"), "Refresh", strScript); } catch (Exception ex) { Response.Write(ex.ToString()); } }
private void LoadThuocTinhSanPham(int sanphamid) { int thuoctinhid = 0; int thuoctinhchaid = 0; ThuocTinhSanPham ttsp = new ThuocTinhSanPham(); DataSet ds = ttsp.SelectBySanPhamID(sanphamid); if (ds.Tables[0].Rows.Count > 0) { thuoctinhid = int.Parse(ds.Tables[0].Rows[0]["ThuocTinhID"].ToString()); ThuocTinh tt = new ThuocTinh(); DataSet dstt = tt.SelectByID(thuoctinhid); if (dstt.Tables[0].Rows.Count > 0) { thuoctinhchaid = int.Parse(dstt.Tables[0].Rows[0]["thuoctinhchaid"].ToString()); } } ddlThuocChinhCha.SelectedValue = thuoctinhchaid.ToString(); LoadThuocTinh(); foreach (DataRow dr in ds.Tables[0].Rows) { foreach (ListItem li in lbiThuocTinh.Items) { if (li.Value == dr["ThuocTinhID"].ToString()) li.Selected = true; } } }
private void LoadThuocTinhCha() { ThuocTinh tt = new ThuocTinh(); DataSet ds = tt.SelectAllThuocTinhByThuocTinhChaAndNhomSanPham(int.Parse("0" + ddlNhomSanPham.SelectedValue), 0); ddlThuocChinhCha.DataSource = ds.Tables[0]; ddlThuocChinhCha.DataTextField = "TenThuocTinh"; ddlThuocChinhCha.DataValueField = "ThuocTinhID"; ddlThuocChinhCha.DataBind(); }
private void LoadThuocTinh() { lbiThuocTinh.Items.Clear(); if (ddlThuocChinhCha.Items.Count > 0) { ThuocTinh tt = new ThuocTinh(); DataSet ds = tt.SelectAllThuocTinhByThuocTinhChaAndNhomSanPham(int.Parse(ddlNhomSanPham.SelectedValue), int.Parse(ddlThuocChinhCha.SelectedValue)); lbiThuocTinh.DataSource = ds.Tables[0]; lbiThuocTinh.DataTextField = "TenThuocTinh"; lbiThuocTinh.DataValueField = "ThuocTinhID"; lbiThuocTinh.DataBind(); } }
public static bool UpdateTenNhom(ThuocTinh data) { return(ThuocTinhRepository.Instance.UpdateTenNhom(data)); }
public static bool Update(ThuocTinh data, out string msg) { return(ThuocTinhRepository.Instance.Update(data, out msg)); }
public static bool Index(ThuocTinh data) { return(ThuocTinhRepository.Instance.Index(data)); }
private void LoadProperty(int scid) { ThuocTinh tt = new ThuocTinh(); DataSet ds = tt.SelectByNhomSanPhamID(scid); foreach (DataRow dr in ds.Tables[0].Rows) { wucProperty wucThuocTinh = (wucProperty) Page.LoadControl("wucProperty.ascx"); wucThuocTinh.PropertyName = dr["TenThuocTinh"].ToString(); wucThuocTinh.PropertyID = int.Parse(dr["ThuocTinhId"].ToString()); pnlThuocTinh.Controls.Add(wucThuocTinh); } }
private void LoadSubProperties(int ThuocTinhId) { try { divProperties.InnerHtml = ""; ThuocTinh tt = new ThuocTinh(); DataSet ds = tt.SelectByThuocTinhChaID(ThuocTinhId); if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { int ThuocTinhConID = int.Parse(dr["ThuocTinhID"].ToString()); if (CheckShowedProperty(ThuocTinhConID)) { divProperties.InnerHtml = ""; DataSet dstt = tt.SelectByID(ThuocTinhConID); if (dstt.Tables[0].Rows.Count > 0) { for (int i = 0; i < dstt.Tables[0].Rows.Count; i++) { string strHref = "&spid=" + ThuocTinhConID + "_" + ThuocTinhId; if (Request.Url.ToString().IndexOf(strHref) != -1) { //Request.Url.ToString().Replace(strHref + "_del", ""); divProperties.InnerHtml += "<a style='color:pink;' href=\"" + Request.Url; divProperties.InnerHtml += "\">"; divProperties.InnerHtml += dstt.Tables[0].Rows[i]["TenThuocTinh"].ToString().Trim(); divProperties.InnerHtml += "</a>"; divProperties.InnerHtml += " <a href=\"" + Request.Url; divProperties.InnerHtml += "\" ><img style='cursor:hand;width:12px;border:0px;' src=\"images/del.gif\" ></img></a><br>"; divProperties.InnerHtml = divProperties.InnerHtml.Replace(strHref, ""); } //else //{ // // Request.Url.ToString().Replace(strHref, strHref + "_del"); // divProperties.InnerHtml += "<a style='color:pink;' href=\"" + this.Request.Url; // divProperties.InnerHtml += "\">"; // divProperties.InnerHtml += dstt.Tables[0].Rows[i]["TenThuocTinh"].ToString().Trim(); // divProperties.InnerHtml += "</a>"; // divProperties.InnerHtml += " <a href=\"" + this.Request.Url; // divProperties.InnerHtml += "\" ><img style='cursor:hand;width:8px;border:0px;' src=\"images/delete.gif\" ></img></a><br>"; // divProperties.InnerHtml = divProperties.InnerHtml.ToString().Replace(strHref, strHref + "_del"); //} } } break; } else { divProperties.InnerHtml += "<a style='color:pink;' href=\"" + Request.Url; //if (Request.QueryString["spid"] == null) divProperties.InnerHtml += "&spid=" + dr["ThuocTinhID"] + "_" + ThuocTinhId; //else //{ // string strSpid = this.Request.Url.; // divProperties.InnerHtml.Replace("", ""); //} divProperties.InnerHtml += "\">"; divProperties.InnerHtml += dr["TenThuocTinh"].ToString().Trim(); divProperties.InnerHtml += "</a><br>"; } } } } catch (Exception ex) { Response.Write(ex.ToString()); } }