/// <summary> /// Saves changes of current <see cref="BusinessObject"/> to the operations list. /// </summary> /// <param name="document">Xml document containing operation list to execute.</param> public override void SaveChanges(XDocument document) { if (this.Id == null) { this.GenerateId(); } if (this.Status != BusinessObjectStatus.Unchanged && this.Status != BusinessObjectStatus.Unknown) { if (this.Parent != null) { if (this.Parent.BOType == BusinessObjectType.CommercialDocument) { this.CommercialDocumentHeaderId = this.Parent.Id.Value; this.FinancialDocumentHeaderId = null; } else if (this.Parent.BOType == BusinessObjectType.FinancialDocument) { this.CommercialDocumentHeaderId = null; this.FinancialDocumentHeaderId = this.Parent.Id.Value; } else { throw new InvalidOperationException("Type of Parent is not supported"); } } BusinessObjectHelper.SaveBusinessObjectChanges(this, document, null, null); } if (this.Settlements != null) { this.Settlements.SaveChanges(document); } }
/// <summary> /// Saves changes of current <see cref="BusinessObject"/> to the operations list. /// </summary> /// <param name="document">Xml document containing operation list to execute.</param> public override void SaveChanges(XDocument document) { if (this.Id == null) { this.GenerateId(); } if (this.Status != BusinessObjectStatus.Unchanged && this.Status != BusinessObjectStatus.Unknown) { DocumentField field = DictionaryMapper.Instance.GetDocumentField(this.DocumentFieldId); string parentIdColumnName = null; if (this.Parent.BOType == BusinessObjectType.CommercialDocumentLine) { parentIdColumnName = "commercialDocumentLineId"; } else if (this.Parent.BOType == BusinessObjectType.WarehouseDocumentLine) { parentIdColumnName = "warehouseDocumentLineId"; } Dictionary <string, object> forcedToSave = new Dictionary <string, object>(); forcedToSave.Add(parentIdColumnName, this.Parent.Id.ToUpperString()); BusinessObjectHelper.SaveBusinessObjectChanges(this, document, forcedToSave, field.Metadata.Element("dataType").Value); } }
public override void SaveChanges(XDocument document) { if (this.DontSave) { return; } if (this.Id == null) { this.GenerateId(); } if (this.Status != BusinessObjectStatus.Unchanged && this.Status != BusinessObjectStatus.Unknown) { Dictionary <string, object> forcedToSave = new Dictionary <string, object>(); string parentColumnName = null; string relatedDocumentColumnName = null; DocumentRelationManager.GetColumnNames(this, ref parentColumnName, ref relatedDocumentColumnName); forcedToSave.Add(parentColumnName, this.Parent.Id.ToUpperString()); forcedToSave.Add(relatedDocumentColumnName, this.RelatedDocument.Id.ToUpperString()); BusinessObjectHelper.SaveBusinessObjectChanges(this, document, forcedToSave, null); } }
public override void SaveChanges(XDocument document) { if (this.Id == null) { this.GenerateId(); } if (this.Attributes != null) { this.Attributes.SaveChanges(document); } if (this.Lines != null) { this.Lines.SaveChanges(document); } //if the document has been changed or some of his children have been changed if ((this.Status != BusinessObjectStatus.Unchanged && this.Status != BusinessObjectStatus.Unknown) || this.ForceSave) { if (this.AlternateVersion == null || ((this.AlternateVersion.Status == BusinessObjectStatus.Unchanged || this.AlternateVersion.Status == BusinessObjectStatus.Unknown) && ((IVersionedBusinessObject)this.AlternateVersion).ForceSave == false)) { BusinessObjectHelper.SaveBusinessObjectChanges(this, document, null, null); this.Number.SaveChanges(document); } } }
/// <summary> /// Saves changes of current <see cref="BusinessObject"/> to the operations list. /// </summary> /// <param name="document">Xml document containing operation list to execute.</param> public override void SaveChanges(XDocument document) { if (this.Id == null) { this.GenerateId(); } if (this.Status != BusinessObjectStatus.Unchanged && this.Status != BusinessObjectStatus.Unknown) { Dictionary <string, object> forcedToSave = new Dictionary <string, object>(); string parentColumnName = null; string relatedDocumentColumnName = null; if (this.Direction == WarehouseDirection.Outcome) { parentColumnName = "outcomeWarehouseDocumentLineId"; relatedDocumentColumnName = "incomeWarehouseDocumentLineId"; } else { parentColumnName = "incomeWarehouseDocumentLineId"; relatedDocumentColumnName = "outcomeWarehouseDocumentLineId"; } forcedToSave.Add(relatedDocumentColumnName, this.RelatedLine.Id.ToUpperString()); forcedToSave.Add(parentColumnName, this.Parent.Id.ToUpperString()); BusinessObjectHelper.SaveBusinessObjectChanges(this, document, forcedToSave, null); } }
/// <summary> /// Saves changes of current <see cref="BusinessObject"/> to the operations list. /// </summary> /// <param name="document">Xml document containing operation list to execute.</param> public override void SaveChanges(XDocument document) { if (this.Id == null) { this.GenerateId(); } if (this.Status != BusinessObjectStatus.Unchanged && this.Status != BusinessObjectStatus.Unknown) { Dictionary <string, object> forcedToSave = new Dictionary <string, object>(); Payment parent = (Payment)this.Parent; if (parent.Direction * parent.Amount > 0) { forcedToSave.Add("incomePaymentId", this.Parent.Id.ToUpperString()); forcedToSave.Add("outcomePaymentId", this.RelatedPayment.Id.ToUpperString()); } else { forcedToSave.Add("outcomePaymentId", this.Parent.Id.ToUpperString()); forcedToSave.Add("incomePaymentId", this.RelatedPayment.Id.ToUpperString()); } BusinessObjectHelper.SaveBusinessObjectChanges(this, document, forcedToSave, null); } }
public override void SaveChanges(XDocument document) { if (this.Id == null) { this.GenerateId(); } if ((this.Status != BusinessObjectStatus.Unchanged && this.Status != BusinessObjectStatus.Unknown) || this.ForceSave) { if (this.AlternateVersion == null || ((this.AlternateVersion.Status == BusinessObjectStatus.Unchanged || this.AlternateVersion.Status == BusinessObjectStatus.Unknown) && ((IVersionedBusinessObject)this.AlternateVersion).ForceSave == false)) { if (this.Status == BusinessObjectStatus.New) { this.CreationDate = SessionManager.VolatileElements.CurrentDateTime; } else if (this.Status == BusinessObjectStatus.Modified) { this.ModificationDate = SessionManager.VolatileElements.CurrentDateTime; } BusinessObjectHelper.SaveBusinessObjectChanges(this, document, null, null); } } }
public override void SaveChanges(XDocument document) { if (this.Id == null) { this.GenerateId(); } if (this.Status != BusinessObjectStatus.Unchanged && this.Status != BusinessObjectStatus.Unknown) { BusinessObjectHelper.SaveBusinessObjectChanges(this, document, null, null); } }
/// <summary> /// Saves changes of current <see cref="BusinessObject"/> to the operations list. /// </summary> /// <param name="document">Xml document containing operation list to execute.</param> public override void SaveChanges(XDocument document) { if (this.Status != BusinessObjectStatus.Unchanged && this.Status != BusinessObjectStatus.Unknown) { if (this.Id == null) { this.GenerateId(); } ItemField field = DictionaryMapper.Instance.GetItemField(this.ItemFieldId); BusinessObjectHelper.SaveBusinessObjectChanges(this, document, null, field.Metadata.Element("dataType").Value); } }
/// <summary> /// Saves changes of current <see cref="BusinessObject"/> to the operations list. /// </summary> /// <param name="document">Xml document containing operation list to execute.</param> public override void SaveChanges(XDocument document) { if (this.Id == null) { this.GenerateId(); } //save changes of child elements first if (this.Accounts != null) { this.Accounts.SaveChanges(document); } if (this.Addresses != null) { this.Addresses.SaveChanges(document); } if (this.Attributes != null) { this.Attributes.SaveChanges(document); } //if the contractor has been changed or some of his children have been changed if ((this.Status != BusinessObjectStatus.Unchanged && this.Status != BusinessObjectStatus.Unknown) || this.ForceSave) { if (this.AlternateVersion == null || ((this.AlternateVersion.Status == BusinessObjectStatus.Unchanged || this.AlternateVersion.Status == BusinessObjectStatus.Unknown) && ((IVersionedBusinessObject)this.AlternateVersion).ForceSave == false)) { //BusinessObjectHelper.SaveMainObjectChanges(this, document, "contractor", new string[] { "id", //"code", "isSupplier", "isReceiver", "isBusinessEntity", "isBank", "isEmployee", //"isTemplate", "isOwnCompany", "fullName", "shortName", "nip", "nipPrefixCountryId", "version" }, null); BusinessObjectHelper.SaveBusinessObjectChanges(this, document, null, null); } } //relations have to be saved at the end if (this.GroupMemberships != null) { this.GroupMemberships.SaveChanges(document); } if (this.Relations != null) { this.Relations.SaveChanges(document); } }
/// <summary> /// Saves changes of current <see cref="BusinessObject"/> to the operations list. /// </summary> /// <param name="document">Xml document containing operation list to execute.</param> public override void SaveChanges(XDocument document) { if (this.DontSave) { return; } if (this.Id == null) { this.GenerateId(); } if (this.Status != BusinessObjectStatus.Unchanged && this.Status != BusinessObjectStatus.Unknown) { Dictionary <string, object> forcedToSave = new Dictionary <string, object>(); string parentColumnName = null; string relatedDocumentColumnName = null; //parent of the line if (this.Parent.Parent.BOType == BusinessObjectType.CommercialDocument || this.Parent.Parent.BOType == BusinessObjectType.ServiceDocument) { parentColumnName = "commercialDocumentLineId"; relatedDocumentColumnName = "warehouseDocumentLineId"; } else { parentColumnName = "warehouseDocumentLineId"; relatedDocumentColumnName = "commercialDocumentLineId"; } if (this.RelatedLine != null) { forcedToSave.Add(relatedDocumentColumnName, this.RelatedLine.Id.ToUpperString()); } forcedToSave.Add(parentColumnName, this.Parent.Id.ToUpperString()); forcedToSave.Add("valuated", this.IsValuated ? "1" : "0"); BusinessObjectHelper.SaveBusinessObjectChanges(this, document, forcedToSave, null); } }
/// <summary> /// Saves changes of current <see cref="BusinessObject"/> to the operations list. /// </summary> /// <param name="document">Xml document containing operation list to execute.</param> public override void SaveChanges(XDocument document) { if (this.Id == null) { this.GenerateId(); } //save changes of child elements first if (this.Attributes != null) { this.Attributes.SaveChanges(document); } if (this.Lines != null) { this.Lines.SaveChanges(document); } if (this.VatTableEntries != null) { this.VatTableEntries.SaveChanges(document); } if (this.Payments != null) { this.Payments.SaveChanges(document); } //if the document has been changed or some of his children have been changed if ((this.Status != BusinessObjectStatus.Unchanged && this.Status != BusinessObjectStatus.Unknown) || this.ForceSave) { if (this.AlternateVersion == null || ((this.AlternateVersion.Status == BusinessObjectStatus.Unchanged || this.AlternateVersion.Status == BusinessObjectStatus.Unknown) && ((IVersionedBusinessObject)this.AlternateVersion).ForceSave == false)) { this.SystemStartEditValidation(); BusinessObjectHelper.SaveBusinessObjectChanges(this, document, null, null); this.Number.SaveChanges(document); } } }
/// <summary> /// Saves changes of current <see cref="BusinessObject"/> to the operations list. /// </summary> /// <param name="document">Xml document containing operation list to execute.</param> public override void SaveChanges(XDocument document) { if (this.Id == null) { this.GenerateId(); } //save changes of child elements first if (this.Attributes != null) { this.Attributes.SaveChanges(document); } if (this.Status != BusinessObjectStatus.Unchanged && this.Status != BusinessObjectStatus.Unknown) { if (this.RelatedWarehouseDocumentLine == null || this.RelatedWarehouseDocumentLine.Status != BusinessObjectStatus.Deleted) { BusinessObjectHelper.SaveBusinessObjectChanges(this, document, null, null); } } }
/// <summary> /// Saves changes of current <see cref="BusinessObject"/> to the operations list. /// </summary> /// <param name="document">Xml document containing operation list to execute.</param> public override void SaveChanges(XDocument document) { if (this.Id == null) { this.GenerateId(); } //save changes of child elements first if (this.Attributes != null) { this.Attributes.SaveChanges(document); } //if the contractor has been changed or some of his children have been changed if ((this.Status != BusinessObjectStatus.Unchanged && this.Status != BusinessObjectStatus.Unknown) || this.ForceSave) { if (this.AlternateVersion == null || ((this.AlternateVersion.Status == BusinessObjectStatus.Unchanged || this.AlternateVersion.Status == BusinessObjectStatus.Unknown) && ((IVersionedBusinessObject)this.AlternateVersion).ForceSave == false)) { BusinessObjectHelper.SaveBusinessObjectChanges(this, document, null, null); } } //relations have to be saved at the end if (this.Relations != null) { this.Relations.SaveChanges(document); } if (this.UnitRelations != null) { this.UnitRelations.SaveChanges(document); } if (this.GroupMemberships != null) { this.GroupMemberships.SaveChanges(document); } }
/// <summary> /// Saves changes of current <see cref="BusinessObject"/> to the operations list. /// </summary> /// <param name="document">Xml document containing operation list to execute.</param> public override void SaveChanges(XDocument document) { if (this.Id == null) { this.GenerateId(); } if (this.Attributes != null) { this.Attributes.SaveChanges(document); } if (this.Status != BusinessObjectStatus.Unchanged && this.Status != BusinessObjectStatus.Unknown) { BusinessObjectHelper.SaveBusinessObjectChanges(this, document, null, null); } if (this.IncomeOutcomeRelations != null) { this.IncomeOutcomeRelations.SaveChanges(document); } }
/// <summary> /// Saves changes of current <see cref="BusinessObject"/> to the operations list. /// </summary> /// <param name="document">Xml document containing operation list to execute.</param> public override void SaveChanges(XDocument document) { if (this.Id == null) { this.GenerateId(); } //save changes of child elements first if (this.Attributes != null) { this.Attributes.SaveChanges(document); } if (this.Lines != null) { this.Lines.SaveChanges(document); } //if the document has been changed or some of his children have been changed if ((this.Status != BusinessObjectStatus.Unchanged && this.Status != BusinessObjectStatus.Unknown) || this.ForceSave) { if (this.AlternateVersion == null || ((this.AlternateVersion.Status == BusinessObjectStatus.Unchanged || this.AlternateVersion.Status == BusinessObjectStatus.Unknown) && ((IVersionedBusinessObject)this.AlternateVersion).ForceSave == false)) { Dictionary <string, object> forcedToSave = new Dictionary <string, object>(); forcedToSave.Add("modificationApplicationUserId", SessionManager.User.UserId.ToString()); if (!this.IsNew) { forcedToSave.Add("modificationDate", SessionManager.VolatileElements.CurrentDateTime.ToIsoString()); } BusinessObjectHelper.SaveBusinessObjectChanges(this, document, forcedToSave, null); this.Number.SaveChanges(document); } } }