예제 #1
0
        public void AddOrReplaceLookupDetail(LookupDetail entity)
        {
            LookupDetail selectedItem = null;
            int          index        = 0;

            foreach (var item in _lookupDetails)
            {
                if (item.Id == entity.Id)
                {
                    selectedItem = item;
                    break;
                }
                index++;
            }

            if (selectedItem == null)
            {
                entity.Lookup   = this;
                entity.LookupId = this.Id;
                _lookupDetails.Add(entity);
            }
            else
            {
                entity.Id       = selectedItem.Id;
                entity.Lookup   = this;
                entity.LookupId = this.Id;

                entity.CompanyId   = selectedItem.CompanyId;
                entity.CreatedBy   = selectedItem.CreatedBy;
                entity.CreatedDate = selectedItem.CreatedDate;
                entity.UpdatedBy   = selectedItem.UpdatedBy;
                entity.UpdatedDate = selectedItem.UpdatedDate;

                selectedItem          = entity;
                _lookupDetails[index] = selectedItem;
            }
        }
예제 #2
0
        public void RemoveLookupDetail(LookupDetail entity)
        {
            var selectedItem = _lookupDetails.FirstOrDefault(e => e.Id == entity.Id);

            _lookupDetails.Remove(selectedItem);
        }
예제 #3
0
        public void AddOrReplaceLookupDetail(string name, string value, bool isEditable)
        {
            var lookupDetail = new LookupDetail(name, value, isEditable, this);

            _lookupDetails.Add(lookupDetail);
        }