Professional Documents
Culture Documents
Магазин 2
Магазин 2
Кафедра
"Комп’ютерних інформаційних технологій"
Курсовий проект
з дисципліни: "Об’єктно-орієнтоване програмування"
на тему: "Розробка програмного модулю «Інтернет магазин»"
Виконав:
Курсант 300 навчальної групи
солдат В.ПУПКІН
Керівник:
Викладач кафедри № 22
капітан І.СТОЦЬКИЙ
Київ 2022
2
АНОТАЦІЯ
курсового проекту на тему:
« Розробка програмного модулю «Інтернет магазин» »
ANNOTATION
course project on the topic:
ЗМІСТ
АНОТАЦІЯ 2
ВСТУП 5
ВСТУП
РОЗДІЛ І
Вибір продуктів;
Кошик із вибраними продуктами;
Інформація про додаток.
Серед найпопулярніших CMS електронної
комерції — Magento, OpenCart, osCommerce, VirtueMart, UMI.CMS, PHPShop
CMS, eCommerce та Ubercart для Drupal, а також VirtueMart для Joomla.
Висновки до розділу
1. Головне меню;
2. Розділ кошик;
3. Вікно реєстрації та авторизації;
написання коду для реагування на дії користувача, такі як клацання миші або
натискання клавіш. Елемент управління - це окремий елемент інтерфейсу
користувача, призначений для відображення або введення даних. Windows
Forms включає широкий набір елементів керування, які можна додавати на
форми: текстові поля, кнопки, списки, перемикачі і навіть веб-сторінки.
Використовуючи функцію перетягування конструктора Windows Forms у
Visual Studio, можна легко створювати програми Windows Forms. Достатньо
виділити елемент управління курсором і помістити його у потрібне місце на
формі. Для подолання труднощів, пов'язаних із вирівнюванням елементів
керування, конструктор надає такі засоби, як лінії сітки та лінії прив'язки.
Start
F label4.Text ==
"Зареєструйтесь"
T
MessageBox.Show("Ви не
зареєструвались");
return;
F
DataBank.cust == ""
T
MessageBox.Show("Ви нічого не
обрали");
return;
DB db = new DB();
MySqlCommand command = new MySqlCommand("INSERT INTO `замовлення` (`login`, `pass`,
`name`, `custom`,`number`) VALUES (@log, @pas, @nam, @cus,@num)", db.getConnection());
command.Parameters.Add("@log", MySqlDbType.VarChar).Value = DataBank.userloginnam;
command.Parameters.Add("@pas", MySqlDbType.VarChar).Value = DataBank.userpas;
command.Parameters.Add("@nam", MySqlDbType.VarChar).Value = DataBank.usernamefie;
command.Parameters.Add("@cus", MySqlDbType.VarChar).Value = DataBank.cust;
command.Parameters.Add("@num", MySqlDbType.VarChar).Value = DataBank.usernumbe;
db.openConnection();
F
command.ExecuteNonQuery() == 1
end
Start
F DataBank.login ==
"Зареєструйтесь"
MessageBox.Show("Ви не зареєстровані");
return;
F
pr[1] == 0
T
MessageBox.Show("Ви не обрали
кількіcть");
return;
end
Лістинг 1
public Foodform2()
{
InitializeComponent();
label9.Text = DataBank.login;
button4.FlatAppearance.BorderSize = 0;
button4.FlatStyle = FlatStyle.Flat;
17
button1.FlatAppearance.BorderSize = 0;
button1.FlatStyle = FlatStyle.Flat;
button3.FlatAppearance.BorderSize = 0;
button3.FlatStyle = FlatStyle.Flat;
Лістинг 2
Лістинг 3
DB db = new DB();
MySqlCommand command = new MySqlCommand("INSERT INTO `замовлення` (`login`, `pass`,
`name`, `custom`,`number`) VALUES (@log, @pas, @nam, @cus,@num)", db.getConnection());
18
db.openConnection();
if (command.ExecuteNonQuery() == 1)
{
}
else
MessageBox.Show("Щось пішло не так");
db.closeConnection();
Висновки до розділу
Висновки до розділу
ВИСНОВКИ
ДОДАТОК А
public registerform()
{
InitializeComponent();
usernamefield.Text = "Введіть ім'я";
usernamefield.ForeColor = Color.Gray;
userloginname.Text = "Введіть логін";
userloginname.ForeColor = Color.Gray;
userpass.Text = "Введіть пароль";
userpass.ForeColor = Color.Gray;
usernumber.Text = "Введіть телефон";
usernumber.ForeColor = Color.Gray;
}
else
{
usernamefield.ForeColor = Color.Black;
}
}
if (checkUser())
{
return;
}
int number;
try
{
number = Convert.ToInt32(usernumber.Text);
}
catch
{
MessageBox.Show("Введіть коректний номер телефону");
return;
}
DataBank.userloginnam = userloginname.Text;
DataBank.userpas = userpass.Text;
DataBank.usernamefie = usernamefield.Text;
DataBank.usernumbe = Convert.ToInt32(usernumber.Text);
DB db = new DB();
29
db.openConnection();
if (command.ExecuteNonQuery() == 1)
{
DataBank.login = userloginname.Text;
MessageBox.Show("Аккаунт був створений");
this.Hide();
Foodform1 Mainforma = new Foodform1();
Mainforma.Show();
}
else
MessageBox.Show("Аккаунт не був створений");
db.closeConnection();
if (table.Rows.Count > 0)
{
MessageBox.Show("Данний логін вже зайнятий");
return true;
}
else
return false;
}
30
}
}
public Foodform2()
{
InitializeComponent();
label9.Text = DataBank.login;
button4.FlatAppearance.BorderSize = 0;
button4.FlatStyle = FlatStyle.Flat;
button1.FlatAppearance.BorderSize = 0;
button1.FlatStyle = FlatStyle.Flat;
button3.FlatAppearance.BorderSize = 0;
button3.FlatStyle = FlatStyle.Flat;
Mainform.Show();
}
this.Hide();
BucketForm bucketform = new BucketForm();
bucketform.Show();
}
if (pr[0] > 0)
{
pr[0] -= 1;
textBox1.Text = $"Кокакола {pr[0]} шт.";
}
}
pr[2] -= 1;
textBox3.Text = $"Колбаса {pr[2]} шт.";
}
}
public BucketForm()
{
InitializeComponent();
label4.Text = DataBank.login;
label5.Text = DataBank.sum;
}
button4.FlatAppearance.BorderSize = 0;
button4.FlatStyle = FlatStyle.Flat;
button1.FlatAppearance.BorderSize = 0;
button1.FlatStyle = FlatStyle.Flat;
37
button3.FlatAppearance.BorderSize = 0;
button3.FlatStyle = FlatStyle.Flat;
this.Hide();
Foodform1 Mainform = new Foodform1();
Mainform.Show();
}
}
38
DB db = new DB();
MySqlCommand command = new MySqlCommand("INSERT INTO `замовлення` (`login`, `pass`,
`name`, `custom`,`number`) VALUES (@log, @pas, @nam, @cus,@num)", db.getConnection());
command.Parameters.Add("@log", MySqlDbType.VarChar).Value = DataBank.userloginnam;
command.Parameters.Add("@pas", MySqlDbType.VarChar).Value = DataBank.userpas;
command.Parameters.Add("@nam", MySqlDbType.VarChar).Value = DataBank.usernamefie;
command.Parameters.Add("@cus", MySqlDbType.VarChar).Value = DataBank.cust;
command.Parameters.Add("@num", MySqlDbType.VarChar).Value = DataBank.usernumbe;
db.openConnection();
if (command.ExecuteNonQuery() == 1)
{
Mainform.Show();
}
else
MessageBox.Show("Щось пішло не так");
db.closeConnection();
}
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise,
false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new
System.ComponentModel.ComponentResourceManager(typeof(registerform));
this.panel2 = new System.Windows.Forms.Panel();
this.label2 = new System.Windows.Forms.Label();
this.usernumber = new System.Windows.Forms.TextBox();
this.userpass = new System.Windows.Forms.TextBox();
this.buttonlogin = new System.Windows.Forms.Button();
this.userloginname = new System.Windows.Forms.TextBox();
40
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 28.2F,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label1.Location = new System.Drawing.Point(220, 8);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(274, 54);
this.label1.TabIndex = 0;
this.label1.Text = "Реєстрація";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// registerform
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(734, 491);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "registerform";
this.Text = "registerform";
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
#endregion
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Button buttonlogin;
private System.Windows.Forms.TextBox userloginname;
private System.Windows.Forms.TextBox usernamefield;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox usernumber;
private System.Windows.Forms.TextBox userpass;
private System.Windows.Forms.Label label2;
}
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Foodform1());
}
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise,
false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new
System.ComponentModel.ComponentResourceManager(typeof(loginform));
this.panel1 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.loginfield = new System.Windows.Forms.TextBox();
this.passfield = new System.Windows.Forms.TextBox();
this.panel2 = new System.Windows.Forms.Panel();
this.label2 = new System.Windows.Forms.Label();
this.buttonlogin = new System.Windows.Forms.Button();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
this.panel2.SuspendLayout();
44
this.SuspendLayout();
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.Orange;
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel1.Controls.Add(this.label1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(734, 68);
this.panel1.TabIndex = 0;
this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 28.2F,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label1.Location = new System.Drawing.Point(220, 8);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(302, 54);
this.label1.TabIndex = 0;
this.label1.Text = "Авторизація";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// pictureBox1
//
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(35, 25);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(66, 61);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox1.TabIndex = 1;
this.pictureBox1.TabStop = false;
//
// pictureBox2
//
this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image")));
this.pictureBox2.Location = new System.Drawing.Point(35, 122);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(66, 61);
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox2.TabIndex = 2;
this.pictureBox2.TabStop = false;
//
// loginfield
//
this.loginfield.Font = new System.Drawing.Font("Microsoft Sans Serif", 28.2F,
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.loginfield.Location = new System.Drawing.Point(133, 25);
this.loginfield.Name = "loginfield";
45
this.buttonlogin.UseVisualStyleBackColor = true;
this.buttonlogin.Click += new System.EventHandler(this.buttonlogin_Click);
//
// loginform
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(734, 491);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "loginform";
this.Text = "loginform";
this.Load += new System.EventHandler(this.loginform_Load);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.ResumeLayout(false);
#endregion
DB db = new DB();
else
MessageBox.Show("Ви увішли !");
this.Hide();
Foodform1 Mainform = new Foodform1();
Mainform.Show();
}
}