Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Application Design Question

Status
Not open for further replies.

mpsoutine

Programmer
Jan 6, 2003
87
US
Hi,

A short introduction to the progam I'm working on. I have a Form View with combo boxes and edit contols. The combo boxes, Buyer & Seller, are populated with the contents of one the tables, Customer Table, in my data from my data.

I also have an "Add" button on my form view. As you can guess, when the user clicks "Add" the contents of the combo boxes and edit controls are added to a record in "Transaction" table.

The code I have now does work. The problem is that I have the steps that add the record into the database are in the Form View class instead of the the Record Set class. This I know is bad programming.

The problem I can't figure out is how can I access the Combo boxes and Edit controls in a Form View class from a Record Set class. I guessing I will have to access the address of the Form View class.

I was thinking:

void CCustomerTransactionView::OnTransaction()
{

UpdateData()

CCustomerSet TmpSet;
TmpSet.AddCustomer(Can't figure out what to pass here);

}

Thanks
 
Hello

Which database system are you using, and what language is your form system written in?
The code sample could be Java or C++, but the "Form" language looks as if it could be Access or Oracle Forms.

John
 
Hi,

You're right that would be helpful. I'm using Access for the database and Visual C++ to design the application. I don't have the code in front of my right now. One idea I had was to pass the address of the list control from the "FindTrade" class to the "EditTrade" class using the DoModal() function for EditTrade.



CFindTradeDialogBox as the List Control in question as well as an "Edit" button.

User selects an item in the List Control and then clicks "EditTrade"

This generates a second dialogbox "TradeEditDialogBox" that has edit controls populated with the contents on the record in the list control and well as an "OK" button.

When the user click "OK" the record in the database is updated. But I also want to update the List Control in the "FindTrade" Dialog box. This is the problem.

I'll be able to send code tomorrow. Thanks for getting back to me.
 
Here is the code:

//////////////FindDialog/////////////
void CFindDialog::OnButtonEdit()
{
//AfxMessageBox("You clicked the Edit Button");

CTransactionSet TmpSet;
CListCtrl* pList;
pList = &m_lcTradeList;
TmpSet.Open();
CEditTradeDialog TmpEdTrdDlg;

int nTransID;

this->nLcReturnValue = m_lcTradeList.GetNextItem(-1,LVNI_SELECTED);
int nItemIndex = this->nLcReturnValue;

if(this->nLcReturnValue == -1)
{
AfxMessageBox("You must select and entry");
}
else

{

CString y;
y.Format("The unique ID is %d" ,nItemIndex);
AfxMessageBox(y);





nTransID = m_lcTradeList.GetItemData(this->nLcReturnValue);
CString z;
z.Format("The TransactionID is %d",nTransID);
AfxMessageBox(z);


CString sel;
sel.Format("the TransactionID at %d is %d ", nItemIndex, nTransID);
AfxMessageBox(sel);





}

TmpEdTrdDlg.DoModal(nTransID, pList);


}

///////////////CEditTradeDialog///////////////

void CEditTradeDialog::OnEditTrade()
{

UpdateData(TRUE);

CTransactionSet TmpTransSet;


if(!TmpTransSet.IsOpen())
TmpTransSet.Open();

TmpTransSet.Edit();

TmpTransSet.m_Buyer = m_strBuyer;
TmpTransSet.m_Seller = m_strSeller;

TmpTransSet.m_BuyerBrokerNumber = atoi(m_strBuyerBrokerNumber);
TmpTransSet.m_BuyerBrokerCommission = atof(m_strBuyerBrokerComm);

TmpTransSet.m_SellerBrokerNumber = atoi(m_strSellerBrokerNumber);
TmpTransSet.m_SellerBrokerCommision = atof(m_strBuyerBrokerComm);



TmpTransSet.m_TradeDate = m_strTradeDate;
TmpTransSet.m_SettlementDate = m_strSettlementDate;
TmpTransSet.m_MaturityDate = m_strMaturityDate;

TmpTransSet.m_Amount = m_strAmount;
TmpTransSet.m_Rate = atof(m_strRate);

TmpTransSet.m_NumberOfDays = atoi(m_strNumberOfDays);


TmpTransSet.m_CollateralDescription = m_strSecurityDescription;




TmpTransSet.Update();



this->ClearContents();

//TmpTransSet.UpdateItem(this->mpList);

CDialog::OnCancel();









}

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top