.net

C# Business objects and collections

I'm having difficulty wrapping my head around business objects or more specifically, business object collections. Here's a quick example of what i'm trying to do. If i have an Incident Object, this object can have a number of people involved and each of those Person objects can have multiple notes. Notes can't exist without a Person ob...

Create dynamic report

Hi all, I need to create a dynamic report. The report needs to allow: Before the report generation * add unknown number of images with text note. After the report generation: * remove image by right click. * edit the text note by clicking on it. Somebody knows about some report for C# that has those options? thanks, Ofir ...

Html.DeleteActionLink helper

Hi all, I have a link to delete action using Jquery dialog confirm message. Clicking on delete link, a modal popup is showing with a confirmation question. Button Yes is triggered to submit the form with id = Model.Id <td> <% using (Html.BeginForm<AssessorActionPlanController>( c => c.Delete(Model.Id), FormMethod.Post, n...

How to serialize object to text WITH type info?

I want to serialize objects to text, but I want to preserve the type info so that I may deserialize without a reference to the type object. XML Serialization gives me the text I want, but does not keep the type info. What I've read about binary serialization is that it keeps the type info, but its not readable. Looks like the SoapForm...

PageMethods exception details

I have quite a big project and it is all done using pagemethods. Code behind is basically just to serve and handle the data. Everything works perfect, except for one thing - I recently created a custom exception class that I want to use for more user friendly reports and even possible actions. For this purpose, I inherited the exception ...

c# on .net 3.5 SP1 System.Security.Principal.WindowsIdentity.GetCurrent().Name returns names in different order? [Closed - configruation error]

Hello everyone, i am working on a windows forms .net 3.5 project in c# and the project uses the following line to get the current user: Created_By = System.Security.Principal.WindowsIdentity.GetCurrent().Name; On one box the result is hostname\username but on my box the result is username\hostname. Both boxes run Windows 7 Ultimate. ...

How to migrate ugly and undocumented VB6 Code to .NET

I know that there are already Questions about VB6 migration, but the code base of my project brings some new questions here. I have to say the Code quality, structure and architecture is just a nightmare. There are 2 Big Projects: Nr.1 with 40 Forms, 40 Modules and a few class files, this EXE is kind of a "base system". Nr.2 with 80 For...

What .net mechanism should be used to communicate between a web service and an http handler?

The scenario is as follows: a device (not a PC) makes an HTTP request to a server and passes in identifying information in the http headers. The http handler on the server receives the request and keeps it open (implementing a long poll type mechanism). At some point, a user running a desktop app invokes some UI that causes information t...

How to refresh (i.e. clear text from) an autocompletebox once an item has been selected?

Hello, I'm designing a Silverlight screen where I use an autocompletebox control. One the item 'foobar' has been selected in the autocompletebox, it's text reads 'foobar'. If a user wants to select the 'quux' value, he has to: delete the text from the control, then to type 'qu' so as to be able to select 'quux'. Is there a way to ...

Custom ComboBox control inside other custom ComboBox control, how to bind Items?

I created two custom ComboBox controls, both inherit from the default ComboBox control. public BlueComboBox : ComboBox {} public WhiteComboBox : ComboBox {} BlueComboBox contains a template and is styled properly and works perfectly. WhiteComboBox is a bit more complex. It contains a template consisting of a TextBlock and a BlueComboB...

bind datagrid to collection

how do I bind a DataGrid to a collection ? (e.g : List ). i used this : Datagrid dg = new Datagrid(); dg.DataSource = myCollection; dg.DataBind(); but after this, the Datagrid still doesn't display the data from the collection. ...

Calculating the difference between 2 times, and then compare the difference to see if it is less than 5 minutes.

hey guys, I want to calculate the difference between two times and then compare difference is less than 5 MIN.. Please note I want difference in min. using c#.net ...

Determining casting of an object

Hi , I have the code below RssFeedReader rss = (RssFeedReader)this.ParentToolPane.SelectedWebPart; My problem is only at run time do I know if 'this.ParentToolPane.SelectedWebPart' is of type RssFeedReader or of type 'RssCountry' How would I check the object type and cast it appropriatley? Many Thanks, ...

How do I work with shared assemblies and projects?

To preface, I've been working with C# for a few months, but I'm completely unfamiliar with concepts like deployment and assemblies, etc. My questions are many and varied, although I'm furiously Googling and reading about them to no avail (I currently have Pro C# 2008 and the .NET 3.5 Platform in front of me). We have this process and it...

Cost Factor in Software Development

For a single developer, who is developing a .NET application, what is the difference in cost between: Linux, using MonoDevelop, Mono Framework, and Apache, and Windows XP Pro, using Visual Studio 2008, SQL Server 2005, and IIS 6.0 [Note: Edited heavily. If I've changed the meaning, feel free to roll back. - Jon] ...

Debug problem with asp.net VS2005

hi, I'm having troubles with an asp.net 2.0 application that I took over from other developers (meaning I don't really know much of the code). It is throwing an unhandled exception, but I cannot get any source info where exactly the exception occurs, and debug stepping through the source suddenly ends with the only option of showing dis...

Is there a way to view only the instance methods of an object in Visual Studio's Intellisense?

If I go to visual studio and type MyEnumerable., I'll see a list of all the methods that can executed from that object. This list shows extension methods as well, which is great, but is there a way (a keboard shortcut?) to narrow this list down to not include extension methods? ...

IoC and constructor over-injection anti-pattern resolution

This question is a result of a post by Jeffery Palermo on how to get around branched code and dependency injection http://jeffreypalermo.com/blog/constructor-over-injection-anti-pattern/ In his post, Jeffery has a class (public class OrderProcessor : IOrderProcessor) that takes 2 interfaces on the constructor. One is a validator IOrder...

Finding HTML strings in document - Regex - C#

I want to get all HTML <p>...</p> in a document. Using Regex to find all such strings using: Regex regex = new Regex(@"\<p\>([^\>]*)\</p\>", RegexOptions.IgnoreCase); But I am not able to get any result. Is there anything wrong with my regular expression.? For now, I just want to get everything that comes in between <p>...</p> tags a...

UniTransaction throwing NullReferenceException

I'm trying to begin a transaction however on calling the .Begin() method throws a NullReferenceException and the stacktrace shows that it is coming from IBMU2.UODOTNET.UniTransaction.ServerTransaction(Int32 aKey). Has anyone successfully used UniTransaction, if so is there something that i'm missing? // note: Session is already connec...