public static bool IsObjectPermanentlyDeleted(this DChange change) { return(change.New != null && change.Old != null && change.New.IsDeleted && change.New.Id != DObject.RootId); }
private bool IsSameFileAdded(DChange change) { var oldFile = change.Old.ActualFileSnapshot.Files.First(); var newFile = change.New.ActualFileSnapshot.Files.First(); return(oldFile.Body.Md5.Equals(newFile.Body.Md5)); }
public DChange AddFile(DChange change, DFile file, string fileName) { if (change.Old.ActualFileSnapshot.Files.Count > 0) { change = CreateSnapshot(change); } change.New.ActualFileSnapshot.AddFile(file, _personId); return(change); }
public DChange EditObject(Guid objectId) { var objects = _connector.ServerApi.GetObjects(new[] { objectId }); var old = objects.First(); var changed = old.Clone(); var change = new DChange { Old = old, New = changed }; return(change); }
private DateTime GetEffectiveCreated(DChange change) { var now = DateTime.UtcNow; if (!change.New.PreviousFileSnapshots.Any()) { return(now); } var maxCreated = change.New.PreviousFileSnapshots.Max(x => x.Created); return(maxCreated < now ? now : maxCreated.AddMilliseconds(1)); }
public override void ChangingElement(Panel panel, Drinks element, DChange del) { Milk temp = element as Milk; nameBox.Text = element.Name; volume.Value = Convert.ToDecimal(element.Volume); Featness.Value = Convert.ToDecimal(temp.Fatness); this.save.Text = "Change Object"; delToAdd = null; delToChange = del; }
public override void ChangingElement(Panel panel, Drinks element, DChange del) { Lemonade temp = element as Lemonade; nameBox.Text = element.Name; volume.Value = Convert.ToDecimal(element.Volume); CountOfLemons.Value = Convert.ToDecimal(temp.CountOfLemon); this.save.Text = "Change Object"; delToAdd = null; delToChange = del; }
public override void ChangingElement(Panel panel, Drinks element, DChange del) { Cognac temp = element as Cognac; nameBox.Text = element.Name; volume.Value = Convert.ToDecimal(element.Volume); percentBox.Text = temp.PercentOfAlcohol.ToString(); ageBox.Text = temp.Age.ToString(); this.save.Text = "Change Object"; delToAdd = null; delToChange = del; }
public override void ChangingElement(Panel panel, Drinks element, DChange del) { Vine temp = element as Vine; nameBox.Text = element.Name; volume.Value = Convert.ToDecimal(element.Volume); percentBox.Text = temp.PercentOfAlcohol.ToString(); types.SelectedItem = temp.vineType; this.save.Text = "Change Object"; delToAdd = null; delToChange = del; }
public override void ChangingElement(Panel panel, Drinks element, DChange del) { Kvass temp = element as Kvass; nameBox.Text = element.Name; volume.Value = Convert.ToDecimal(element.Volume); ChangingLeavenElement(temp.LeavenType); this.save.Text = "Change Object"; delToAdd = null; delToChange = del; }
private DChange CreateSnapshot(DChange change) { if (change.New.ActualFileSnapshot.IsEmpty()) { change.New.PreviousFileSnapshots.Add(new DFilesSnapshot { CreatorId = change.New.CreatorId, Created = change.New.Created }); } else { change.New.PreviousFileSnapshots.Add(change.New.ActualFileSnapshot.Clone()); } change.New.ActualFileSnapshot.Created = GetEffectiveCreated(change); change.New.ActualFileSnapshot.Reason = "Rvt updated"; change.New.ActualFileSnapshot.CreatorId = _personId; change.New.ActualFileSnapshot.Files.Clear(); return(change); }
public virtual void ChangingElement(Panel panel, Drinks element, DChange del) { }
protected void ChangingElement(Drinks template, DChange del) { del.Invoke(template); }