public AddPhone(Phone_rec phrec, List <string> ind_id)
        {
            InitializeComponent();

            rec = phrec;

            comboBox1.Items.AddRange(ind_id.ToArray());
        }
Exemple #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            switch (comboBox.SelectedIndex)
            {
            case 0:
                Phone_rec recPH = new Phone_rec();

                AddPhone     addPH = new AddPhone(recPH, inds);
                DialogResult res1  = addPH.ShowDialog();

                if (res1 == DialogResult.OK)
                {
                    DataRow dr = ds.Tables[0].NewRow();
                    dr["t_id"]   = recPH.Id;
                    dr["model"]  = recPH.Model;
                    dr["ind_id"] = recPH.Ind_id;
                    dr["year"]   = recPH.Year;
                    dr["price"]  = recPH.Price;
                    ds.Tables[0].Rows.Add(dr);
                }

                break;

            case 1:
                Industry_rec recIND = new Industry_rec();

                AddIndustry  addIND = new AddIndustry(recIND);
                DialogResult res2   = addIND.ShowDialog();

                if (res2 == DialogResult.OK)
                {
                    DataRow dr = ds.Tables[1].NewRow();
                    dr["ind_id"]  = recIND.Id;
                    dr["name"]    = recIND.Name;
                    dr["country"] = recIND.Country;
                    dr["type"]    = recIND.Type;
                    dr["website"] = recIND.Website;
                    ds.Tables[1].Rows.Add(dr);
                }

                break;
            }
        }