コード例 #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            var idCarte    = Decimal.ToInt32(Math.Truncate(this.numericUpDown2.Value));
            var textReview = this.textBox7.Text;

            if (string.IsNullOrEmpty(textReview))
            {
                MessageBox.Show("Un review este obligatoriu la restituirea unei carti", "Information",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                return;
            }
            if (!WcfClient.GetInstance().PotRestituiiCartea(_cititor, idCarte))
            {
                MessageBox.Show("Nu poti restituii cartea imprumutata de alta persoana", "Information",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                return;
            }
            if (WcfClient.GetInstance().RestituieCarte(_cititor, idCarte, textReview))
            {
                MessageBox.Show("Ati restituit cu succes cartea", "Information",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("A aparut o eroare neprevazuta", "Information",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            string caption = "Library";
            string message = "";

            if (string.IsNullOrEmpty(this.textBox1.Text) || string.IsNullOrEmpty(this.textBox2.Text) ||
                string.IsNullOrEmpty(this.textBox3.Text) || string.IsNullOrEmpty(textBox4.Text))
            {
                message = "Toate campurile trebuie completate!";
                MessageBox.Show(message, caption,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }
            if (this.numericUpDown1.Value == 0)
            {
                message = "Trebuie sa adaugi cel putin o carte in bibioteca";
                MessageBox.Show(message, caption,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }

            AchizitieCarte carti = new AchizitieCarte
            {
                Titlu        = this.textBox1.Text,
                NumeAutor    = this.textBox2.Text,
                PrenumeAutor = this.textBox3.Text,
                Descriere    = this.textBox4.Text,
                NumarCarti   = Decimal.ToInt32(Math.Truncate(this.numericUpDown1.Value))
            };

            var dbResult = WcfClient.GetInstance().AchizitieCarte(carti);

            if (dbResult)
            {
                message = "Ati adaugat cu succes cartile in biblioteca. Doriti o noua tranzactie?";
            }
            else
            {
                message = "Din pacate cartile nu au fost adaugate in biblioteca. Doriti o noua tranzactie?";
            }
            var result = MessageBox.Show(message, caption,
                                         MessageBoxButtons.YesNo,
                                         MessageBoxIcon.Question);

            this.textBox1.Text        = "";
            this.textBox2.Text        = "";
            this.textBox3.Text        = "";
            this.textBox4.Text        = "";
            this.numericUpDown1.Value = 0;
            if (result == DialogResult.No)
            {
                this.Hide();
                Form1 form1 = new Form1();
                form1.ShowDialog();
            }
        }
コード例 #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            var autorNume    = this.textBox3.Text;
            var autorPrenume = this.textBox8.Text;
            var titluCarte   = this.textBox4.Text;
            int numarZile    = Decimal.ToInt32(Math.Truncate(this.numericUpDown1.Value));

            if (string.IsNullOrEmpty(autorPrenume) || string.IsNullOrEmpty(autorNume) ||
                string.IsNullOrEmpty(titluCarte))
            {
                MessageBox.Show("Toate campurile trebuie completate corect", "Mesaj de eroare",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }
            if (numarZile < 1)
            {
                MessageBox.Show("Poti imprumuta cel putin pentru o zi", "Mesaj de eroare",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }

            if (WcfClient.GetInstance().ExistaCartea(titluCarte, autorNume, autorPrenume))
            {
                MessageBox.Show("Cartea nu exista", "Information",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                return;
            }
            var dataScadenta = WcfClient.GetInstance().EsteCarteaDisponibila(autorNume, autorPrenume, titluCarte);

            if (dataScadenta != null)
            {
                MessageBox.Show("Cartea nu este disponibila momentan, reveniti pe " + dataScadenta, "Information",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                return;
            }

            var result = WcfClient.GetInstance().ImprumutaCartea(_cititor, titluCarte, autorNume, autorPrenume, numarZile);

            if (result)
            {
                MessageBox.Show("Ati imprumutat cartea cu succes", "Information",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("A aparut o eroare neprevazuta", "Information",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
            }
        }
コード例 #4
0
ファイル: FormStatistici.cs プロジェクト: cosminchiriac97/tsp
        private void button4_Click(object sender, EventArgs e)
        {
            var           genuri  = WcfClient.GetInstance().GenurileCeleMaiCautati();
            List <string> topList = new List <string>();

            foreach (var gen in genuri)
            {
                topList.Add(gen.Name + " " + gen.Scor);
            }
            this.listBox4.DataSource = topList;
        }
コード例 #5
0
ファイル: FormStatistici.cs プロジェクト: cosminchiriac97/tsp
        private void button3_Click(object sender, EventArgs e)
        {
            var           autoriiCeiMaiSolicitati = WcfClient.GetInstance().AutoriiCeiMaiCautati();
            List <string> topList = new List <string>();

            foreach (var autor in autoriiCeiMaiSolicitati)
            {
                topList.Add(autor.Nume + " " + autor.Prenume + " " + autor.Scor);
            }
            this.listBox3.DataSource = topList;
        }
コード例 #6
0
ファイル: FormStatistici.cs プロジェクト: cosminchiriac97/tsp
        private void button2_Click(object sender, EventArgs e)
        {
            var           cartiSolicitate = WcfClient.GetInstance().CeleMaiSolicitateCarti();
            List <string> topListCarti    = new List <string>();

            foreach (var carte in cartiSolicitate)
            {
                topListCarti.Add(carte.Titlu + " " + carte.Count);
            }
            this.listBox2.DataSource = topListCarti;
        }
コード例 #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            var bookList = WcfClient.GetInstance().GetCarti(this.textBox1.Text);

            this.textBox2.Text = "";
            if (bookList != null)
            {
                foreach (var book in bookList)
                {
                    this.textBox2.Text = this.textBox2.Text + book.Titlu + "@";
                }
            }
            else
            {
                this.textBox2.Text = "Nu exista nici o carte de acest gen!";
            }
            this.textBox2.Text = this.textBox2.Text.Replace("@", System.Environment.NewLine);
        }
コード例 #8
0
ファイル: FormStatistici.cs プロジェクト: cosminchiriac97/tsp
        private void button5_Click(object sender, EventArgs e)
        {
            var titluCarte = this.textBox1.Text;

            if (string.IsNullOrEmpty(titluCarte))
            {
                MessageBox.Show("Nu ati adaugat titlul cartii", "Informatie",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                return;
            }
            var reviews = WcfClient.GetInstance().GetReviewsForABook(titluCarte);

            this.listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            foreach (var review in reviews)
            {
                listView1.Items.Add(new ListViewItem(new string[] { review.Text }));
            }
        }
コード例 #9
0
ファイル: FormStatistici.cs プロジェクト: cosminchiriac97/tsp
        private void button1_Click(object sender, EventArgs e)
        {
            DateTime deLa         = this.dateTimePicker1.Value;
            DateTime panaLa       = this.dateTimePicker2.Value;
            var      cititoriList = WcfClient.GetInstance().ArataCititoriDeLaPanaLa(deLa, panaLa);

            if (cititoriList == null)
            {
                MessageBox.Show("A aparut o eroare neprevazuta", "Eroare",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }
            this.label6.Text = cititoriList.Length.ToString();
            List <string> cititoriString = new List <string>();

            foreach (var cititor in cititoriList)
            {
                cititoriString.Add(cititor.Nume + " " + cititor.Prenume);
            }
            this.listBox1.DataSource = cititoriString;
        }
コード例 #10
0
ファイル: FormDialog.cs プロジェクト: cosminchiriac97/tsp
        private void button1_Click(object sender, EventArgs e)
        {
            var nume    = this.textBox1.Text;
            var prenume = this.textBox2.Text;
            var email   = this.textBox3.Text;
            var adresa  = this.textBox4.Text;

            if (string.IsNullOrEmpty(nume) || string.IsNullOrEmpty(prenume) || string.IsNullOrEmpty(email) ||
                string.IsNullOrEmpty(adresa))
            {
                MessageBox.Show("Toate campurile trebuie completate", "Mesaj de eroare",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }

            var cititor = new InregistrareCititor
            {
                Nume    = nume,
                Prenume = prenume,
                Email   = email,
                Adresa  = adresa
            };
            var reader = WcfClient.GetInstance().AddCititor(cititor);

            if (reader != null)
            {
                this.Hide();
                startPage.Hide();
                FormImprumutaCarte form = new FormImprumutaCarte(reader);
                form.ShowDialog();
            }
            else
            {
                MessageBox.Show("Something went wrong!", "Mesaj de eroare",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }