예제 #1
0
 public bool HasntEmptyParametrs(ArticleInformation article)
 {
     if (article.name == "" || article.count == "" || article.prise == "" || article.productionDate == "" || article.shelfLife == "")
     {
         return(false);
     }
     return(true);
 }
예제 #2
0
 public bool OneIsIndividual(ArticleInformation article, List <ArticleInformation> articles)
 {
     foreach (ArticleInformation i in articles)
     {
         if (i.id == article.id)
         {
             return(false);
         }
     }
     return(true);
 }
예제 #3
0
 private void Button1_Click(object sender, EventArgs e)
 {
     if (Text == "Add new article")
     {
         CheckArticlesIndividual check = new CheckArticlesIndividual();
         ArticleInformation      toAdd = new ArticleInformation(textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text);
         if (check.OneIsIndividual(toAdd, FormsComunication.articles))
         {
             if (check.HasntEmptyParametrs(toAdd))
             {
                 FormsComunication.articles.Add(toAdd);
                 FormsComunication.changed = true;
                 Close();
             }
             else
             {
                 MessageBox.Show("Some text boxes are empty");
             }
         }
         else
         {
             MessageBox.Show("User with this number of phone or email in the list!");
         }
     }
     else if (Text == "Remake article's information")
     {
         CheckArticlesIndividual check = new CheckArticlesIndividual();
         ArticleInformation      toAdd = new ArticleInformation(textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text);
         if (check.OneIsIndividual(toAdd, FormsComunication.articles, FormsComunication.articles[FormsComunication.selectedArticleIndex]))
         {
             if (check.HasntEmptyParametrs(toAdd))
             {
                 FormsComunication.articles[FormsComunication.selectedArticleIndex] = toAdd;
                 FormsComunication.changed = true;
                 Close();
             }
             else
             {
                 MessageBox.Show("Some text boxes are empty");
             }
         }
         else
         {
             MessageBox.Show("User with this number of phone or email in the list!");
         }
     }
 }