//Fills the focused text box with the selected information from the Suggestion list private void itemSelectedFullList(object sender, SelectionChangedEventArgs e) { if (listfullSuggestions.SelectedItem != null && itsME == "Supplier") { txtSupplier.Text = listfullSuggestions.SelectedValue.ToString(); } if (listfullSuggestions.SelectedItem != null && itsME == "Manufacturer") { txtManufacturer.Text = listfullSuggestions.SelectedValue.ToString(); } if (listfullSuggestions.SelectedItem != null && itsME == "Articletype") { txtArticleType.Text = listfullSuggestions.SelectedItem.ToString().Substring(0, 3); } if (listfullSuggestions.SelectedValue != null && itsAnUpdate) { Article_ProjectModel artproj = new Article_ProjectModel() { ID_Article = Convert.ToInt32(txtArticleType.Text), ID_Project = Convert.ToInt32(ProjectController.getProjectID(listfullSuggestions.SelectedValue.ToString())) }; if (!Article_ProjectController.articleprojectExists(artproj) && itsAnUpdate) { if (txtProjects.Text != "") { if (listfullSuggestions.SelectedItem != null && itsME == "Project") { txtProjects.Text += "," + listfullSuggestions.SelectedValue.ToString(); } } if (txtProjects.Text == "") { if (listfullSuggestions.SelectedItem != null && itsME == "Project") { txtProjects.Text += listfullSuggestions.SelectedValue.ToString(); } } } } if (!itsAnUpdate && itsME == "Project") { if (txtProjects.Text != "") { txtProjects.Text += "," + listfullSuggestions.SelectedValue.ToString(); } if (txtProjects.Text == "") { txtProjects.Text += listfullSuggestions.SelectedValue.ToString(); } } if (listfullSuggestions.SelectedItem != null && itsME == "Location") { txtLocation.Text = listfullSuggestions.SelectedValue.ToString(); } }
public List <Article_ProjectModel> articleprojectList(int articleID) { List <Article_ProjectModel> articleprojectList = new List <Article_ProjectModel>(); string[] projs = txtProjects.Text.Split(','); foreach (string project in projs) { Article_ProjectModel articleproject = new Article_ProjectModel() { ID_Article = articleID, ID_Project = ProjectController.getProjectID(project) }; articleprojectList.Add(articleproject); } return(articleprojectList); }
public static bool articleprojectExists(Article_ProjectModel proj) { SQLiteConnection con = new SQLiteConnection(InventoryDBSqliteConnection.LoadConnectionString()); con.Open(); string query = "SELECT * FROM Article_Project WHERE ID_Project = '" + proj.ID_Project + "' AND ID_Article = '" + proj.ID_Article + "'"; SQLiteCommand cmd = new SQLiteCommand(query, con); using (SQLiteDataReader reader = cmd.ExecuteReader()) { if (reader.HasRows) { return(true); } else { return(false); } } }