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

C#

 
AnswerRe: how make textbox or masked textbox take month and year only such as "mm/yyyy" Pin
Manfred Rudolf Bihy5-Dec-10 6:14
professionalManfred Rudolf Bihy5-Dec-10 6:14 
AnswerRe: how make textbox or masked textbox take month and year only such as "mm/yyyy" Pin
Nabawoka5-Dec-10 11:06
Nabawoka5-Dec-10 11:06 
AnswerRe: how make textbox or masked textbox take month and year only such as "mm/yyyy" Pin
Eddy Vluggen5-Dec-10 12:01
professionalEddy Vluggen5-Dec-10 12:01 
QuestionWeb Browser Tab Control problem Pin
nawoc5-Dec-10 5:06
nawoc5-Dec-10 5:06 
AnswerRe: Web Browser Tab Control problem Pin
Luc Pattyn5-Dec-10 7:46
sitebuilderLuc Pattyn5-Dec-10 7:46 
GeneralRe: Web Browser Tab Control problem Pin
nawoc5-Dec-10 9:42
nawoc5-Dec-10 9:42 
GeneralRe: Web Browser Tab Control problem Pin
Luc Pattyn5-Dec-10 9:44
sitebuilderLuc Pattyn5-Dec-10 9:44 
QuestionShould I be using inhertance for this? Pin
Jacob D Dixon4-Dec-10 15:26
Jacob D Dixon4-Dec-10 15:26 
Well I am sad to say that I have usually avoided inheritance because I don't have a full understanding of it and/or I haven't yet found a good use for it.

So my newest learning project is a client / server (have been posting about it you may notice alot). A brief overview of what I have been doing is passing my custom object over TCP. My custom object is a seperate DLL project.

Erik didn't like it but to be honest I haven't came up with a better way or fully understood. AFter reviewing hie article that he pointed me to I'm just wondering if I should be using a interface and/or inheritance.

Here is my Commons object:

[Serializable]
public class Commons
{
    public Commons()
    {
        TimeStamp = DateTime.Now;
    }

    public enum Tasks
    {
        CHECKIN,            // Checkin which updates the checkin time of agents (Default)
        DISKDRIVE,          // So the agent / server will update the disk dives
        DRIVEINFO,          // So the agent / server will update the drive info
        FAN,                // So the agent / server will update the fan info
        MESSAGE,            // Used by server to send message to agent
        PHYSICALMEMORY,     // So the agent / server will update the physical memory info
        PRINTERS,           // So the agent / server will update the printers
        PROCESSES,          // So the agent / server will update the processes
        REGISTER,           // So the agent / server will register a new agent
        SERVICES,           // So the agent / server will update the services
        SOFTWARE,           // So the agent / server will update the software

        // Commands
        ADD_CMD,            // * Used by control center to add agent command
        CLOSECD,            // Causes the agent to close the CD ROM
        GET_ALL,            // * Used by control center to get all information on a certain agent
        REBOOT,             // Causes the agent to reboot
        OPENCD,             // Causes the agent to open the CD ROM
        SHUTDOWN            // Causes the agent to shutdown
    }

    /// <summary>
    /// The task we are performing
    /// </summary>
    public Tasks Task { get; set; }

    /// <summary>
    /// The tasks we are adding to memory
    /// </summary>
    public Tasks AddTask { get; set; }

    /// <summary>
    /// Time stamp this object was created
    /// </summary>
    public DateTime TimeStamp { get; set; }

    public string AgentId { get; set; }             // This must be set
    public string Netbios { get; set; }
    public string IpAddresses { get; set; }
    public string PhysicalAddresses { get; set; }
    public string Message { get; set; }

    public int LocationID { get; set; }

