public string UpdateAdv(string adv_id, string adv_embed, string adv_link, string adv_name, string adv_type, string adv_pages, string ddlPos, string txtSelectedFile, string adv_startdate, string adv_enddate, string adv_order, string adv_isActive, [Optional, DefaultParameterValue("false")] string adv_isRotate, string adv_description, string adv_width, string adv_height) { if (String.IsNullOrWhiteSpace(HttpContext.Current.User.Identity.Name)) { return(string.Empty); } try { int _order = 0; Int32.TryParse(adv_order, out _order); int _AdvID = 0; Int32.TryParse(adv_id, out _AdvID); DataTable _result = AdvHelper.Update(_AdvID, adv_name, Convert.ToDateTime(adv_startdate), Convert.ToDateTime(adv_enddate), adv_embed, adv_description, adv_isActive == "on" ? true : false, adv_isRotate == "on" ? true : false, _order, Convert.ToInt32(adv_type), adv_link, txtSelectedFile, Convert.ToInt32(adv_width), Convert.ToInt32(adv_height)); if (!string.IsNullOrEmpty(adv_pages)) { AdvHelper.UpdateAdvPositionDetails(_AdvID, Convert.ToInt32(ddlPos), adv_pages); return("{ok : true, message: \"\"}"); } return("{ok : false, message: \"Cập nhật không thành công\"}"); } catch (Exception ex) { return("{ok : false, message: \"" + ex.Message + "\"}"); } }
public string AddNewAdv(string adv_embed, string adv_link, string adv_name, string adv_type, string adv_pages, string ddlPos, string txtSelectedFile, string adv_startdate, string adv_enddate, string adv_order, string adv_isActive, [Optional, DefaultParameterValue("false")] string adv_isRotate, string adv_description, string adv_width, string adv_height) { if (String.IsNullOrWhiteSpace(HttpContext.Current.User.Identity.Name)) { return(string.Empty); } try { int _order = 0; Int32.TryParse(adv_order, out _order); // System.Globalization.CultureInfo enGB = new System.Globalization.CultureInfo("en-GB"); DataTable _result = AdvHelper.InsertNewAdv(adv_name, Convert.ToDateTime(adv_startdate), Convert.ToDateTime(adv_enddate), adv_embed, adv_description, adv_isActive == "on" ? true : false, adv_isRotate == "on" ? true : false, _order, Convert.ToInt32(adv_type), adv_link, txtSelectedFile, Convert.ToInt32(adv_width), Convert.ToInt32(adv_height)); if (_result != null && _result.Rows.Count > 0) { int _advID = Convert.ToInt32(_result.Rows[0][0]); if (!string.IsNullOrEmpty(adv_pages)) { AdvHelper.InsertAdvPositionDetails(_advID, Convert.ToInt32(ddlPos), adv_pages); } return("{ok : true, message: \"\"}"); } return("{ok : false, message: \"Thêm mới không thành công\"}"); } catch (Exception ex) { return("{ok : false, message: \"" + ex.Message + "\"}"); } }
private void gridView_ItemClick(object sender, ItemClickEventArgs e) { var parent = VisualHelper.FindParent <Page>(sender as FrameworkElement); if (parent == null) { return; } if (AdvHelper.IsAdvItem(e.ClickedItem)) { return; } parent.Frame.Navigate(typeof(DetailsPage), e.ClickedItem); }
public string DeleteAdv(string adv_id) { if (String.IsNullOrWhiteSpace(HttpContext.Current.User.Identity.Name)) { return(string.Empty); } try { AdvHelper.AdvDelete(adv_id); return("{ok : true, message: \"Xóa thành công\"}"); } catch (Exception ex) { return("{ok : false, message: \"" + ex.Message + "\"}"); } }
protected override void AddData(IResponse response) { var res = response as ISearchResponse; if (res == null) { return; } foreach (var result in res.Results) { Items.Add(new SearchNodeViewModel(result)); if (Items.Count == AdvHelper.GetAdvItemIndex()) { Items.Add(new AdvNodeViewModel()); } } base.AddData(response); }
protected override void AddData(IResponse response) { var res = response as IEventListResponse; if (res == null) { IsEmpty = true; return; } foreach (var result in res.Results) { Items.Add(new EventNodeViewModel(result, _categoryNameProvider)); if (Items.Count == AdvHelper.GetAdvItemIndex()) { Items.Add(new AdvNodeViewModel()); } } base.AddData(response); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string html = String.Empty; AdvHelper ah = new AdvHelper(); // List<AdvDoc> doc = ah.GetAdvByPosition(catid, this.postId); List <AdvDoc> doc = ah.GetAdvByPositionById(advID); if (doc != null) { AdvDoc item; for (int i = 0; i < doc.Count; i++) { item = doc[i]; if (!string.IsNullOrEmpty(item.FilePath)) { switch (item.Type) { case 1: html += String.Format(ImgFormat, item.Link.Length > 0 ? item.Link : "javascript:void(0);", item.FilePath.StartsWith("http") ? item.FilePath : Utility.ImagesStorageUrl + "/" + item.FilePath, css, _target); break; case 2: html += String.Format(FlashFormat, item.FilePath.StartsWith("http") ? item.FilePath : Utility.ImagesStorageUrl + "/" + item.FilePath, item.Width, item.Height, css); break; case 3: html += String.Format(EmbedFormat, item.Embed, css); break; } } } ltrContent.Text = html; } else { this.Visible = false; } } }