Sunteți pe pagina 1din 31

MINISTERUL EDUCAŢIEI, CULTURII ȘI CERCETĂRII

AL REPUBLICII MOLDOVA

IP CENTRUL DE EXCELENȚĂ ÎN ECONOMIE ȘI FINANȚE


Catedra ”Informatică”

RAPORT PRIVIND
PRACTICA
CE ANTICIPEAZĂ PROBELE DE ABSOLVIRE

la specialitatea 61310 ,,Programarea si analiza produselor program”

Realizat în cadrul companiei „N1”

Conducător: ZATÎCA Alexandru, Elevul gr. PAP1613G, Mazur Cristian:


gr. did. I, master în șt. ale educației Evaluat cu nota

(Semnătura) Data susținerii


,,____”_______________________2020

Chișinău, 2020
CUPRINS
I. DESCRIEREA STRUCTURII ORGANIZATORICE A ÎNTREPRINDEREII .....................3
II. DESCRIEREA INSTRUMENTELOR DE LUCRU...............................................................4
III. SARCINI ȘI PROIECTE INDIVIDUALE DE LUCRU...............................................5
Meniul de logare în aplicație............................................................................................................6
Panoul de înregistrare a utilizatorilor noi........................................................................................7
Panoul administratorului..................................................................................................................8
Anexe..............................................................................................................................................11

2
I. DESCRIEREA STRUCTURII ORGANIZATORICE A
ÎNTREPRINDEREII

Practica ce anticipează probele de absolvire am realizat-o în cadrul instituției retea


de magazine “N1” din Chișinău.

Prezentarea generală a instituției:

Compania Nr1 deservește 1300 de clienți angro precum hoteluri, restaurante, centre de


afaceri. De asemenea compania distribuie produse alimentare în toate rețelele comerciale
ale Moldovei.

Rețeaua de magazine Nr1 este una dintre cele mai populare rețele din Moldova, care este
cunoscută pentru sortimentul său vast, iar uneori unic, precum și pentru calitatea înaltă a
produselor sale.

Ce înseamnă N1?
Nr1 este o rețea de magazine plasate în Chisinău, capitala Republicii Moldova. În anul
2016 rețeaua deja conține 15 magazine cu suprafața totală de 25 mii de m2. Din ele 17 mii
de m2 aparțin companiei, celelalte sunt în chirie pe termen lung. Ale spații cu suprafața de 8
mii m2 sunt în proces de proiectare sau construcție.

Magazinele Nr1 sunt vizitate zilnic de până peste 50 mii de cumpărători. Sortimentul


produselor în cel mai mare magazin este de 30 mii de articole. În companie lucrează 2 mii
de angajați: în magazine, în departamentul vânzări angro și în secțiile de producere.

Rețeaua de magazine Nr1 este distribuitor exclusiv al 22 branduri de produse alimentare,


printre care Parmalat, Nordic Seafood, Barilla, Zott, Hahne. Compania importă sute de
camioane mari anual..

3
II. DESCRIEREA INSTRUMENTELOR DE LUCRU

4
Lansat publicului in iunie 2000 si oficial in primavara anului 2002, C#
este un limbaj de programare care combina facilitati testate de-a lungul

timpului cu inovatii de ultim moment. Creatorii acestui limbaj au fost o


echipa de la firma Microsoft condusa de Anders Hejlsberg. Desi limbajul este
creat de Microsoft, acesta nu este destinat doar platformelor Microsoft.
Compilatoare C# exista si pentru alte sisteme precum Linux sau Macintosh.
Creat ca instrument de dezvoltare pentru arhitectura .NET, limbajul ofera o modalitate facila si
eficienta de a scrie programe pentru sistemul Windows, internet, componente software etc.

My SQL este un limbaj de programare specific pentru manipularea


datelor în sistemele de manipulare a bazelor de date relaționale, iar la
origine este un limbaj bazat pe algebra relațională. Acesta are ca
scop inserarea datelor, interogații, actualizare și ștergere, modificarea și crearea schemelor, precum și
controlul accesului la date. A devenit un standard în domeniu, fiind cel mai popular limbaj utilizat
pentru crearea, modificarea, regăsirea și manipularea datelor de către SGBD-urile relaționale. Pe
lângă versiunile standardizate ale limbajului, există o mulțime de dialecte și variante, unele
proprietare, fiind specifice anumitor SGBD-uri și de asemenea conținând extensii pentru a suporta
SBD-urile (Sistemele de Baze de Date) obiectuale (obiectual-relaționale).

Microsoft Word este un procesor de text, parte a suitei


