public static bool CreateIssueAttachment(string name, byte[] bytes, long actionID) { //Create a new issue bool saved = false; try { _Client = new IssueMgtServiceClient(); saved = _Client.CreateIssueAttachment(name, bytes, actionID); _Client.Close(); } catch (FaultException fe) { throw new ApplicationException("CreateIssueAttachment() service error.", fe); } catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("CreateIssueAttachment() timeout error.", te); } catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("CreateIssueAttachment() communication error.", ce); } return(saved); }
protected void OnCommandClick(object sender, CommandEventArgs e) { //Event handler for command button clicked switch (e.CommandName) { case "Cancel": Response.Redirect("~/Default.aspx?issueID=" + this.mIssueID.ToString()); break; case "OK": if (this.fuAttachment.HasFile) { IssueMgtServiceClient crgService = new IssueMgtServiceClient(); bool ret = crgService.CreateIssueAttachment(this.fuAttachment.FileName, this.fuAttachment.FileBytes, this.mActionID); Response.Redirect("~/Default.aspx?issueID=" + this.mIssueID.ToString()); } break; } }
protected void OnButtonClick(object sender, EventArgs e) { //Event handler for command button clicked try { Button btn = (Button)sender; switch (btn.ID) { case "btnCancel": Response.Redirect("~/IssueMgt.aspx?issueID=" + this.mIssueID.ToString()); break; case "btnOk": if (this.fuAttachment.HasFile) { IssueMgtServiceClient crgService = new IssueMgtServiceClient(); bool ret = crgService.CreateIssueAttachment(this.fuAttachment.FileName, this.fuAttachment.FileBytes, this.mActionID); Response.Redirect("~/IssueMgt.aspx?issueID=" + this.mIssueID.ToString()); } break; } } catch (ApplicationException ex) {; } catch (Exception ex) {; } }