The Artima Developer Community
Sponsored Link

Design Forum
Design pattern suggestion

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Mike Kerr

Posts: 1
Nickname: mikezx10
Registered: Jun, 2009

Design pattern suggestion Posted: Jun 29, 2009 10:18 AM
Reply to this message Reply
Advertisement
My app consists of a main form and a tab control with 2 tabs, one tab is a datagird that will display all companies.

The other tab will be a detail view which I will add custom controls to depending on the type of object loaded to the data grid.

When the user click a data row, I will get a datarow send that to a companyFactory and that will return a company that has populated itself with data from the row.


It will then create an event handler that will be used in the main form and pass the company.



In the main form I will pass the Icompany to the UserControlFactory which will get the appropriate user control and populate that controls txtboxes and comboxes with the company data (company name, address, contact) and then add this userControl to the tabpage tab1



I am wondering if this is a good design and if so what patter to use for the mapping of the datarow to the Icomapny and also what pattern to use for the populating the user control from the Icomapny data.


I have a Icompany object there are 3 kinds of companys assuming, CedingCompany, and directCompany.
I will have 3 user controlls one for each type of company. I dont know anything about directCompany or AssumingCompany, just know that they will exist in the future.

for all companys they will display in a data grid and when the user wants to edit one they click the grid row and i will then get the datagridviewrow and....

this is what i was thinking, in the gridView usercontrol for the row click
protected virtual void OnClickRow(DataRow row)
{

ICompany company = CompanyFactory.GetCompany(row["CompanyType"],row);

EventHandler<ClickRowEventArgs> handler = this.ClickRow;
if (handler != null)
handler(this, new ClickRowEventArgs(company));
}

in the main form:
private void frmMain_ClickRow(object sender, ucDataGrid.ClickRowEventArgs e)
{
UserControl control = ControlFactory.GetUserControl(company);
tabControl.Controls.Add(Control);
}

Topic: Two compared tech architectures , please help ! Previous Topic   Next Topic Topic: How design pattern can help if there are too many config items messy around

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use