(pachetului) Microsoft Office. Numele întreg este Microsoft Office Word deși
popular se numește Microsoft Word, MS Word sau doar Word in unele cazuri.
Prima lui versiune datează din 1983 fiind inițial disponibil sub numele de
Multi-Tool Word pentru Xenix systems.[1][2][3], doar pentru MS-
DOS (ultima versiune MS-DOS fiind 6 în 1993). În 1985, Microsoft Word a fost lansat și pe (atunci
noua) platformă Apple Macintosh, iar în 1989 pentru Windows, Microsoft continuând să suporte
ambele platforme până astăzi.

Visual Studio include un set complet de instrumente de

5
dezvoltare pentru generarea de aplicații ASP.NET, Servicii Web XML,
aplicații desktop și aplicații mobile. Visual Basic, Visual C++, Visual C# și
Visual J# toate folosesc același mediu de dezvoltare integrat (IDE) care le
permite partajarea instrumentelor și facilitează crearea de soluții folosind
mai multe limbaje de programare. Aceste limbaje permit să beneficieze de
caracteristicile .NET Framework care oferă acces la tehnologii cheie care simplifica dezvoltarea de
aplicații web ASP și XML Web Services cu Visual Web Developer.

Adobe Photoshop este un software folosit pentru


editarea imaginilor digitale pe calculator, program produs și distribuit
de compania americană Adobe Systems și care se se adresează în
special profesioniștilor domeniului. Adobe Photoshop, așa cum este
cunoscut astăzi, este vârful de lance al gamei de
produse software pentru editare de imagini digitale, fotografii, grafică
pentru tipar, video și Web de pe piață. Photoshop este un program cu o
interfață intuitivă și care permite o multitudine extraordinară de modificări necesare în mod curent
profesioniștilor și nu numai: editări de luminozitate și contrast, culoare, focalizare, aplicare de efecte
pe imagine sau pe zone (selecții), retușare de imagini degradate, număr arbitrar de canale de culoare,
suport de canale de culoare pe 8, 16 sau 32 biți, efecte third-party etc. Există situații specifice pentru
un profesionist în domeniu când alte pachete duc la rezultate mai rapide, însă pentru prelucrări
generale de imagine, întrucât furnizează instrumente solide, la standard industrial, Photoshop este
efectiv indispensabil.

III. SARCINI ȘI PROIECTE INDIVIDUALE DE LUCRU

6
Ca sarcină practică am avut de realizat o aplicație care va putea automatiza procesul de programări la
consultații, vizualizarea prețurilor aproximative pentru serviciile oferite și vizualizarea performațelor
avocaților disponibili.

Panoul administratorului

7
Panoul de înregistrare a utilizatorilor noi

Magazin

8
9
Contacte

Anexe
using System;

