private void metroButton1_Click_1(object sender, EventArgs e) { if (Frm == "Add") { MemoryStream stream = new MemoryStream(); if (stdImg.Image == null) { MessageBox.Show("تأكد من إدخال صوره الطالب"); } else if (txtNationId.Text == "") { MessageBox.Show("تأكد من الرقم القومى للطالب"); } else if (txtcode.Text == "") { MessageBox.Show("تأكد من كود الطالب"); } else if (cmbDept.Text == string.Empty || cmbLev.Text == string.Empty || cmbSem.Text == string.Empty) { MessageBox.Show("اختر القسم والفرقة والترم للطالب"); } else if (stdImg.Image != null || txtNationId.Text != "" || txtcode.Text != "") { stdImg.Image.Save(stream, stdImg.Image.RawFormat); byte[] img = stream.ToArray(); std.AddStd(txtcode.Text, txtyear.Text, dtjoin.Text, txtstdname.Text, dtBirth.Value.Day, dtBirth.Value.Month, dtBirth.Value.Year, txtaddG.Text, txtaddC.Text, Stutus, Gender, txtPlaceG.Text, txtPlaceC.Text, Relegion, txtNationId.Text, txtMob.Text, txtHPhone.Text, txtEmail.Text, txtAddress.Text, Convert.ToInt32(cmbDept.SelectedValue), StdType, txtQualif.Text, dtQualif.Value.Year.ToString(), txtSchoolQulif.Text, txtSchoolAdQulif.Text, txtGname.Text, txtRelation.Text, txtJob.Text, txtGNational.Text, txtGAdd.Text, txtGmob1.Text, txtGmob2.Text, img, KnowPlace, Convert.ToInt32(cmbLev.SelectedValue), Convert.ToInt32(cmbSem.SelectedValue)); MessageBox.Show("تم اضافةالطالب بنجاح", "اضافة طالب جديد"); this.Close(); } } else { MemoryStream stream = new MemoryStream(); stdImg.Image.Save(stream, stdImg.Image.RawFormat); byte[] img = stream.ToArray(); std.UpdateStd(ID, txtcode.Text, txtyear.Text, dtjoin.Text, txtstdname.Text, dtBirth.Value.Day, dtBirth.Value.Month, dtBirth.Value.Year, txtaddG.Text, txtaddC.Text, Stutus, Gender, txtPlaceG.Text, txtPlaceC.Text, Relegion, txtNationId.Text, txtMob.Text, txtHPhone.Text, txtEmail.Text, txtAddress.Text, Convert.ToInt32(cmbDept.SelectedValue), StdType, txtQualif.Text, dtQualif.Value.Year.ToString(), txtSchoolQulif.Text, txtSchoolAdQulif.Text, txtGname.Text, txtRelation.Text, txtJob.Text, txtGNational.Text, txtGAdd.Text, txtGmob1.Text, txtGmob2.Text, img, KnowPlace, Convert.ToInt32(cmbLev.SelectedValue), Convert.ToInt32(cmbSem.SelectedValue)); MessageBox.Show("تم تعديل البيانات بنجاح", "تعديل بيانات"); this.Close(); } }