private string getPdfURL() { if (_itemId > 0) { tblItemFieldsXValue val = new tblItemFieldsXValue(); val.Where.LanguageId.Value = Int32.Parse(Request["langId"]); // 4 is PDF location val.Where.ItemFieldId.Value = 4; val.Where.ItemId.Value = _itemId; val.Query.Load(); if (val.RowCount > 0) { val.Rewind(); return("~/renderpdf.aspx?itemId=" + _itemId.ToString() + "&hei=100"); } else { return(""); } } else { return("~/renderpdf.aspx?pdfid=" + _pdfId.ToString()); } }
protected void LinkButton1_Click(object sender, EventArgs e) { #region remove value stores tblItemFieldsXValue vals = new tblItemFieldsXValue(); vals.Where.ItemId.Value = _itemId; vals.Query.Load(); if (vals.RowCount > 0) { vals.Rewind(); do { if (vals.s_ItemFieldStringId != "") { tblItemFieldStringValues val = new tblItemFieldStringValues(); val.LoadByPrimaryKey(vals.ItemFieldStringId); val.MarkAsDeleted(); val.Save(); } if (vals.s_ItemFieldTextId != "") { tblItemFieldTextValues val = new tblItemFieldTextValues(); val.LoadByPrimaryKey(vals.ItemFieldTextId); val.MarkAsDeleted(); val.Save(); } if (vals.s_ItemFieldStringId != "") { tblItemFieldStringValues val = new tblItemFieldStringValues(); val.LoadByPrimaryKey(vals.ItemFieldStringId); val.MarkAsDeleted(); val.Save(); } if (vals.s_ItemFieldPdfAssetId != "") { tblPdfAssets val = new tblPdfAssets(); val.LoadByPrimaryKey(vals.ItemFieldPdfAssetId); val.MarkAsDeleted(); val.Save(); } } while (vals.MoveNext()); } #endregion tblItems item = new tblItems(); item.LoadByPrimaryKey(_itemId); item.MarkAsDeleted(); item.Save(); Response.Redirect(Request.RawUrl); }
private string getPdfURL() { if (_itemId > 0) { tblItemFieldsXValue val = new tblItemFieldsXValue(); val.Where.LanguageId.Value = Int32.Parse(Request["langId"]); // 4 is PDF location val.Where.ItemFieldId.Value = 4; val.Where.ItemId.Value = _itemId; val.Query.Load(); if (val.RowCount > 0) { val.Rewind(); return "~/renderpdf.aspx?itemId=" + _itemId.ToString() + "&hei=100"; } else { return ""; } } else { return "~/renderpdf.aspx?pdfid=" + _pdfId.ToString(); } }
private void loadPdfs() { tblPdfAssets assets = new tblPdfAssets(); assets.LoadAll(); int sel = -1; if (_itemId > -1) { tblItems itm = new tblItems(); itm.LoadByPrimaryKey(_itemId); tblItemFieldsXValue val = new tblItemFieldsXValue(); val.Where.ItemId.Value = _itemId; val.Where.ItemFieldId.Value = 5; val.Where.LanguageId.Value = int.Parse(Request["langId"]); val.Query.Load(); if (val.RowCount > 0) { val.Rewind(); if (_temp) sel = val.ItemFieldPdfAssetTempId; else sel = val.ItemFieldPdfAssetId; HyperLink2.Text = "View PDF"; HyperLink2.Target = "_blank"; HyperLink2.NavigateUrl = "~/renderpdf.aspx?itemid=" + _itemId.ToString()+"&langid=" + Request["langid"]; } else { val.AddNew(); val.ItemId = _itemId; val.ItemFieldId = 5; val.LanguageId = int.Parse(Request["langId"]); val.ItemFieldPdfAssetId = -1; val.Save(); } } else { if (_pdfid > -1) { HyperLink2.NavigateUrl = "~/renderpdf.aspx?pdfid=" + _pdfid.ToString(); HyperLink2.Text = "View PDF"; HyperLink2.Target = "_blank"; sel = _pdfid; } else { HyperLink2.Visible = false; LinkButton1.Visible = false; } } ListItem li2 = new ListItem("--Select--"); DropDownList1.Items.Add(li2); if (assets.RowCount > 0) { assets.Rewind(); do { ListItem li = new ListItem(assets.PdfTitle, assets.PdfAssetId.ToString()); if (sel == assets.PdfAssetId) { li.Selected = true; } DropDownList1.Items.Add(li); } while (assets.MoveNext()); } if (DropDownList1.SelectedIndex == 0) { HyperLink2.Visible = false; LinkButton1.Visible = false; } }
private void loadPdfs() { tblPdfAssets assets = new tblPdfAssets(); assets.LoadAll(); int sel = -1; if (_itemId > -1) { tblItems itm = new tblItems(); itm.LoadByPrimaryKey(_itemId); tblItemFieldsXValue val = new tblItemFieldsXValue(); val.Where.ItemId.Value = _itemId; val.Where.ItemFieldId.Value = 5; val.Where.LanguageId.Value = int.Parse(Request["langId"]); val.Query.Load(); if (val.RowCount > 0) { val.Rewind(); if (_temp) { sel = val.ItemFieldPdfAssetTempId; } else { sel = val.ItemFieldPdfAssetId; } HyperLink2.Text = "View PDF"; HyperLink2.Target = "_blank"; HyperLink2.NavigateUrl = "~/renderpdf.aspx?itemid=" + _itemId.ToString() + "&langid=" + Request["langid"]; } else { val.AddNew(); val.ItemId = _itemId; val.ItemFieldId = 5; val.LanguageId = int.Parse(Request["langId"]); val.ItemFieldPdfAssetId = -1; val.Save(); } } else { if (_pdfid > -1) { HyperLink2.NavigateUrl = "~/renderpdf.aspx?pdfid=" + _pdfid.ToString(); HyperLink2.Text = "View PDF"; HyperLink2.Target = "_blank"; sel = _pdfid; } else { HyperLink2.Visible = false; LinkButton1.Visible = false; } } ListItem li2 = new ListItem("--Select--"); DropDownList1.Items.Add(li2); if (assets.RowCount > 0) { assets.Rewind(); do { ListItem li = new ListItem(assets.PdfTitle, assets.PdfAssetId.ToString()); if (sel == assets.PdfAssetId) { li.Selected = true; } DropDownList1.Items.Add(li); } while (assets.MoveNext()); } if (DropDownList1.SelectedIndex == 0) { HyperLink2.Visible = false; LinkButton1.Visible = false; } }