Sunteți pe pagina 1din 6

Cod program RENT A CAR

// 213432432Dlg.cpp : implementation file


//

#include "pch.h"
#include "framework.h"
#include "213432432.h"
#include "213432432Dlg.h"
#include "afxdialogex.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

class MASINI
{
public:
int NrZile;
int TipMasina;
int Pret;
}Masini;

// CAboutDlg dialog used for App About

class CAboutDlg : public CDialogEx


{
public:
CAboutDlg();

// Dialog Data
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_ABOUTBOX };
#endif

protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support

// Implementation
protected:
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialogEx(IDD_ABOUTBOX)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
END_MESSAGE_MAP()

// CMy213432432Dlg dialog

CMy213432432Dlg::CMy213432432Dlg(CWnd* pParent /*=nullptr*/)


: CDialogEx(IDD_MY213432432_DIALOG, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CMy213432432Dlg::DoDataExchange(CDataExchange* pDX)


{
CDialogEx::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(CMy213432432Dlg, CDialogEx)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_CBN_SELCHANGE(COMBO_MASINI, &CMy213432432Dlg::OnCbnSelchangeMasini)
ON_CBN_SELCHANGE(COMBO_PRELUARE, &CMy213432432Dlg::OnCbnSelchangePreluare)
ON_CBN_SELCHANGE(COMBO_PREDARE, &CMy213432432Dlg::OnCbnSelchangePredare)
ON_BN_CLICKED(IDC_BUTTON1, &CMy213432432Dlg::OnBnClickedButton1)
END_MESSAGE_MAP()

// CMy213432432Dlg message handlers

BOOL CMy213432432Dlg::OnInitDialog()
{
CDialogEx::OnInitDialog();

// Add "About..." menu item to system menu.

// IDM_ABOUTBOX must be in the system command range.


ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);

CMenu* pSysMenu = GetSystemMenu(FALSE);


if (pSysMenu != nullptr)
{
BOOL bNameValid;
CString strAboutMenu;
bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
ASSERT(bNameValid);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}

// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon

// TODO: Add extra initialization here


CComboBox* meniuPreluare;
meniuPreluare = (CComboBox*)GetDlgItem(COMBO_PRELUARE);
meniuPreluare->AddString(L"Aeroportul International George Enescu - Bacau");
meniuPreluare->AddString(L"Aeroportul International Henri Coanda - Bucuresti");
meniuPreluare->AddString(L"Aeroportul International Cluj");
meniuPreluare->AddString(L"Aeroportul International Mihail Kogalniceanu -
Constanta");
meniuPreluare->AddString(L"Aeroportul International Iasi");
meniuPreluare->AddString(L"Aeroportul International Sibiu");

CComboBox* meniuPredare;
meniuPredare = (CComboBox*)GetDlgItem(COMBO_PREDARE);
meniuPredare->AddString(L"Birou S.C GARAJUL LUI MORARU S.R.L Bacau");
meniuPredare->AddString(L"Aeroportul International George Enescu - Bacau");
meniuPredare->AddString(L"Birou S.C GARAJUL LUI MORARU S.R.L Bucuresti");
meniuPredare->AddString(L"Aeroportul International Henri Coanda - Bucuresti");
meniuPredare->AddString(L"Aeroportul International Cluj");
meniuPredare->AddString(L"Aeroportul International Mihail Kogalniceanu -
Constanta");
meniuPredare->AddString(L"Aeroportul International Iasi");
meniuPredare->AddString(L"Aeroportul International Sibiu");

CComboBox* meniuMasina;
meniuMasina = (CComboBox*)GetDlgItem(COMBO_MASINA);
meniuMasina->AddString(L"1.Dacia Logan Diesel 2.0 (20 EURO/ZI)");
meniuMasina->AddString(L"2.Renault Fluence Diesel 1.6 (40 EURO/ZI)");
meniuMasina->AddString(L"3.Skoda Rapid 1.6 Diesel (60 EURO/ZI)");
meniuMasina->AddString(L"4.Volkswagen Touareg Diesel 2.0 (80 EURO/ZI)");
meniuMasina->AddString(L"5.BMW M4 COUPE 3.0 Benzina (100 EURO/ZI)");
meniuMasina->AddString(L"6.Porsche Panamera 3.0 Diesel (120 EURO/ZI)");

return TRUE; // return TRUE unless you set the focus to a control
}

void CMy213432432Dlg::OnSysCommand(UINT nID, LPARAM lParam)


{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialogEx::OnSysCommand(nID, lParam);
}
}

// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.

void CMy213432432Dlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting

SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()),
0);

// Center icon in client rectangle


int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;

// Draw the icon


dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialogEx::OnPaint();
}
}

// The system calls this function to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CMy213432432Dlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}

void CMy213432432Dlg::OnCbnSelchangeMasini()
{
// TODO: Add your control notification handler code here
CComboBox* meniuMasina;
meniuMasina = (CComboBox*)GetDlgItem(COMBO_MASINA);
int MASINA = meniuMasina->GetCurSel();
Masini.TipMasina = MASINA + 1;

}
void CMy213432432Dlg::OnCbnSelchangePreluare()
{
// TODO: Add your control notification handler code here
CComboBox* meniuPreluare;
meniuPreluare = (CComboBox*)GetDlgItem(COMBO_PRELUARE);
int Preluare = meniuPreluare->GetCurSel();

void CMy213432432Dlg::OnCbnSelchangePredare()
{
// TODO: Add your control notification handler code here
CComboBox* meniuPredare;
meniuPredare = (CComboBox*)GetDlgItem(COMBO_PREDARE);
int Predare = meniuPredare->GetCurSel();

void CMy213432432Dlg::OnBnClickedButton1()
{
// TODO: Add your control notification handler code here
CEditView* zile, * total;
CString day, text, masina_text, preluare_text, predare_text;

CComboBox* meniuMasina;
meniuMasina = (CComboBox*)GetDlgItem(COMBO_MASINA);
int MASINA = meniuMasina->GetCurSel();
Masini.TipMasina = MASINA + 1;
meniuMasina->GetLBText(MASINA, masina_text);
CComboBox* meniuPreluare;
meniuPreluare = (CComboBox*)GetDlgItem(COMBO_PRELUARE);
int Preluare = meniuPreluare->GetCurSel();
meniuPreluare->GetLBText(Preluare, preluare_text);
CComboBox* meniuPredare;
meniuPredare = (CComboBox*)GetDlgItem(COMBO_PREDARE);
int Predare = meniuPredare->GetCurSel();
meniuPredare->GetLBText(Predare, predare_text);

zile = (CEditView*)GetDlgItem(Ieditboxzile);

zile->GetWindowTextW(day);

Masini.NrZile = _ttoi(day);

if (Masini.TipMasina != 0)
{
Masini.Pret = ((Masini.TipMasina * 20) * Masini.NrZile);
}
total = (CEditView*)GetDlgItem(TOTAL);
text.Format(_T("Ati inchiriat masina %s pe o perioada de %d zile , costul total
este de %d EURO. Masina va fi preluata din %s si predata la %s"), masina_text,
Masini.NrZile, Masini.Pret, preluare_text, predare_text);
total->SetWindowText(text);
UpdateData();
}