Exemplo n.º 1
0
        private void Approve(CommandDocumentation model, CommandLineHelpConfiguration?configuration = null)
        {
            var pathProvider = new DefaultCommandLineHelpPathProvider();
            var documentSet  = new DocumentSet <IDocument>();

            configuration ??= new ConfigurationProvider().GetDefaultCommandLineHelpConfiguration();

            var commandPage = new CommandPage(documentSet, pathProvider, model, configuration);

            // add dummy application page and command page itself to document set
            // because command page will create a link to the application page
            // which would fail otherwise
            documentSet.Add(pathProvider.GetPath(model.Application), new TextDocument());
            documentSet.Add(pathProvider.GetPath(model), commandPage);

            var doc = commandPage.GetDocument();

            Assert.NotNull(doc);

            var markdown = doc.ToString();

            var writer = new ApprovalTextWriter(markdown);

            Approvals.Verify(writer, new ApprovalNamer(relativeOutputDirectory: "../../../_referenceResults"), Approvals.GetReporter());
        }
Exemplo n.º 2
0
        private void Login_Click(object sender, EventArgs e)
        {
            ReadFromFile(3);
            ReadFromFile(4);
            string username = lUsername.Text;
            string password = lPassword.Text;

            foreach (var item in Utilizatori)
            {
                if (item.Username == username && item.Password == password)
                {
                    currentUser = new Guest(item.Id, item.Nume, item.Prenume, item.Username, item.Password, item.Email, false);
                    LoginPage.Hide();
                    CommandPage.Hide();
                    ProductPage.Show();
                    AdminPage.Hide();
                }
            }

            foreach (var item in Administratori)
            {
                if (item.Username == username && item.Password == password)
                {
                    currentAdmin = new Admin(item.Id, item.Nume, item.Prenume, item.Username, item.Password, item.Email, true);
                    LoginPage.Hide();
                    CommandPage.Hide();
                    ProductPage.Hide();
                    AdminPage.Show();
                }
            }
        }
Exemplo n.º 3
0
        private void comandaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (currentUser != null)
            {
                CommandPage.Show();
                ProductPage.Hide();
                LoginPage.Hide();
            }
            else
            {
                LoginPage.Show();
                ProductPage.Hide();
                CommandPage.Hide();
            }
            lvComanda.Items.Clear();
            double total = 0;

            if (comanda != null)
            {
                foreach (var produs in comanda.Produse)
                {
                    if (produs.Item3 == true)
                    {
                        foreach (var item in ProdusePerisabile)
                        {
                            if (produs.Item1 == item.Id)
                            {
                                var Item = new ListViewItem(new[] {
                                    item.Denumire,
                                    produs.Item2.ToString(),
                                    item.Categorie,
                                    item.Pret.ToString(),
                                });
                                lvComanda.Items.Add(Item);
                                total += item.Pret * produs.Item2;
                            }
                        }
                    }
                    else
                    {
                        foreach (var item in ProduseNeperisabile)
                        {
                            if (produs.Item1 == item.Id)
                            {
                                var Item = new ListViewItem(new[] {
                                    item.Denumire,
                                    produs.Item2.ToString(),
                                    item.Categorie,
                                    item.Pret.ToString(),
                                });
                                lvComanda.Items.Add(Item);
                                total += item.Pret * produs.Item2;
                            }
                        }
                    }
                }
                cOutTotal.Text = total.ToString();
            }
        }
Exemplo n.º 4
0
 private void logoutToolStripMenuItem_Click(object sender, EventArgs e)
 {
     currentUser  = null;
     currentAdmin = null;
     ProductPage.Hide();
     CommandPage.Hide();
     AdminPage.Hide();
     LoginPage.Show();
 }
Exemplo n.º 5
0
 public Form()
 {
     InitializeComponent();
     ReadFromFile(0);// Citire Tot din Fisiere
     CommandPage.Hide();
     ProductPage.Hide();
     registerPanel.Hide();
     AdminPage.Hide();
 }
Exemplo n.º 6
0
 private void produseToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (currentUser != null)
     {
         ProductPage.Show();
         CommandPage.Hide();
         LoginPage.Hide();
     }
     else
     {
         LoginPage.Show();
         ProductPage.Hide();
         CommandPage.Hide();
     }
 }