/// <summary> /// Saves the sales order line. /// </summary> /// <param name="line">The line.</param> /// <returns></returns> public static int SaveSalesOrderLine(CommanderSalesOrderLine line) { try { if (line.IsValid) { // Save entity line.Id = DataAccessProvider.Instance().SaveCommanderSalesOrderLine(line); } else { // Entity is not valid throw new InValidBusinessObjectException(line); } } catch (Exception ex) { if (ExceptionPolicy.HandleException(ex, "Business Logic")) { throw; } } // Done return(line.Id); }
/// <summary> /// Populates a commander sales order line object from the item values held in the TextFieldCollection. /// </summary> /// <param name="fields">The fields.</param> /// <returns></returns> private CommanderSalesOrderLine PopulateCommanderSalesOrderLine(TextFieldCollection fields) { CommanderSalesOrderLine newLine = new CommanderSalesOrderLine(); PopulateProperties(fields, newLine); newLine.UpdatedBy = GetType().ToString(); return(newLine); }
/// <summary> /// Gets the sales order line. /// </summary> /// <param name="id">The id.</param> /// <returns></returns> public static CommanderSalesOrderLine GetSalesOrderLine(int id) { CommanderSalesOrderLine salesOrderLine = null; try { salesOrderLine = CBO <CommanderSalesOrderLine> .FillObject(DataAccessProvider.Instance().GetCommanderSalesOrderLine(id)); } catch (Exception ex) { if (ExceptionPolicy.HandleException(ex, "Business Logic")) { throw; } } return(salesOrderLine); }
/// <summary> /// Texts the parser_ record read. /// </summary> /// <param name="CurrentLineNumber">The current line number.</param> /// <param name="lineText">The line text.</param> protected override void textFieldParser_RecordRead(int CurrentLineNumber, string lineText) { string type; string subType; GetRowTypeAndSubType(lineText, out type, out subType); //check the type and subtype so we know what schema to set the parser to and which handlers to setup if (type == Customer_Order && subType == "A") { CommanderSalesOrder.SetCommanderSalesOrderHeaderSchema(textFieldParser.TextFields); AddSalesOrderHandlers(); } else if (type == Order_Item && subType == "A") { CommanderSalesOrderLine.SetCommanderSalesOrderLinesSchema(textFieldParser.TextFields); AddSalesOrderLineHandlers(); } }