private void button1_Click_1(object sender, EventArgs e) { if (Sendertxt1.Text == "") { MessageBox.Show(" تنظیمات ارسال پیام را انجام نشده است "); } else if (Resivtxt2.Text != "" && c1.BarrasiFieldEmail(Resivtxt2.Text) == false) { MessageBox.Show("رایانامه گیرنده را وارد نمایید"); Resivtxt2.Text = ""; } else { label2.Text = "در حال انجام عملیات ارسال... "; button1.Enabled = false; backgroundWorker1.RunWorkerAsync(); } }
private void button2_Click(object sender, EventArgs e) { if (textBox1.Text == "") { MessageBox.Show("نام کاربری رایانامه را وارد نمایید"); } else if (textBox2.Text == "") { MessageBox.Show("رمز عبور رایانامه را وارد نمایید"); } else if (textBox3.Text == "" & c1.BarrasiFieldEmail(textBox3.Text) == false) { MessageBox.Show("رایانامه را صحیح وارد نمایید"); } else if (textBox4.Text == "") { MessageBox.Show(" سرور ایمیل را وارد نمایید(smtp)"); } else if (textBox5.Text == "") { MessageBox.Show("شماره پورت را وارد نمایید"); } else { cldbSql.CallDB("delete from Tanzim_email"); SqlConnection con = new SqlConnection(); try { // string s3 = "Data Source=.;Initial Catalog=db2;Integrated Security=true;"; //string s3 = @"provider=microsoft.jet.oledb.4.0;" + @"data source=..\\Debug\\db\\db2.mdb"; string str1 = ""; str1 = ConfigurationManager.ConnectionStrings["cn1"].ConnectionString; con = new SqlConnection(str1); con.Open(); SqlCommand cmd = new SqlCommand("insert into Tanzim_email(us,pass,address_sender,smtp,port,ssl)values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + checkBox1.Checked + "')", con); cmd.ExecuteNonQuery(); MessageBox.Show("تنظیمات رایانامه ذخیره شد"); con.Close(); } catch (Exception er) { MsgBox.ShowMessage(this.Handle.ToInt32(), er.Message.ToString(), "خطا", "تایید", "", "", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign); } //---------------------- Tanzim_Email_set(); //------------------- // f = new Form_Email_Taki(); // f.Visible = true; } }
private void button5_Click(object sender, EventArgs e) { try{ errorProvider1.Clear(); if (textBox_8.Text.StartsWith("0") == true) { errorProvider1.SetError(textBox_8, " شماره تلفن_همراه همراه را (بدون صفر) کامل و صحیح وارد کنيد"); } else if (BarrasiTarikh() == false) { errorProvider1.SetError(maskedTextBox1, " تاریخ تولد را صحیح وارد نمایید "); } else if (textBox_10.Text != "" && clmft.BarrasiFieldEmail(textBox_10.Text) == false) { errorProvider1.SetError(textBox_10, " رایانامه را صحیح وارد نمایید"); textBox_10.Text = ""; } else if (textBox_6.Text.Length <= 9) { errorProvider1.SetError(textBox_6, "کد ملی 10 رقمی را صحیح وارد نمایید"); } else { ///--------------------------------------------- string str1 = ""; str1 = ConfigurationManager.ConnectionStrings["cn1"].ConnectionString; con = new SqlConnection(str1); con.Open(); //جلوگیری از تکرار کد_ملی string s1 = " select * from Personel where کد_ملی='" + textBox_6.Text + "' "; da = new SqlDataAdapter(s1, con); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count == 0) { //----------این کدملی اصلا وجود ندارد ------------------------------------- cldbSql.CallDB("update Personel set نام= N'" + textBox_2.Text + "',فامیلی=N'" + textBox_3.Text + "',نام_پدر=N'" + textBox_4.Text + "',تاریخ_تولد=N'" + maskedTextBox1.Text + "',شماره_شناسنامه=N'" + textBox_5.Text + "',کد_ملی=N'" + textBox_6.Text + "',شهر_اقامت=N'" + textBox_7.Text + "',مذهب=N'" + textBox_11.Text + "',تابعیت=N'" + textBox_9.Text + "',وضعیت_تاهل='" + comboBox1.Text + "',پست_الکترونیکی=N'" + textBox_10.Text + "',تلفن_همراه=N'" + textBox_8.Text + "',جنسیت=N'" + comboBox2.Text + "',آدرس=N'" + textBox_12.Text + "',آدرس_عکس=N'" + textBox4.Text + "' where کد_عضویت=N'" + textBox_1.Text + "' "); cm.EndCurrentEdit(); //----------------------------------------------------------------------- } else { //-------------این کدملی وجود داردکه همان کد ملی وارد شده ثبت نام می باشد //--------------------------------درحالتی که کد ملی نمایش روی text6 می باشد------------------------------- if (label17.Text != textBox_6.Text) { MsgBox.ShowMessage(this.Handle.ToInt32(), "کد ملی تکراری می باشد", "خطا", "تایید", "", "", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign); textBox_6.Text = label17.Text; } else { cldbSql.CallDB("update Personel set نام= N'" + textBox_2.Text + "',فامیلی=N'" + textBox_3.Text + "',نام_پدر=N'" + textBox_4.Text + "',تاریخ_تولد=N'" + maskedTextBox1.Text + "',شماره_شناسنامه=N'" + textBox_5.Text + "',کد_ملی=N'" + textBox_6.Text + "',شهر_اقامت=N'" + textBox_7.Text + "',مذهب=N'" + textBox_11.Text + "',تابعیت=N'" + textBox_9.Text + "',وضعیت_تاهل='" + comboBox1.Text + "',پست_الکترونیکی=N'" + textBox_10.Text + "',تلفن_همراه=N'" + textBox_8.Text + "',جنسیت=N'" + comboBox2.Text + "',آدرس=N'" + textBox_12.Text + "',آدرس_عکس=N'" + textBox4.Text + "' where کد_عضویت=N'" + textBox_1.Text + "' "); cm.EndCurrentEdit(); //----------------------------------------------------------------------- } } } } catch (Exception ex) { MsgBox.ShowMessage(this.Handle.ToInt32(), ex.Message.ToString(), " خطا ", "تایید", "", "", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign); } }
private void button2_Click(object sender, EventArgs e) { if (comboBox7.Text == "") { textBox17.Text = ""; textBox18.Text = ""; textBox19.Text = ""; textBox20.Text = ""; textBox17.Enabled = false; textBox18.Enabled = false; textBox19.Enabled = false; textBox20.Enabled = false; } if (comboBox6.Text == "") { textBox14.Text = ""; textBox15.Text = ""; textBox14.Enabled = false; textBox15.Enabled = false; } string str_rouz = "", str_mah = "", str_sal = ""; try{ textKhali(); errorProvider1.Clear(); BarrasiFieldTarikhi(); if (textBox1.Text == "") { errorProvider1.SetError(textBox1, " لطفا تمام خانه ها را تکميل کنيد"); } else if (textBox2.Text == "") { errorProvider1.SetError(textBox2, " فاميلي را وارد کنيد"); } else if (textBox3.Text == "") { errorProvider1.SetError(textBox3, " نام پدر را وارد کنيد"); } // else if (maskedTextBox1.Text == "") errorProvider1.SetError(maskedTextBox1, " تاريخ تولد را وارد کنيد"); else if (comboBox21.Text == "") { errorProvider1.SetError(comboBox21, " روز تاريخ تولد را وارد کنيد"); } else if (comboBox22.Text == "") { errorProvider1.SetError(comboBox22, " ماه تاريخ تولد را وارد کنيد"); } else if (textBox23.Text == "") { errorProvider1.SetError(textBox23, " سال تاريخ تولد را وارد کنيد"); } else if (textBox5.Text == "") { errorProvider1.SetError(textBox5, " شماره شناسنامه را وارد کنيد"); } //------------- else if (BarrasiCodeMelli() == false) { errorProvider1.SetError(textBox6, "کد ملی 10 رقمی را صحیح وارد نمایید"); } //------------- else if (textBox7.Text == "") { errorProvider1.SetError(textBox7, " شهر محل اقامت را وارد کنيد"); } else if (textBox8.Text == "") { errorProvider1.SetError(textBox8, " نام مذهب را وارد کنيد"); } else if (textBox9.Text != "" && clmft.BarrasiFieldEmail(textBox9.Text) == false) { // errorProvider1.SetError(textBox9, " پست الکترونيکي صحیح و کامل وارد نمایید"); textBox9.Text = ""; } else if (textBox11.Text == "") { errorProvider1.SetError(textBox11, "تابعيت را وارد کنيد"); } else if (textBox112.Text.StartsWith("0") == true) { errorProvider1.SetError(label12, " شماره تلفن_همراه همراه را (بدون صفر) کامل و صحیح وارد کنيد"); // BarrasiFieldTell(); } else if (textBox112.Text.Length <= 2 || textBox113.Text.Length <= 2 || textBox114.Text.Length <= 3) { errorProvider1.SetError(label12, " شماره تلفن_همراه همراه را کامل وارد کنيد"); // BarrasiFieldTell(); } else if (comboBox1.Text == "") { errorProvider1.SetError(comboBox1, "وضعيت تاهل را مشخص کنيد"); } else if (comboBox5.Text == "") { errorProvider1.SetError(comboBox5, "جنسیت را مشخص کنيد"); } else if (textBox4.Text == "") { errorProvider1.SetError(textBox4, " آدرس را وارد کنيد"); } else if (txtImagePath.Text == "") { errorProvider1.SetError(pictureBox1, " عکس را وارد کنيد"); } else if (comboBox6.Text == "") { errorProvider1.SetError(comboBox6, " ميزان تحصيلات را وارد کنيد"); } // else if (textBox14.Text == "") errorProvider1.SetError(textBox14, "رشته تحصيلي را وارد کنيد"); // else if (textBox15.Text == "") errorProvider1.SetError(textBox15, " نام دانشگاه را وارد کنيد"); else if (comboBox7.Text == "") { errorProvider1.SetError(comboBox7, " نوع شغل را وارد کنيد کنيد"); } // else if (textBox17.Text == "") errorProvider1.SetError(textBox17, " مدت شغل را وارد کنيد"); //else if (textBox18.Text == "") errorProvider1.SetError(textBox18, " نوع مسئوايت را وارد کنيد"); //else if (textBox19.Text == "") errorProvider1.SetError(textBox19, " ميزان درآمد را وارد کنيد"); //else if (textBox20.Text == "") errorProvider1.SetError(textBox20, " نشاني محل کار را وارد کنيد"); // else if (textBox24.Text == "") errorProvider1.SetError(textBox24, " خلاصه ثوابق فعاليت را وارد کنيد"); else if (comboBox3.Text == "") { errorProvider1.SetError(comboBox3, " موضوع پيشنهادي فعاليت را وارد کنيد"); } // else if (textBox26.Text == "") errorProvider1.SetError(textBox26, "هدف از عضويت را وارد کنيد"); else if (comboBox2.Text == "") { errorProvider1.SetError(comboBox2, " نوع عضويت را وارد کنيد"); } else if (comboBox4.Text == "") { errorProvider1.SetError(comboBox4, " روز تاریخ عضویت را وارد کنيد"); } else if (comboBox8.Text == "") { errorProvider1.SetError(comboBox8, " ماه تاریخ عضویت را وارد کنيد"); } else if (textBox10.Text == "") { errorProvider1.SetError(textBox10, " سال تاریخ عضویت را وارد کنيد"); } else { try { // BarrasiFieldTell(); // BarrasiFieldEmail(); byte[] imageData = ReadFile(txtImagePath.Text); // textBox21.Text = t21t; //t21 = int.Parse(textBox21.Text); t21 = int.Parse(textBox21.Text); str_rouz = comboBox4.Text; str_mah = comboBox8.Text; str_sal = textBox10.Text; string tarikh = str_sal + "/" + str_mah + "/" + str_rouz; cm.Refresh(); // dbAccess.CallDB("insert into Personel(کد_عضویت,عکس,آدرس_عکس,نام,فامیلی,نام_پدر,تاریخ_تولد,شماره_شناسنامه,کد_ملی,شهر_اقامت,مذهب,تابعیت,وضعیت_تاهل,پست_الکترونیکی,تلفن_همراه,آدرس)values('" + t21 + "','" + (object)imageData + "','" + (object)txtImagePath.Text + "','" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + maskedTextBox2.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "','" + textBox11.Text + "','" + comboBox1.Text + "','" + textBox9.Text + "','" + textBox12.Text + "','" + textBox4.Text + "')"); Prs(t21); cldbSql.CallDB("insert into tah(کد_عضویت,میزان_تحصیلات,رشته_تحصیلی,گرایش_تحصیلی,دانشگاه)values(N'" + t21 + "',N'" + comboBox6.Text + "',N'" + textBox14.Text + "',N'" + textBox12.Text + "',N'" + textBox15.Text + "')"); cldbSql.CallDB("insert into faal(کد_عضویت,موضوع_فعالیت,خلاصه_سوابق)values(N'" + t21 + "',N'" + comboBox3.Text + "',N'" + textBox24.Text + "')"); cldbSql.CallDB("insert into Sabt_ozv(کد_عضویت,تاریخ_عضویت,هدف_عضویت,نوع_عضویت)values(N'" + t21 + "',N'" + tarikh + "',N'" + textBox26.Text + "',N'" + comboBox2.Text + "')"); cldbSql.CallDB("insert into shoghl(کد_عضویت,نوع_شغل,مدت_شغل,عنوان_شغل,میزان_درآمد,نشانی_محل_کار)values(N'" + t21 + "',N'" + comboBox7.Text + "',N'" + textBox17.Text + "',N'" + textBox18.Text + "',N'" + textBox19.Text + "',N'" + textBox20.Text + "')"); t21 = t21 + 1; textBox21.Text = t21 + ""; textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; // maskedTextBox1.Text = ""; textBox5.Text = ""; textBox6.Text = ""; textBox7.Text = ""; textBox8.Text = ""; textBox9.Text = ""; comboBox6.Text = ""; textBox11.Text = ""; textBox114.Text = ""; textBox4.Text = ""; textBox14.Text = ""; textBox15.Text = ""; comboBox7.Text = ""; textBox17.Text = ""; textBox18.Text = ""; textBox19.Text = ""; textBox20.Text = ""; textBox24.Text = ""; textBox26.Text = ""; // maskedTextBox2.Text = ""; pictureBox1.Image = null; txtImagePath.Text = ""; // comboBox4.Text = ""; // comboBox8.Text = ""; // textBox10.Text = ""; comboBox1.Text = ""; comboBox3.Text = ""; comboBox2.Text = ""; comboBox5.Text = ""; comboBox21.Text = ""; comboBox22.Text = ""; textBox23.Text = ""; textBox112.Text = ""; textBox113.Text = ""; } catch (Exception) { MsgBox.ShowMessage(this.Handle.ToInt32(), "دکمه تایید را کلیک کنید تا کد عضویت فعال شود", "!! توجه ", "تایید", "", "", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign); textBox21.Text = "100000"; } } } catch (Exception er) { MsgBox.ShowMessage(this.Handle.ToInt32(), er.Message, "!! توجه ", "تایید", "", "", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign); } }