.net

c# DateTime Add Property without extension Method

I am writing a class library where i need to extend System.DateTime to have a property called VendorSpecificDay such that DateTime txnDate = DateTime.Today; VendorSpecificDayEnum vendorDay = txnDate.VendorSpecificDay; public enum VendorSpecificDayEnum { Monday, Tuesday, ShoppingDay, HolidayDay } I realize that this is a perfe...

How to Play .WAV in .Net Compact Framework (Datalogic Memor) Windows CE 5.0?

I have a Data logic Memor with Windows CE 5.0 on my Applications i used only Message Box and Color Changing Labels for My Validation and Error Handling. Now my problem is that i need to play .wav file on validation so even users do not need to look on screen every time they used the Scanner. I tried this link http://msdn.microsoft.co...

best practice for avoid connection timeout when using LINQ to SQL

i need to know best practice for avoid connection timeout when using LINQ to SQL in .net applications specially when returning IQueryable<T>from data access tiers or layers. I get "Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in us...

EF POCO - Unable to infer a key for entity type?

I have a POCO class, mapping to a table that basically contain three primary keys as follow: public class ContactProjectSite { public int ContactID { get; set; } public int ProjectID { get; set; } public int SiteID { get; set; } public virtual Contact Contact { get; set; } public virtual Proj...

Providing a ReadOnly PropertyDescriptor to an Object

I've setup my class to inherit from ICustomTypeDescriptor I've also then setup this method for the GetProperties implementation for the inheritance. Public Class POSTerminal Inherits BasePacket Implements ICustomTypeDescriptor Public Function GetProperties(ByVal attributes() As System.Attribute) As System.ComponentModel.Prope...

.NET proxy/loader application architecture

I want to launch a WPF App, in a 2nd AppDomain, from a 'loader' class. If the WPF App times itself out, I want it to fire an event back to the loader class and the loader class will Unload() the the 2nd AppDomain and show a login screen. If the user logs back in, the same process will repeat. I have this working to a degree by : Loa...

MVC Downcasting to base class Strongly typed view

I have the following entity object: public class ForumPost { public virtual int ForumPostId { get; set; } public virtual int LoginId { get; set; } public virtual string Body { get; set; } ... Then I have a page that has a list of ForumPost(s) and and edit option, all on one page. I've created a CommentsVie...

Creating a queryable property for a linq to sql entity

I have a simple table structure in SQL Server: One table storing a list of Bikes (Bikes) and a second table storing a historical list of the bike's owners (Owners). Using Linq 2 SQL I generated a model that gives me a 'Bike' entity with a 1 to many relationship to 'Owner' called 'HistoricalOwners'. So far so good... Now I have many q...

What is the best book or study material to study POCO in asp.net?

What is the best book to study Plain Old CLR Object (POCO) in .NET? ...

How to use tricks in combination of "IF" conditions?(C# ASP.NET)

I have four checkboxes in my form. I have string variable called "CheckedString". If i check the first checkbox "A" must be assigned to "CheckedString". If i select both first and second checkbox at a time. "AB" must be assigned to "CheckedString". If i select third and fourth checkbox "CD" must be assigned to "CheckedString".So that sev...

Loading an Assembly fails because of incorrect format

Hi, I develop on a pretty big windows forms .net (C#) application with several assemblys. Originally each assembly was build for the Target Platfom "Any CPU". Due to a problem with Crystal Reports on x64 machines we had to build the whole project for x86 target platform. I startet rebuilding some of our Projects for x86 and it worked j...

Windows filtering platform (WFP), and ip forward

Hi, my problem is this, I have a pc (windows 2008 server) that is the gateway, well with wfp I'd like to get all packed addressed to port 80 from other pc and switch to port 8080 where a proxy is hearing... well I have already installed WDK and C++ Express can you give me some help or link or book, the only think I've found is this ...

Better way to filter records on a grid as user types few letters.

My standalone Windows app. is written on C# 2008 and back-end is MySQL 5.1. In a Windows Form, I have a TextBox control on top and a DataGridView below. Initially, as the Form loads, the DataGridView is filled with Item Names of products in sorted order. As and when the user starts typing few letters in the TextBox, the records in the D...

LINQ where using index in query language

Is there anu posibility to write this using query language ... not method chain? notifications.Where((n, index) => n.EventId == m_lastSelectedEventID) .Select((n, index) => new {Position = index}).FirstOrDefault(); Thanks, Radu ...

how to send a json object from java to a .net client?

hi, from my android client i am sending a json to string object.but the .net client is getting it as empty string. here is my code. HttpPost request = new HttpPost(SERVICE_URI+"/save"); JSONStringer json = new JSONStringer() .object() .key("cno").value("2000") .key("cname").value("HI") .key("cmail").value("HI") .key("cphno").value("...

How do I read a Foxpro 8.0 database from c#?

I need to import tables from foxpro 8.0 to sql server. How do I read the tables & schema from a foxpro directory/files in C# so I can create the tables in SQL Server and copy the data over? ...

MVC Ajax.BeginForm

I have an ajax form like so: <% using (Ajax.BeginForm("Comments", "Comments", null, new AjaxOptions {UpdateTargetId="main", OnSuccess="createSuccess" }, new{ @id="main"})) {%> <%: Html.ValidationSummary(true, "errors") %> <fieldset> <legend>Fields</legend> <div class="editor-label"> <%: Html.Lab...

Filtering list returned by NetworkInterface.GetAllNetworkInterfaces

The NetworkInterface.GetAllNetworkInterfaces method returns a list of all interfaces on the system, but it returns a lot of seemingly garbage interfaces too like xxxx::xxxx:xxxx:xxxx:xxxx%12 ::1 in addition to "normal" ones like 127.0.0.1 192.168.0.3 etc I only want keep these "normal" ones. What criteria (properties, methods) sh...

how to copy from text box to struct C#

I need to copy the strings from text box to struct. is there any way to do it? here's what am trying: public unsafe struct mystruc { public byte[] install_name; // size limit 32 bytes public byte[] install_id; // size limit 4 bytes public byte[] model_name; // size limit 4 bytes }; private void read_b_Click(object sende...

Invoking UI thread from BeginGetResponse in Silverlight

Hi guys I know how to do this in everyday .NET, but mucking round with WP7 development and Silverlight is driving me mad. An HttpWebRequest response must be done async, cool with that, but how can I invoke the UI thread from the async method? i.e. HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create('http://stackoverflow.com...