private async void ExecuteWizardFinishingAsync(object sender, FinishingEventArgs e) { try { // The values indicated in the wizard are loaded List <Aliquo.Core.Models.DataField> result = (List <Aliquo.Core.Models.DataField>)e.Result; string customerCode = Aliquo.Core.Data.FindField(result, "CustomerCode").Value.ToString(); DateTime dateNote = Aliquo.Core.Convert.ValueToDate(Aliquo.Core.Data.FindField(result, "DateNote").Value); string productCode = Aliquo.Core.Data.FindField(result, "ProductCode").Value.ToString(); // We create the model to store the data Aliquo.Core.Models.Note note = new Aliquo.Core.Models.Note(); // The collection starts note.Lines = new List <Aliquo.Core.Models.Line>(); // This is the basic information to create a note note.Type = Aliquo.Core.NoteType.SalesOrder; note.PropertyCode = customerCode; note.Date = dateNote; Aliquo.Core.Models.Line line = new Aliquo.Core.Models.Line { Type = Aliquo.Core.LineType.Product, Code = productCode, Quantity = 1 }; // The line is assigned to the model list note.Lines.Add(line); // Call the function to create the note long id = await Host.Documents.SetNoteAsync(note); // Update the list this.View.Refresh(); } catch (HandledException ex) { throw new HandledException(ex.Message, ex); } catch (System.Exception ex) { throw new Exception(ex.Message, ex); } }
private void Command_Execute(IHost sender, ExecuteEventArgs e) { try { // We create the model to store the data Aliquo.Core.Models.Note note = new Aliquo.Core.Models.Note(); // This is the basic information to create a note note.Type = Aliquo.Core.NoteType.SalesOrder; // Show the window with the model sender.Documents.Views.AddNote(note); } catch (Exception ex) { sender.Management.Views.ShowException(ex); } }
private async void Command_Execute(IHost sender, ExecuteEventArgs e) { try { // We create the model to store the data Aliquo.Core.Models.Note note = new Aliquo.Core.Models.Note(); // The collection starts note.Lines = new List <Aliquo.Core.Models.Line>(); // This is the basic information to create a note note.Type = Aliquo.Core.NoteType.SalesOrder; note.PropertyCode = "001"; Aliquo.Core.Models.Line line = new Aliquo.Core.Models.Line { Type = Aliquo.Core.LineType.Product, Code = "0275", Quantity = 1 }; // The line is assigned to the model list note.Lines.Add(line); // Call the function to create the note Int64 id = await sender.Documents.SetNoteAsync(note); // Update the list e.View.Refresh(); // Now, if necessary, the document created on the screen is displayed sender.Documents.Views.ShowNote(id, isActive: true); } catch (Exception ex) { sender.Management.Views.ShowException(ex); } }
private async void Command_Execute(IHost sender, ExecuteEventArgs e) { this.Host = sender; try { if (e.View.GetCurrentId() != null) { idNote = Aliquo.Core.Convert.ValueToInt64(e.View.GetCurrentId()); Aliquo.Core.Models.Note note = await this.Host.Documents.GetNoteAsync(idNote); // The assistant is configured System.Text.StringBuilder settings = new System.Text.StringBuilder(); settings.AppendFormat("<? NAME='Email' TYPE='STRING' TEXT='E-mail' STYLE='EMAIL' REQUIRED=1>"); settings.AppendFormat("<? NAME='Subject' TYPE='STRING' TEXT='Subject' DEFAULT='Delivery of delivery note material {0}'>", Aliquo.Core.Formats.SerialAndNumber(note.SerialCode, note.Number)); settings.AppendFormat("<? NAME='Message' TYPE='STRING' TEXT='MensMessageaje' DEFAULT='Enclosed we send you information about the delivery of the delivery note {0}.' ROWS=9 LENGTH=2048>", Aliquo.Core.Formats.SerialAndNumber(note.SerialCode, note.Number)); ITask task = this.Host.Management.Views.WizardCustom(PlugInTitle, string.Empty, settings.ToString()); task.Finishing += ExecuteWizardFinishingAsync; // Check that the parameter is filled configEmail = this.Host.Configuration.GetParameter("EMAIL_SERVER"); if (string.IsNullOrEmpty(configEmail)) { task.Cancel(); Message.Show("Confirm that the configuration of the EMAIL_SERVER parameter is complete.", "EMAIL_SERVER parameter"); } } } catch (Exception ex) { sender.Management.Views.ShowException(ex); } }