public void Upload_Click(object sender, System.EventArgs e) { if (ValidateUpload()) { try { uploadControl.SaveAs(ConfigurationManager.AppSettings["DocumentUploadPath"] + uploadControl.PostedFile.FileName); Document d = new Document(); d.DocumentName = uploadControl.PostedFile.FileName; d.FilePath = uploadControl.PostedFile.FileName; d.TypeID = 1; //FIXME HACK!!!!!!!!!!!!!!!!!!!!!!!!!!! if (controller.EditService.SaveDocument(controller.Section.Node.Site.Id, controller.Section.Node.Culture, d)) { lblSave.Text = "Your file was uploaded"; documents = controller.CatalogueViewer.GetDocuments(controller.Section.Node.Site.Id, controller.Section.Node.Culture); rptDocuments.DataSource = documents; rptDocuments.DataBind(); } else { lblSaveNew.Text = "Your file was not saved"; } } catch (Exception f) { lblSaveNew.Text = "Your file was not saved"; LogManager.GetLogger(GetType()).Error(f); } } else { lblSaveNew.Text = "Your file was not saved"; } }
public bool DeleteDocument(int storeID, string cultureCode, Document d) { try { this._sessionManager.OpenSession().Delete(d); this._sessionManager.OpenSession().Flush(); } catch (Exception e) { LogManager.GetLogger(GetType()).Error(e); return false; } return true; }