Example #1
0
        public static EndpointSqlDto Clone(Endpoint endpoint)
        {
            EndpointSqlDto sqlDto = new EndpointSqlDto
            {
                ApplicationId = endpoint.ApplicationId, EntityId = endpoint.Id,
                Provider      = endpoint.Provider, Referrer = endpoint.Referrer, Requestor = endpoint.Requestor, Responder = endpoint.Responder,
                Login         = endpoint.Login, Logout = endpoint.Logout, Organization = endpoint.Organization, Contact = endpoint.Contact,
                Description   = endpoint.Description, Post = (endpoint.Active) ? (short)1 : (short)0
            };

            return(sqlDto);
        }
Example #2
0
        public static DataTable DataTable(Endpoint endpoint)
        {
            EndpointSqlDto dtoEndpoint      = Clone(endpoint);
            DataTable      dtoEndpointTable = new DataTable {
                TableName = endpoint.GetType().Name
            };
            List <System.Reflection.PropertyInfo> dtoProperties = new List <System.Reflection.PropertyInfo>(typeof(EndpointSqlDto).GetProperties());

            dtoEndpointTable.Columns.AddRange(dtoProperties.Select(p => new DataColumn(p.Name, p.PropertyType)).ToArray());
            dtoEndpointTable.Rows.Add(dtoProperties.Select(p => dtoEndpoint.GetType().GetProperty(p.Name).GetValue(dtoEndpoint)).ToArray());

            return(dtoEndpointTable);
        }
Example #3
0
        public static Endpoint Clone(EndpointSqlDto sqlDto)
        {
            DateTime now      = DateTime.Now;
            Endpoint endpoint = new Endpoint
            {
                ApplicationId = sqlDto.ApplicationId, Id = sqlDto.EntityId,
                Provider      = sqlDto.Provider, Referrer = sqlDto.Referrer, Requestor = sqlDto.Requestor, Responder = sqlDto.Responder,
                Login         = sqlDto.Login, Logout = sqlDto.Logout, Organization = sqlDto.Organization, Contact = sqlDto.Contact,
                Description   = sqlDto.Description, Created = now, Edited = now, Active = (sqlDto.Post > 0) ? true : false
            };

            return(endpoint);
        }