protected void gvrGrid_rowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { GridView gev = (GridView)e.Row.FindControl("elGrid"); Affinity.ExportLogs el = new Affinity.ExportLogs(this.phreezer); // populate current exports grid Affinity.ExportLogCriteria elc = new Affinity.ExportLogCriteria(); Affinity.Request r = (Affinity.Request)e.Row.DataItem; elc.RequestID = r.Id; el.Query(elc); gev.DataSource = el; gev.DataBind(); GridView guv = (GridView)e.Row.FindControl("ulGrid"); Affinity.UploadLogs ul = new Affinity.UploadLogs(this.phreezer); // populate current uploads grid Affinity.UploadLogCriteria ulc = new Affinity.UploadLogCriteria(); ulc.RequestID = r.Id; ul.Query(ulc); guv.DataSource = ul; guv.DataBind(); } }
/* ~~~ SETS ~~~ */ /// <summary> /// Returns a collection of UploadLog objects /// </summary> /// <param name="criteria"></param> /// <returns>UploadLogs</returns> protected UploadLogs GetUploadLogs(UploadLogCriteria criteria) { //criteria.OriginatorId = this.Id; UploadLogs uploadLogs = new UploadLogs(this.phreezer); uploadLogs.Query(criteria); return(uploadLogs); }
protected void Page_Load(object sender, EventArgs e) { this.RequirePermission(Affinity.RolePermission.AdminSystem); //this.Master.SetLayout("Administration Dashboard", MasterPage.LayoutStyle.ContentOnly); if (Request["a"].Equals("delete")) { Affinity.Attachment att = new Affinity.Attachment(this.phreezer); att.Load(int.Parse(Request["id"])); int orderId = att.Request.Order.Id; string fileName = att.Filepath; string filePath = Server.MapPath("./") + "attachments/" + fileName; try { File.Delete(filePath); log.Debug("Deleted attachment #" + att.Id + ": " + filePath); } catch (Exception ex) { log.Error("Unable attachment #" + att.Id + ": " + filePath); } att.Delete(); Affinity.UploadLogCriteria ulc = new Affinity.UploadLogCriteria(); ulc.AttachmentID = att.Id; ulc.OrderID = orderId; Affinity.UploadLogs uplogs = new Affinity.UploadLogs(this.phreezer); uplogs.Query(ulc); int cnt = uplogs.Count; for (int i = 0; i < cnt; i++) { Affinity.UploadLog ul = (Affinity.UploadLog)uplogs[i]; ul.Delete(); } //Affinity.UploadLogs ulc = new Affinity.UploadLogs(this.phreezer); this.Redirect("AdminOrder.aspx?id=" + orderId + "&feedback=Attachment+Deleted"); } else { this.Master.ShowFeedback("Unknown Action", MasterPage.FeedbackType.Error); } }