protected void rptlastest_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemIndex < 0) { return; } DataRowView curData = (DataRowView)e.Item.DataItem; HyperLink lnkTitle = (HyperLink)e.Item.FindControl("lnkTitle"); Label lblCreatedOn = (Label)e.Item.FindControl("lblCreatedOn"); Image imgAvatar = (Image)e.Item.FindControl("imgAvatar"); if (lang == 1) { lnkTitle.Text = curData["Content_Headline"].ToString(); } else { lnkTitle.Text = curData["Content_HeadlineKD"].ToString(); } if (string.IsNullOrEmpty(ConvertUtility.ToString(curData["Content_Avatar"]))) { imgAvatar.ImageUrl = "/Images/icon_app52.png"; } else { CreateAvatar.MOReceiver ws = new CreateAvatar.MOReceiver(); ws.GenerateAvatarThumnail(curData["Content_Avatar"].ToString(), 60, 60); imgAvatar.ImageUrl = preurl + MultimediaUtility.GetAvatarThumnail(curData["Content_Avatar"].ToString(), 60, 60).Replace("~", ""); } lnkTitle.NavigateUrl = "../Download.aspx?id=" + curData["Distribution_ID"].ToString() + "&lang=" + lang + "&w=" + width; //lnkTitle.NavigateUrl = UrlProcess.GetNewsDetailUrl(lang.ToString(), "detail", width, curData["Distribution_ID"].ToString()); }
protected void rptlstCategory_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemIndex < 0) { return; } DataRowView curData = (DataRowView)e.Item.DataItem; Image imgAvatar = (Image)e.Item.FindControl("imgAvatar"); HyperLink lnkAvatar = (HyperLink)e.Item.FindControl("lnkAvatar"); HyperLink lnkTenAnh = (HyperLink)e.Item.FindControl("lnkTenAnh"); //Literal ltrTheloai = (Literal)e.Item.FindControl("ltrTheloai"); Literal ltrLuottai = (Literal)e.Item.FindControl("ltrLuottai"); HyperLink lnkTai = (HyperLink)e.Item.FindControl("lnkTai"); //HyperLink lnkTang = (HyperLink)e.Item.FindControl("lnkTang"); string sGioiThieu; lnkTenAnh.Text = "<span class=\"bold\">" + curData["Name"] + "</span>"; //ltrTheloai.Text = Resources.Resource.wTheLoai + curData["Web_Name"].ToString(); sGioiThieu = curData["Description"].ToString(); if (sGioiThieu.Length > 120) { sGioiThieu = sGioiThieu.Substring(0, sGioiThieu.LastIndexOf(" ", 110)) + "..."; } ltrLuottai.Text = Resources.Resource.wGioiThieu + sGioiThieu; lnkTai.Text = "<span class=\"orange bold\">" + Resources.Resource.wTai + "</span>"; string url = AppEnv.GetSetting("JavaGameDownloadPartner") + "?id=" + curData["GameID"] + "&code=" + SecurityMethod.MD5Encrypt(curData["GameID"] + "_" + msisdn) + "&msisdn=" + msisdn; lnkAvatar.NavigateUrl = lnkTenAnh.NavigateUrl = url; lnkTai.NavigateUrl = url; CreateAvatar.MOReceiver ws = new CreateAvatar.MOReceiver(); ws.GenerateAvatarThumnail(curData["Avatar"].ToString(), 60, 70); imgAvatar.ImageUrl = preurl + MultimediaUtility.GetAvatarThumnail(curData["Avatar"].ToString(), 60, 70).Replace("~", ""); }
public static string GetAvatar(string avatar, int width, int height) { if (!string.IsNullOrEmpty(avatar)) { CreateAvatar.MOReceiver ws = new CreateAvatar.MOReceiver(); ws.GenerateAvatarThumnail(avatar, width, height); string urlData = GetSetting("urldata"); string img = MultimediaUtility.GetAvatarThumnail(avatar, width, height).Replace("~", ""); return(urlData + img); } return("/Images/icon_app52.png"); }
protected void Page_Load(object sender, EventArgs e) { preurl = ConfigurationSettings.AppSettings.Get("urldata"); width = Request.QueryString["w"]; if (!IsPostBack) { lang = ConvertUtility.ToInt32(Request.QueryString["lang"]); if (lang == 1) { lblTitle.Text = "TIN MỚI NHẤT"; } } if (!string.IsNullOrEmpty(Request.QueryString["cpage"])) { curpage = ConvertUtility.ToInt32(Request.QueryString["cpage"]); } //lastest News int totalrecord = 0; DataTable dtlatest = TintucController.GetTopNewsWithPagging(ConvertUtility.ToInt32(ConfigurationSettings.AppSettings.Get("news_zoneid")), pagesize, curpage, 60, out totalrecord); rptlastest.DataSource = dtlatest; rptlastest.ItemDataBound += rptlastest_ItemDataBound; rptlastest.DataBind(); Paging1.totalrecord = totalrecord; Paging1.pagesize = pagesize; Paging1.numberpage = pagenumber; Paging1.defaultparam = "?lang=" + Request.QueryString["lang"] + "&display=" + Request.QueryString["display"] + "&w=" + Request.QueryString["w"]; Paging1.queryparam = "?lang=" + Request.QueryString["lang"] + "&display=" + Request.QueryString["display"] + "&w=" + Request.QueryString["w"] + "&cpage="; //end lastest News if (curpage == 1) { int totalrecord1; DataTable dtTinTongHop = TintucController.GetAllNewsByCategory(ConvertUtility.ToInt32(ConfigurationSettings.AppSettings.Get("tintonghop")), 1, 1, out totalrecord1); if (dtTinTongHop.Rows.Count > 0) { //divtintonghop.Visible = true; if (lang == 1) { lnkTitle.Text = dtTinTongHop.Rows[0]["Content_Headline"].ToString(); } else { lnkTitle.Text = dtTinTongHop.Rows[0]["Content_HeadlineKD"].ToString(); } if (string.IsNullOrEmpty(ConvertUtility.ToString(dtTinTongHop.Rows[0]["Content_Avatar"]))) { imgAvatar.ImageUrl = "/Images/icon_app52.png"; } else { CreateAvatar.MOReceiver ws = new CreateAvatar.MOReceiver(); ws.GenerateAvatarThumnail(dtTinTongHop.Rows[0]["Content_Avatar"].ToString(), 60, 60); imgAvatar.ImageUrl = preurl + MultimediaUtility.GetAvatarThumnail(dtTinTongHop.Rows[0]["Content_Avatar"].ToString(), 60, 60).Replace("~", ""); //imgAvatar.ImageUrl = preurl + MultimediaUtility.GetAvatar(curData["Content_Avatar"].ToString().Replace("~", "")); } lnkTitle.NavigateUrl = "../Download.aspx?id=" + dtTinTongHop.Rows[0]["Distribution_ID"].ToString() + "&lang=" + lang + "&w=" + width; //lnkTitle.NavigateUrl = UrlProcess.GetNewsDetailUrl(lang.ToString(), "detail", width, dtTinTongHop.Rows[0]["Distribution_ID"].ToString()); } } }