protected void PopulateControls(MonAn pr) { ltrPrice.Text = showMoney(pr.Gia).ToString(); if (Session["lang"].ToString().Equals("vn")) { ltrTenSanPham.Text = pr.TenMon_Vn; ltrCtTitle.Text = pr.TenMon_Vn; ltrMoTa.Text = pr.MoTa_Vn; ltrChiTietSanPham.Text = pr.ChiTiet_Vn; figureLarge.Title = pr.TenMon_Vn; } else if (Session["lang"].ToString().Equals("en")) { ltrTenSanPham.Text = pr.TenMon_En; ltrCtTitle.Text = pr.TenMon_En; ltrMoTa.Text = pr.MoTa_En; ltrChiTietSanPham.Text = pr.ChiTiet_En; figureLarge.Title = pr.TenMon_En; } else if (Session["lang"].ToString().Equals("ru")) { ltrTenSanPham.Text = pr.TenMon_Ru; ltrCtTitle.Text = pr.TenMon_Ru; ltrMoTa.Text = pr.MoTa_Ru; ltrChiTietSanPham.Text = pr.ChiTiet_Ru; figureLarge.Title = pr.TenMon_Ru; } List<Img> album = new List<Img>(); int idimg = 0; string listimg = pr.HinhAnh; string[] str = listimg.Split('\''); foreach (var item in str) { if (item.ToString() != "") { Img dataimg = new Img(); dataimg.ID = idimg; dataimg.HinhAnh = item.ToString(); album.Add(dataimg); idimg++; } } rptListImg.DataSource = album; rptListImg.DataBind(); figureLarge.HRef = str.First().Trim().ToString(); figureThumb.Src = ToThumb(str.First().Trim().ToString()); List<MonAn> listBV = MonAn.MonAn_LayTheoIDTheLoai(pr.MenuID); if (listBV != null && listBV.Count != 0) { rptRelatedProduct.DataSource = listBV; rptRelatedProduct.DataBind(); } }
private void SetData(MonAn data) { lblId.Text = data.ID.ToString(); txtTieuDe_Vi.Text = data.TenMon_Vn; txtChiTietVn.Text = data.ChiTiet_Vn; txtTomTatVn.Text = data.MoTa_Vn; txtTieuDe_En.Text = data.TenMon_En; txtChiTietEn.Text = data.ChiTiet_En; txtTomTatEn.Text = data.MoTa_En; txtTieuDe_Ru.Text = data.TenMon_Ru; txtChiTietRu.Text = data.ChiTiet_Ru; txtTomTatRu.Text = data.MoTa_Ru; txtHinhNho.Text = data.AnhDaiDien; if (data.Gia <= 0) txtDonGia.Text = "0"; else txtDonGia.Text = String.Format("{0:#.##}", data.Gia); ddlLoaiMenu.SelectedValue = data.MenuID.ToString(); int idimg = 0; string listimg = data.HinhAnh; string[] str = listimg.Split('\''); foreach (var item in str) { if (item.ToString() != "") { Img dataimg = new Img(); dataimg.ID = idimg; dataimg.HinhAnh = item.ToString(); album.Add(dataimg); idimg++; } } dlListImg.DataSource = album; dlListImg.DataBind(); }
private MonAn GetData() { MonAn data = null; if (lblId.Text != "") data = MonAn.Single(lblId.Text); else data = new MonAn(); data.TenMon_Vn = txtTieuDe_Vi.Text; data.MoTa_Vn = txtTomTatVn.Text; data.ChiTiet_Vn = txtChiTietVn.Text; data.TenMon_En = txtTieuDe_En.Text; data.MoTa_En = txtTomTatEn.Text; data.ChiTiet_En = txtChiTietEn.Text; data.TenMon_Ru = txtTieuDe_Ru.Text; data.MoTa_Ru = txtTomTatRu.Text; data.ChiTiet_Ru = txtChiTietRu.Text; data.AnhDaiDien = txtHinhNho.Text; data.Gia = Convert.ToDecimal(txtDonGia.Text); data.MenuID = ConvertType.ToInt32(ddlLoaiMenu.SelectedValue.Trim()); string datalistimg = ""; foreach (var item in album) datalistimg += item.HinhAnh + "'"; data.HinhAnh = datalistimg; return data; }
public static bool Update(MonAn monan) { try { int rs = DataProvider.Instance.ExecuteNonQuery("MonAn_Update", monan.ID, monan.TenMon_Vn, monan.TenMon_En, monan.TenMon_Ru, monan.MoTa_Vn, monan.MoTa_En, monan.MoTa_Ru, monan.AnhDaiDien, monan.Gia, monan.HinhAnh, monan.ChiTiet_Vn, monan.ChiTiet_En, monan.ChiTiet_Ru, monan.MenuID); return rs > 0; } catch { return false; } }
public static bool Add(MonAn monan) { try { object rs = DataProvider.Instance.ExecuteNonQueryWithOutput("@ID", "MonAn_Add", monan.ID, monan.TenMon_Vn, monan.TenMon_En, monan.TenMon_Ru, monan.MoTa_Vn, monan.MoTa_En, monan.MoTa_Ru, monan.AnhDaiDien, monan.Gia, monan.HinhAnh, monan.ChiTiet_Vn, monan.ChiTiet_En, monan.ChiTiet_Ru, monan.MenuID); return Convert.ToInt32(rs) > 0; } catch { return false; } }