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.SqlClient;

namespace amlakyar
{
    public partial class frm_gholname_rahn_ejare : 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_rahn_ejare()
        {
            InitializeComponent();
        }

        private void frm_gholname_rahn_ejare_Load(object sender, EventArgs e)
        {

        }

        

        private void button3_Click(object sender, EventArgs e)
        {
            
            }

        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_ma.Text != "" && txtname_mos.Text != "" && txtmablaghkol_mo.Text != "" && txtmablagh_mah_mo.Text != "")
            {
                c = "insert into gholname_rahn_ejare(name_ma,fathername_ma,tarikhtavalod_ma,sn_shenasname_ma,sadere_ma,tel_ma,address_ma,name_mos,fathername_mos,tarikhtavalod_mos,sn_shenasname_mos,sadere_mos,tel_mos,address_mos,aztarikh_mo,tatarikh_mo,mablaghkol_mo,mablagh_mah_mo,mablagh_mo,sn_chek_mo,bank_mo) values ('" + txtname_ma.Text + "' , '" + txtfathername_ma.Text + "' , '" + txttarikhtavalod_ma.Text + "' , '" + txtsn_shenasname_ma.Text + "' , '" + txtsadere_ma.Text + "' , '" + txttel_ma.Text + "' , '" + txtaddress_ma.Text + "' , '" + txtname_mos.Text + "' , '" + txtfathername_mos.Text + "' , '" + txttarikhtavalod_mos.Text + "' , '" + txtsn_shenasname_mos.Text + "' , '" + txtsadere_mos.Text + "' , '" + txttel_mos.Text + "' , '" + txtaddress_mos.Text + "' , '" + txtaztarikh_mo.Text + "' , '" + txttatarikh_mo.Text + "' , '" + txtmablaghkol_mo.Text + "' , '" + txtmablagh_mah_mo.Text + "' , '" + txtmablagh_mo.Text + "' , '" + txtsn_chek_mo.Text + "' , '" + txtbank_mo.Text + "' )";
                SqlCommand cmd = new SqlCommand(c, con);
                con.Open();
                cmd.ExecuteNonQuery();
                con.Close();


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


        }
    }
