What Are The Features Of The Controller Class In The MVC Design Pattern
Aug 13, 2009
In the MVC design pattern we must use a controller(s) classes.
What are the fucntions (features) of the controller apart from handling communication bewteen Model and View?e.eg; can we include input validation code in the controller?
View 4 Replies
ADVERTISEMENT
Jul 7, 2009
In teh MVC design pattern, Controller is strongly related to the view (GUI). IN my application i need to generated a new BrandID, i used stored procedure to retreive the highest BrandID from teh DB (The model calls the stored procedure and sends the retreival value to the Controller), then in the controller increments the BrandID by "1" to create a new brand ID. SInce, controller is strogly related to "view", should i include this "brandID increment" part in teh controller or in the model classes?
View 3 Replies
Jun 4, 2012
Using VB.Net, I'm looking for best practices in dealing with the following idiom:[code]What I really want is something VB.Net doesn't offer -- additional and simultaneous iterators on For Each statements.[code]I'm interested in both Linq and non-Linq recommendations, comments about Copy method design, comparisions to C# or other languages.
View 3 Replies
Mar 4, 2012
I am working on a parser for a serial data protocol. I have an overarching Packet class, a couple sub-classes such as CommandPacket and StatusPacket, and then a few sub-classes of each of those:
[Code]..
While I don't think it is entirely relelvant to the discussion, I am doing this in VB.NET. There is also a similar (but not quite the same) question posted here: Java - subclass validation design pattern
View 2 Replies
Feb 21, 2010
What is the proper design pattern for custom events in .NET (VB or C#).
I am refering to custom events, where in you override the AddHandler, RemoveHander, and RaiseEvent methods.
View 1 Replies
Mar 12, 2012
I've been studying design patterns off-and-on now for a project I've recently been working on. I've been fortunate with this last one not to have to work with databases, but will soon have an opportunity.
View 8 Replies
Jul 23, 2009
I'm trying to replicate a design pattern used in a graphical programming language called LabVIEW. One thread produces commands, and another thread, or series of threads, consumes the commands.This is very similar to using Queues in VB...but there doesn't seem to be an easy way to start the consumer thread when new items are added to the queue.
Here is what I would like to accomplish, please let me know if there is a straightforward way to accomplish this with out of box .Net functionality.1) Start the Consumer Thread...it sits idle, waiting for some new commands to appear in its Queue.2) Producer places a few commands into the Queue. Example: "Home X Axis", "Home Y Axis", "Initialize Pump", "Display Ready Message"3) Consumer thread 'wakes up' at seeing the new commands, then performs the 4 tasks specified in 2.4) Consumer thread goes 'idle' again, and simply waits for new commands to appear in the Queue.
Process can continue on and on forever. The main problem I see with Queues is that there is no 'Wait for Something to Appear in Queue then Retrieve it" functionality. I don't want to use a perpetual loop to keep checking ever n milliseconds.
View 1 Replies
Apr 18, 2012
With C# anonymous delegates, we can avoid declaration of extra method, I know in VB.NET they're not available, but is there a design pattern that I can use so that I can avoid writing an extra method each time? I need it for SPSecurity.RunWithElevatedPrivileges which will be used a lot of times in our code.
[Code]...
View 1 Replies
Jan 30, 2012
Suppose I have two events:
Public Sub Control1Updated() Handles control1.TextChanged
control2.Text = SomeFunction(control1.Text)
End Sub
[code]....
Basically the pairs of {control1.Text, control2.Text} and {control2.Text, control1.Text} should be the same. If control1.Text is changed to let's say "a" then control2.Text is ALWAYS "b". If control2.Text is changed to "b" then control1.Text is ALWAYS "a". How do I achieve this with events without going into an infinite loop? [the best I can think of is to make a check if the other control.Text is already the desired value].
View 1 Replies
Jun 15, 2012
I have a winform which allows people to edit data from a database, to simplify things assume there is a Customer table in database with 3 fields - Name, City, Country. Through winform(s) people can Add/Edit/Delete customers.For each of these actions we need to save:
What the field names are (Name,City,Country in this case)What the field values were before they were modified What the field values are after they are modified.If the action is Add or Delete then 2 and 3 will be the same.I have already implemented this using XMLSerialisation (but not using any of the design patterns) and my XML output looks like this.
<?xml version="1.0" encoding="utf-8"?>
<ActivityItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<UserID>26</UserID>
<FormTitle>frmCustomer</FormTitle>
[code]....
The solution can handle different areas of the system with different number of fields (i.e the same thing works when you are modifying Products for instance).is there a well defined design pattern to deal with this kind of behavior?
View 2 Replies
Sep 5, 2009
having difficulty with understanding object lifetime / instantiation.I have a windows from with a datagridview and a panel. The datagridview has a checkbox column and a list of names which is populated from a database.The panel has a few text boxes (e.g. name, age, favourite sports team) and a 'save changes' button.
The idea is that when the user selects a person in the datagridview by checking the appropriate checkbox then the panel shows the relevant data for that person (name, age, fav sports team) by pulling the data from a database. If the user would like to update the person's details they can do so by typing in the textboxes and then clicking the 'save changes' button. All quite simple so far.
The way I have designed this is to have a 'panel' class and to create an instance when the user checks a checkbox.(NB - the reason I have created a 'panel' class is that I intend to replicate the datagridview and panel on other tabpages within my form and thought it would be useful to have a generic 'panel' class that I could re-use.)
My code looks a bit like this:
If CheckBoxClicked Then
Dim UpdatePanel As New UpdatePanel(MyForm.NameTextBox, MyForm.AgeTextBox, MyForm.FavSportTeamTextBox, MyForm.SaveButton)
UpdatePanel.GetData()
...
When the user clicks the SaveButton the data is updated to the database and I have a display message (simple textbox) which says "Update successful" and displays for 5 seconds before hiding itself.
Here is the problem:Suppose a user checks a checkbox, reviews the data and does not make any changes, and then checks another checkbox and decides to update the data by clicking the 'save changes' button. What happens is that the "Update successful" message is displayed twice.
I think this is because every time the user checks a checkbox an instance of UpdatePanel is created. If a I select five different people using the checkboxes and then hit 'save changes' I get five "Update successful" messages.
I am not sure how to overcome this. It feels like each time a checkbox is clicked I need to check if an instance of UpdatePanel exists and then destroy it. I tried using UpdatePanel = Nothing and also investigated IDisposable and GC.Collect() but with no luck.
[code]....
View 1 Replies
Jul 11, 2009
I would like to use a Logitech wireless game controller. I imagine such a custom control already exists as a VB 2008 .net class library. I've tried to search MSDN but can't find anything.
View 1 Replies
May 26, 2009
Assume you have controls A, B, C, D and E all with a Visibility property. You also have states 1,2,3,4,5 and 6 in which various combinations of your controls would be displayed. Currently this is being handled by switch statements for each state: i.e.
Select Case PageState
case "1"
a.visible = false
b.visible = true
[code]....
As you can imagine, this becomes a pain as every state needs a show/hide statement for each control. How can I refactor this so that adding controls and/or states becomes trivial?My first instinct is to extend the control and add a collection of states that it should display for but this sounds like overkill.
Edit:I was deliberately vague in my question in case this has other implications. In my current instance the "controls" in question are ASP Panels. Does that change anything?
View 4 Replies
May 3, 2011
One of the problems that I constantly see with Winforms applications is that the GUI thread is stuck while a long-running task is running or just plain stops refreshing (yes, I know - needs threading). Is there a code template/design pattern I can use when reacting to mouse clicks or button presses? Should there be a processing thread always running in the GUI app? Basically, how do I write a great Winforms Application that is easy to maintain and doesn't have any quirky refresh bugs?
View 4 Replies
Nov 3, 2011
I have a contextStrategie :
Shared Sub New()
If ConfigurationManager.AppSettings.GetValues("Context").ToString = "Custom" Then
_context = New CustomHandler
[code]....
I'm trying (for test purpose) to obtain the name of the class used for my instance :
Dim context As ContextStrategie = New ContextStrategie()
'what I tried :
test.InnerText = context.GetType.Name
What I tried return ContextStrategie, which is useless to me.obtain either CustomHandler or XMLHandler?
View 1 Replies
Jun 22, 2012
I've been searching on Google for a recurrence pattern class for awhile now. I need a class I can use to schedule daily, weekly, monthly, and yearly recurrences of messages. I've found references to appropriate classes but no available downloads.
View 1 Replies
May 10, 2011
I need to be able to serialize a class into a string, and I know of 2 patterns:
1) (normal) Serialization pattern
2) Proxy Serialization pattern
I've read [URL] (the only website in google that talks about the proxy-serialization pattern) and still cant find the advantage or benefit of using this pattern. Could someone explain what exactly is the proxy serialization pattern, or rather exactly what problem does the proxy-serialization pattern solves that the normal-serialization pattern doesn't solve?
View 1 Replies
Feb 6, 2010
I was hoping that I could get some guidance from some of you guys on Object Design with Database back ends. I am trying to build what could be considered to be my first full scale application, which is a student tracker (simplification). While I have a reasonable idea of how I would go about designing the classes for the system, the bit that I don't know how to do is, how I would go about getting the data to and from the database.
For example with my other applications, I have done a couple of things;
1) Gathered all the data when the application started up, creating the objects then. Then when the application closed sending the data back to the database.
2) Have the code which deals with getting the data in the specific class, so the student class for example would take only one constructor argument which would be the studentID, then the class code would connect to the database and populate the object fields as appropriate.
3) Variations of the above. I have also looked into LINQ, which seems like it would be very useful if you don't expect your classes to deal with any business logic and just data, but I suppose it would be possible to create a wrapper class that would include the business logic.
[Code]....
View 1 Replies
Mar 11, 2010
I was hoping that I could get some guidance from some of you guys on Object Design with Database back ends.I am trying to build what could be considered to be my first full scale application, which is a student tracker (simplification). While I have a reasonable idea of how I would go about designing the classes for the system, the bit that I don't know how to do is, how I would go about getting the data to and from the database
View 3 Replies
Aug 10, 2010
how to organize the classes within my RPG project that I'm making. I've tried to implement a battle system but I am not comfortable with my initial results. This is the basic layout I currently have for my classes. [Code] clsCharacter contains statistics pertaining to one character, including magic available to that character to use. Also includes what weapons that character has equipped. clsTeam contains multiple clsCharacter, as well as a list of items that each clsCharacter in the team can use. clsBattle contains two clsTeams. One team is the player and the other is the computer. Now, this is a wonderful way to organize data. However, I see limitations with this approach. For instance, to pass data from Battle to Character, it has to pass through the team class and vice-versa. Plus, if I use Properties, it transfers data as ByVal instead of ByRef, so I cannot guarantee that I'm editing the original and not a copy of the passed object (IIRC)
In addition, I feel it is just messy code to include methods within the clsCharacter class that invoke this: MyTeam.MyBattle.DoAction(). Plus, the clsCharacter might not even be in the battle at the time - I don't won't to bog down that class featuring code that is exclusive for battling when I also need to be concerned about moving around the map, saving/loading data, etc. So, any suggestions? Right now, I'm burnt out of ideas. One idea I have so far is to include a function for the clsCharacter that exports a list of all possible moves the character could make, and if the character is CPU choose the most optimal one, and if Human than wrap it up in some nifty GUI so they can choose what action to take. But at the same time, how do I use that information within the context of the battle?
View 2 Replies
Feb 20, 2010
Me need use MultiLineStringEditor Class from System.Design namespace.I add reference as file (as in the .NET tab, it no) from
c:Program FilesReference AssembliesMicrosoftFramework.NETFrameworkv4.0System.Design.dll
and Visual Studio show in References
System.Design.dll
.NET
0.0.0.0
False
<The system cannot find the reference specified>
View 1 Replies
Jul 20, 2011
I can articulate my question well enough to get some clear and usable feedback here. I have reports (like paper reports) in my .NET application that have data bound to them. Typically the reports are a combination of many data elements across several busniess entites that may not all relate through an Inheritance hierarcy, etc. This makes it difficult to get all the needed data placed together to bind to the report.
So what I have done before are make 'Report' classes with data elements specific to supporting the reports they are bound to, and on the back end might be tied to specially created Stored Procedures that bring this data back (maybe several joins across many tables to get the right data needed). So if I was to make an analogy to the database world, I am essentially 'denormailizing' the data structure to get all of this data into a single class to make it easy to bind to the report.
However on the hard line OOP concepts and architecture design, one could say that a report is just another 'thing' to bind data to, and its class should not be designed just to suit the needs of data binding. In this thought process, I would actually need to make my class design be able to create the relationships needed to get all of the data together properly to still be bound, but not create any special 'Report' classes. I find this difficult to do sometimes. It is much easier to create these relationships in the back end stored procedures and then just output the resultset to be almost immediately bound to the report.
So what is the right way to solve this? If I create these specialized report classes with really no behavior, am I introducing an anti-pattern like the Anemic Domain Model?I could use some feedback, and please speak up if my question and scenarios did not make sense.
View 1 Replies
Apr 22, 2010
I've got a BaseDataClass with shared fields and functions
CODE:
I have several classes that derive from this base class. The derived classes have all Shared functions that can be called directly from the BLL with no instantiation. The functions in these derived classes call the base Init(), call their specific stored procs, call the base CleanAll() and then return the results.
So if I have 5 derived classes with 10 functions each, totaling 50 possible function calls, since they are all Shared, the CLR only calls one at a time, right? All calls are queued to wait until each Shared function completes.
Is there a better design with having Shared functions in your DAL and still have base class functions? Or since I have a base class, is it better to move towards instance methods within the DAL?
View 1 Replies
Aug 19, 2010
This is a followup to the question I asked here:
[URL]
I understand the answer in the post above, which is absolutely amazing, by the way. It's about implementing interfaces with a class. However, what if a class needs to share features with another class?Yes, that class can an Interface. However, let's use this sample definition.
[code]...
Or, in other words:An equippable item can perform acts outside of its typical usage of a shield or weapon. But not all items can act as a sheid or weapon.I mean, I could create a class that implements IWeapon, IShield, IMagic, IUseableItem, etc. But there should be a better way than returning NULL when those interfaces are called.
View 2 Replies
Aug 2, 2010
Let say I have a function inside a class which require 4 parameter (table name,field name,field value, return field) When I use this function my form, such as
myclass.Search("customers", <-- after pressing the "," a popup list will be displayed that contain all the fields in "customers" table.
View 19 Replies
Oct 16, 2011
in VS 2008, is there a way to design a ContextMenuStrip in a designer without a relation to a specific Form or UserControl class? For example,if you need the same ContextMenuStrip in Form1, Form2 and Form3, in which of them am I to design the ContextMenuStrip? Do I have to add a "pseudo-Form" to the project that contains my shared ContextMenuStrips and create only one instance of that Form, or is there another way? I consider this a programmatic hack, that's why my question is whether the IDE offers something better.
View 10 Replies
Aug 8, 2011
Background:I have a base class and several inherited derived classes. The derived classes don't always need to have the same properties. If any properties are shared among the derived classes, those properties would live at the base class level ('Contents', for example).Similarly, GoodDocument below has 'GoodThings' but would not want/need to have 'BadThings'.I want to treat instances of both 'GoodDocument' and 'BadDocument' as type 'Document'
public mustinherit class Document
public property Contents as string
public sub new()...
[code]....
View 3 Replies
Nov 26, 2010
I have created my webpage in asp.net in 1024*768 resolution, my problem was that when i change my monitor resolution then the controls in my webpage will be displayed in unmanaged manner .
How to arrange items in my webpage which support multiple resolution ...
Whatever the resolution of my monitor the controls in my webpage will display as it is as managed in 1024*768 reolution !
View 1 Replies
Jun 27, 2011
I seem to have reached a limit on the size of the form. I cannot make the form longer and I need to add more fields. Is there a limit on how many fields can be included in a form?
View 1 Replies
May 25, 2011
I searched codeplex and google. I have found so many such as tustena but unfortunately they are not domain driven based and in these solutions I could not find a good modelling documents or references. i am a newbie in CRM but I am sensetive to design it with solid object-oriented fundamentals. Any reference or open source solution especifically for CRM design and implementaion in .NET? Cheers
View 1 Replies