private void UpdateParent(ServiceTypeOld serviceTypeOld) { ServiceTypeOld old = serviceTypeOld.Parent ?? ServiceTypeOld.Null; if (old != ServiceTypeOld.Null) { ServiceTypeDTO dto = new ServiceTypeDTO { Id = old.Id, Code = (int) ((int) old.Code), ShortName = old.ShortName, LongName = old.LongName, Unit = old.Unit, Parent = old.Parent, TypeId = old.TypeId, IsGroup = 1 }; old.SaveChanges(dto); } }
public static ServiceTypeOld AddServiceType(ServiceTypeDTO dto) { ServiceTypeOld old = new ServiceTypeOld(); old.SaveChanges(dto); if (ServiceTypes.FindById(old.Id) == null) { ServiceTypes.Add(old); } return old; }
protected override DataTransferObject GetDataTransferObject() { ServiceTypeDTO edto = new ServiceTypeDTO { Code = System.Convert.ToInt32(this.numCode.Value), ShortName = this.tbShortName.get_Text(), LongName = this.tbLongName.get_Text(), UnloadDbfName = this.tbUnloadDbfName.get_Text(), Unit = this.selectUnit.SelectedFasetItem }; ServiceTypeOld old = (this.bsParentServiceTypes.get_Current() == null) ? ServiceTypeOld.Null : ((ServiceTypeOld) this.bsParentServiceTypes.get_Current()); edto.Parent = old; edto.IsGroup = this.cbIsGroup.get_Checked() ? ((int) 1) : ((int) 0); edto.TypeId = this.selectServiceTypes.SelectedFasetItem.Id; return edto; }