public void SaveValue() { if (FileUpload1.PostedFile.ContentLength > 0) { tblItemFieldsXValue val = new tblItemFieldsXValue(); val.Where.ItemId.Value = _itemId; // hard coded val.Where.ItemFieldId.Value = 3; val.Where.LanguageId.Value = int.Parse(Request["langId"]); val.Query.Load(); // tblItemFieldBlobValues imgAsset = new tblItemFieldBlobValues(); //imgAsset.AddNew(); tblPdfAssets imgAsset = new tblPdfAssets(); imgAsset.AddNew(); int sizeFile = FileUpload1.PostedFile.ContentLength; imgAsset.PdfData = getImageBits(FileUpload1.PostedFile.InputStream, sizeFile); // imgAsset.ImageTitle = FileUpload1.PostedFile.FileName.Substring(FileUpload1.PostedFile.FileName.LastIndexOf("\\") + 1); imgAsset.PdfTitle = TextBox1.Text; imgAsset.Save(); } }
protected void LinkButton1_Click(object sender, EventArgs e) { tblPdfAssets pdfs = new tblPdfAssets(); pdfs.LoadByPrimaryKey(_pdfid); pdfs.MarkAsDeleted(); pdfs.Save(); Response.Redirect(Request.RawUrl); }
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); }