Exemple #1
0
 private void btn_Import_Click(object sender, EventArgs e)
 {
     Import imp = new Import(filename, num_of_items, array_delimiter,
                                     values, card_Format_for_values, Description_of_values,
                                     deck_id);
     imp.ImportFile();
     this.FirstForm.Show();
     this.Visible = false;
 }
Exemple #2
0
        private void btn_Import_Click(object sender, EventArgs e)
        {
            try
            {
                //"INSERT INTO Decks (cat,subcat,title,type,uid,nuid) VALUES (?cat,?subcat,?title,?type,?uid,?nuid)";
                //create deck Array of strings in the order of cat, subcat, title, uid, nuid
                if ((comboBox2.Text == "") || (txtbox_Category.Text == "") || (txtbox_title.Text == ""))
                {
                    MessageBox.Show("Please fill in the required fields.");
                    return;
                }
                string[] values1 = new string[6];
                int uid = ProfileManager.getCurrentUserID();

                int num = Convert.ToInt32(num_of_items);
                values1[0] = txtbox_Category.Text;
                values1[1] = txtbox_subcat.Text;
                values1[2] = txtbox_title.Text;
                values1[3] = comboBox2.Text;
                values1[4] = uid.ToString();
                values1[5] = null; //nuid
                int deck_id = insertLocalDB.insertToDecks(values1);

                if (deck_id != -1)
                {
                    Import imp = new Import(filename, num_of_items, array_delimiter,
                                            values, card_Format_for_values, Description_of_values,
                                            deck_id);
                    imp.ImportFile();
                    this.FirstForm.Show();
                    this.Visible = false;
                }
                else
                {
                    MessageBox.Show("Error inserting deck");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }