Click here to Skip to main content
15,896,557 members
Home / Discussions / C#
   

C#

 
GeneralRe: Null array in a dictionary Pin
OriginalGriff12-Jul-13 3:37
mveOriginalGriff12-Jul-13 3:37 
GeneralRe: Null array in a dictionary Pin
Richard Deeming12-Jul-13 1:50
mveRichard Deeming12-Jul-13 1:50 
AnswerRe: Null array in a dictionary Pin
Jay Nardev12-Jul-13 1:11
Jay Nardev12-Jul-13 1:11 
QuestionRead Minidumps through Native Code Pin
Zach.Saunders11-Jul-13 6:02
Zach.Saunders11-Jul-13 6:02 
AnswerRe: Read Minidumps through Native Code Pin
Eddy Vluggen11-Jul-13 8:32
professionalEddy Vluggen11-Jul-13 8:32 
GeneralRe: Read Minidumps through Native Code Pin
Zach.Saunders11-Jul-13 9:52
Zach.Saunders11-Jul-13 9:52 
GeneralRe: Read Minidumps through Native Code Pin
Mycroft Holmes11-Jul-13 14:01
professionalMycroft Holmes11-Jul-13 14:01 
GeneralRe: Read Minidumps through Native Code Pin
Zach.Saunders11-Jul-13 15:33
Zach.Saunders11-Jul-13 15:33 
GeneralRe: Read Minidumps through Native Code Pin
Eddy Vluggen14-Jul-13 2:59
professionalEddy Vluggen14-Jul-13 2:59 
QuestionLatest built installer for a project doesn't show up in Add/Remove Programs Pin
stingray2711-Jul-13 2:59
stingray2711-Jul-13 2:59 
AnswerRe: Latest built installer for a project doesn't show up in Add/Remove Programs Pin
stingray2711-Jul-13 4:14
stingray2711-Jul-13 4:14 
GeneralRe: Latest built installer for a project doesn't show up in Add/Remove Programs Pin
stingray2712-Jul-13 1:53
stingray2712-Jul-13 1:53 
QuestionRemove / delete MemoryMappedFile Pin
Member 333503211-Jul-13 1:32
Member 333503211-Jul-13 1:32 
AnswerRe: Remove / delete MemoryMappedFile Pin
Garth J Lancaster11-Jul-13 1:54
professionalGarth J Lancaster11-Jul-13 1:54 
GeneralRe: Remove / delete MemoryMappedFile Pin
Member 333503211-Jul-13 2:01
Member 333503211-Jul-13 2:01 
QuestionDesign Question Pin
Kevin Marois10-Jul-13 16:07
professionalKevin Marois10-Jul-13 16:07 
What's the best way to notify the front end of a business rule or possible FK violation? For example, I have a lookup called PayType, and so far my DeletePayType looks like this:

public static void DeletePayType(int PayTypeId)
{
    using (var dc = getDataContext())
    {

        bool inUse = isPayTypeInUse(PayTypeId);

        if (inUse)
        {
            //TODO: Handle this differently
            throw new Exception("Pay Type is in use and cannot be deleted");
        }
        else
        {
            var payType = (from ca in dc.PayTypes
                            where ca.PayTypeId == PayTypeId
                            select ca).FirstOrDefault();

            if (payType != null)
            {
                dc.PayTypes.DeleteOnSubmit(payType);

                try
                {
                    dc.SubmitChanges();
                }
                catch (Exception e)
                {
                    throw e;
                }
            }
        }
    }
}


Throwing an exception doesn't seem right, but I need the client to know that the pay type is in use and can't be deleted.

Thanks
If it's not broken, fix it until it is

AnswerRe: Design Question Pin
Mycroft Holmes10-Jul-13 17:16
professionalMycroft Holmes10-Jul-13 17:16 
GeneralRe: Design Question Pin
Kevin Marois10-Jul-13 17:31
professionalKevin Marois10-Jul-13 17:31 
GeneralRe: Design Question Pin
Mycroft Holmes10-Jul-13 18:22
professionalMycroft Holmes10-Jul-13 18:22 
GeneralRe: Design Question Pin
Kevin Marois10-Jul-13 18:58
professionalKevin Marois10-Jul-13 18:58 
GeneralRe: Design Question Pin
Mycroft Holmes10-Jul-13 19:34
professionalMycroft Holmes10-Jul-13 19:34 
GeneralRe: Design Question Pin
Kevin Marois10-Jul-13 19:57
professionalKevin Marois10-Jul-13 19:57 
GeneralRe: Design Question Pin
Freak3010-Jul-13 21:23
Freak3010-Jul-13 21:23 
GeneralRe: Design Question Pin
jschell11-Jul-13 8:47
jschell11-Jul-13 8:47 
GeneralRe: Design Question Pin
Mycroft Holmes11-Jul-13 12:50
professionalMycroft Holmes11-Jul-13 12:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.