.net-4.0

How to show asp.net chart grouped by 2 parameters

主宰稳场 提交于 2020-01-06 08:46:08
问题 I want to present some condensed data to the user using the Chart component. SQL (C# / Oracle): SELECT c.date, c.approved, count(distinct c.f1) amt_c, count(b.f1) amt_b, sum(b.value) sum_values FROM contracts c JOIN bens b ON c.ben_id = b.id WHERE :YearMonth = to_char(c.date,'YYYYMM') AND NOT c.approved = 'REJECTED' GROUP BY c.date, c.approved ORDER BY c.date I have this SQL in a method that passes a DataSet to the ObjectDataSource in the .aspx page (The approved field can have 3 values:

Cancel Requests on link clicked asp.net

谁说胖子不能爱 提交于 2020-01-06 07:59:46
问题 I have a home page on a website (ASP.NET 4.0 C#) which loads a lot of data every time it is accessed (basically a dashboard). This can (depending on the user) take a while to load, so I broke each section into update panels and load them separately so that the user can see it loading and not just think it the page has frozen. However this presents new issues because if the user does not want to wait and clicks on the navigation menu (or a link) to a different page, they have to wait until the

Sound not playing in my application

心已入冬 提交于 2020-01-06 04:43:25
问题 I am running 1 background process in my application...it continuously checks for some input...When proper input is entered of found..It will play Some wav file.. I have added 1 wav filled named as "ding.wav" into Resources.. and i have written following code in my application... I am using System.Media namespace. and using .Net 4.0 SoundPlayer player = new SoundPlayer(); player.Stream = Properties.Resources.ding; player.Play(); but sound is not playing... Can you tell me what i am doing wrong

Messaging problem using MVVM-Light

六月ゝ 毕业季﹏ 提交于 2020-01-06 03:32:26
问题 Initially I wanted to pass an "ObservableCollection< customClass>" between two VMs , but even simple messaging isn't working for me. MainViewModel private void openNewSpecialCustomer() { GalaSoft.MvvmLight.Messaging.Messenger.Default.Send("Musaab"); Console.WriteLine("send done"); AddNewSpecialCustomer a = new AddNewSpecialCustomer(); _dialogService.showDialoge(a); } AddNewSpecialCustomerViewModel public AddNewSpecialCustomerViewModel() { GalaSoft.MvvmLight.Messaging.Messenger.Default

Diagnosing MissingMethodException

不想你离开。 提交于 2020-01-06 02:58:58
问题 When starting up my application on one machine it immidiately exits saying it has "stopped working". In the event log I see a MissingMethodException being the cause. There is no exception dialog displayed, and in the event log details I can't see any detailed error message (containing e.g "Method not found: xyz"). The event handler information says (tried to translate this back to english here, may not be verbatim) Application: Myapp.exe Framework-version v4.0.30319 Description: The process

AutoGenerate Identity Negative PK in EF4

被刻印的时光 ゝ 提交于 2020-01-05 07:30:12
问题 I am using EF 4.4.0.0 and following custom methods for generating identity negative PK: private int? GetMinId() { return Context.ENTITY.Min(c => (int?)c.Id); } public int GenerateNegativeId() { var minId = GetMinId() ?? default(int); if (0 < minId) return minId * -1; if (0 > minId) return --minId; return -1; } Could you explain how to AutoGenerate Identity Negative PK ids. (Is it possible?) Thank you 回答1: This is not possible, because identity generation happens on the database side. Why do

How to validate C# code?

若如初见. 提交于 2020-01-05 07:26:07
问题 I'm working on a WPF application that validates C# code from files. I was able to get the file and, for a different need, instantiate its type. Now what I need is validate that code against some criteria I set. What do I mean? Let's say I have a file "Test.cs" and this file has the following code: using xpto; using abcd; public class Test { public static void Testing() { Iqueryable<XYZ> var1 = ctx.Where(c => c.IdSomething == number); var1 = var1.Where(v => v.Count(x => x.ValZ) > 0); } } In my

Can't show class with interface properties in PropertyGrid

别来无恙 提交于 2020-01-05 07:05:14
问题 Currently i'm trying to configure some of my classes through the PropertyGrid. Now i have some problems about showing the value (the right side within the grid) if the class provides the property as an interface. I thought, cause the grid uses reflection it would take the real type and uses it's normal ways on showing the value within the grid. For a demonstration simply take the class hierarchy below and create a simple form with a PropertyGrid and put the object into it by calling

Converting string array to int

你离开我真会死。 提交于 2020-01-05 05:47:07
问题 I'm having a weird problem, trying to take a string from a string array and convert it to an integer. Take a look at this code snippet: string date = "‎21/‎07/‎2010 ‏‎13:50"; var date1 = date.Split(' ')[0]; string[] dateArray = date1.Split('/'); string s = "21"; string t1 = dateArray[0]; bool e = string.Compare(s, t1) == 0; //TRUE int good = Convert.ToInt32(s); //WORKING! int bad = Convert.ToInt32(t1); //Format exception - Input string was not in a correct format. Can someone please explain

how to cancel Task quicker

放肆的年华 提交于 2020-01-04 13:43:36
问题 I have a Windows Service which starts a task on start up This task which has a while loop and after performing one iteration it go to sleep for 5 minutes. When I stop service, the task is cancelled first and later some other operations gets performed if the task is in sleep, it get cancelled only when it wakes up , i want it to be cancelled even if it is sleeping and don't want to wait for waking it up. following is the code Task controllerTask = Task.Factory.StartNew(() => { var interval =