public static MarketSegmentContract ToMarketSegmentContract(MarketSegment segment) { MarketSegmentContract contract = null; if (segment != null) { contract = new MarketSegmentContract(); contract.Key = segment.Key; contract.Code = segment.Code; contract.Name = segment.Name; contract.ParentSector = Converter.ToMarketSectorContract(segment.ParentSector); } return contract; }
public static MarketSegment ToMarketSegment(MarketSegmentContract contract) { return (contract != null ? new MarketSegment(contract.Key, Converter.ToMarketSector(contract.ParentSector), contract.Name, contract.Code) : null); }
private void AddMarketSegment(MarketSegmentContract segment) { string query = string.Format("INSERT INTO MarketSegment (MarketSegmentID,MarketSectorID,Code,MarketSegmentName) VALUES ({0},{1},'{2}','{3}');", segment.Key, segment.ParentSector.Key, segment.Code, segment.Name); this.database.ExecuteNonQuery( this.database.GetSqlStringCommand(query)); }