private void Form3_Load(object sender, EventArgs e) { if (Form1.isCreate) { label1.Text = "CREATE"; button1.Text = "Submit"; } else { label1.Text = "UPDATE"; button1.Text = "Update"; ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client("BasicHttpBinding_IService1"); ServiceReference1.Stock s = proxy.GetStock(Form1.Id); textBox1.Text = s.Symbol; textBox2.Text = s.Name; textBox3.Text = s.Exchange; textBox4.Text = s.Ceo; textBox5.Text = s.Hq_address; textBox6.Text = s.Country; textBox7.Text = s.Logo; textBox8.Text = s.Marketcap; textBox9.Text = s.Employees; textBox11.Text = s.Sector; textBox12.Text = s.Industry; textBox13.Text = s.Phone; textBox14.Text = s.Url; richTextBox1.Text = s.Description; proxy.Close(); } }
private void button1_Click(object sender, EventArgs e) { if (Form1.isCreate) { ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client("BasicHttpBinding_IService1"); ServiceReference1.Stock s = new ServiceReference1.Stock(); s.Symbol = textBox1.Text; s.Name = textBox2.Text; s.Exchange = textBox3.Text; s.Ceo = textBox4.Text; s.Hq_address = textBox5.Text; s.Country = textBox6.Text; s.Logo = textBox7.Text; s.Marketcap = textBox8.Text; s.Employees = textBox9.Text; s.Sector = textBox11.Text; s.Industry = textBox12.Text; s.Phone = textBox13.Text; s.Url = textBox14.Text; s.Description = richTextBox1.Text; s.Id = Form1.Id; s.Listdate = monthCalendar1.SelectionRange.Start.ToShortDateString(); bool flag = proxy.AddStock(s); proxy.Close(); if (flag) { this.Close(); } } else { ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client("BasicHttpBinding_IService1"); ServiceReference1.Stock s = new ServiceReference1.Stock(); s.Symbol = textBox1.Text; s.Name = textBox2.Text; s.Exchange = textBox3.Text; s.Ceo = textBox4.Text; s.Hq_address = textBox5.Text; s.Country = textBox6.Text; s.Logo = textBox7.Text; s.Marketcap = textBox8.Text; s.Employees = textBox9.Text; s.Sector = textBox11.Text; s.Industry = textBox12.Text; s.Phone = textBox13.Text; s.Url = textBox14.Text; s.Description = richTextBox1.Text; s.Id = Form1.Id; s.Listdate = monthCalendar1.SelectionRange.Start.ToShortDateString(); bool flag = proxy.updateStock(s, s.Id); proxy.Close(); if (flag) { this.Close(); } } }
private void Form2_Load(object sender, EventArgs e) { ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client("BasicHttpBinding_IService1"); ServiceReference1.Stock s = proxy.GetStock(Form1.Id); label1.Text = s.Symbol; label2.Text = s.Name; pictureBox1.ImageLocation = s.Logo; label7.Text = ": " + s.Ceo; label8.Text = ": " + s.Hq_address; label9.Text = ": " + s.Country; label15.Text = ": " + s.Marketcap; label19.Text = ": " + s.Employees; label10.Text = s.Sector; label11.Text = s.Industry; label12.Text = "traded on " + s.Exchange.ToUpper() + " & listed at " + s.Listdate; label13.Text = ": " + s.Phone; label17.Text = ": " + s.Url; richTextBox1.Text = s.Description; proxy.Close(); }