コード例 #1
0
        private void btnsave_Click_1(object sender, EventArgs e)
        {
            string sql;

            if (txtcode.Text == "")
            {
                MessageBox.Show("لطفا کد ملی را وارد کتید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            if (chkedit.Checked == false)
            {
                if (idExist == true)
                {
                    MessageBox.Show("شما اطلاعاتی با این کد ملی ثبت کرده اید.دوباره تلاش کنید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                sql = "INSERT INTO tbl_person VALUES('" + txtcode.Text + "','" + txtname.Text + "','" + txtfamily.Text + "','" + txtfname.Text + "','" + txtbirthday.Text + "','" + txtbirthplace.Text + "','" + txtshsh.Text + "','" + (txtssh.Text) + "','" + (txtserishalphabet.Text + " " + txtserish.Text) + "','" + txtcodeposti.Text + "','" + txtaddress.Text + "','" + txtjob.Text + "','" + (rbman.Checked == true ? "Man" : "Woman") + "','" + txttabeiat.Text + "','" + txtsanadplace.Text + "','" + txtactiveplace.Text + "','" + txtmahalekasb.Text + "')";
                db1.InsertRecord(sql);
                sql = "INSERT INTO tbl_call(phone,mobile,phone_mahal,id_person_fk) VALUES('" + txtphone.Text + "','" + txtphone1.Text + "','','" + txtcode.Text + "')";
                db1.InsertRecord(sql);
                sql = "INSERT INTO tbl_info_sanad VALUES('" + txtactivetype.Text + "','" + txtactivetime.Text + "','" + txtmojabeztype.Text + "','" + txtsendmojavez.Text + "','" + txtvakhast.Text + "','" + txtshohrat.Text + "','" + txtshomaremojavez.Text + "','" + txtdate.Text + "','" + txtexpire.Text + "','" + txtdategharardad.Text + "','" + txtaccounttype.Text + "','" + txtdateeftetah.Text + "','" + txtaccountnumber1.Text + "','" + txtgharardadnumber.Text + "','" + txttashilatnumber.Text + "','" + txtcodeetebari.Text + "','" + txtcodesenfi.Text + "','" + txttashilatprice.Text + "','" + txtnerkh.Text + "','" + txttime.Text + "','" + txtpayprice.Text + "','" + txtcode.Text + "')";
                db1.InsertRecord(sql);
                sql = "INSERT INTO tbl_chek(fullname_reccive_chek, id_accuont_factor, m_pardakht_hc_bank, price_chek, price_chek_alfabet, branch, city, carmozd_chek, id_person_fk) VALUES('" + txtchequeowner.Text + "','" + txtaccountnumber.Text + "','" + txtplacepay.Text + "','" + txtpricecheque.Text + "','" + txtchequeprice1.Text + "','" + txtshobe.Text + "','" + txtcity.Text + "','" + txtchequekarmozd.Text + "','" + txtcode.Text + "')";
                db1.InsertRecord(sql);
                Applicant.txtcode = txtcode.Text;
                panel1.Visible    = true;
                lblres.Text       = "اطلاعات با موفقیت ثبت شد";
                btnsave.Text      = "ثبت اطلاعات";
            }
            else if (chkedit.Checked == true && idExist == true)
            {
                sql = "update tbl_person SET fname ='" + txtname.Text + "',lname ='" + txtfamily.Text + "',fathername ='" + txtfname.Text + "',b_date='" + txtbirthday.Text + "',m_date='" + txtbirthplace.Text + "',id_shen='" + txtshsh.Text + "',serial_shen='" + txtssh.Text + "',seri_shen='" + (txtserishalphabet.Text + " " + txtserish.Text) + "',code_posti='" + txtcodeposti.Text + "',address='" + txtaddress.Text + "',jop='" + txtjob.Text + "',sex='" + (rbman.Checked == true ? "Man" : "Woman") + "',tabiyat='" + txttabeiat.Text + "',m_setting_sanad='" + txtsanadplace.Text + "',add_local_active='" + txtactiveplace.Text + "',mahalekasb='" + txtmahalekasb.Text + "' where codemeli = " + txtcode.Text;
                db1.EditRecord(sql);
                sql = "update tbl_call SET phone = '" + txtphone.Text + "',mobile ='" + txtphone1.Text + "',phone_mahal ='' where id_person_fk = " + txtcode.Text;
                db1.EditRecord(sql);
                sql = "update tbl_info_sanad SET type_active='" + txtactivetype.Text + "',time_active='" + txtactivetime.Text + "',type_access='" + txtmojabeztype.Text + "',corpratin_sodor_access='" + txtsendmojavez.Text + "',chek_recive='" + txtvakhast.Text + "',type_get='" + txtshohrat.Text + "',num_access='" + txtshomaremojavez.Text + "',date_access='" + txtdate.Text + "',end_date='" + txtexpire.Text + "',ip_date='" + txtdategharardad.Text + "',type_account='" + txtaccounttype.Text + "',start_date='" + txtdateeftetah.Text + "',num_account='" + txtaccountnumber1.Text + "',ip_num='" + txtgharardadnumber.Text + "',tashilat_num='" + txttashilatnumber.Text + "',code_valid='" + txtcodeetebari.Text + "',code_bisines='" + txtcodesenfi.Text + "',tashilat_price='" + txttashilatprice.Text + "',nerkh_to100='" + txtnerkh.Text + "',intime='" + txttime.Text + "',price_varizi='" + txtpayprice.Text + "' where id_person_fk='" + txtcode.Text + "'";
                db1.EditRecord(sql);
                sql = "update tbl_chek SET fullname_reccive_chek='" + txtchequeowner.Text + "', id_accuont_factor='" + txtaccountnumber.Text + "', m_pardakht_hc_bank='" + txtplacepay.Text + "', price_chek='" + txtpricecheque.Text + "', price_chek_alfabet='" + txtchequeprice1.Text + "', branch='" + txtshobe.Text + "', city='" + txtcity.Text + "', carmozd_chek='" + txtchequekarmozd.Text + "' where id_person_fk ='" + txtcode.Text + "'";
                db1.InsertRecord(sql);
                panel1.Visible  = true;
                lblres.Text     = "اطلاعات با موفقیت ویرایش شد";
                btnsave.Text    = "ثبت اطلاعات";
                chkedit.Checked = false;
            }
            else if (chkedit.Checked == true && idExist == false)
            {
                MessageBox.Show("اطلاعاتی برای ویرایش موجود نیست", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
        }
コード例 #2
0
        private void btnsave_Click(object sender, EventArgs e)
        {
            string sql;

            if (txtcode.Text == "")
            {
                MessageBox.Show("لطفا کد ملی را وارد کتید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            if (chkedit.Checked == false)
            {
                if (idExist == true)
                {
                    MessageBox.Show("شما اطلاعاتی با این کد ملی ثبت کرده اید.دوباره تلاش کنید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                sql = "INSERT INTO tbl_zamen VALUES('" + txtcode.Text + "','" + txtname.Text + "','" + txtfamily.Text + "','" + txtfname.Text + "','" + txtbirthday.Text + "','" + txtbirthplace.Text + "','" + txtshsh.Text + "','" + txtssh.Text + "','" + (txtserishalphabet.Text + " " + txtserish.Text) + "','" + txtcodeposti.Text + "','" + txtaddress.Text + "','" + txtjob.Text + "','" + (rbman.Checked == true ? "Man" : "Woman") + "','" + txttabeiat.Text + "','" + txtsanadplace.Text + "','" + txtactiveplace.Text + "','" + txtmahalekasb.Text + "')";
                db1.InsertRecord(sql);
                sql = "INSERT INTO tbl_call(phone,mobile,phone_mahal,id_person_fk) VALUES('" + txtphone.Text + "','" + txtphone1.Text + "','" + txtphonemahalekasb.Text + "','" + txtcode.Text + "')";
                db1.InsertRecord(sql);
                sql = "INSERT INTO tbl_info_sand_zamen VALUES('" + txtactivetype.Text + "','" + txtactivetime.Text + "','" + txtmojabeztype.Text + "','" + txtsendmojavez.Text + "','" + txtvakhast.Text + "','" + txtshohrat.Text + "','" + txtdate.Text + "','" + txtdate1.Text + "','" + txtexpire.Text + "','" + txtaccounttype.Text + "','" + txtdateeftetah.Text + "','" + txtaccountnumber1.Text + "','" + txtcodeetebari.Text + "','" + txtcode.Text + "')";
                db1.InsertRecord(sql);
                Zamens.Zamen1  = true;
                panel1.Visible = true;
                lblres.Text    = "اطلاعات با موفقیت ثبت شد";
            }
            else if (chkedit.Checked == true && idExist == true)
            {
                if (blnIsZamenInf == false)
                {
                    MessageBox.Show("شما فقط میتوانید اطلاعات غیرضامن را در قسمت اطلاعات وام گیرنده ویرایش کنید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                sql = "update tbl_zamen SET fname ='" + txtname.Text + "',lname ='" + txtfamily.Text + "',fathername ='" + txtfname.Text + "',b_date='" + txtbirthday.Text + "',m_date='" + txtbirthplace.Text + "',id_shen='" + txtshsh.Text + "',serial_shen='" + txtssh.Text + "',seri_shen='" + txtserish.Text + "',code_posti='" + txtcodeposti.Text + "',address='" + txtaddress.Text + "',jop='" + txtjob.Text + "',sex='" + (rbman.Checked == true ? "Man" : "Woman") + "',tabiyat='" + txttabeiat.Text + "',m_setting_san='" + txtsanadplace.Text + "',add_local_active='" + txtactiveplace.Text + "' where codemeli = " + txtcode.Text;
                db1.EditRecord(sql);
                sql = "update tbl_call SET phone = '" + txtphone.Text + "',mobile ='" + txtphone1.Text + "',phone_mahal ='" + txtphonemahalekasb.Text + "' where id_person_fk = " + txtcode.Text;
                db1.EditRecord(sql);
                sql = "update tbl_info_sand_zamen SET type_active='" + txtactivetype.Text + "',time_active='" + txtactivetime.Text + "',type_access='" + txtmojabeztype.Text + "',corpratin_sodor_access='" + txtsendmojavez.Text + "',chek_recive='" + txtvakhast.Text + "',shohrat_type_get='" + txtshohrat.Text + "',num_access='" + txtdate.Text + "',date_access='" + txtdate1.Text + "',end_date='" + txtexpire.Text + "',account_type='" + txtaccounttype.Text + "',openacc_date='" + txtdateeftetah.Text + "',account_num='" + txtaccountnumber1.Text + "',code_etebari='" + txtcodeetebari.Text + "' where fk_code='" + txtcode.Text + "'";
                db1.EditRecord(sql);
                panel1.Visible  = true;
                lblres.Text     = "اطلاعات با موفقیت ویرایش شد";
                chkedit.Checked = false;
            }
            else if (chkedit.Checked == true && idExist == false)
            {
                MessageBox.Show("اطلاعاتی برای ویرایش موجود نیست", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
        }