public void SaveValue() { if (DropDownList1.SelectedIndex > 0) { 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.AddNew(); val.ItemId = _itemId; val.ItemId = 5; val.LanguageId = int.Parse(Request["langId"]); } if (val.ItemFieldPdfAssetId != Int32.Parse(DropDownList1.SelectedValue)) val.ItemFieldPdfAssetTempId = Int32.Parse(DropDownList1.SelectedValue); val.Save(); } }
public void SaveValue() { if (DropDownList1.SelectedIndex > 0) { 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.AddNew(); val.ItemId = _itemId; val.ItemId = 5; val.LanguageId = int.Parse(Request["langId"]); } if (val.ItemFieldPdfAssetId != Int32.Parse(DropDownList1.SelectedValue)) { val.ItemFieldPdfAssetTempId = Int32.Parse(DropDownList1.SelectedValue); } val.Save(); } }
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 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; } }
public void LoadItem(int itemId) { _itemId = itemId; tblItems item = new tblItems(); item.LoadByPrimaryKey(itemId); tblItemTypes type = new tblItemTypes(); type.LoadByPrimaryKey(item.ItemTypeId); lbItemName.Text = item.ItemTitle; if ((int)UserContext.GetContextItemAsInt("userlevel") == 1) lbItemName.Text += "[" + item.ItemId.ToString() + "]"; _itemTypeTitle = type.ItemTypeTitle; switch (_itemTypeTitle) { case "epicCMSRichTextControl": // cmsTextEditControl edit = new adm admin_controls_cmsTextEditControl txt = (admin_controls_cmsTextEditControl)Page.LoadControl("~/admin/controls/cmsTextEditControl.ascx"); txt.ItemId = itemId; PlaceHolder1.Controls.Add(txt); lbApprove.Visible = false; lbReject.Visible = false; if (txt.IsTemp()) { if ((int)UserContext.GetContextItemAsInt("userlevel") > 2) { Label1.Visible = false; } else { tblItemFieldsXValue val = new tblItemFieldsXValue(); val.Where.ItemId.Value = _itemId; val.Where.ItemFieldId.Value = 7; val.Where.LanguageId.Value = int.Parse(Request["langId"]); val.Query.Load(); //if (val.ItemFieldStringTempId > -1) //{ // lbApprove.Visible = true; // lbReject.Visible = true; //} } } break; case "epicCMSTextControl": admin_controls_cmsBasicTextEditControl txt4 = (admin_controls_cmsBasicTextEditControl)Page.LoadControl("~/admin/controls/cmsBasicTextEditControl.ascx"); txt4.ItemId = itemId; PlaceHolder1.Controls.Add(txt4); lbApprove.Visible = false; lbReject.Visible = false; if (txt4.IsTemp()) { if ((int)UserContext.GetContextItemAsInt("userlevel") > 2) { Label1.Visible = false; } else { tblItemFieldsXValue val = new tblItemFieldsXValue(); val.Where.ItemId.Value = _itemId; val.Where.ItemFieldId.Value = 7; val.Where.LanguageId.Value = int.Parse(Request["langId"]); val.Query.Load(); //if (val.ItemFieldStringTempId > -1) //{ // lbApprove.Visible = true; // lbReject.Visible = true; //} } } break; case "epicCMSImageControl": //admin_controls_cmsImageEditControl img = (admin_controls_cmsImageEditControl)Page.LoadControl("~/admin/controls/cmsImageEditControl.ascx"); admin_controls_cmsSelectImage img = (admin_controls_cmsSelectImage)Page.LoadControl("~/admin/controls/cmsSelectImage.ascx"); img.ItemId = itemId; PlaceHolder1.Controls.Add(img); lbApprove.Visible = false; lbReject.Visible = false; if (img.IsTemp()) { if ((int)UserContext.GetContextItemAsInt("userlevel") > 2) { Label1.Visible = false; } else { tblItemFieldsXValue val = new tblItemFieldsXValue(); val.Where.ItemId.Value = _itemId; val.Where.ItemFieldId.Value = 3; val.Where.LanguageId.Value = int.Parse(Request["langId"]); val.Query.Load(); //if (val.ItemFieldStringTempId > -1) //{ //lbApprove.Visible = true; // lbReject.Visible = true; //} } } break; case "epicCMSPDFControl": admin_controls_cmsPDFEditControl img2 = (admin_controls_cmsPDFEditControl)Page.LoadControl("~/admin/controls/cmsPDFEditControl.ascx"); admin_controls_cmsSelectPdf pdf = (admin_controls_cmsSelectPdf)Page.LoadControl("~/admin/controls/cmsSelectPDF.ascx"); img2.ItemId = itemId; pdf.ItemId = itemId; PlaceHolder1.Controls.Add(pdf); lbApprove.Visible = false; lbReject.Visible = false; if (pdf.IsTemp()) { if ((int)UserContext.GetContextItemAsInt("userlevel") > 2) { Label1.Visible = false; } //else //{ // lbApprove.Visible = true; // lbReject.Visible = true; //} } break; case "epicCMSImageTextControl": admin_controls_cmsTextImageEditControl te = (admin_controls_cmsTextImageEditControl)Page.LoadControl("~/admin/controls/cmsTextImageEditControl.ascx"); te.ItemId = itemId; PlaceHolder1.Controls.Add(te); break; } if (ConfigurationManager.AppSettings["usesApprovals"] != "true") { lbApprove.Visible = false; lbReject.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; } }
public void LoadItem(int itemId) { _itemId = itemId; tblItems item = new tblItems(); item.LoadByPrimaryKey(itemId); tblItemTypes type = new tblItemTypes(); type.LoadByPrimaryKey(item.ItemTypeId); lbItemName.Text = item.ItemTitle; if ((int)UserContext.GetContextItemAsInt("userlevel") == 1) { lbItemName.Text += "[" + item.ItemId.ToString() + "]"; } _itemTypeTitle = type.ItemTypeTitle; switch (_itemTypeTitle) { case "epicCMSRichTextControl": // cmsTextEditControl edit = new adm admin_controls_cmsTextEditControl txt = (admin_controls_cmsTextEditControl)Page.LoadControl("~/admin/controls/cmsTextEditControl.ascx"); txt.ItemId = itemId; PlaceHolder1.Controls.Add(txt); lbApprove.Visible = false; lbReject.Visible = false; if (txt.IsTemp()) { if ((int)UserContext.GetContextItemAsInt("userlevel") > 2) { Label1.Visible = false; } else { tblItemFieldsXValue val = new tblItemFieldsXValue(); val.Where.ItemId.Value = _itemId; val.Where.ItemFieldId.Value = 7; val.Where.LanguageId.Value = int.Parse(Request["langId"]); val.Query.Load(); //if (val.ItemFieldStringTempId > -1) //{ // lbApprove.Visible = true; // lbReject.Visible = true; //} } } break; case "epicCMSTextControl": admin_controls_cmsBasicTextEditControl txt4 = (admin_controls_cmsBasicTextEditControl)Page.LoadControl("~/admin/controls/cmsBasicTextEditControl.ascx"); txt4.ItemId = itemId; PlaceHolder1.Controls.Add(txt4); lbApprove.Visible = false; lbReject.Visible = false; if (txt4.IsTemp()) { if ((int)UserContext.GetContextItemAsInt("userlevel") > 2) { Label1.Visible = false; } else { tblItemFieldsXValue val = new tblItemFieldsXValue(); val.Where.ItemId.Value = _itemId; val.Where.ItemFieldId.Value = 7; val.Where.LanguageId.Value = int.Parse(Request["langId"]); val.Query.Load(); //if (val.ItemFieldStringTempId > -1) //{ // lbApprove.Visible = true; // lbReject.Visible = true; //} } } break; case "epicCMSImageControl": //admin_controls_cmsImageEditControl img = (admin_controls_cmsImageEditControl)Page.LoadControl("~/admin/controls/cmsImageEditControl.ascx"); admin_controls_cmsSelectImage img = (admin_controls_cmsSelectImage)Page.LoadControl("~/admin/controls/cmsSelectImage.ascx"); img.ItemId = itemId; PlaceHolder1.Controls.Add(img); lbApprove.Visible = false; lbReject.Visible = false; if (img.IsTemp()) { if ((int)UserContext.GetContextItemAsInt("userlevel") > 2) { Label1.Visible = false; } else { tblItemFieldsXValue val = new tblItemFieldsXValue(); val.Where.ItemId.Value = _itemId; val.Where.ItemFieldId.Value = 3; val.Where.LanguageId.Value = int.Parse(Request["langId"]); val.Query.Load(); //if (val.ItemFieldStringTempId > -1) //{ //lbApprove.Visible = true; // lbReject.Visible = true; //} } } break; case "epicCMSPDFControl": admin_controls_cmsPDFEditControl img2 = (admin_controls_cmsPDFEditControl)Page.LoadControl("~/admin/controls/cmsPDFEditControl.ascx"); admin_controls_cmsSelectPdf pdf = (admin_controls_cmsSelectPdf)Page.LoadControl("~/admin/controls/cmsSelectPDF.ascx"); img2.ItemId = itemId; pdf.ItemId = itemId; PlaceHolder1.Controls.Add(pdf); lbApprove.Visible = false; lbReject.Visible = false; if (pdf.IsTemp()) { if ((int)UserContext.GetContextItemAsInt("userlevel") > 2) { Label1.Visible = false; } //else //{ // lbApprove.Visible = true; // lbReject.Visible = true; //} } break; case "epicCMSImageTextControl": admin_controls_cmsTextImageEditControl te = (admin_controls_cmsTextImageEditControl)Page.LoadControl("~/admin/controls/cmsTextImageEditControl.ascx"); te.ItemId = itemId; PlaceHolder1.Controls.Add(te); break; } if (ConfigurationManager.AppSettings["usesApprovals"] != "true") { lbApprove.Visible = false; lbReject.Visible = false; } }