public IHttpActionResult CheckOut([FromBody] CheckOutArguments args) { AuthenticateWithTokenInHeaders(); try { var purchase = this.businessLogic.Cart.CheckOut(args.PaymentMethod, args.ShippingAddress); return(Ok(purchase)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
private void backgroundWorkerCheckOut_DoWork(object sender, DoWorkEventArgs e) { try { // Do not access the form's BackgroundWorker reference directly. // Instead, use the reference provided by the sender parameter. BackgroundWorker worker = sender as BackgroundWorker; if (worker.CancellationPending == false) { CheckOutArguments arg = e.Argument as CheckOutArguments; if (arg.Type == JobType.Load) { e.Result = myIfsSvn.GetProjectList(); } else if (arg.Type == JobType.CheckOut) { this.CheckOutProject(arg); e.Result = JobType.CheckOut; } } // If the operation was canceled by the user, // set the DoWorkEventArgs.Cancel property to true. if (worker.CancellationPending) { e.Cancel = true; } } catch (Exception) { //throw the exception so that RunWorkerCompleted can catch it. throw; } }
private void CheckOutProject(CheckOutArguments arg) { using (SvnClient client = new SvnClient()) { // Bind the SharpSvn UI to our client for SSL certificate and credentials SvnUIBindArgs bindArgs = new SvnUIBindArgs(); SvnUI.Bind(client, bindArgs); if (arg.ShowMoreLogInformation) { client.Notify += new EventHandler <SvnNotifyEventArgs>(client_Notify); } client.Cancel += new EventHandler <SvnCancelEventArgs>(client_Cancel); Uri rootUri = client.GetRepositoryRoot(arg.ProjectWorkspaceUri); myIfsSvn.CheckOut(client, arg.ProjectNbprojectUri, arg.CheckOutPathNbproject, new SvnCheckOutArgs() { ThrowOnError = false, IgnoreExternals = true }, arg.CleanUpWhenLocked); myIfsSvn.CheckOut(client, arg.ProjectWorkspaceUri, arg.CheckOutPathWorkspace, new SvnCheckOutArgs() { IgnoreExternals = true }, arg.CleanUpWhenLocked); myIfsSvn.CheckOut(client, arg.ProjectDocumentUri, arg.CheckOutPathDocument, new SvnCheckOutArgs() { IgnoreExternals = true }, arg.CleanUpWhenLocked); this.Log("Starting Component Checkout [" + DateTime.Now.ToString() + "]", arg.ShowMoreLogInformation); Uri componentUri; if (arg.HasDocCompornents) { componentUri = new Uri(Properties.Resources.ServerDocumentationOnlinedocframework.Replace("^/", rootUri.AbsoluteUri)); myIfsSvn.CheckOut(client, componentUri, arg.CheckOutPathDocumentEn, null, arg.CleanUpWhenLocked); } foreach (SvnComponent component in arg.CompornentArray) { componentUri = new Uri(component.Path.Replace("^/", rootUri.AbsoluteUri)); this.Log(component.Name, arg.ShowMoreLogInformation); if (component.Type == SvnComponent.SvnComponentType.Work) { myIfsSvn.CheckOut(client, componentUri, arg.CheckOutPathWorkspace + @"\" + component.Name, null, arg.CleanUpWhenLocked); } else if (component.Type == SvnComponent.SvnComponentType.Document) { List <SvnListEventArgs> folderList = myIfsSvn.GetFolderList(componentUri); folderList.RemoveAt(0); foreach (SvnListEventArgs folder in folderList) { myIfsSvn.CheckOut(client, folder.Uri, arg.CheckOutPathDocumentEn + @"\" + folder.Name, null, arg.CleanUpWhenLocked); } } } } }