private void btnAddReciever_Click(object sender, EventArgs e)
        {
            string fName = txtFName.Text;
            string lName = txtLName.Text;
            string email = txtEmail.Text;
            string role = "";
            //MessageBox.Show(optionRole.Text);
            if (optionRole.Text.Equals("دانشجو"))
                role = "student";
            else
                role = "professor";

            if (string.IsNullOrEmpty(fName) ||
                string.IsNullOrEmpty(lName)||
                string.IsNullOrEmpty(email) ||
                string.IsNullOrEmpty(role))
            {
                MessageBox.Show("خطا: تمام قسمت ها را پر کنید.");
            }
            else
            {
                _receiver = new Receiver(fName, lName, email, role);
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                Database.getDatabase().AddReciever(_receiver);
                MessageBox.Show("مخاطب اضافه شد!");

            }
        }
Beispiel #2
0
 public void AddReciever(Receiver receiver)
 {
     string query = "Insert into receivers (first_name , last_name, email, role) VALUES ('" + receiver.FName + "', '" + receiver.LName + "','" + receiver.Email + "','" + receiver.Role + "')";
     Database.con.Insert(query);
 }
 private void ReceiversDropDown_SelectedIndexChanged(object sender, EventArgs e)
 {
     selectedReceiver = receivers[ReceiversDropDown.SelectedIndex];
 }
 private void ReceiversDropDown_SelectedIndexChanged(object sender, EventArgs e)
 {
     selectedReceiver = receiversOfGroup[ReceiversDropDown.SelectedIndex];
 }