using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.Sql;
using System.Data.SqlClient;

namespace amlakyar
{
    public partial class frm_gholname_forush : Form
    {
        static SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\amlak.mdf;integrated security=true;User Instance=True");
        SqlDataAdapter da = new SqlDataAdapter("", con);
        DataSet ds = new DataSet();
        public frm_gholname_forush()
        {
            InitializeComponent();
        }

             
                
        private void button2_Click_1(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button3_Click_1(object sender, EventArgs e)
        {
            string c;


            SqlDataAdapter da = new SqlDataAdapter("", con);
            if (txtname_family_fo.Text != "" && txtname_family_kh.Text != "" && txtmasahat_mo.Text != "" && txtprice_melk_mo.Text != "")
            {



                c = "insert into gholname_forush(name_family_fo,father_name_fo,tarikh_tavalod_fo,sn_shenasname_fo,sadere_fo,tel_fo,address_fo,name_family_kh,father_name_kh,tarikh_tavalod_kh,sn_shenasname_kh,sadere_kh,tel_kh,address_kh,masahat_mo,sn_shenasname_melk_mo,sn_sabt_sanad_mo,tel_melk_mo,address_mo,tozihat_mo,price_melk_mo,tarikh_sabt_sanad_mo) values ('" + txtname_family_fo.Text + "' , '" + txtfather_name_fo.Text + "' , '" + txttarikh_tavalod_fo.Text + "' , '" + txtsn_shenasname_fo.Text + "' , '" + txtsadere_fo.Text + "' , '" + txttel_fo.Text + "' , '" + txtaddress_fo.Text + "' , '" + txtname_family_kh.Text + "' , '" + txtfather_name_kh.Text + "' , '" + txttarikh_tavalod_kh.Text + "' , '" + txtsn_shenasname_kh.Text + "' , '" + txtsadere_kh.Text + "' , '" + txttel_kh.Text + "' , '" + txtaddress_kh.Text + "' , '" + txtmasahat_mo.Text + "' , '" + txtsn_shenasname_melk_mo.Text + "' , '" + txtsn_sabt_sanad_mo.Text + "' , '" + txttel_melk_mo.Text + "' , '" + txtaddress_mo.Text + "' , '" + txttozihat_mo.Text + "' , '" + txtprice_melk_mo.Text + "' , '" + txttarikh_sabt_sanad_mo.Text + "' )";
                SqlCommand cmd = new SqlCommand(c, con);
                con.Open();
                cmd.ExecuteNonQuery();
                con.Close();






                MessageBox.Show("اطلاعات با موفقیت ثبت شد");
            }
            else { MessageBox.Show("لطفا فيلد های ستاره دار را به دقت وارد نماييد"); }
        }
    }
}