/// <summary> /// /// </summary> /// <param name="item"></param> public void AddPeriodItem(PeriodItem item) { item.isModified = true; item.position = itemListChangeHandler.Items.Count; item.period = this; itemListChangeHandler.AddNew(item); }
public void setPeriod(PeriodItem item, String excelFile, int rowRef = -1, int colRef = -1, bool remove = false) { this.isPeriod = true; this.periodItem = item; this.excelFileName = excelFile; this.rowRef = rowRef; this.colRef = colRef; this.removePeriodItem = remove; }
public PeriodItem GetCopy() { PeriodItem item = new PeriodItem(); item.name = this.name; item.value = this.value; item.formula = this.formula; item.position = this.position; return(item); }
public bool Contains(PeriodItem periodItem) { foreach (PeriodItem perioditem in this.itemListChangeHandler.getItems()) { if (periodItem.name == periodItem.name) { return(true); } } return(false); }
/// <summary> /// /// </summary> /// <param name="scope"></param> public void SynchronizeDeletePeriodItem(PeriodItem item) { PeriodItem foundItem = this.GetPeriodItem(item.position); if (foundItem == null) { return; } RemovePeriodItem(foundItem); this.isModified = true; }
public PeriodItem getToPeriodItem(string sign) { PeriodItem item = new PeriodItem(); item.name = this.periodName.name; item.value = this.periodToDateTime.ToShortDateString(); if (!String.IsNullOrWhiteSpace(sign)) { item.operatorSign = sign; } return(item); }
public PeriodItem getFromPeriodItem(string sign) { PeriodItem item = new PeriodItem(); item.name = this.name; item.value = this.periodFrom; if (!String.IsNullOrWhiteSpace(sign)) { item.operatorSign = sign; } return(item); }
/// <summary> /// /// </summary> /// <param name="item"></param> public void RemovePeriodItem(PeriodItem item) { item.isModified = true; itemListChangeHandler.AddDeleted(item); foreach (PeriodItem child in itemListChangeHandler.Items) { if (child.position > item.position) { child.position = child.position - 1; } } }
/// <summary> /// Oublier un fils /// </summary> /// <param name="child"></param> public void ForgetPeriodItem(PeriodItem item) { itemListChangeHandler.forget(item); foreach (PeriodItem child in itemListChangeHandler.Items) { if (child.position > item.position) { child.position = child.position - 1; } } item.position = -1; }
/// <summary> /// /// </summary> /// <param name="scope"></param> public PeriodItem SynchronizePeriodItems(PeriodItem periodItem) { PeriodItem foundItem = this.GetPeriodItem(periodItem.position); if (foundItem == null) { foundItem = new PeriodItem(); foundItem.name = periodItem.name; foundItem.value = periodItem.value; foundItem.loop = periodItem.loop; foundItem.formula = periodItem.formula; foundItem.comparator = periodItem.comparator; foundItem.closeBracket = periodItem.closeBracket; foundItem.openBracket = periodItem.openBracket; foundItem.operationGranularity = periodItem.operationGranularity; foundItem.operationNumber = periodItem.operationNumber; foundItem.operationDate = periodItem.operationDate; foundItem.operation = periodItem.operation; AddPeriodItem(foundItem); } else { foundItem.name = periodItem.name; foundItem.value = periodItem.value; foundItem.loop = periodItem.loop; foundItem.formula = periodItem.formula; foundItem.comparator = periodItem.comparator; foundItem.closeBracket = periodItem.closeBracket; foundItem.openBracket = periodItem.openBracket; foundItem.operationGranularity = periodItem.operationGranularity; foundItem.operationNumber = periodItem.operationNumber; foundItem.operationDate = periodItem.operationDate; foundItem.operation = periodItem.operation; UpdatePeriodItem(foundItem); } this.isModified = true; return(foundItem); }
/// <summary> /// /// </summary> /// <param name="item"></param> public void UpdatePeriodItem(PeriodItem item, bool sort = true) { item.isModified = true; itemListChangeHandler.AddUpdated(item, sort); }