    // ***************************************
    // Holds the arrays of what is being updated
    // These can be null.
    // If the task is set to PROCESSES then the Processes array should
    // be populated
    public Software[]   Software { get; set; }
    public Services[]   Services { get; set; }
    public DiskDrive[]  DiskDrive { get; set; }
    public DrivesInfo[] DriveInfo { get; set; }
    public Memory[]     Memory { get; set; }
    public Printers[]   Printers { get; set; }
    public Processes[]  Processes { get; set; }
    public Fan[]        Fan { get; set; }
}


Now those other classes look like this:
[Serializable]
public class Printers
{
    public string PrinterName { get; set; }
    public string PaperSizes { get; set; }
    public string PrinterResolutions { get; set; }

    public bool SupportsColor { get; set; }
    public bool IsDefaultPrinter { get; set; }
    public bool CanDuplex { get; set; }
    public bool IsPlotter { get; set; }
}


So getting an idea of what I'm trying to do, I am wondering if a situation like this will best serve using a interface and/or inheriting a class? I get the idea, you implement a interface, you inherit a class.. but like I said I haven't put together a good use for something I'm trying to do.

Now what I am doing with this data once it reaches the server is inserting it into SQL. If a client gets the TASK == PRINTERS, then it will perform a lookup using WMI of all local printers, poopulate the Printers[] array and send back to the server. So server gets the TASK == PRINTERS and see the Printers[] array is populated and proceeds to insert that data into SQL.

Sorry if this question is kind of broad.
AnswerRe: Should I be using inhertance for this? Pin
PIEBALDconsult4-Dec-10 16:30
mvePIEBALDconsult4-Dec-10 16:30 
GeneralRe: Should I be using inhertance for this? [modified] Pin
Jacob D Dixon4-Dec-10 17:14
Jacob D Dixon4-Dec-10 17:14 
GeneralRe: Should I be using inhertance for this? Pin
PIEBALDconsult5-Dec-10 3:49
mvePIEBALDconsult5-Dec-10 3:49 
GeneralRe: Should I be using inhertance for this? Pin
Jacob D Dixon5-Dec-10 4:15
Jacob D Dixon5-Dec-10 4:15 
GeneralRe: Should I be using inhertance for this? Pin
PIEBALDconsult5-Dec-10 8:53
mvePIEBALDconsult5-Dec-10 8:53 
GeneralRe: Should I be using inhertance for this? Pin
Jacob D Dixon6-Dec-10 16:17
Jacob D Dixon6-Dec-10 16:17 
GeneralRe: Should I be using inhertance for this? Pin
Spectre_0016-Dec-10 2:33
Spectre_0016-Dec-10 2:33 
AnswerRe: Should I be using inhertance for this? Pin
nortee5-Dec-10 21:29
nortee5-Dec-10 21:29 
AnswerRe: Should I be using inhertance for this? Pin
Steve Naidamast6-Dec-10 3:04
professionalSteve Naidamast6-Dec-10 3:04 
AnswerRe: Should I be using inhertance for this? Pin
mbb016-Dec-10 22:05
mbb016-Dec-10 22:05 
GeneralRe: Should I be using inhertance for this? Pin
nortee6-Dec-10 23:21
nortee6-Dec-10 23:21 
GeneralRe: Should I be using inhertance for this? Pin
Jacob D Dixon8-Dec-10 3:46
Jacob D Dixon8-Dec-10 3:46 
AnswerRe: Should I be using inhertance for this? Pin
James Lonero8-Dec-10 8:41
James Lonero8-Dec-10 8:41 
QuestionMessage Removed Pin
4-Dec-10 13:27
SRJ924-Dec-10 13:27 
AnswerRe: Game Creation Pin
Luc Pattyn4-Dec-10 13:56
sitebuilderLuc Pattyn4-Dec-10 13:56 
GeneralRe: Game Creation Pin
SRJ924-Dec-10 14:09
SRJ924-Dec-10 14:09 
GeneralRe: Game Creation Pin
Luc Pattyn4-Dec-10 14:16
sitebuilderLuc Pattyn4-Dec-10 14:16 

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.