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 – lobaratoriya 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.
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).
(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();
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(daqiqa->Text),
s2 = msclr::interop::marshal_as(sms ->Text),
s3 = msclr::interop::marshal_as(mb->Text);
if(fun(s1) && fun(s2) && fun(s3)){
rich -> Text = "";
int n = W -> Rows -> Count;
int m = W -> Columns -> Count;
__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;
}
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(a1->Text),
s2=msclr::interop::marshal_as(a2->Text),
s3=msclr::interop::marshal_as(a3->Text),
s4=msclr::interop::marshal_as(a4->Text),
s5=msclr::interop::marshal_as(a5->Text),
s6=msclr::interop::marshal_as(a6->Text),
s7=msclr::interop::marshal_as(a7->Text),
s8=msclr::interop::marshal_as(a8->Text),
s9=msclr::interop::marshal_as(a9->Text),
s10=msclr::interop::marshal_as(a10->Text),
s11=msclr::interop::marshal_as(a11->Text),
s12=msclr::interop::marshal_as(a12->Text),
s13=msclr::interop::marshal_as(a13->Text),
s14=msclr::interop::marshal_as(a14->Text),
s15=msclr::interop::marshal_as(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));
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) {
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");
}
Do'stlaringiz bilan baham: |