Tajriba ishi №17
Mavzu: Mini loyihalar yaratish: dastur tuzish
Ishni bajarishdan maqsad: Visual Studio 2012 muhitida C++ dasturlash tilida
mobil aloqa kompaniyalari mijozlariga hizmat ko’rsatish dasturini yaratish .
Nazariy qism:
Mabil aloqa kompaniyalarida mijozlarga xizmat ko’rsatish qudagi turlardan iborat
1.Tariflar bilan ishlash , qulay tariflarni tanlash , tariflar qo’shish va tariflarni
o’chirsh mumkin.
2. Internet paketlarini tanlash va ularga o’zgartirishlar kiritish.
3.Administrator bo’limini yaratish.
17 – Tajriba ishida biz tariflar bo’limini shakillantiramiz.
Tariflar bo’limi operator va mijozlarga xizmat qiladi.
Dastlab form mihozlar uchun xizmat qiladi . Agar login va parol kiritilsa bu
form operatorlar uchun xizmat qiladi.
Mijozlarning imkoniyatlari bir muncha cheklangan bo’ladi, faqat o’zlariga
maqul tarifni tanlab biladilar.
105
1 – rasm. Tariflar oynasi.
Login va parol kiritilsa unda formda saqlash va yuklash tugmalari hosil bo’ladi 2
- rasm.
2 – rasm. Tariflar oynasi (Administrator uchun).
Saqlash tugmasida bajarilgan amallarni saqlash mumkin.
Yuklash tugmasida yangi tarif qo’shishi mumkin.
O’zgarishlar internet to’plamlari bo’limida ham amalga oshadi
Bu bo’limda o’zingizga maqul tarifni tanlab bila olasiz(3-rasm).
106
(3-rasm)
Operatorlar uchun ajratilgan bo’limdagi yuklash tugmachasi mavjud, bu tugmachada
tarif yuklash mumkin(4-rasm).
4-rasm
Bu bo’limda tarif nomi va uning elementlarini kiritishingiz mumkin.
//Tariflar bo’limi ilovasi
#include
"stdafx.h"
#include
"math.h"
#include
"Add.h"
int
fun(
string
x
)
{
int
n =
x
.size();
107
for
(
int
i = 0; i < n ; i ++)
{
if
(
x
[i] <
'0'
||
x
[i] >
'9'
)
return
0;
}
return
1;
}
#pragma
endregion
private
: System::
Void
Tarif_Load(System::
Object
^
sender
,
System::
EventArgs
^
e
) {
oleDbDataAdapter1 -> Fill(dataSet1);
if
(a == 1)
button2->Visible =
true
, button3 -> Visible =
true
;
}
private
: System::
Void
label1_Click(System::
Object
^
sender
, System::
EventArgs
^
e
)
{
}
private
: System::
Void
button1_Click(System::
Object
^
sender
, System::
EventArgs
^
e
)
{
if
(daqiqa -> Text !=
""
&& sms -> Text !=
""
&& mb -> Text !=
""
){
string
s1 = msclr::interop::marshal_as<
string
>(daqiqa->Text),
s2 = msclr::interop::marshal_as<
string
>(sms ->Text),
s3 = msclr::interop::marshal_as<
string
>(mb->Text);
if
(fun(s1) && fun(s2) && fun(s3)){
rich -> Text =
""
;
int
n = W -> Rows -> Count;
int
m = W -> Columns -> Count;
108
__int64
a , b , c ;
a =
Convert
::ToInt64(daqiqa -> Text);
b =
Convert
::ToInt64(sms -> Text);
c =
Convert
::ToInt64(mb -> Text);
String
^ s;
double
x , y , z , d , mn = 1e18 , g;
for
(
int
i = 0; i < n - 1 ; i++){
rich -> Text +=
Convert
::ToString(W -> Rows[i] -> Cells[0] -> Value) +
" = "
;
x =
(
Convert
::ToInt64(W -> Rows[i] -> Cells[2] -> Value) +
Convert
::ToInt64(W -> Rows[i] -> Cells[3] -> Value)) / 2. *
max
(0 ,a - 30 *
Convert
::ToInt64(W -> Rows[i] -> Cells[5] -> Value));
y =
(
Convert
::ToInt64(W -> Rows[i] -> Cells[6] -> Value) +
Convert
::ToInt64(W -> Rows[i] -> Cells[7] -> Value)) / 2. *
max
(0 ,b -30 *
Convert
::ToInt64(W -> Rows[i] -> Cells[9] -> Value) );
//Add bo’limi kodi
#include
"stdafx.h"
#include
"string"
#include
"iostream"
#include
"stdlib.h"
#include
"msclr\marshal_cppstd.h"
;
using
namespace
std;
using
namespace
msclr::interop;
int
fun(
string
x
)
{
int
n =
x
.size();
for
(
int
i = 0; i < n ; i ++)
{
if
(
x
[i] <
'0'
||
x
[i] >
'9'
)
return
0;
109
}
return
1;
}
#pragma
endregion
private
: System::
Void
Add_Load(System::
Object
^
sender
,
System::
EventArgs
^
e
) {
oleDbDataAdapter1 -> Fill(dataSet1);
}
private
: System::
Void
button1_Click(System::
Object
^
sender
, System::
EventArgs
^
e
)
{
oleDbConnection1 -> Open();
if
(a1 -> Text !=
""
&& a2->Text !=
""
&& a3->Text !=
""
&& a4-
>Text !=
""
&& a5->Text !=
""
&& a6->Text !=
""
&& a7->Text !=
""
&& a8->Text
!=
""
&& a9->Text !=
""
&& a10->Text !=
""
&& a11->Text !=
""
&& a12->Text !=
""
&& a13->Text !=
""
&& a14->Text !=
""
&& a15->Text !=
""
&& a16 -> Text !=
""
)
{
try
{
string
s1=msclr::interop::marshal_as<
string
>(a1->Text),
s2=msclr::interop::marshal_as<
string
>(a2->Text),
s3=msclr::interop::marshal_as<
string
>(a3->Text),
s4=msclr::interop::marshal_as<
string
>(a4->Text),
s5=msclr::interop::marshal_as<
string
>(a5->Text),
s6=msclr::interop::marshal_as<
string
>(a6->Text),
s7=msclr::interop::marshal_as<
string
>(a7->Text),
s8=msclr::interop::marshal_as<
string
>(a8->Text),
s9=msclr::interop::marshal_as<
string
>(a9->Text),
110
s10=msclr::interop::marshal_as<
string
>(a10->Text),
s11=msclr::interop::marshal_as<
string
>(a11->Text),
s12=msclr::interop::marshal_as<
string
>(a12->Text),
s13=msclr::interop::marshal_as<
string
>(a13->Text),
s14=msclr::interop::marshal_as<
string
>(a14->Text),
s15=msclr::interop::marshal_as<
string
>(a15->Text);
if
(fun(s2) && fun(s3) && fun(s4) && fun(s5) && fun(s6) && fun(s7) && fun(s8)
&& fun(s9) && fun(s10) && fun(s11) && fun(s12) && fun(s13) && fun(s14) &&
fun(s15))
{
dataSet1 -> Tables[
"Tarif"
] -> Rows -> Add(a1->Text , a2->Text , a3->Text , a4-
>Text , a5->Text , a6->Text , a7->Text,a8->Text,a9->Text,a10->Text,a11->Text,a12-
>Text,a13->Text,a15->Text,a16->Text);
oleDbDataAdapter1 -> Update(dataSet1 -> Tables[
"Tarif"
]);
this
-> Hide();
MessageBox
::Show(
"Tarif Qo'shildi"
);
}
else
MessageBox
::Show(
"Jadvalni to'ldirishda hatolik bor"
);
}
catch
(
OleDbException
^ oleException)
{
MessageBox
::Show(oleException -> Message ,
"Error"
,
MessageBoxButtons
::
OK
,
MessageBoxIcon
::
Error
);
}
}
else
MessageBox
::Show(
"Hamma katakni to'ldiring!"
);
oleDbConnection1 -> Close();
}
z =
Convert
::ToInt64(W -> Rows[i] -> Cells[13] -> Value) *
max
(0 ,c - 30
*
Convert
::ToInt64(W -> Rows[i] -> Cells[14] -> Value));
111
d =
Convert
::ToInt64(W -> Rows[i] -> Cells[1] -> Value) * 30;
g = (x + y + z + d) / 100 ;
rich -> Text +=
Convert
::ToString(g) +
" $ \n"
;
if
(g < mn )
{
mn = g;
s =
Convert
::ToString(W -> Rows[i] -> Cells[0] -> Value);
}
}
MessageBox
::Show( s ,
"Qulay tarif"
);
}
else
MessageBox
::Show(
"jadvalni to'ldirishda hatolik bor"
);
}
else
MessageBox
::Show(
"Iltimos jadvali to'ldiring "
);
}
private
: System::
Void
button2_Click(System::
Object
^
sender
, System::
EventArgs
^
e
)
{
Add
^ A =
gcnew
Add
;
A -> Show();
}
private
: System::
Void
bindingNavigator1_RefreshItems(System::
Object
^
sender
,
System::
EventArgs
^
e
) {
}
private
: System::
Void
bindingNavigator1_RefreshItems_1(System::
Object
^
sender
,
System::
EventArgs
^
e
) {
}
private
: System::
Void
button2_Click_1(System::
Object
^
sender
, System::
EventArgs
^
e
) {
112
this
->Hide();
Add
^ F =
gcnew
Add
;
F -> Show();
}
private
: System::
Void
button3_Click_1(System::
Object
^
sender
, System::
EventArgs
^
e
) {
oleDbDataAdapter1 -> Update(dataSet1 -> Tables[
"Tarif"
]);
MessageBox
::Show(
"Saqlandi"
);
}
Tajriba ishi №18
Mavzu: Mini loyihalar yaratish: dastur tuzish.
Ishni bajarishdan maqsad: Visual Studio 2012 muhitida C++ dasturlash tilida
mobil aloqa kompaniyalari mijozlariga hizmat ko’rsatish dasturini yaratish.
Nazariy qism:
Mabil aloqa kompaniyalarida mijozlarga xizmat ko’rsatish qudagi turlardan iborat
1.Tariflar bilan ishlash, qulay tariflarni tanlash, tariflar qo’shish va tariflarni o’chirsh
mumkin.
2. Internet paketlarini tanlash va ularga o’zgartirishlar kiritish.
3.Administrator bo’limini yaratish(1 - rasm).
1-rasm . Form oynasi
113
18 – Tajriba ishida internet paketlar bo’limini shakillantiramiz.
Internet paketlar bo’limi operator va mijozlarga xizmat qiladi.
Dastlab form mihozlar uchun xizmat qiladi. Agar login va parol kiritilsa bu
form operatorlar uchun xizmat qiladi.
Mijozlarning imkoniyatlari bir muncha cheklangan bo’ladi, faqat o’zlariga
maqul Internet to’plamini tanlab biladilar.
1-rasm.Mijozlar uchun
Login va parol kiritilsa unda formda o’zgarishlar yuz beradi.
2 – rasm. Operator uchun
114
Operatorlar internet to’plamini qo’shib bilishi mumkin.
Yuklash tugmasi bosilsa yangi to’plam qo’shiladi.
//Paket bo’limi kodi
#pragma
endregion
private
: System::
Void
listView1_SelectedIndexChanged(System::
Object
^
sender
, System::
EventArgs
^
e
) {
}
private
: System::
Void
button1_Click(System::
Object
^
sender
, System::
EventArgs
^
e
)
{
}
private
: System::
Void
Paket_Load(System::
Object
^
sender
, System::
EventArgs
^
e
) {
115
Paket
^ F =
gcnew
Paket
;
if
(ok)
this
->Width = 875;
oleDbDataAdapter1->Fill(dataSet1);
oleDbDataAdapter2->Fill(dataSet1);
oleDbDataAdapter3->Fill(dataSet1);
}
private
: System::
Void
dataGridView1_CellContentClick(System::
Object
^
sender
,
System::Windows::Forms::
DataGridViewCellEventArgs
^
e
) {
}
private
: System::
Void
tabPage1_Click(System::
Object
^
sender
, System::
EventArgs
^
e
) {
}
private
: System::
Void
button1_Click_1(System::
Object
^
sender
, System::
EventArgs
^
e
) {
oleDbDataAdapter1 -> Update(dataSet1-
>Tables[
"Paket_kunlik"
]);
}
private
: System::
Void
groupBox1_Enter(System::
Object
^
sender
,
System::
EventArgs
^
e
) {
}
private
: System::
Void
textBox1_TextChanged(System::
Object
^
sender
,
System::
EventArgs
^
e
) {
}
private
: System::
Void
bindingNavigatorCountItem_Click(System::
Object
^
sender
,
System::
EventArgs
^
e
) {
}
private
: System::
Void
button5_Click(System::
Object
^
sender
, System::
EventArgs
^
e
)
{
if
(k1 -> Text !=
""
&& k2 -> Text !=
""
&& k3 -> Text !=
""
&&
k4 -> Text !=
""
&& k5 -> Text !=
""
)
116
{
dataSet1 -> Tables[
"Paket_kunlik"
] -> Rows -> Add(k1 -> Text , k2 ->
Text , k3 -> Text , k4 -> Text , k5 -> Text);
oleDbDataAdapter1 -> Update(dataSet1 -> Tables[
"Paket_kunlik"
]);
k1 -> Text =
""
;
k2 -> Text =
""
;
k3 -> Text =
""
;
k4 -> Text =
""
;
k5 -> Text =
""
;
}
else
MessageBox
::Show(
"Iltimos jadvalni to'ldiring"
);
}
private
: System::
Void
button4_Click(System::
Object
^
sender
, System::
EventArgs
^
e
) {
if
(h1 -> Text !=
""
&& h2 -> Text !=
""
&& h3 -> Text !=
""
&&
h4 -> Text !=
""
&& h5 -> Text !=
""
)
{
dataSet1 -> Tables[
"Paket_Haftalik"
] -> Rows -> Add(h1 -> Text , h2 -
> Text , h3 -> Text , h4 -> Text , h5 -> Text);
oleDbDataAdapter2 -> Update(dataSet1 -> Tables[
"Paket_Haftalik"
]);
h1 -> Text =
""
;
h2 -> Text =
""
;
h3 -> Text =
""
;
h4 -> Text =
""
;
h5 -> Text =
""
;
}
else
MessageBox
::Show(
"Iltimos jadvalni to'ldiring"
);
}
117
private
: System::
Void
button3_Click(System::
Object
^
sender
, System::
EventArgs
^
e
)
{
if
(o1 -> Text !=
""
&& o2 -> Text !=
""
&& o3 -> Text !=
""
&&
o4 -> Text !=
""
)
{
dataSet1 -> Tables[
"Paket_oylik"
] -> Rows -> Add(o1 -> Text , o2 ->
Text , o3 -> Text , o4 -> Text);
oleDbDataAdapter3 -> Update(dataSet1 -> Tables[
"Paket_oylik"
]);
o1 -> Text =
""
;
o2 -> Text =
""
;
o3 -> Text =
""
;
o4 -> Text =
""
;
}
else
MessageBox
::Show(
"Iltimos jadvalni to'ldiring"
);
}
private
: System::
Void
button6_Click(System::
Object
^
sender
, System::
EventArgs
^
e
)
{
oleDbDataAdapter1 -> Update(dataSet1 -> Tables[
"Paket_kunlik"
]);
MessageBox
::Show(
"Saqlash bajarildi"
);
}
private
: System::
Void
button2_Click(System::
Object
^
sender
, System::
EventArgs
^
e
)
{
oleDbDataAdapter2 -> Update(dataSet1 ->
Tables[
"Paket_Haftalik"
]);
MessageBox
::Show(
"Saqlash bajarildi"
);
}
private
: System::
Void
button1_Click_2(System::
Object
^
sender
, System::
EventArgs
^
e
) {
oleDbDataAdapter3 -> Update(dataSet1 ->
Tables[
"Paket_oylik"
]);
118
MessageBox
::Show(
"Saqlash bajarildi"
);
}
private
: System::
Void
bindingNavigator1_RefreshItems(System::
Object
^
sender
,
System::
EventArgs
^
e
) { }
|