private void button2_Click(object sender, EventArgs e) { if (textBox2.Text != string.Empty && textBox3.Text != string.Empty && textBox4.Text != string.Empty && textBox5.Text != string.Empty && textBox6.Text != string.Empty && textBox7.Text != string.Empty && textBox8.Text != string.Empty && textBox9.Text != string.Empty && textBox10.Text != string.Empty) { if (radioButton1.Checked || radioButton2.Checked) { Doctor_s_List a = new Doctor_s_List(); a.Id = int.Parse(textBox1.Text); a.Name = textBox2.Text; a.Date_Of_Birth = Convert.ToDateTime(textBox3.Text); a.Date_Joined = Convert.ToDateTime(textBox4.Text); a.Designation = textBox5.Text; a.Specialty = textBox6.Text; a.Mobile_No_ = textBox7.Text; a.Address = textBox8.Text; a.Username = textBox9.Text; a.Password = textBox10.Text; if (radioButton1.Checked) { a.Gender = "Male"; } else { a.Gender = "Female"; } try { using (MemoryStream ms = new MemoryStream()) { pictureBox1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); var binary = new System.Data.Linq.Binary(ms.GetBuffer()); a.Image = binary; } h.Doctor_s_Lists.InsertOnSubmit(a); h.SubmitChanges(); MessageBox.Show("Registration Completed Successfully"); } catch (Exception) { MessageBox.Show("Registration error !! Please insert your information in proper way !!!"); } } else { MessageBox.Show("Please select your Gender"); } } else { MessageBox.Show("Please provide all Information"); } }
partial void DeleteDoctor_s_List(Doctor_s_List instance);
partial void UpdateDoctor_s_List(Doctor_s_List instance);
partial void InsertDoctor_s_List(Doctor_s_List instance);