.net

XslCompiledTransform causes grief with Infopath

I am not an infopath developer and this is my first real encounter with XSLT. Lately i've had to work on a project where i need to convert an infopath form uploaded to Sharepoint into html. Once in html we can use any thirdparty library to spit out any desired/supported format we want. What We Do In Code: We create an XslCompiledTrans...

yield break; - crazy behaviour

using System; using System.Collections.Generic; using System.Text; using System.Collections; namespace ConsoleApplication4 { class Program { static void Main (string[] args) { var test1 = Test1(1, 2); var test2 = Test2(3, 4); } static IEnumerable Test1(int v1, int v2) ...

Does a mixed .net/sap system make sense?

This might be a bit vague question, but real life is like this. Our company is rolling out SAP system. I know they now do Web Services so we could simultaneously roll out the .NET thing for anything we know we can do in C#. What are the pitfalls along the way of SAP - .NET integration? I understand that SAP's logic is quite different ...

Rule Evaluation Systems and "not exact" matches (ej: x < 3000)

I am designing a rule evaluation system which need to handle a fact database and certain rules over the database. We currently have a modified version of RETE that works partially right with some drawbacks. The problem is the rules doesn't limit to exact matches but they must also support inequality (as in less than) and other kinds of ...

How do you add a DLL to the GAC from an InstallScript Project in InstallShield?

How do you add a DLL to the GAC from an InstallScript Project in InstallShield? I tried added [GLOBALASSEMBLYCACHE] as a destination to the component, with no luck. It tells me that is not valid data for the destination. ...

Find references to the object in runtime

I have an object, which lives forever. I am deleteing all references I can see, to it after using it, but it still not collected. Its life cycle is pretty sophisticated so I can't be sure that all references been cleared. if ( container.Controls.Count > 0 ) { var controls = new Control[ container.Controls.Count ]; container.Con...

Infopath Master Detail Section Lost after XslCompiledTransform

We have a web application which parses Infopath Xml forms hosted in Sharepoint environment and converts them to Html. We then convert to any desirable format using other third party libraries. I acquire the XmlDocument from sharepoint but when i Transform it using the XslCompiledTransform object I loose the Master/Details Section from ...

detecting if type implements ICollection<T>

Hello, I am trying to check if a type implements the generic Icollection interface, since this is a base interface for any of my generic collections. the below code doesnt work GetType(ICollection(Of)).IsAssignableFrom( objValue.GetType().GetGenericTypeDefinition()) whats a good way of detecting if a type implements a generic in...

How to test which tab is selected in VB.net TabControl

Hi, I have a TabControl with two TabPages and I was wondering what is the best way to test which tab is currently displayed? I'm not sure why I can't figure this one out... ...

XmlAttribute/XmlElement equivalent for JavaScriptSerializer

Is there an equivalent Attribute that can be placed on object Properties in a .NET Class that would perform the equivalent of XmlElement or XmlAttribute? [XmlRoot("objects")] public class MyObjects: List<MyObject> { } [XmlRoot("object")] public class MyObject { [XmlAttribute("name")] public string Name { get; set; } [XmlAttribute...

SelectSingleNode without namespace

I'm using .Net 2.0, and need to SelectSingleNode from my XmlDocument regardless of namespace, as wrong headed as that may sound. to be specific XmlElement slipType = (XmlElement)document.SelectSingleNode("//Provenance1"); will set slipType to null since I don'l know th namespace Provenance1 is in at the time of the query. ...

Correct way to host a *stable* WCF MSMQ windows service

I have an application that uses MSMQ for asynchronous processing of certain things. I use WCF to put messages on to the queue and have a WCF MSMQ listener (a windows service) to receive messages and deal with them. My problem is keeping this stable. What is the correct way to deal with (for example) the queue server (which is a separat...

Where should I put miscellaneous functions in a .NET project?

I found myself having to remove the first line of a string quite often while working on a text parser in C#. I put together a simple function to do that for me, but coming from a PHP background, I have no idea where to put it since I can't define a function outside a class. What's a customary way of doing that in .NET? Do I create a stat...

Sync system time to domain controller using .NET code

I have time based tests to run that require changing the system time multiple times during the test. I want to be able to resync the time to the domain controller time at the end of the test. I there any way to do that using .NET code (C#). I am changing the time using the p-invoke function found in: http://stackoverflow.com/question...

Creating new image from cropped image

I'm currently trying to crop an image, and then save the new image. I have the original image, the x and y co-ordinates of where on that image I want the cropping to being, and the width and height of the new cropped image. Here is my code: Bitmap originalBitmap = new Bitmap(filePath); Bitmap newImage = new Bitmap(width, height); Graph...

How to fetch all hits in lucene.net

Hi, I want to fetch all hits from lucene. Is there any wild card character which fetches all records? ...

SubSonic Active Record

I recently decided to give SubSonic a try in my new project. I really how simple it is to generate all the models and database queries. But I have encountered some problems. But I think it generates the models wrong (Or maybee I need to create simpler relations). For an example; In my database shown in part in the picture below it gener...

In LinqToSql how do you enable change tracking on an entity's custom property?

For other reasons, i've had to create my own property in an Entity in the ORM, which has is a type of another entity (had issues with associations so did it this way instead). The problem is that whenever I make a change to that property, it isn't being flagged as a change so I cannot call SubmitChanges on it. So basically my question ...

MSDTC with Entity Framework

I have an app that is saving to a db (using Entity Framework) and saving documents to Sharepoint in a single save. I'm attempting to use MSDTC with a TransactionScope. Part of my EF insert logic includes passing a list of foreign keys to the data layer. The layer retrieves the "foreign key'd" object from the db and then adds it to t...

Parse js/html string format them nicely

Hi there I m pretty sure there is an open source/free library for .net out there that does this already, so before I reinvent the wheel... I need to grab an some sort of input: could be a file, a string, etc and format it nicely. It will mostly be HTML and javascript, if CSS is supported nice. any ideas? ...