10
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace Magazin_alimentar
{
public partial class admin : Form
{
SqlConnection con = new SqlConnection(@"Data
Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Colea\Desktop\Magazin
alimentar\BD\LoginMAG.mdf;Integrated Security=True;Connect Timeout=30");
public admin()
{
InitializeComponent();
}

private void admin_Load(object sender, EventArgs e)


{

SqlCommand comen = new SqlCommand("SELECT * from Comenzi", con);


SqlDataAdapter daco = new SqlDataAdapter(comen);
DataSet dsco = new DataSet();
daco.Fill(dsco);
dataGridView13.DataSource = dsco.Tables[0];

SqlCommand u1 = new SqlCommand("SELECT * from Categorii", con);


SqlDataAdapter us1 = new SqlDataAdapter(u1);
DataSet su1 = new DataSet();
us1.Fill(su1);
dataGridView10.DataSource = su1.Tables[0];

//Afisare furnizori
SqlCommand user = new SqlCommand("SELECT * from Furnizori", con);
SqlDataAdapter us = new SqlDataAdapter(user);
DataSet su = new DataSet();
us.Fill(su);

11
dataGridView2.DataSource = su.Tables[0];
dataGridView9.DataSource = su.Tables[0];

//Afisre user
SqlCommand ui = new SqlCommand("SELECT * from Login", con);
SqlDataAdapter di = new SqlDataAdapter(ui);
DataSet du = new DataSet();
di.Fill(du);
dataGridView4.DataSource = du.Tables[0];
dataGridView6.DataSource = du.Tables[0];

//Afisare admini
SqlCommand fur = new SqlCommand("SELECT * from Admini", con);
SqlDataAdapter fr = new SqlDataAdapter(fur);
DataSet fu = new DataSet();
fr.Fill(fu);
dataGridView3.DataSource = fu.Tables[0];
dataGridView5.DataSource = fu.Tables[0];
dataGridView11.DataSource = fu.Tables[0];

SqlCommand sel1 = new SqlCommand("SELECT * FROM Categorii", con);


SqlCommand sel3 = new SqlCommand("SELECT * FROM Furnizori", con);
SqlCommand sel10 = new SqlCommand("SELECT * FROM Categorii", con);
SqlCommand sel30 = new SqlCommand("SELECT * FROM Furnizori", con);
SqlDataAdapter da1 = new SqlDataAdapter(sel1);
DataSet ds1 = new DataSet();
SqlDataAdapter da2 = new SqlDataAdapter(sel3);
DataSet ds2 = new DataSet();
SqlDataAdapter da10 = new SqlDataAdapter(sel1);
DataSet ds10 = new DataSet();
SqlDataAdapter da20 = new SqlDataAdapter(sel3);
DataSet ds20 = new DataSet();
da1.Fill(ds1);
da2.Fill(ds2);
da10.Fill(ds10);
da20.Fill(ds20);
comboBox1.DataSource = ds1.Tables[0];
comboBox2.DataSource = ds2.Tables[0];
comboBox1.DisplayMember = "Denumire_c";
comboBox2.DisplayMember = "Denumire_f";
comboBox1.ValueMember = "ID_Categorie";
comboBox2.ValueMember = "ID_Furnizor";
comboBox4.DataSource = ds10.Tables[0];
comboBox3.DataSource = ds20.Tables[0];

12
comboBox4.DisplayMember = "Denumire_c";
comboBox3.DisplayMember = "Denumire_f";
comboBox4.ValueMember = "ID_Categorie";
comboBox3.ValueMember = "ID_Furnizor";

//Afisare produse
SqlCommand sel = new SqlCommand("SELECT [Produse].[ID_Produs], [Produse].
[Denumire], Produse.Pret, [Categorii].[Denumire_c], [Furnizori].[Denumire_f] FROM [Produse]
INNER JOIN [Categorii] ON [Produse].[ID_Categorie]=[Categorii].[ID_Categorie] INNER JOIN
[Furnizori] ON [Produse].[ID_Furnizor]=[Furnizori].[ID_Furnizor]", con);
SqlDataAdapter da = new SqlDataAdapter(sel);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
dataGridView8.DataSource = ds.Tables[0];
dataGridView7.DataSource = ds.Tables[0];

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)


{
SqlCommand sel = new SqlCommand("SELECT [Produse].[ID_Produs], [Produse].
[Denumire], Produse.Pret, [Categorii].[Denumire_c], [Furnizori].[Denumire_f] FROM [Produse]
INNER JOIN [Categorii] ON [Produse].[ID_Categorie]=[Categorii].[ID_Categorie] INNER JOIN
[Furnizori] ON [Produse].[ID_Furnizor]=[Furnizori].[ID_Furnizor] where Denumire_c=@ne", con);
sel.Parameters.AddWithValue("@ne", comboBox1.Text);
SqlDataAdapter da = new SqlDataAdapter(sel);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];

private void tabPage1_Click(object sender, EventArgs e)


{

private void button1_Click(object sender, EventArgs e)


{

13
if (string.IsNullOrWhiteSpace(textBox1.Text) || string.IsNullOrWhiteSpace(textBox2.Text))
{
MessageBox.Show("Indepliniti cimpurile");
}
else
{
SqlCommand cmd;
cmd = new SqlCommand("Insert into Produse(Denumire, Pret, ID_Categorie,
ID_Furnizor) values('" + this.textBox1.Text + "', '" + this.textBox2.Text + "', '" +
comboBox1.SelectedValue + "', '" + comboBox2.SelectedValue + "')", con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Inserare reusita!");

}
SqlCommand sel = new SqlCommand("SELECT [Produse].[ID_Produs], [Produse].
[Denumire], Produse.Pret, [Categorii].[Denumire_c], [Furnizori].[Denumire_f] FROM [Produse]
INNER JOIN [Categorii] ON [Produse].[ID_Categorie]=[Categorii].[ID_Categorie] INNER JOIN
[Furnizori] ON [Produse].[ID_Furnizor]=[Furnizori].[ID_Furnizor]", con);
SqlDataAdapter da = new SqlDataAdapter(sel);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
dataGridView8.DataSource = ds.Tables[0];
dataGridView7.DataSource = ds.Tables[0];

private void comboBox1_SelectedIndexChanged_1(object sender, EventArgs e)


{

private void button2_Click(object sender, EventArgs e)


{
if (string.IsNullOrWhiteSpace(textBox4.Text) || string.IsNullOrWhiteSpace(textBox3.Text))
{
MessageBox.Show("Indepliniti cimpurile");
}
else
{
SqlCommand cmd;
cmd = new SqlCommand("Insert into Furnizori(Denumire_f, Adresa_f) values('" +

14
this.textBox4.Text + "', '" + this.textBox3.Text + "')", con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Inserare reusita!");

}
SqlCommand user = new SqlCommand("SELECT * from Furnizori", con);
SqlDataAdapter us = new SqlDataAdapter(user);
DataSet su = new DataSet();
us.Fill(su);
dataGridView2.DataSource = su.Tables[0];

private void button3_Click(object sender, EventArgs e)


{
Principala p = new Principala();
Form1 f1 = new Form1();
this.Close();
p.Show();
f1.Show();

private void button4_Click(object sender, EventArgs e)


{
if (string.IsNullOrWhiteSpace(textBox5.Text) || string.IsNullOrWhiteSpace(textBox6.Text) ||
string.IsNullOrWhiteSpace(textBox7.Text) || string.IsNullOrWhiteSpace(textBox8.Text))
{
MessageBox.Show("Indepliniti cimpurile");
}
else
{
SqlCommand cmd;
cmd = new SqlCommand("Insert into Admini(Nume, Prenume, Password, Login) values('"
+ this.textBox5.Text + "', '" + this.textBox6.Text + "', '" + this.textBox7.Text + "', '" +
this.textBox8.Text + "')", con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Inserare reusita!");

15
}
SqlCommand sel = new SqlCommand("SELECT * from Admini", con);
SqlDataAdapter da = new SqlDataAdapter(sel);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView3.DataSource = ds.Tables[0];
dataGridView5.DataSource = ds.Tables[0];
dataGridView11.DataSource = ds.Tables[0];
}

private void label18_Click(object sender, EventArgs e)


{

private void button5_Click(object sender, EventArgs e)


{
if (string.IsNullOrWhiteSpace(textBox9.Text) || string.IsNullOrWhiteSpace(textBox10.Text)
|| string.IsNullOrWhiteSpace(textBox11.Text) || string.IsNullOrWhiteSpace(textBox12.Text) ||
string.IsNullOrWhiteSpace(textBox13.Text))
{
MessageBox.Show("Indepliniti cimpurile");
}
else
{
SqlCommand cmd;
cmd = new SqlCommand("Insert into Login(Email, Parola, Nume, Prenume, Adresa)
values('" + this.textBox9.Text + "', '" + this.textBox10.Text + "', '" + this.textBox11.Text + "', '" +
this.textBox12.Text + "', '" + this.textBox13.Text + "')", con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Inserare reusita!");

}
SqlCommand sel = new SqlCommand("SELECT * from Login", con);
SqlDataAdapter da = new SqlDataAdapter(sel);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView4.DataSource = ds.Tables[0];
dataGridView6.DataSource = ds.Tables[0];
}

private void tabPage2_Click(object sender, EventArgs e)

16
{

}
////////////////////////////Sterge admin////////////////////////////////////////////////
private void button6_Click(object sender, EventArgs e)
{
string query = "SELECT * FROM Admini WHERE ID_Admin = '" + textBox14.Text.Trim()
+ "'";
SqlDataAdapter sda = new SqlDataAdapter(query, con);
DataTable dt = new DataTable();
sda.Fill(dt);
if (dt.Rows.Count == 1)
{
SqlCommand cmd = new SqlCommand("delete from Admini where ID_Admin=@id",
con);
con.Open();
cmd.Parameters.AddWithValue("@id", textBox14.Text);
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Stergere reusita");
}
else
{
MessageBox.Show("Introdu corect datele");
}

SqlCommand sel = new SqlCommand("SELECT * from Admini", con);


SqlDataAdapter da = new SqlDataAdapter(sel);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView3.DataSource = ds.Tables[0];
dataGridView5.DataSource = ds.Tables[0];
}
////////////////////////////Sterge user////////////////////////////////////////////////
private void button7_Click(object sender, EventArgs e)
{
string query = "SELECT * FROM Login WHERE ID_Login = '" + textBox15.Text.Trim() +
"'";
SqlDataAdapter sda = new SqlDataAdapter(query, con);
DataTable dt = new DataTable();
sda.Fill(dt);
if (dt.Rows.Count == 1)

17
{
SqlCommand cmd = new SqlCommand("delete from Login where ID_Login=@id", con);
con.Open();
cmd.Parameters.AddWithValue("@id", textBox15.Text);
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Stergere reusita");
}
else
{
MessageBox.Show("Introdu corect datele");
}

SqlCommand sel = new SqlCommand("SELECT * from Login", con);


SqlDataAdapter da = new SqlDataAdapter(sel);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView4.DataSource = ds.Tables[0];
dataGridView6.DataSource = ds.Tables[0];
}

private void button9_Click(object sender, EventArgs e)


{

string query = "SELECT * FROM Produse WHERE ID_Produs = '" + textBox17.Text.Trim()


+ "'";
SqlDataAdapter sda = new SqlDataAdapter(query, con);
DataTable dt = new DataTable();
sda.Fill(dt);
if (dt.Rows.Count == 1)
{
SqlCommand cmd = new SqlCommand("delete from Furnizori where ID_Furnizor=@id",
con);
con.Open();
cmd.Parameters.AddWithValue("@id", textBox15.Text);
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Stergere reusita");
}
else
{
MessageBox.Show("Introdu corect datele");
}

18
SqlCommand sel = new SqlCommand("SELECT [Produse].[ID_Produs], [Produse].
[Denumire], Produse.Pret, [Categorii].[Denumire_c], [Furnizori].[Denumire_f] FROM [Produse]
INNER JOIN [Categorii] ON [Produse].[ID_Categorie]=[Categorii].[ID_Categorie] INNER JOIN
[Furnizori] ON [Produse].[ID_Furnizor]=[Furnizori].[ID_Furnizor]", con);
SqlDataAdapter da = new SqlDataAdapter(sel);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
dataGridView8.DataSource = ds.Tables[0];
dataGridView7.DataSource = ds.Tables[0];
}

private void button11_Click(object sender, EventArgs e)


{
if (string.IsNullOrWhiteSpace(textBox19.Text))
{
MessageBox.Show("Indepliniti cimpul");
}
else
{
SqlCommand cmd;
cmd = new SqlCommand("Insert into Categorii(Denumire_c) values('" +
this.textBox19.Text + "')", con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Inserare reusita!");

}
SqlCommand user = new SqlCommand("SELECT * from Categorii", con);
SqlDataAdapter us = new SqlDataAdapter(user);
DataSet su = new DataSet();
us.Fill(su);
dataGridView10.DataSource = su.Tables[0];

private void button8_Click(object sender, EventArgs e)


{

19
if (!string.IsNullOrEmpty(textBox20.Text) && !string.IsNullOrWhiteSpace(textBox20.Text)
&&
!string.IsNullOrEmpty(textBox18.Text) && !string.IsNullOrWhiteSpace(textBox18.Text)
&&
!string.IsNullOrEmpty(textBox16.Text) && !string.IsNullOrWhiteSpace(textBox16.Text))
{
SqlCommand command = new SqlCommand("UPDATE [Produse] SET
[Denumire]=@Denumire, [Pret]=@Pret, [ID_Categorie]=@ID_Categorie,
[ID_Furnizor]=@ID_Furnizor WHERE [ID_Produs]=@ID_Produs", con);

command.Parameters.AddWithValue("ID_Produs", textBox20.Text);
command.Parameters.AddWithValue("Denumire", textBox18.Text);
command.Parameters.AddWithValue("Pret", textBox16.Text);
command.Parameters.AddWithValue("ID_Categorie", comboBox4.SelectedValue);
command.Parameters.AddWithValue("ID_Furnizor", comboBox3.SelectedValue);
con.Open();
command.ExecuteNonQuery();
con.Close();
}
else
{
MessageBox.Show("Incercaati din nou");
}

SqlCommand sel = new SqlCommand("SELECT [Produse].[ID_Produs], [Produse].


[Denumire], Produse.Pret, [Categorii].[Denumire_c], [Furnizori].[Denumire_f] FROM [Produse]
INNER JOIN [Categorii] ON [Produse].[ID_Categorie]=[Categorii].[ID_Categorie] INNER JOIN
[Furnizori] ON [Produse].[ID_Furnizor]=[Furnizori].[ID_Furnizor]", con);
SqlDataAdapter da = new SqlDataAdapter(sel);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
dataGridView8.DataSource = ds.Tables[0];
dataGridView7.DataSource = ds.Tables[0];

private void button10_Click(object sender, EventArgs e)


{
if (!string.IsNullOrEmpty(textBox23.Text) && !string.IsNullOrWhiteSpace(textBox23.Text)
&&
!string.IsNullOrEmpty(textBox22.Text) && !string.IsNullOrWhiteSpace(textBox22.Text)
&&

20
!string.IsNullOrEmpty(textBox21.Text) && !string.IsNullOrWhiteSpace(textBox21.Text))
{
SqlCommand command = new SqlCommand("UPDATE [Furnizori] SET
[Denumire_f]=@Denumire_f, [Adresa_f]=@Adresa_f WHERE [ID_Furnizor]=@ID_Furnizor",
con);

command.Parameters.AddWithValue("ID_Furnizor", textBox23.Text);
command.Parameters.AddWithValue("Denumire_f", textBox22.Text);
command.Parameters.AddWithValue("Adresa_f", textBox21.Text);

con.Open();
command.ExecuteNonQuery();
con.Close();
}
else
{
MessageBox.Show("Incercaati din nou");
}
SqlCommand user = new SqlCommand("SELECT * from Furnizori", con);
SqlDataAdapter us = new SqlDataAdapter(user);
DataSet su = new DataSet();
us.Fill(su);
dataGridView2.DataSource = su.Tables[0];
dataGridView9.DataSource = su.Tables[0];
}

private void tabPage3_Click(object sender, EventArgs e)


{

private void button12_Click(object sender, EventArgs e)


{
if (!string.IsNullOrEmpty(textBox24.Text) && !string.IsNullOrWhiteSpace(textBox24.Text)
&&
!string.IsNullOrEmpty(textBox25.Text) && !string.IsNullOrWhiteSpace(textBox25.Text)
&&
!string.IsNullOrEmpty(textBox26.Text) && !string.IsNullOrWhiteSpace(textBox26.Text)
&&
!string.IsNullOrEmpty(textBox27.Text) && !string.IsNullOrWhiteSpace(textBox27.Text)
&&
!string.IsNullOrEmpty(textBox28.Text) && !string.IsNullOrWhiteSpace(textBox28.Text))
{
SqlCommand command = new SqlCommand("UPDATE [Admini] SET [Nume]=@Nume,

21
[Prenume]=@Prenume, [Password]=@Password, [Login]=@Login WHERE
[ID_Admin]=@ID_Admin", con);

command.Parameters.AddWithValue("ID_Admin", textBox24.Text);
command.Parameters.AddWithValue("Nume", textBox25.Text);
command.Parameters.AddWithValue("Prenume", textBox26.Text);
command.Parameters.AddWithValue("Password", textBox27.Text);
command.Parameters.AddWithValue("Login", textBox28.Text);
con.Open();
command.ExecuteNonQuery();
con.Close();
}
else
{
MessageBox.Show("Incercaati din nou");
}
SqlCommand sel = new SqlCommand("SELECT * from Admini", con);
SqlDataAdapter da = new SqlDataAdapter(sel);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView3.DataSource = ds.Tables[0];
dataGridView5.DataSource = ds.Tables[0];
dataGridView11.DataSource = ds.Tables[0];
}

private void button13_Click(object sender, EventArgs e)


{
if (!string.IsNullOrEmpty(textBox29.Text) && !string.IsNullOrWhiteSpace(textBox29.Text)
&&
!string.IsNullOrEmpty(textBox30.Text) && !string.IsNullOrWhiteSpace(textBox30.Text)
&&
!string.IsNullOrEmpty(textBox31.Text) && !string.IsNullOrWhiteSpace(textBox31.Text)
&&
!string.IsNullOrEmpty(textBox32.Text) && !string.IsNullOrWhiteSpace(textBox32.Text)
&&
!string.IsNullOrEmpty(textBox33.Text) && !string.IsNullOrWhiteSpace(textBox33.Text)
&&
!string.IsNullOrEmpty(textBox34.Text) && !string.IsNullOrWhiteSpace(textBox34.Text))
{
SqlCommand command = new SqlCommand("UPDATE [Login] SET [Email]=@Email,
[Parola]=@Parola, [Nume]=@Nume, [Prenume]=@Prenume, [Adresa]=@Adresa WHERE
[ID_Login]=@ID_Login", con);

command.Parameters.AddWithValue("ID_Login", textBox29.Text);

22
command.Parameters.AddWithValue("Email", textBox30.Text);
command.Parameters.AddWithValue("Parola", textBox31.Text);
command.Parameters.AddWithValue("Nume", textBox32.Text);
command.Parameters.AddWithValue("Prenume", textBox33.Text);
command.Parameters.AddWithValue("Adresa", textBox34.Text);
con.Open();
command.ExecuteNonQuery();
con.Close();
}
else
{
MessageBox.Show("Incercaati din nou");
}
}

private void button14_Click(object sender, EventArgs e)


{
string query = "SELECT * FROM Comenzi WHERE ID_Comanda = '" +
textBox35.Text.Trim() + "'";
SqlDataAdapter sda = new SqlDataAdapter(query, con);
DataTable dt = new DataTable();
sda.Fill(dt);
if (dt.Rows.Count == 1)
{
SqlCommand cmd = new SqlCommand("delete from Comenzi where ID_Comanda=@id",
con);
con.Open();
cmd.Parameters.AddWithValue("@id", textBox35.Text);
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Stergere reusita");
}
else
{
MessageBox.Show("Introdu corect datele");
}

SqlCommand sel = new SqlCommand("SELECT * from Comenzi", con);


SqlDataAdapter da = new SqlDataAdapter(sel);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView13.DataSource = ds.Tables[0];

23
}

}
Anexa 2
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Magazin_alimentar
{
public partial class Contacte : Form
{
public Contacte()
{
InitializeComponent();
}

private void Contacte_Load(object sender, EventArgs e)


{

private void ListBox3_SelectedIndexChanged(object sender, EventArgs e)


{

}
}
}
Anexa 3
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Magazin_alimentar
{
public partial class desprenoi : Form
{
public desprenoi()
{
InitializeComponent();
}

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)


{

24
}

private void desprenoi_Load(object sender, EventArgs e)


{

}
}
}
Anexa 4
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace Magazin_alimentar
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)


{

///////////////////////////////////////////////////////////////////////////////////Logare -
Email si
Parola///////////////////////////////////////////////////////////////////////////////////////
////////
private void logare_Click(object sender, EventArgs e)
{
SqlConnection sqlcon = new SqlConnection(@"Data
Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Colea\Desktop\Magazin
alimentar\BD\LoginMAG.mdf;Integrated Security=True;Connect Timeout=30");

string query = "SELECT * FROM Login WHERE Email = '"+textBox1.Text.Trim()+"' and


Parola = '"+textBox2.Text.Trim()+"' ";
string query2 = "SELECT * FROM Admini WHERE Login = '" + textBox1.Text.Trim() +
"' and Password = '" + textBox2.Text.Trim() + "' ";
SqlDataAdapter sda = new SqlDataAdapter(query, sqlcon);
SqlDataAdapter sda2 = new SqlDataAdapter(query2, sqlcon);
DataTable dt = new DataTable();
DataTable dt2 = new DataTable();
sda.Fill(dt);
sda2.Fill(dt2);
if (dt.Rows.Count == 1)

25
{
Principala form1 = (Principala)Application.OpenForms["Principala"];
Form2 frm2 = new Form2();
frm2.Show();
form1.Hide();
this.Close();
}
else if (dt2.Rows.Count == 1)
{
Principala form1 = (Principala)Application.OpenForms["Principala"];
admin adm = new admin();
adm.Show();
form1.Hide();
this.Close();
}
else
{
MessageBox.Show("Introdu corect datele");
}

}
/////////////////////////////////////////////////////////////////Buton
Exit/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
/////////////////////////////////////////////////////////////////Buton
Inregistrare/////////////////////////////////////////////////////////////////////////////////
////////////////////////////
private void button1_Click(object sender, EventArgs e)
{
Form3 objForm3 = new Form3();
objForm3.Show();
}

}
}

Anexa 5
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.IO;
using System.Drawing.Imaging;

namespace Magazin_alimentar
{

26
public partial class Form2 : Form
{

SqlConnection con = new SqlConnection(@"Data


Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Colea\Desktop\Magazin
alimentar\BD\LoginMAG.mdf;Integrated Security=True;Connect Timeout=30");
public Form2()
{
InitializeComponent();
}

private void Form2_Load(object sender, EventArgs e)


{

SqlCommand sel1 = new SqlCommand("SELECT * FROM Categorii", con);


SqlDataAdapter da1 = new SqlDataAdapter(sel1);
DataSet ds1 = new DataSet();
da1.Fill(ds1);
comboBox1.DataSource = ds1.Tables[0];
comboBox1.DisplayMember = "Denumire_c";
comboBox1.ValueMember = "ID_Categorie";

SqlCommand sel = new SqlCommand("SELECT [Produse].[ID_Produs], [Produse].


[Denumire] FROM [Produse] INNER JOIN [Categorii] ON [Produse].[ID_Categorie]=[Categorii].
[ID_Categorie] INNER JOIN [Furnizori] ON [Produse].[ID_Furnizor]=[Furnizori].[ID_Furnizor]
where Denumire_c=@ne", con);
sel.Parameters.AddWithValue("@ne", comboBox1.Text);
SqlDataAdapter da = new SqlDataAdapter(sel);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
dataGridView1.Columns[0].Visible = false;
}

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)


{
SqlCommand sel = new SqlCommand("SELECT [Produse].[ID_Produs], [Produse].
[Denumire] FROM [Produse] INNER JOIN [Categorii] ON [Produse].[ID_Categorie]=[Categorii].
[ID_Categorie] INNER JOIN [Furnizori] ON [Produse].[ID_Furnizor]=[Furnizori].[ID_Furnizor]
where Denumire_c=@ne", con);
sel.Parameters.AddWithValue("@ne", comboBox1.Text);
SqlDataAdapter da = new SqlDataAdapter(sel);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];

private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs


e)
{

27
SqlCommand sel2 = new SqlCommand("SELECT * FROM [Produse] INNER JOIN [Categorii]
ON [Produse].[ID_Categorie]=[Categorii].[ID_Categorie] INNER JOIN [Furnizori] ON [Produse].
[ID_Furnizor]=[Furnizori].[ID_Furnizor] where ID_Produs=@ne", con);
sel2.Parameters.AddWithValue("@ne", dataGridView1.CurrentRow.Cells[0].Value);
SqlDataAdapter da2 = new SqlDataAdapter(sel2);
DataTable ds2 = new DataTable();
da2.Fill(ds2);
textBox3.Text = ds2.Rows[0].ItemArray[0].ToString();
label1.Text = "Denumire: " + ds2.Rows[0].ItemArray[1].ToString();
label2.Text = "Categorie: " + ds2.Rows[0].ItemArray[6].ToString();
label3.Text = "Pret: " + ds2.Rows[0].ItemArray[2].ToString() + " lei";
label4.Text = "Furnizor: " + ds2.Rows[0].ItemArray[8].ToString();

private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)


{

private void button3_Click(object sender, EventArgs e)


{
Principala p = new Principala();
Form1 f1 = new Form1();
this.Close();
p.Show();
f1.Show();
}

private void button1_Click(object sender, EventArgs e)


{
if (string.IsNullOrWhiteSpace(textBox1.Text) ||
string.IsNullOrWhiteSpace(textBox2.Text))
{
MessageBox.Show("Indepliniti cimpurile!");
}
else if (string.IsNullOrWhiteSpace(textBox3.Text))
{
MessageBox.Show("Alege produsul!");
}
else
{
SqlCommand cmd;
cmd = new SqlCommand("Insert into Comenzi(ID_Produs, Cantitate, Nme_Prenume,
Telefon) values ('" + textBox3.Text + "', '" + comboBox2.Text + "' , '" + textBox1.Text + "',
'" + textBox2.Text + "')", con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Comanda reusita!");

28
}
}
}
Anexa 6
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace Magazin_alimentar
{
public partial class Form3 : Form
{
string sqlconnection = @"Data
Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Colea\Desktop\Magazin
alimentar\BD\LoginMAG.mdf;Integrated Security=True;Connect Timeout=30";

public Form3()
{
InitializeComponent();

}
//////////////////////////////////////////////////////Inregistrare in baza de
date///////////////////////////////////////////////
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" ||
textBox4.Text == "" || textBox5.Text == "")
MessageBox.Show("Indepliniti toate cimpurile");
else if (textBox5.Text != textBox6.Text)
MessageBox.Show("Parolele nu coincid");
else
{
using (SqlConnection conSQL = new SqlConnection(sqlconnection))
{
conSQL.Open();
SqlCommand sqlcmd = new SqlCommand("addUser", conSQL);
sqlcmd.CommandType = CommandType.StoredProcedure;
sqlcmd.Parameters.AddWithValue("@Email", textBox4.Text.Trim());
sqlcmd.Parameters.AddWithValue("@Parola", textBox5.Text.Trim());
sqlcmd.Parameters.AddWithValue("@Nume", textBox1.Text.Trim());
sqlcmd.Parameters.AddWithValue("@Prenume", textBox2.Text.Trim());
sqlcmd.Parameters.AddWithValue("@Adresa", textBox3.Text.Trim());
sqlcmd.ExecuteNonQuery();
MessageBox.Show("Inregistrare reusita");
//Inapoi la principala
this.Close();
}

29
}

private void Form3_Load(object sender, EventArgs e)


{

}
}
}
Anexa 7
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Magazin_alimentar
{
public partial class Principala : Form
{

public Principala()
{
InitializeComponent();
button5.MouseLeave += OnMouseLeaveButton5;
button5.MouseEnter += OnMouseEnterButton5;
}

private void button2_Click(object sender, EventArgs e)


{
Form3 objForm3 = new Form3();
objForm3.Show();
}

private void button5_Click(object sender, EventArgs e)


{
this.Close();
}

private void Principala_Load(object sender, EventArgs e)


{

private void button1_Click(object sender, EventArgs e)


{
Form1 objForm1 = new Form1();
objForm1.Show();
}

private void button3_Click(object sender, EventArgs e)


{
desprenoi dpn = new desprenoi();
dpn.Show();

30
}

private void OnMouseEnterButton5(object sender, EventArgs e)


{
button5.BackColor = Color.Red;
button5.ForeColor = Color.White;
}
private void OnMouseLeaveButton5(object sender, EventArgs e)
{
button5.BackColor = SystemColors.ControlLightLight;
button5.ForeColor = Color.Black;
}

private void button4_Click(object sender, EventArgs e)


{
Contacte co = new Contacte();
co.Show();
}
}
}
Anexa 8
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Magazin_alimentar
{
static class Program
{
/// <summary>
/// Главная точка входа для приложения.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Principala());
}
}
}

31

S-ar putea să vă placă și