C# - Building Extremely Lightweight Business Object / DAL ?
Apr 7, 2010
I have completed a simple database for a project. Only 6tables. Of the 6, one is a "lookup" table.There is one "master" table that is the driver for the system. It is referenced as a foreign key by the other four tables.Give that this step is completed. What is the FASTEST, EASIEST way to create POCOs/BizObjects that can load load the data and the child data.Here are my CAVEATS.
I don't want to spend more than 30-60 minutes learning how? There is very little biz logic needed in the POCOs. They will pretty much load data. Don't even really need to write back data.I already know CSLA (up to version 3) but I feel that is overkill for this little project.Nevertheless, I would love it if it ROOT objects could have collection classes that contain the CHILD objects as in CSLA...but again, without using CSLA.
View 3 Replies
ADVERTISEMENT
Oct 11, 2010
using an object-binding I have a an object representing "Employee". The employee has an ID-property. The ID of the employee must be unique.
My validation of the entered data is handled in the property set part of the object. In general, I validate criteria belonging to the object to validate only (eg numeric range of the ID, if it's value is not empy, ...). But in this case I need to know all ID's from the other employees. My tried this:
''' <summary>
''' Set EmployeeID
''' </summary>
[Code].....
View 2 Replies
Sep 17, 2009
I am writing a program that takes a shipdate and generates a timeline of deadlines for a manufacturing job by working backwards from the shipdate. I hav no problem handling weekends. However, some holidays are giving me problems. For holidays that don't have a set date (Thanksgiving, Labor Day, Memorial Day...) what is the best way to determine the date they fall on? Most of the examples I have seen use an array of dates (either from a file or hard coded) for these holidays. Is there a way to do this tha won't require someon to generate a list every year for these holidays?
View 3 Replies
Apr 19, 2009
Due to a discussion in another thread , I am starting to use business object in an 3-Tiered windows app. As a starting point, I am trying to build objects/classes on a table from my database.
The database table has the following columns:
ID
TypeID
Reference
[Code]....
View 1 Replies
Jun 17, 2009
The issue I'm currently having is mapping multiple GUI fields to object properties (i.e. Presentation layer to Business Logic Layer mapping). To be more specific, this is in VB.Net 2.0 WinForms. The nature of the solution requires us to have 4 columns which exhibit the same type of behavior on our GUI - each column consisting of 11 textboxes (we'll just use this small sample size, as the problem extends beyond 11 textboxes).
What I am currently doing is setting the tag of each textbox in all four columns to a value like so:
Textbox1.tag = "name"
Textbox2.tag = "type"
Textbox3.tag = "speed"
[Code]...
As you can see this can get very bad, rather quickly. Currently we're setting 43 some odd properties that can be mapped to -- thus that select statement is extremely long -- many of which are embedded in multiple methods to try and attempt DRY (I've watered down the code to essentially a conceptual implementation).
Question is: how can I refactor this? I've attempted using a dictionaries/hashes to a certain extent, but it either became overly complex, or just plain didn't make an implementation sense as it convoluted the problem even more.
View 1 Replies
Jun 21, 2010
I have a custom business object called Customer and a Form1 with a BindingSource1, NumericUpDown1, TextBox1 and ComboBox1 and the attached code. Setting break points in the Property Sets shows that the Set for the ComboBox never fires at all even though the Set for the NumericUpDown and TextBox fire like crazy. [code]
View 1 Replies
Apr 16, 2010
I need to generate a table from a List(Of Students). My Student class has properties for AcademicYear, TeachingSet, Surname and Forenames, is sorted in that order and also properties for ID and start date. The table should nest TeachingSets within AcademicYears and then the students within the TeachingSets, as shown in the table I've mocked up at http:[url]...
Using a repeater I get
08-10 students B74394 Mzejb Bsppn
08-10 students B74395 Lbuifsjof Bvti
08-10 students C68924 Epoob Cmpblf[code].....
View 1 Replies
May 7, 2012
I'm developing a business model for an application where I am representing physical entities. The hierarchy created from this is neat, but as I'm doing this, I'm beginning to think about things like, what properties should be included in one that may already be apart of another? Or what if some properties are expected to be in one object, but another object needs to return that value, how does it communicate that request through the hierarchical chain? And what is the best practice for this design?
[Code]...
But then I got to thinking, what if I have a ConnectionPoint entity and I want it to return which Panel it has? Should it have it's own Panel association as well? Or should there be a method/pattern for communicating the request up the chain? And again... what's typical best practice?
View 3 Replies
Nov 14, 2009
In a vb .net winforms app I am trying out something for "wide and shallow" children of a record. I use strongly typed business objects ( Strataframe ).My plan is to have a number of "child tables" collected in a dataset I drop on the form. they have no correspondence in persisted data, so the dataset is untyped and I am creating the schema through the property sheet for the tables. Each table is the datasource for a datagridview in the interface.
In my proof of concept sample, My main businessobject (CustomerBO) interacts with a SQL Server 2008 table with fields - pk, name, - and a third column which is currently varchar(max) as I considered XML but could just as easily be varbinary(max) if that works better for holding the serialized dataset.
bo.bigfield will be the strongly typed prop I want to hold the byte() array or XML or whatever that represents the dataset for that record.So, the question in a nutshell - how do I convert a dataset to a single datum and reproduce the dataset from that datum. This is my first foray into datasets, datagridviews as well so if there are better ways to accomplish any of that I'm listening.
View 1 Replies
Dec 29, 2011
I was just wondering if it is possible to apply an attribute to a property within a business object (MyBusinessObject) such that after the DataSource of a grid is set to a List(Of MyBusinessObject), the visible property of the column will automatically be false. For example:
myGrid.DataSource = New List(Of MyBusinessObject)
Public Class MyBusinessObject
[code]....
View 1 Replies
Oct 13, 2011
I'd like to have an updateable DataGridView that's bound to a database-driven business object. It needs to handle all aspects of CRUD and be sortable and filterable as well.
Most of them simply bind to an object (non-database, manually filled) and do not allow you to Add, Delete, and Edit records. Furthermore, they basically never show how you would perform sorting and filtering.
I think the biggest things I'm not understanding are:
1) How do you make the DataGridView perform additions, deletions, and edits on an object.
2) How do you program your object to handle additions, deletions, and edits. Do you just need methods that use ADO.Net, NHibernate, or Linq to SQL (or any other CRUD handling mechanism)?
3) How to make this filterable and sortable.
Is this overly difficult to do or why am I have so much trouble finding examples for this?
View 2 Replies
Dec 18, 2011
I thought I would practice using reflection by building an Object Browser similar to what's in VS2010.
The reflection part is easy enough, but I'm can't find any means of determining where all of the assemblies are installed. On my machine (Win 7) the GAC would seem to be located at C:Windowsassembly.
However, 4.0 assemblies look to be located at C:WindowsMicrosoft.NETassembly in either GAC_32 or GAC_MSIL.
VS Object Browser obviously knows where to look, you can even filter on "All Components" or select a framework version.
But when I look at the Object Browser in VS, I find that it lists assemblies from several different locations: For example...
CODE:
How does VS know to list these assemblies? Is there some registry key I'm missing that defines all of these locations?
View 2 Replies
Mar 25, 2011
How to put jpeg images from my access database into active directory. I'm currently looking at one particular tutorial but its not making any sense. [URL]
View 4 Replies
Jun 8, 2011
I'm trying to figure out how to put jpeg images from my access database into active directory. I really don't know where to begin? I'm currently looking at one particular tutorial but its not making any sense. [URL]..
View 2 Replies
Apr 17, 2009
I have a dataset with around 15 table adapters. Everytime I make a change, such as add a column, change a type, or just anything, it takes around 3-4 minutes before studio responds again. The processor and ram are in good shape, but there is a spike in network usage by devenv during this time. In fact, devenv has the higheset network usage all together, even with with IE open and browsing. Why would this be and is there any remedy?[code]...
View 3 Replies
Aug 10, 2011
I have a button array that I filled up. Here is the code I used to do that.
Public buttons(29) As Button
For i = 0 To 29
buttons(i) = CType(Me.Controls("Button" & i), Button)
i += 1
Next i
Here is some code that I used (it is extremely inefficient):
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button2.Click, Button3.Click, Button4.Click, Button5.Click, Button6.Click, Button7.Click, Button8.Click, Button9.Click, Button10.Click, Button11.Click, Button12.Click, Button13.Click, Button14.Click,
[CODE].....................
View 1 Replies
Nov 6, 2010
This morning I opened up my project The Bible Study Tool and got a pop up warning box that says the following: There is no editor available for 'G:VisualStudio ProjectsThe Bible Study ToolThe Bible Study ToolBSTMain.vb'. Make sure the application for the file type (.vb) is installed. I do not know how to 'make sure the application for the file type (.vb) is installed. I get same error no matter what solution (program) I try to open. I can see the forms code window, but when I double-click the form in the solution explorer I get the above warning.
[Code]...
View 6 Replies
Apr 6, 2009
I have looked all over for a solution to this problem and have tried a bunch of different things, but nothing seems to work.I have a sub procedure that does the following:
1) adds two columns to a data table (table1)
2) fills a dataset with several tables in order to make calculations (this determines the data that will be stored in the two new columns of table1)
3) updates ONLY table1, and ONLY the two columns that have just been added (these columns are thus empty for every row before the update begins)
As it is now, the da.Update takes about 3 hours to populate the entire table (it updates about 300 records per MINUTE if I'm lucky). There are approximately 40000 records in table1 for this test subset, but there will eventually be up to 1.5-2 million (in other words, this is a small table currently). I have tried using executenonquery() along with a sql UPDATE command instead of da.Update, as well as many other things, but none of them has improved performance at all. I've also tested it on two PCs, one running Vista and one XP, and there were no differences. I'm using Access 2003. I know Access is not ideal, but for now it is the only option.
I know that the root of this is the line of code with the da.Update, because the giant loop before it that I previously thought was causing the slowdown executes in 30 seconds, leaving only the update before the subroutine is complete. I don't know how exactly the da.Update works, but I've suspected that maybe it has something to do with that? Code is below:
[code]...
View 7 Replies
Jul 8, 2010
I've got an MDI form with a menustrip that already detects all .dll files in a folder and adds them to the menu to show the user which plugins are available. The thing is that I don't know what to do from here on out...
I'd like to be able to update my program without having to stifle through all my code (it's a very big program) and be able to create basic new features through external DLLs. It's extremely useful for users to make their own features too
Anyway, what a plugin would look like is most likely just a form with controls on it that the user makes themselves in VB. I'd like the plugin to activate through an init() sub within the plugin by clicking on the menu item shown in my MDI form.
I kind of started with my own code but it didn't really get anywhere:
ListFilesInMenuStrip(PluginsToolStripMenuItem, App_Path() & "Plugins")
For Each c As Control In Me.Controls
If TypeOf c Is MenuStrip Then
[Code]....
...Where ListFilesInMenuStrip() is my function to add all the DLLs to the menu and App_Path is just a shortcut function which serves the same purpose as VB6's App.Path() class.
I've also done research but only came across all their weird complex CodeDom and other weird things...This seems so simple but I just can't wrap my mind around it :I
View 4 Replies
Apr 28, 2011
For example, to calculate this:(22 ^ 29) Mod 57Supposedly there is a way to get around overflows and do these calculations, but I can't find much online. Now, the person who said this was doing VBA in Excel and said that there was about 4 lines of code which could handle the overflow so it wouldn't happen.
View 4 Replies
Dec 27, 2011
We have an automatic process that opens a template excel file, writes rows of data, and returns the file to the user. This process is usually fast, however I was recently asked to add a summary page with some Excel formulas to one of the templates, and now the process takes forever.
It successfully runs with about 5 records after a few minutes, however this week's record set is almost 400 rows and the longest I've let it run is about half an hour before cancelling it. Without the formulas, it only takes a few seconds to run.
Is there any known issues with writing rows to an Excel file that contains formulas? Or is there a way to tell Excel not to evaluate formulas until the file is opened by a user?
The formulas on the summary Sheet are these:
' Returns count of cells in column where data = Y
=COUNTIF(Sheet1!J15:Sheet1!J10000, "Y")
=COUNTIF(Sheet1!F15:Sheet1!F10000, "Y")
[Code].....
View 3 Replies
Aug 11, 2009
I am an experienced programmer but mainly in 4GLs and assembly. Relatively new to VB programming, especially GUI applications. On a form I need to create an area that will be used to display *extremely* large TIFF images. typical image size would be 2000 pixels by 100,000 pixels. Typically I will NOT want to display the entire image at once, so the area will need to have scroll bars and/or other methods to scroll/pan around the image.
I have read about and tinkered with the bitmap and picturebox objects, including some threads about several different ways to implement scrollbars. However, I see that the picturebox size is limited to 32K pixels in both dimensions. I suppose that I might be able to copy various portions of the bitmap to the picturebox depending on scroll position, but that seems potentially quite slow and cumbersome. Can an expert developer who is experienced with these types of issues regarding the following:
1. Can bitmap objects be used effectively with TIFF images of the size I am working with?
2. an approach that should produce reasonable scrolling performance for these extremely large images without excessive coding effort?
3. For an image that exceeds the picturebox size when displayed at 1:1 scale, is the picturebox capable of displaying a reduced size version of such an image without lots of code, and if so, how?
4. Many (most?) graphics display objects count on all of their display data being stored in memory rather than on disk. Would that be true of a TIFF image loaded into a bitmap object and displayed via a picturebox? If so, the amount of RAM required in order to buffer the entire image in memory could be a potential problem for images of this size. Is there an advisable way to have the picturebox or other display object only load portions of the image into memory on an as needed basis, and purge them once they are no longer required? Are there any built in objects/methods/properties or is there any sample code to show how to do this?
View 12 Replies
Feb 8, 2012
I'm trying to load this image file on a PictureBox but I get an "OutOfMemoryException was unhandled" error.
How do I allocate more memory for this? Or maybe use another container? My project's main feature is loading maps, unfortunately my boss wants to load the whole map and won't accept sliced version of the map.
View 8 Replies
Apr 18, 2011
I am trying to create a new user and set their password in AD LDS using asp.net vb. I'm binding to an instance of a directory entry, which is working fine. And I can add a user without a problem. The problem is that I can't seem to set the password when I add the user.Is this the right way to set the password
View 3 Replies
Jun 27, 2010
I am attempting to create an application for my (very) small businessRight now I am trying to create an "Add a Customer" formI know VERY LITTLE about MySql so I thought I would save the text into a textfile.. I then realized I do not know how to save multiple text box in a text file (I only knew how to save one text box in a text file)
View 14 Replies
Sep 2, 2009
This is a debate that can never be fulfilled without you. Please come forward and respond.What if we have a client who wants to develop a web enterprise application (based on SAAS architecture) and prefers for C# and not VB.NET based. Argument can be:
1. C# is better suited for developing enterprise application versus VB.NET
2. C# is object oriented versus VB.NET is not
3. Programming in C# is faster than VB.NET
4. Libraries/function blocks in VS.NET is more for C# versus VB.NET
I would request you to help me answer this. I believe this is the type of questions many faces when deciding for which language to go for, both developers and organizations.
View 1 Replies
Jan 24, 2012
I have an application that does complex calculations for members. Each member can have multiple US states linked to their profile. Each state has got different calculations for each course a member completes. As of now I have been performing the calculations in the DB (SQL Server 2008) and then sending data back to app layer where they can see their history and then download a certificate for each course. I have a business logic layer but not a lot happens there. I know this has been asked a lot but where do you think I should perform these calculations: business layer or database? I am going back and forth
View 3 Replies
Mar 20, 2012
I was having a discussion with a colleague about a method used to check business rules. In general there are two conditions:
"If one fails the whole thing fails"
Example 1: "If one fails the whole thing fails"I have used the following technique for condition 1 in several cases. Essentially if one of those conditions is false then the whole thing fails
Dim blnTemp As Boolean = True
If Fail=False Then blnTemp = blnTemp AndAlso False
{code code code}
[code]....
View 3 Replies
May 20, 2011
does a big business in shirts, especially for groups and teams. They need a project that will calculate the price for individual orders, as well as a summary for all orders.The store employee will enter the orders in an order form that has text boxes for customer name and order number. To specify the shirts, use a text box for the quantity, radio buttons to select the size (small, medium, large, extra large, and XXL), and check boxes to specify a monogram and/or a pocket. Display the shirt price for the current order and the order total in labels.
Include buttons to add a shirt to an order, clear the current item, complete the order, and display the summary of all orders. Do not allow the summary to display if the current order is not complete. Also, disable the text boxes for customer name and order number after an order is started; enable them again when the user clicks on the button to begin a new order. Confirm the operation before clearing the current order.
When the user adds shirts to an order, validate the quantity, which must be greater than zero. If the entry does not pass the validation, do not perform any calculation but display a message box and allow the user to correct the value. Determine the price of the shirts from the radio buttons and check boxes for the monogram and pockets. Multiply the quantity by the price to determine the extended price, and add to the order total and summary total
The assignment also requires a pop up message "Daily Summary" with total shirts sold, total sales, and average sale per customer.So far I have this as my code but I am not sure what needs to change in order to display the correct total shirts- mine only displays the last accepted shirt order.
[Code]...
View 1 Replies
Jun 22, 2012
I need to calculate the end date given the number of business days (excluding weekend and holidays). All the examples I've seen so far return the number of business days between a start date and an end date.
View 1 Replies