コード例 #1
0
ファイル: Form26.cs プロジェクト: Golmakaniamin/MHMPayroll
        private void Form26_Load(object sender, EventArgs e)
        {
            DB_Base database = new DB_Base();

            database.Connection_Open();
            database.Fill("SELECT * FROM [PKH] WHERE (no1 = 1)", objDataSet, "PKH1_1", true);
            database.Connection_Close();

            if (objDataSet.Tables["PKH1_1"].Rows[0]["no2"].ToString() == "1")
            {
                radioButton1.Checked = true;
            }
            else if (objDataSet.Tables["PKH1_1"].Rows[0]["no2"].ToString() == "2")
            {
                radioButton2.Checked = true;
            }
            else if (objDataSet.Tables["PKH1_1"].Rows[0]["no2"].ToString() == "3")
            {
                radioButton3.Checked = true;
            }
            else if (objDataSet.Tables["PKH1_1"].Rows[0]["no2"].ToString() == "4")
            {
                radioButton4.Checked = true;
            }

            textBox1.Text       = objDataSet.Tables["PKH1_1"].Rows[0]["q1"].ToString();
            maskedTextBox1.Text = objDataSet.Tables["PKH1_1"].Rows[0]["q2"].ToString();
            textBox2.Text       = objDataSet.Tables["PKH1_1"].Rows[0]["q3"].ToString();
            textBox3.Text       = objDataSet.Tables["PKH1_1"].Rows[0]["q4"].ToString();
            textBox4.Text       = objDataSet.Tables["PKH1_1"].Rows[0]["q5"].ToString();
            textBox5.Text       = objDataSet.Tables["PKH1_1"].Rows[0]["q5"].ToString();

            database.Connection_Open();
            database.Fill("SELECT * FROM [PKH] WHERE (no1 = 2)", objDataSet, "PKH1_2", true);
            database.Connection_Close();

            if (objDataSet.Tables["PKH1_2"].Rows[0]["no2"].ToString() == "1")
            {
                radioButton5.Checked = true;
            }
            else if (objDataSet.Tables["PKH1_2"].Rows[0]["no2"].ToString() == "2")
            {
                radioButton6.Checked = true;
            }
            else if (objDataSet.Tables["PKH1_2"].Rows[0]["no2"].ToString() == "3")
            {
                radioButton7.Checked = true;
            }
            else if (objDataSet.Tables["PKH1_2"].Rows[0]["no2"].ToString() == "4")
            {
                radioButton8.Checked = true;
            }

            textBox6.Text       = objDataSet.Tables["PKH1_2"].Rows[0]["q1"].ToString();
            maskedTextBox2.Text = objDataSet.Tables["PKH1_2"].Rows[0]["q2"].ToString();
            textBox7.Text       = objDataSet.Tables["PKH1_2"].Rows[0]["q3"].ToString();
            textBox8.Text       = objDataSet.Tables["PKH1_2"].Rows[0]["q4"].ToString();
            textBox9.Text       = objDataSet.Tables["PKH1_2"].Rows[0]["q5"].ToString();
            textBox10.Text      = objDataSet.Tables["PKH1_2"].Rows[0]["q5"].ToString();
        }
コード例 #2
0
ファイル: Db_Combo.cs プロジェクト: Golmakaniamin/MHMPayroll
        public void Bind_Data1(string Qry, string DisplayMember, string ValueMember)
        {
            DB_Base DataBase = new DB_Base();

            DataBase.Connection_Open();
            DataBase.Fill(Qry, objDataSet, "MyTble", true);
            DataBase.Connection_Close();

            this.DataSource    = objDataSet.Tables["MyTble"];
            this.DisplayMember = DisplayMember;
            this.ValueMember   = ValueMember;
        }
コード例 #3
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            if (txt_loan_code.Text == "")
            {
                MessageBox.Show("لطفا کد وام را وارد نمایید", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txt_loan_code.Focus();
                return;
            }

            if (txt_loan_price.Text == "")
            {
                MessageBox.Show("لطفا مبلغ وام را وارد نمایید", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txt_loan_price.Focus();
                return;
            }

            if (mtxt_payment_date.ToString().IndexOf("_").ToString() != "-1")
            {
                MessageBox.Show("لطفا تاریخ پرداخت وام را وارد نمایید", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                mtxt_payment_date.Focus();
                return;
            }

            DB_Base database = new DB_Base();

            database.Connection_Open();

            database.objCommand.Parameters.AddWithValue("@loan_code", txt_loan_code.Text);
            database.objCommand.Parameters.AddWithValue("@loan_price", txt_loan_price.Text);
            database.objCommand.Parameters.AddWithValue("@loan_payment_date", mtxt_payment_date.Text);
            database.objCommand.Parameters.AddWithValue("@receiver", id_idmen);

            database.objCommand.CommandText = "INSERT INTO tbl_loan (loan_code, loan_price, loan_payment_date, receiver) VALUES (@loan_code, @loan_price, @loan_payment_date, @receiver)";
            database.objCommand.Connection  = database.objConnection;

            if (database.objCommand.ExecuteNonQuery() > 0)
            {
                MessageBox.Show("ثبت با موفقیت انجام شد", "پيغام", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("خطا در ثبت", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            database.objCommand.Dispose();
            database.Connection_Close();
            database.objConnection.Dispose();

            ResetFields();
            ShowLoan();
        }
コード例 #4
0
ファイル: Form26.cs プロジェクト: Golmakaniamin/MHMPayroll
        private void butt_ok_Click(object sender, EventArgs e)
        {
            DB_Base database1 = new DB_Base();

            database1.Connection_Open();

            database1.objCommand.CommandText = "UPDATE PKH SET no2=@no2, q1=@q1, q2=@q2, q3=@q3, q4=@q4, q5=@q5, q6=@q6 WHERE (no1=1)";
            database1.objCommand.Connection  = database1.objConnection;

            if (radioButton1.Checked == true)
            {
                database1.objCommand.Parameters.AddWithValue("@no2", "1");
            }
            else if (radioButton2.Checked == true)
            {
                database1.objCommand.Parameters.AddWithValue("@no2", "2");
            }
            else if (radioButton3.Checked == true)
            {
                database1.objCommand.Parameters.AddWithValue("@no2", "3");
            }
            else if (radioButton4.Checked == true)
            {
                database1.objCommand.Parameters.AddWithValue("@no2", "4");
            }

            database1.objCommand.Parameters.AddWithValue("@q1", textBox1.Text);
            database1.objCommand.Parameters.AddWithValue("@q2", maskedTextBox1.Text);
            database1.objCommand.Parameters.AddWithValue("@q3", textBox2.Text);
            database1.objCommand.Parameters.AddWithValue("@q4", textBox3.Text);
            database1.objCommand.Parameters.AddWithValue("@q5", textBox4.Text);
            database1.objCommand.Parameters.AddWithValue("@q6", textBox5.Text);

            if (database1.objCommand.ExecuteNonQuery() > 0)
            {
                MessageBox.Show("ثبت با موفقیت انجام شد", "پيغام", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("خطا در ثبت", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            database1.objCommand.Dispose();
            database1.Connection_Close();
            database1.objConnection.Dispose();
        }
コード例 #5
0
ファイル: Form14.cs プロジェクト: Golmakaniamin/MHMPayroll
        private void butt_ok_Click(object sender, EventArgs e)
        {
            DB_Base database = new DB_Base();

            database.Connection_Open();
            database.objCommand.Parameters.AddWithValue("@azafkari_adi", textBox9.Text);
            database.objCommand.Parameters.AddWithValue("@azafkari_tatily", textBox8.Text);
            database.objCommand.Parameters.AddWithValue("@nobat_kar", textBox7.Text);
            database.objCommand.Parameters.AddWithValue("@sab_kari", textBox6.Text);
            database.objCommand.Parameters.AddWithValue("@mamoriat", textBox5.Text);
            database.objCommand.Parameters.AddWithValue("@sat_rozaneh", textBox4.Text);
            database.objCommand.Parameters.AddWithValue("@sat_haftgi", textBox3.Text);
            database.objCommand.Parameters.AddWithValue("@sat_mahaneh", textBox2.Text);
            database.objCommand.Parameters.AddWithValue("@sat_sakht", textBox1.Text);
            database.objCommand.Parameters.AddWithValue("@udate", Persia.Calendar.ConvertToPersian(DateTime.Now).Simple.ToString());
            database.objCommand.Parameters.AddWithValue("@utime", DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString() + ":" + DateTime.Now.Second.ToString());
            database.objCommand.Parameters.AddWithValue("@upc", ".");
            // database.objCommand.Parameters.AddWithValue("@uId", tex_codper.Text);
            //  database.objCommand.Parameters.AddWithValue("@uGrop", label16.Text);
            //  database.objCommand.Parameters.AddWithValue("@uuser", label16.Text);
            database.objCommand.CommandText = "INSERT INTO [Tbl_zarib] ([azafkari_adi],[azafkari_tatily],[nobat_kar],[sab_kari],[mamoriat],[sat_rozaneh],[sat_haftgi],[sat_mahaneh],[sat_sakht],[udate],[utime],[upc]) values (@azafkari_adi,@azafkari_tatily,@nobat_kar,@sab_kari,@mamoriat,@sat_rozaneh,@sat_haftgi,@sat_mahaneh,@sat_sakht,@udate,@utime,@upc)";
            database.objCommand.Connection  = database.objConnection;

            if (database.objCommand.ExecuteNonQuery() > 0)
            {
                MessageBox.Show("ثبت با موفقیت انجام شد", "پيغام", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("خطا در ثبت", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            database.objCommand.Dispose();
            database.Connection_Close();
            database.objConnection.Dispose();
            delete();
        }
コード例 #6
0
        private void button4_Click(object sender, EventArgs e)
        {
            //درصد بیمه کارفرما، بیکاری و پرسنل
            if (textBox2.Text == "")
            {
                MessageBox.Show("لطفا فیلد درصد بیمه سهم کارفرما را وارد نمایید", "اخطار", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox2.Focus();
                return;
            }

            if (textBox3.Text == "")
            {
                MessageBox.Show("لطفا فیلد درصد بیمه سهم بیکاری را وارد نمایید", "اخطار", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox3.Focus();
                return;
            }

            if (textBox4.Text == "")
            {
                MessageBox.Show("لطفا فیلد درصد بیمه سهم پرسنل را وارد نمایید", "اخطار", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox4.Focus();
                return;
            }

            SqlCommand objCommand = new SqlCommand();

            objCommand.Connection  = objConnection;
            objCommand.CommandText = "UPDATE Tbl_hogog SET karfarma_darsad=" + textBox2.Text + " WHERE (bimeh_karfarma = '1')";
            objCommand.CommandType = CommandType.Text;
            objConnection.Open();
            try
            {
                objCommand.ExecuteNonQuery();
            }
            catch (SqlException SqlExceptionErr)
            {
                MessageBox.Show(SqlExceptionErr.Message);
            }
            objConnection.Close();

            objCommand.Connection  = objConnection;
            objCommand.CommandText = "UPDATE Tbl_hogog SET karfarma_darsad=0 WHERE (bimeh_karfarma = '0') ";
            objCommand.CommandType = CommandType.Text;
            objConnection.Open();
            try
            {
                objCommand.ExecuteNonQuery();
            }
            catch (SqlException SqlExceptionErr)
            {
                MessageBox.Show(SqlExceptionErr.Message);
            }
            objConnection.Close();

            objCommand.Connection  = objConnection;
            objCommand.CommandText = "UPDATE Tbl_hogog SET bikari_darsad=" + textBox3.Text + " WHERE (bimeh_bikari = '1')";
            objCommand.CommandType = CommandType.Text;
            objConnection.Open();
            try
            {
                objCommand.ExecuteNonQuery();
            }
            catch (SqlException SqlExceptionErr)
            {
                MessageBox.Show(SqlExceptionErr.Message);
            }
            objConnection.Close();

            objCommand.Connection  = objConnection;
            objCommand.CommandText = "UPDATE Tbl_hogog SET bikari_darsad=0 WHERE (bimeh_bikari = '0') ";
            objCommand.CommandType = CommandType.Text;
            objConnection.Open();
            try
            {
                objCommand.ExecuteNonQuery();
            }
            catch (SqlException SqlExceptionErr)
            {
                MessageBox.Show(SqlExceptionErr.Message);
            }
            objConnection.Close();

            objCommand.Connection  = objConnection;
            objCommand.CommandText = "UPDATE Tbl_hogog SET personel_dasad=" + textBox4.Text + " WHERE (bimeh_personel = '1')";
            objCommand.CommandType = CommandType.Text;
            objConnection.Open();
            try
            {
                objCommand.ExecuteNonQuery();
            }
            catch (SqlException SqlExceptionErr)
            {
                MessageBox.Show(SqlExceptionErr.Message);
            }
            objConnection.Close();

            objCommand.Connection  = objConnection;
            objCommand.CommandText = "UPDATE Tbl_hogog SET personel_dasad=0 WHERE (bimeh_personel = '0') ";
            objCommand.CommandType = CommandType.Text;
            objConnection.Open();
            try
            {
                objCommand.ExecuteNonQuery();
            }
            catch (SqlException SqlExceptionErr)
            {
                MessageBox.Show(SqlExceptionErr.Message);
            }
            objConnection.Close();

            DB_Base database1 = new DB_Base();

            database1.objCommand.CommandText = "UPDATE Tbl_bimeh SET bimeh_karfarma=@bimeh_karfarma, bimeh_bikari=@bimeh_bikari, bimeh_karkonan=@bimeh_karkonan WHERE (tmpid = 1)";
            database1.objCommand.Parameters.AddWithValue("@bimeh_karfarma", textBox2.Text);
            database1.objCommand.Parameters.AddWithValue("@bimeh_bikari", textBox3.Text);
            database1.objCommand.Parameters.AddWithValue("@bimeh_karkonan", textBox4.Text);

            database1.Connection_Open();
            database1.objCommand.Connection = database1.objConnection;

            if (database1.objCommand.ExecuteNonQuery() > 0)
            {
                MessageBox.Show("ثبت با موفقیت انجام شد", "پيغام", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("خطا در ثبت", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            database1.objCommand.Dispose();
            database1.Connection_Close();
            database1.objConnection.Dispose();
        }
コード例 #7
0
ファイル: Form24.cs プロジェクト: Golmakaniamin/MHMPayroll
        private void button2_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("آیا تنظیمات را صحیح انجام داده اید. آیا اطمینان دارید؟", "پیام", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (result == DialogResult.Yes)
            {
                if (objDataSet1.Tables["tbl_personel"].Rows.Count > 0)
                {
                    string id_year1, id_moon1, id_group1;
                    string id_year2, id_moon2, id_group2;

                    id_group1 = comboBox3.SelectedValue.ToString();
                    id_year1  = comboBox2.Text;
                    id_moon1  = Convert.ToString(comboBox1.SelectedIndex + 1);

                    id_group2 = comboBox6.SelectedValue.ToString();
                    id_year2  = comboBox5.Text;
                    id_moon2  = Convert.ToString(comboBox4.SelectedIndex + 1);

                    if (radioButton1.Checked == true)
                    {
                        //حالت اول
                        SqlCommand delete1 = new SqlCommand();
                        delete1.Connection  = objConnection;
                        delete1.CommandText = "DELETE FROM tbl_personel WHERE (idgroup = " + id_group2 + ") AND (idyear = " + id_year2 + ") AND (idmoon = " + id_moon2 + ")";
                        delete1.CommandType = CommandType.Text;
                        objConnection.Open();
                        delete1.ExecuteNonQuery();
                        objConnection.Close();

                        if (checkBox1.Checked == true)
                        {
                            SqlCommand delete2 = new SqlCommand();
                            delete2.Connection  = objConnection;
                            delete2.CommandText = "DELETE FROM Tbl_karkard WHERE (idgroup = " + id_group2 + ") AND (idyear = " + id_year2 + ") AND (idmoon = " + id_moon2 + ")";
                            delete2.CommandType = CommandType.Text;
                            objConnection.Open();
                            delete2.ExecuteNonQuery();
                            objConnection.Close();
                        }

                        if (checkBox2.Checked == true)
                        {
                            SqlCommand delete3 = new SqlCommand();
                            delete3.Connection  = objConnection;
                            delete3.CommandText = "DELETE FROM Tbl_hogogpersonel WHERE (idgroup = " + id_group2 + ") AND (idyear = " + id_year2 + ") AND (idmoon = " + id_moon2 + ")";
                            delete3.CommandType = CommandType.Text;
                            objConnection.Open();
                            delete3.ExecuteNonQuery();
                            objConnection.Close();
                        }

                        for (int w = 0; w <= objDataSet1.Tables["tbl_personel"].Rows.Count - 1; w++)
                        {
                            if (objDataSet1.Tables["tbl_personel"].Rows[w]["selectid"].ToString() == "True")
                            {
                                SqlCommand insert1 = new SqlCommand();
                                insert1.Connection  = objConnection;
                                insert1.CommandText = "INSERT INTO tbl_personel (idgroup,idyear,idmoon,code,name,family,name_pedar,sex,cod_mely,sh_sh,tahol,tedah_farzand,phon_manzel,phon_sabt,phon_hamra,name_bank,bank_shobeh,sh_hesab,sh_kart,code_posti,mar_tmpid,adress,tozihat,image_byte,maliat_madrak,maliat_onvanShoghl,maliat_serishenasnameh,maliat_vazmaskan,maliat_meliat,maliat_namekeshvar,maliat_nezamvazifeh,maliat_rasteshoghli,code_moafiat_maliat,maliat_vazmashin,code_moafiat_bimeh,bimeh_keshvar,bimeh_shahr,bimeh_mashagel,bimeh_tahsilat,bimeh_reshteh,sh_ghrardad,noe_garardad,hogog_morakhasi,data_tarkkar,data_estekhdam,data_shorogaradad,data_paiangarardad,noe_bimeh,sh_bimeh,modateh_gararda,NoeHoghog,hogog_rozaneh_tavafogh,hogog_rozaneh_ghanoni,uuser,udate,utime,upc,brithdate,list1,maliat_Moafiyat_vam,bimeh_meliat,list2) VALUES (@idgroup,@idyear,@idmoon,@code,@name,@family,@name_pedar,@sex,@cod_mely,@sh_sh,@tahol,@tedah_farzand,@phon_manzel,@phon_sabt,@phon_hamra,@name_bank,@bank_shobeh,@sh_hesab,@sh_kart,@code_posti,@mar_tmpid,@adress,@tozihat,@image_byte,@maliat_madrak,@maliat_onvanShoghl,@maliat_serishenasnameh,@maliat_vazmaskan,@maliat_meliat,@maliat_namekeshvar,@maliat_nezamvazifeh,@maliat_rasteshoghli,@code_moafiat_maliat,@maliat_vazmashin,@code_moafiat_bimeh,@bimeh_keshvar,@bimeh_shahr,@bimeh_mashagel,@bimeh_tahsilat,@bimeh_reshteh,@sh_ghrardad,@noe_garardad,@hogog_morakhasi,@data_tarkkar,@data_estekhdam,@data_shorogaradad,@data_paiangarardad,@noe_bimeh,@sh_bimeh,@modateh_gararda,@NoeHoghog,@hogog_rozaneh_tavafogh,@hogog_rozaneh_ghanoni,@uuser,@udate,@utime,@upc,@brithdate,@list1,@maliat_Moafiyat_vam,@bimeh_meliat,@list2)";
                                insert1.CommandType = CommandType.Text;

                                insert1.Parameters.AddWithValue("@code", objDataSet1.Tables["tbl_personel"].Rows[w]["code"]);
                                insert1.Parameters.AddWithValue("@name", objDataSet1.Tables["tbl_personel"].Rows[w]["name"]);
                                insert1.Parameters.AddWithValue("@family", objDataSet1.Tables["tbl_personel"].Rows[w]["family"]);
                                insert1.Parameters.AddWithValue("@name_pedar", objDataSet1.Tables["tbl_personel"].Rows[w]["name_pedar"]);
                                insert1.Parameters.AddWithValue("@sex", objDataSet1.Tables["tbl_personel"].Rows[w]["sex"]);
                                insert1.Parameters.AddWithValue("@cod_mely", objDataSet1.Tables["tbl_personel"].Rows[w]["cod_mely"]);
                                insert1.Parameters.AddWithValue("@sh_sh", objDataSet1.Tables["tbl_personel"].Rows[w]["sh_sh"]);
                                insert1.Parameters.AddWithValue("@tahol", objDataSet1.Tables["tbl_personel"].Rows[w]["tahol"]);
                                insert1.Parameters.AddWithValue("@tedah_farzand", objDataSet1.Tables["tbl_personel"].Rows[w]["tedah_farzand"]);
                                insert1.Parameters.AddWithValue("@phon_manzel", objDataSet1.Tables["tbl_personel"].Rows[w]["phon_manzel"]);
                                insert1.Parameters.AddWithValue("@phon_sabt", objDataSet1.Tables["tbl_personel"].Rows[w]["phon_sabt"]);
                                insert1.Parameters.AddWithValue("@phon_hamra", objDataSet1.Tables["tbl_personel"].Rows[w]["phon_hamra"]);
                                insert1.Parameters.AddWithValue("@name_bank", objDataSet1.Tables["tbl_personel"].Rows[w]["name_bank"]);
                                insert1.Parameters.AddWithValue("@bank_shobeh", objDataSet1.Tables["tbl_personel"].Rows[w]["bank_shobeh"]);
                                insert1.Parameters.AddWithValue("@sh_hesab", objDataSet1.Tables["tbl_personel"].Rows[w]["sh_hesab"]);
                                insert1.Parameters.AddWithValue("@sh_kart", objDataSet1.Tables["tbl_personel"].Rows[w]["sh_kart"]);
                                insert1.Parameters.AddWithValue("@code_posti", objDataSet1.Tables["tbl_personel"].Rows[w]["code_posti"]);
                                insert1.Parameters.AddWithValue("@mar_tmpid", objDataSet1.Tables["tbl_personel"].Rows[w]["mar_tmpid"]);
                                insert1.Parameters.AddWithValue("@adress", objDataSet1.Tables["tbl_personel"].Rows[w]["adress"]);
                                insert1.Parameters.AddWithValue("@tozihat", objDataSet1.Tables["tbl_personel"].Rows[w]["tozihat"]);
                                insert1.Parameters.AddWithValue("@image_byte", objDataSet1.Tables["tbl_personel"].Rows[w]["image_byte"]);
                                insert1.Parameters.AddWithValue("@maliat_madrak", objDataSet1.Tables["tbl_personel"].Rows[w]["maliat_madrak"]);
                                insert1.Parameters.AddWithValue("@maliat_onvanShoghl", objDataSet1.Tables["tbl_personel"].Rows[w]["maliat_onvanShoghl"]);
                                insert1.Parameters.AddWithValue("@maliat_serishenasnameh", objDataSet1.Tables["tbl_personel"].Rows[w]["maliat_serishenasnameh"]);
                                insert1.Parameters.AddWithValue("@maliat_vazmaskan", objDataSet1.Tables["tbl_personel"].Rows[w]["maliat_vazmaskan"]);
                                insert1.Parameters.AddWithValue("@maliat_meliat", objDataSet1.Tables["tbl_personel"].Rows[w]["maliat_meliat"]);
                                insert1.Parameters.AddWithValue("@maliat_namekeshvar", objDataSet1.Tables["tbl_personel"].Rows[w]["maliat_namekeshvar"]);
                                insert1.Parameters.AddWithValue("@maliat_nezamvazifeh", objDataSet1.Tables["tbl_personel"].Rows[w]["maliat_nezamvazifeh"]);
                                insert1.Parameters.AddWithValue("@maliat_rasteshoghli", objDataSet1.Tables["tbl_personel"].Rows[w]["maliat_rasteshoghli"]);
                                insert1.Parameters.AddWithValue("@code_moafiat_maliat", objDataSet1.Tables["tbl_personel"].Rows[w]["code_moafiat_maliat"]);
                                insert1.Parameters.AddWithValue("@maliat_vazmashin", objDataSet1.Tables["tbl_personel"].Rows[w]["maliat_vazmashin"]);
                                insert1.Parameters.AddWithValue("@code_moafiat_bimeh", objDataSet1.Tables["tbl_personel"].Rows[w]["code_moafiat_bimeh"]);
                                insert1.Parameters.AddWithValue("@bimeh_keshvar", objDataSet1.Tables["tbl_personel"].Rows[w]["bimeh_keshvar"]);
                                insert1.Parameters.AddWithValue("@bimeh_shahr", objDataSet1.Tables["tbl_personel"].Rows[w]["bimeh_shahr"]);
                                insert1.Parameters.AddWithValue("@bimeh_mashagel", objDataSet1.Tables["tbl_personel"].Rows[w]["bimeh_mashagel"]);
                                insert1.Parameters.AddWithValue("@bimeh_tahsilat", objDataSet1.Tables["tbl_personel"].Rows[w]["bimeh_tahsilat"]);
                                insert1.Parameters.AddWithValue("@bimeh_reshteh", objDataSet1.Tables["tbl_personel"].Rows[w]["bimeh_reshteh"]);
                                insert1.Parameters.AddWithValue("@bimeh_meliat", objDataSet1.Tables["tbl_personel"].Rows[w]["bimeh_meliat"]);
                                insert1.Parameters.AddWithValue("@sh_ghrardad", objDataSet1.Tables["tbl_personel"].Rows[w]["sh_ghrardad"]);
                                insert1.Parameters.AddWithValue("@noe_garardad", objDataSet1.Tables["tbl_personel"].Rows[w]["noe_garardad"]);
                                insert1.Parameters.AddWithValue("@hogog_morakhasi", objDataSet1.Tables["tbl_personel"].Rows[w]["hogog_morakhasi"]);
                                insert1.Parameters.AddWithValue("@data_tarkkar", objDataSet1.Tables["tbl_personel"].Rows[w]["data_tarkkar"]);
                                insert1.Parameters.AddWithValue("@data_estekhdam", objDataSet1.Tables["tbl_personel"].Rows[w]["data_estekhdam"]);
                                insert1.Parameters.AddWithValue("@data_shorogaradad", objDataSet1.Tables["tbl_personel"].Rows[w]["data_shorogaradad"]);
                                insert1.Parameters.AddWithValue("@data_paiangarardad", objDataSet1.Tables["tbl_personel"].Rows[w]["data_paiangarardad"]);
                                insert1.Parameters.AddWithValue("@noe_bimeh", objDataSet1.Tables["tbl_personel"].Rows[w]["noe_bimeh"]);
                                insert1.Parameters.AddWithValue("@sh_bimeh", objDataSet1.Tables["tbl_personel"].Rows[w]["sh_bimeh"]);
                                insert1.Parameters.AddWithValue("@modateh_gararda", objDataSet1.Tables["tbl_personel"].Rows[w]["modateh_gararda"]);
                                insert1.Parameters.AddWithValue("@NoeHoghog", objDataSet1.Tables["tbl_personel"].Rows[w]["NoeHoghog"]);
                                insert1.Parameters.AddWithValue("@hogog_rozaneh_tavafogh", objDataSet1.Tables["tbl_personel"].Rows[w]["hogog_rozaneh_tavafogh"]);
                                insert1.Parameters.AddWithValue("@idgroup", Convert.ToInt32(id_group2));
                                insert1.Parameters.AddWithValue("@idyear", Convert.ToInt32(id_year2));
                                insert1.Parameters.AddWithValue("@idmoon", Convert.ToInt32(id_moon2));
                                insert1.Parameters.AddWithValue("@uuser", u_set.u_user());
                                insert1.Parameters.AddWithValue("@udate", u_set.u_date());
                                insert1.Parameters.AddWithValue("@utime", u_set.u_time());
                                insert1.Parameters.AddWithValue("@upc", u_set.u_pc());
                                insert1.Parameters.AddWithValue("@brithdate", objDataSet1.Tables["tbl_personel"].Rows[w]["brithdate"]);
                                insert1.Parameters.AddWithValue("@list1", objDataSet1.Tables["tbl_personel"].Rows[w]["list1"]);
                                insert1.Parameters.AddWithValue("@hogog_rozaneh_ghanoni", objDataSet1.Tables["tbl_personel"].Rows[w]["hogog_rozaneh_ghanoni"]);
                                insert1.Parameters.AddWithValue("@maliat_Moafiyat_vam", objDataSet1.Tables["tbl_personel"].Rows[w]["maliat_Moafiyat_vam"]);
                                insert1.Parameters.AddWithValue("@list2", objDataSet1.Tables["tbl_personel"].Rows[w]["list2"]);

                                objConnection.Open();
                                insert1.ExecuteNonQuery();
                                objConnection.Close();

                                DataBase.Connection_Open();
                                DataBase.Fill("SELECT MAX(tmpid) AS rsmax FROM tbl_personel", objDataSet1, "tbl_personel_max", true);
                                DataBase.Connection_Close();

                                //کارکرد
                                if (checkBox1.Checked == true)
                                {
                                    DataBase.Connection_Open();
                                    DataBase.Fill("SELECT * FROM Tbl_karkard WHERE (idgroup = " + id_group1 + ") AND (idyear = " + id_year1 + ") AND (idmoon = " + id_moon1 + ") AND (idpersonal = " + objDataSet1.Tables["tbl_personel"].Rows[w]["tmpid"].ToString() + ")", objDataSet1, "Tbl_karkard", true);
                                    DataBase.Connection_Close();

                                    if (objDataSet1.Tables["Tbl_karkard"].Rows.Count > 0)
                                    {
                                        for (int p = 0; p <= objDataSet1.Tables["Tbl_karkard"].Rows.Count - 1; p++)
                                        {
                                            SqlCommand insert2 = new SqlCommand();
                                            insert2.Connection  = objConnection;
                                            insert2.CommandText = "INSERT INTO Tbl_karkard (idgroup, idyear, idmoon, idpersonal, q1, q2, q3, q4, q5, q6,type1) VALUES (@idgroup, @idyear, @idmoon, @idpersonal, @q1, @q2, @q3, @q4, @q5, @q6, @type1)";
                                            insert2.CommandType = CommandType.Text;
                                            insert2.Parameters.AddWithValue("@idgroup", id_group2);
                                            insert2.Parameters.AddWithValue("@idyear", id_year2);
                                            insert2.Parameters.AddWithValue("@idmoon", id_moon2);
                                            insert2.Parameters.AddWithValue("@idpersonal", objDataSet1.Tables["tbl_personel_max"].Rows[0]["rsmax"]);
                                            insert2.Parameters.AddWithValue("@q1", objDataSet1.Tables["Tbl_karkard"].Rows[p]["q1"]);
                                            insert2.Parameters.AddWithValue("@q2", objDataSet1.Tables["Tbl_karkard"].Rows[p]["q2"]);
                                            insert2.Parameters.AddWithValue("@q3", objDataSet1.Tables["Tbl_karkard"].Rows[p]["q3"]);
                                            insert2.Parameters.AddWithValue("@q4", objDataSet1.Tables["Tbl_karkard"].Rows[p]["q4"]);
                                            insert2.Parameters.AddWithValue("@q5", objDataSet1.Tables["Tbl_karkard"].Rows[p]["q5"]);
                                            insert2.Parameters.AddWithValue("@q6", objDataSet1.Tables["Tbl_karkard"].Rows[p]["q6"]);
                                            insert2.Parameters.AddWithValue("@type1", objDataSet1.Tables["Tbl_karkard"].Rows[p]["type1"]);

                                            objConnection.Open();
                                            insert2.ExecuteNonQuery();
                                            objConnection.Close();
                                        }
                                    }
                                    objDataSet1.Tables["Tbl_karkard"].Clear();
                                }

                                //حقوق و مزایا
                                if (checkBox2.Checked == true)
                                {
                                    DataBase.Connection_Open();
                                    DataBase.Fill("SELECT * FROM Tbl_hogogpersonel WHERE (idgroup = " + id_group1 + ") AND (idyear = " + id_year1 + ") AND (idmoon = " + id_moon1 + ") AND (tmpid_personel = " + objDataSet1.Tables["tbl_personel"].Rows[w]["tmpid"].ToString() + ")", objDataSet1, "Tbl_hogogpersonel", true);
                                    DataBase.Connection_Close();
                                    if (objDataSet1.Tables["Tbl_hogogpersonel"].Rows.Count > 0)
                                    {
                                        for (int p = 0; p <= objDataSet1.Tables["Tbl_hogogpersonel"].Rows.Count - 1; p++)
                                        {
                                            SqlCommand insert2 = new SqlCommand();
                                            insert2.Connection  = objConnection;
                                            insert2.CommandText = "INSERT INTO Tbl_hogogpersonel (idgroup, idyear, idmoon, tmpid_personel, tmpid_hogog, list1, list2, money1) VALUES (@idgroup, @idyear, @idmoon, @tmpid_personel, @tmpid_hogog, @list1, @list2, @money1)";
                                            insert2.CommandType = CommandType.Text;
                                            insert2.Parameters.AddWithValue("@idgroup", id_group2);
                                            insert2.Parameters.AddWithValue("@idyear", id_year2);
                                            insert2.Parameters.AddWithValue("@idmoon", id_moon2);
                                            insert2.Parameters.AddWithValue("@tmpid_personel", objDataSet1.Tables["tbl_personel_max"].Rows[0]["rsmax"]);
                                            insert2.Parameters.AddWithValue("@tmpid_hogog", objDataSet1.Tables["Tbl_hogogpersonel"].Rows[p]["tmpid_hogog"]);
                                            insert2.Parameters.AddWithValue("@list1", objDataSet1.Tables["Tbl_hogogpersonel"].Rows[p]["list1"]);
                                            insert2.Parameters.AddWithValue("@list2", objDataSet1.Tables["Tbl_hogogpersonel"].Rows[p]["list2"]);
                                            insert2.Parameters.AddWithValue("@money1", objDataSet1.Tables["Tbl_hogogpersonel"].Rows[p]["money1"]);

                                            objConnection.Open();
                                            insert2.ExecuteNonQuery();
                                            objConnection.Close();
                                        }
                                    }
                                    objDataSet1.Tables["Tbl_hogogpersonel"].Clear();
                                }
                                objDataSet1.Tables["tbl_personel_max"].Clear();
                            }
                        }
                    }


                    if (radioButton2.Checked == true)
                    {
                        DB_Base database = new DB_Base();

                        for (int w = 0; w <= objDataSet1.Tables["tbl_personel"].Rows.Count - 1; w++)
                        {
                            if (objDataSet1.Tables["tbl_personel"].Rows[w]["selectid"].ToString() == "True")
                            {
                                //حالت اول
                                SqlCommand delete1 = new SqlCommand();
                                delete1.Connection  = objConnection;
                                delete1.CommandText = "DELETE FROM tbl_personel WHERE (idgroup = " + id_group2 + ") AND (idyear = " + id_year2 + ") AND (idmoon = " + id_moon2 + ") AND (tmpid = " + objDataSet1.Tables["tbl_personel"].Rows[w]["tmpid"].ToString() + ")";
                                delete1.CommandType = CommandType.Text;
                                objConnection.Open();
                                delete1.ExecuteNonQuery();
                                objConnection.Close();

                                SqlCommand insert1 = new SqlCommand();
                                insert1.Connection  = objConnection;
                                insert1.CommandText = "INSERT INTO tbl_personel (idgroup,idyear,idmoon,code,name,family,name_pedar,sex,cod_mely,sh_sh,tahol,tedah_farzand,phon_manzel,phon_sabt,phon_hamra,name_bank,bank_shobeh,sh_hesab,sh_kart,code_posti,mar_tmpid,adress,tozihat,image_byte,maliat_madrak,maliat_onvanShoghl,maliat_serishenasnameh,maliat_vazmaskan,maliat_meliat,maliat_namekeshvar,maliat_nezamvazifeh,maliat_rasteshoghli,code_moafiat_maliat,maliat_vazmashin,code_moafiat_bimeh,bimeh_keshvar,bimeh_shahr,bimeh_mashagel,bimeh_tahsilat,bimeh_reshteh,sh_ghrardad,noe_garardad,hogog_morakhasi,data_tarkkar,data_estekhdam,data_shorogaradad,data_paiangarardad,noe_bimeh,sh_bimeh,modateh_gararda,NoeHoghog,hogog_rozaneh_tavafogh,hogog_rozaneh_ghanoni,uuser,udate,utime,upc,brithdate,list1,maliat_Moafiyat_vam,bimeh_meliat,list2) VALUES (@idgroup,@idyear,@idmoon,@code,@name,@family,@name_pedar,@sex,@cod_mely,@sh_sh,@tahol,@tedah_farzand,@phon_manzel,@phon_sabt,@phon_hamra,@name_bank,@bank_shobeh,@sh_hesab,@sh_kart,@code_posti,@mar_tmpid,@adress,@tozihat,@image_byte,@maliat_madrak,@maliat_onvanShoghl,@maliat_serishenasnameh,@maliat_vazmaskan,@maliat_meliat,@maliat_namekeshvar,@maliat_nezamvazifeh,@maliat_rasteshoghli,@code_moafiat_maliat,@maliat_vazmashin,@code_moafiat_bimeh,@bimeh_keshvar,@bimeh_shahr,@bimeh_mashagel,@bimeh_tahsilat,@bimeh_reshteh,@sh_ghrardad,@noe_garardad,@hogog_morakhasi,@data_tarkkar,@data_estekhdam,@data_shorogaradad,@data_paiangarardad,@noe_bimeh,@sh_bimeh,@modateh_gararda,@NoeHoghog,@hogog_rozaneh_tavafogh,@hogog_rozaneh_ghanoni,@uuser,@udate,@utime,@upc,@brithdate,@list1,@maliat_Moafiyat_vam,@bimeh_meliat,@list2)";
                                insert1.CommandType = CommandType.Text;

                                insert1.Parameters.AddWithValue("@code", objDataSet1.Tables["tbl_personel"].Rows[w]["code"]);
                                insert1.Parameters.AddWithValue("@name", objDataSet1.Tables["tbl_personel"].Rows[w]["name"]);
                                insert1.Parameters.AddWithValue("@family", objDataSet1.Tables["tbl_personel"].Rows[w]["family"]);
                                insert1.Parameters.AddWithValue("@name_pedar", objDataSet1.Tables["tbl_personel"].Rows[w]["name_pedar"]);
                                insert1.Parameters.AddWithValue("@sex", objDataSet1.Tables["tbl_personel"].Rows[w]["sex"]);
                                insert1.Parameters.AddWithValue("@cod_mely", objDataSet1.Tables["tbl_personel"].Rows[w]["cod_mely"]);
                                insert1.Parameters.AddWithValue("@sh_sh", objDataSet1.Tables["tbl_personel"].Rows[w]["sh_sh"]);
                                insert1.Parameters.AddWithValue("@tahol", objDataSet1.Tables["tbl_personel"].Rows[w]["tahol"]);
                                insert1.Parameters.AddWithValue("@tedah_farzand", objDataSet1.Tables["tbl_personel"].Rows[w]["tedah_farzand"]);
                                insert1.Parameters.AddWithValue("@phon_manzel", objDataSet1.Tables["tbl_personel"].Rows[w]["phon_manzel"]);
                                insert1.Parameters.AddWithValue("@phon_sabt", objDataSet1.Tables["tbl_personel"].Rows[w]["phon_sabt"]);
                                insert1.Parameters.AddWithValue("@phon_hamra", objDataSet1.Tables["tbl_personel"].Rows[w]["phon_hamra"]);
                                insert1.Parameters.AddWithValue("@name_bank", objDataSet1.Tables["tbl_personel"].Rows[w]["name_bank"]);
                                insert1.Parameters.AddWithValue("@bank_shobeh", objDataSet1.Tables["tbl_personel"].Rows[w]["bank_shobeh"]);
                                insert1.Parameters.AddWithValue("@sh_hesab", objDataSet1.Tables["tbl_personel"].Rows[w]["sh_hesab"]);
                                insert1.Parameters.AddWithValue("@sh_kart", objDataSet1.Tables["tbl_personel"].Rows[w]["sh_kart"]);
                                insert1.Parameters.AddWithValue("@code_posti", objDataSet1.Tables["tbl_personel"].Rows[w]["code_posti"]);
                                insert1.Parameters.AddWithValue("@mar_tmpid", objDataSet1.Tables["tbl_personel"].Rows[w]["mar_tmpid"]);
                                insert1.Parameters.AddWithValue("@adress", objDataSet1.Tables["tbl_personel"].Rows[w]["adress"]);
                                insert1.Parameters.AddWithValue("@tozihat", objDataSet1.Tables["tbl_personel"].Rows[w]["tozihat"]);
                                insert1.Parameters.AddWithValue("@image_byte", objDataSet1.Tables["tbl_personel"].Rows[w]["image_byte"]);
                                insert1.Parameters.AddWithValue("@maliat_madrak", objDataSet1.Tables["tbl_personel"].Rows[w]["maliat_madrak"]);
                                insert1.Parameters.AddWithValue("@maliat_onvanShoghl", objDataSet1.Tables["tbl_personel"].Rows[w]["maliat_onvanShoghl"]);
                                insert1.Parameters.AddWithValue("@maliat_serishenasnameh", objDataSet1.Tables["tbl_personel"].Rows[w]["maliat_serishenasnameh"]);
                                insert1.Parameters.AddWithValue("@maliat_vazmaskan", objDataSet1.Tables["tbl_personel"].Rows[w]["maliat_vazmaskan"]);
                                insert1.Parameters.AddWithValue("@maliat_meliat", objDataSet1.Tables["tbl_personel"].Rows[w]["maliat_meliat"]);
                                insert1.Parameters.AddWithValue("@maliat_namekeshvar", objDataSet1.Tables["tbl_personel"].Rows[w]["maliat_namekeshvar"]);
                                insert1.Parameters.AddWithValue("@maliat_nezamvazifeh", objDataSet1.Tables["tbl_personel"].Rows[w]["maliat_nezamvazifeh"]);
                                insert1.Parameters.AddWithValue("@maliat_rasteshoghli", objDataSet1.Tables["tbl_personel"].Rows[w]["maliat_rasteshoghli"]);
                                insert1.Parameters.AddWithValue("@code_moafiat_maliat", objDataSet1.Tables["tbl_personel"].Rows[w]["code_moafiat_maliat"]);
                                insert1.Parameters.AddWithValue("@maliat_vazmashin", objDataSet1.Tables["tbl_personel"].Rows[w]["maliat_vazmashin"]);
                                insert1.Parameters.AddWithValue("@code_moafiat_bimeh", objDataSet1.Tables["tbl_personel"].Rows[w]["code_moafiat_bimeh"]);
                                insert1.Parameters.AddWithValue("@bimeh_keshvar", objDataSet1.Tables["tbl_personel"].Rows[w]["bimeh_keshvar"]);
                                insert1.Parameters.AddWithValue("@bimeh_shahr", objDataSet1.Tables["tbl_personel"].Rows[w]["bimeh_shahr"]);
                                insert1.Parameters.AddWithValue("@bimeh_mashagel", objDataSet1.Tables["tbl_personel"].Rows[w]["bimeh_mashagel"]);
                                insert1.Parameters.AddWithValue("@bimeh_tahsilat", objDataSet1.Tables["tbl_personel"].Rows[w]["bimeh_tahsilat"]);
                                insert1.Parameters.AddWithValue("@bimeh_reshteh", objDataSet1.Tables["tbl_personel"].Rows[w]["bimeh_reshteh"]);
                                insert1.Parameters.AddWithValue("@bimeh_meliat", objDataSet1.Tables["tbl_personel"].Rows[w]["bimeh_meliat"]);
                                insert1.Parameters.AddWithValue("@sh_ghrardad", objDataSet1.Tables["tbl_personel"].Rows[w]["sh_ghrardad"]);
                                insert1.Parameters.AddWithValue("@noe_garardad", objDataSet1.Tables["tbl_personel"].Rows[w]["noe_garardad"]);
                                insert1.Parameters.AddWithValue("@hogog_morakhasi", objDataSet1.Tables["tbl_personel"].Rows[w]["hogog_morakhasi"]);
                                insert1.Parameters.AddWithValue("@data_tarkkar", objDataSet1.Tables["tbl_personel"].Rows[w]["data_tarkkar"]);
                                insert1.Parameters.AddWithValue("@data_estekhdam", objDataSet1.Tables["tbl_personel"].Rows[w]["data_estekhdam"]);
                                insert1.Parameters.AddWithValue("@data_shorogaradad", objDataSet1.Tables["tbl_personel"].Rows[w]["data_shorogaradad"]);
                                insert1.Parameters.AddWithValue("@data_paiangarardad", objDataSet1.Tables["tbl_personel"].Rows[w]["data_paiangarardad"]);
                                insert1.Parameters.AddWithValue("@noe_bimeh", objDataSet1.Tables["tbl_personel"].Rows[w]["noe_bimeh"]);
                                insert1.Parameters.AddWithValue("@sh_bimeh", objDataSet1.Tables["tbl_personel"].Rows[w]["sh_bimeh"]);
                                insert1.Parameters.AddWithValue("@modateh_gararda", objDataSet1.Tables["tbl_personel"].Rows[w]["modateh_gararda"]);
                                insert1.Parameters.AddWithValue("@NoeHoghog", objDataSet1.Tables["tbl_personel"].Rows[w]["NoeHoghog"]);
                                insert1.Parameters.AddWithValue("@hogog_rozaneh_tavafogh", objDataSet1.Tables["tbl_personel"].Rows[w]["hogog_rozaneh_tavafogh"]);
                                insert1.Parameters.AddWithValue("@idgroup", Convert.ToInt32(id_group2));
                                insert1.Parameters.AddWithValue("@idyear", Convert.ToInt32(id_year2));
                                insert1.Parameters.AddWithValue("@idmoon", Convert.ToInt32(id_moon2));
                                insert1.Parameters.AddWithValue("@uuser", u_set.u_user());
                                insert1.Parameters.AddWithValue("@udate", u_set.u_date());
                                insert1.Parameters.AddWithValue("@utime", u_set.u_time());
                                insert1.Parameters.AddWithValue("@upc", u_set.u_pc());
                                insert1.Parameters.AddWithValue("@brithdate", objDataSet1.Tables["tbl_personel"].Rows[w]["brithdate"]);
                                insert1.Parameters.AddWithValue("@list1", objDataSet1.Tables["tbl_personel"].Rows[w]["list1"]);
                                insert1.Parameters.AddWithValue("@hogog_rozaneh_ghanoni", objDataSet1.Tables["tbl_personel"].Rows[w]["hogog_rozaneh_ghanoni"]);
                                insert1.Parameters.AddWithValue("@maliat_Moafiyat_vam", objDataSet1.Tables["tbl_personel"].Rows[w]["maliat_Moafiyat_vam"]);
                                insert1.Parameters.AddWithValue("@list2", objDataSet1.Tables["tbl_personel"].Rows[w]["list2"]);

                                objConnection.Open();
                                insert1.ExecuteNonQuery();
                                objConnection.Close();

                                DataBase.Connection_Open();
                                DataBase.Fill("SELECT MAX(tmpid) AS rsmax FROM tbl_personel", objDataSet1, "tbl_personel_max", true);
                                DataBase.Connection_Close();

                                //کارکرد
                                if (checkBox1.Checked == true)
                                {
                                    SqlCommand delete2 = new SqlCommand();
                                    delete2.Connection  = objConnection;
                                    delete2.CommandText = "DELETE FROM Tbl_karkard WHERE (idgroup = " + id_group2 + ") AND (idyear = " + id_year2 + ") AND (idmoon = " + id_moon2 + ") AND (idpersonal = " + objDataSet1.Tables["tbl_personel"].Rows[w]["tmpid"].ToString() + ")";
                                    delete2.CommandType = CommandType.Text;
                                    objConnection.Open();
                                    delete2.ExecuteNonQuery();
                                    objConnection.Close();

                                    DataBase.Connection_Open();
                                    DataBase.Fill("SELECT * FROM Tbl_karkard WHERE (idgroup = " + id_group1 + ") AND (idyear = " + id_year1 + ") AND (idmoon = " + id_moon1 + ") AND (idpersonal = " + objDataSet1.Tables["tbl_personel"].Rows[w]["tmpid"].ToString() + ")", objDataSet1, "Tbl_karkard", true);
                                    DataBase.Connection_Close();

                                    if (objDataSet1.Tables["Tbl_karkard"].Rows.Count > 0)
                                    {
                                        for (int p = 0; p <= objDataSet1.Tables["Tbl_karkard"].Rows.Count - 1; p++)
                                        {
                                            SqlCommand insert2 = new SqlCommand();
                                            insert2.Connection  = objConnection;
                                            insert2.CommandText = "INSERT INTO Tbl_karkard (idgroup, idyear, idmoon, idpersonal, q1, q2, q3, q4, q5, q6,type1) VALUES (@idgroup, @idyear, @idmoon, @idpersonal, @q1, @q2, @q3, @q4, @q5, @q6, @type1)";
                                            insert2.CommandType = CommandType.Text;
                                            insert2.Parameters.AddWithValue("@idgroup", id_group2);
                                            insert2.Parameters.AddWithValue("@idyear", id_year2);
                                            insert2.Parameters.AddWithValue("@idmoon", id_moon2);
                                            insert2.Parameters.AddWithValue("@idpersonal", objDataSet1.Tables["tbl_personel_max"].Rows[0]["rsmax"]);
                                            insert2.Parameters.AddWithValue("@q1", objDataSet1.Tables["Tbl_karkard"].Rows[p]["q1"]);
                                            insert2.Parameters.AddWithValue("@q2", objDataSet1.Tables["Tbl_karkard"].Rows[p]["q2"]);
                                            insert2.Parameters.AddWithValue("@q3", objDataSet1.Tables["Tbl_karkard"].Rows[p]["q3"]);
                                            insert2.Parameters.AddWithValue("@q4", objDataSet1.Tables["Tbl_karkard"].Rows[p]["q4"]);
                                            insert2.Parameters.AddWithValue("@q5", objDataSet1.Tables["Tbl_karkard"].Rows[p]["q5"]);
                                            insert2.Parameters.AddWithValue("@q6", objDataSet1.Tables["Tbl_karkard"].Rows[p]["q6"]);
                                            insert2.Parameters.AddWithValue("@type1", objDataSet1.Tables["Tbl_karkard"].Rows[p]["type1"]);

                                            objConnection.Open();
                                            insert2.ExecuteNonQuery();
                                            objConnection.Close();
                                        }
                                    }
                                    objDataSet1.Tables["Tbl_karkard"].Clear();
                                }

                                //حقوق و مزایا
                                if (checkBox2.Checked == true)
                                {
                                    SqlCommand delete3 = new SqlCommand();
                                    delete3.Connection  = objConnection;
                                    delete3.CommandText = "DELETE FROM Tbl_hogogpersonel WHERE (idgroup = " + id_group2 + ") AND (idyear = " + id_year2 + ") AND (idmoon = " + id_moon2 + ") AND (tmpid_personel = " + objDataSet1.Tables["tbl_personel"].Rows[w]["tmpid"].ToString() + ")";
                                    delete3.CommandType = CommandType.Text;
                                    objConnection.Open();
                                    delete3.ExecuteNonQuery();
                                    objConnection.Close();

                                    DataBase.Connection_Open();
                                    DataBase.Fill("SELECT * FROM Tbl_hogogpersonel WHERE (idgroup = " + id_group1 + ") AND (idyear = " + id_year1 + ") AND (idmoon = " + id_moon1 + ") AND (tmpid_personel = " + objDataSet1.Tables["tbl_personel"].Rows[w]["tmpid"].ToString() + ")", objDataSet1, "Tbl_hogogpersonel", true);
                                    DataBase.Connection_Close();
                                    if (objDataSet1.Tables["Tbl_hogogpersonel"].Rows.Count > 0)
                                    {
                                        for (int p = 0; p <= objDataSet1.Tables["Tbl_hogogpersonel"].Rows.Count - 1; p++)
                                        {
                                            SqlCommand insert2 = new SqlCommand();
                                            insert2.Connection  = objConnection;
                                            insert2.CommandText = "INSERT INTO Tbl_hogogpersonel (idgroup, idyear, idmoon, tmpid_personel, tmpid_hogog, list1, list2, money1) VALUES (@idgroup, @idyear, @idmoon, @tmpid_personel, @tmpid_hogog, @list1, @list2, @money1)";
                                            insert2.CommandType = CommandType.Text;
                                            insert2.Parameters.AddWithValue("@idgroup", id_group2);
                                            insert2.Parameters.AddWithValue("@idyear", id_year2);
                                            insert2.Parameters.AddWithValue("@idmoon", id_moon2);
                                            insert2.Parameters.AddWithValue("@tmpid_personel", objDataSet1.Tables["tbl_personel_max"].Rows[0]["rsmax"]);
                                            insert2.Parameters.AddWithValue("@tmpid_hogog", objDataSet1.Tables["Tbl_hogogpersonel"].Rows[p]["tmpid_hogog"]);
                                            insert2.Parameters.AddWithValue("@list1", objDataSet1.Tables["Tbl_hogogpersonel"].Rows[p]["list1"]);
                                            insert2.Parameters.AddWithValue("@list2", objDataSet1.Tables["Tbl_hogogpersonel"].Rows[p]["list2"]);
                                            insert2.Parameters.AddWithValue("@money1", objDataSet1.Tables["Tbl_hogogpersonel"].Rows[p]["money1"]);

                                            objConnection.Open();
                                            insert2.ExecuteNonQuery();
                                            objConnection.Close();
                                        }
                                    }
                                    objDataSet1.Tables["Tbl_hogogpersonel"].Clear();
                                }
                                objDataSet1.Tables["tbl_personel_max"].Clear();
                            }
                        }
                    }

                    MessageBox.Show(" اطلاعات با موفقیت جابجا شد ", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    //لیست خالی است
                }
            }
        }
コード例 #8
0
ファイル: Form5.cs プロジェクト: Golmakaniamin/MHMPayroll
        private void Bind_2_Grid_Good()
        {
            string Qry = "";

            string[] Search_Data;
            string   search = Txt_Search.Text;
            //int i;

            //bool first = true;
            DB_Base fix = new DB_Base();

            if (Txt_Search.Text.Trim() == "")
            {
                FormLoad();
            }
            else
            {
                //Search_Data = fix.FixPersianString(Txt_Search.Text).Split(' ');
                Search_Data = Txt_Search.Text.Split(' ');

                Qry = "SELECT tmpid,selectid,code,name,family,name_pedar,sex,cod_mely,sh_sh FROM tbl_personel WHERE (";

                //for (i = 0; i < Search_Data.Length; i++)
                //{
                //    if (Search_Data[i].Trim() != "")
                //    {
                //        //if (first == false)
                //        //    Qry += "And";
                //        //Qry += "(";
                //        if (Database.Is_Numeric(Search_Data[i]))
                //        {
                //            Qry += "([code] like '%" + Search_Data[i] + "%')";
                //            Qry += "Or ([cod_mely] like '%" + Search_Data[i] + "%')";
                //            Qry += "Or ([sh_sh] like '%" + Search_Data[i] + "%')";
                //            Qry += "Or ([code_posti] like '%" + Search_Data[i] + "%')";
                //            Qry += "Or ([sh_bimeh] like '%" + Search_Data[i] + "%')";
                //            Qry += "Or ([sh_hesab] like '%" + Search_Data[i] + "%')";
                //            Qry += "Or ([tedah_farzand] like '%" + Search_Data[i] + "%')";
                //            Qry += "Or ([phon_manzel] like '%" + Search_Data[i] + "%')";
                //            Qry += "Or ([phon_sabt] like '%" + Search_Data[i] + "%')";
                //            Qry += "Or ([sh_kart] like '%" + Search_Data[i] + "%')";
                //        }
                //        else if (Database.Is_Nominal(Search_Data[i]))
                //            search += Search_Data[i];
                //        //first = false;
                //    }
                //}

                Qry += "(code LIKE '%" + search + "%')";
                Qry += " OR (name LIKE '%" + search + "%')";
                Qry += " OR (family LIKE '%" + search + "%')";
                Qry += " OR (name_pedar LIKE '%" + search + "%')";
                Qry += " OR (sex like '%" + search + "%')";
                Qry += " OR (cod_mely like '%" + search + "%')";
                Qry += " OR (sh_sh like '%" + search + "%')";
                Qry += ")";
                Qry += " AND ((idgroup = " + id_group + ") AND (idyear = " + id_year + ") AND (idmoon = " + id_moon + "))";

                //Qry += ")";
                //MessageBox.Show(Qry);

                objDataSet1.Tables["tbl_personel"].Clear();

                Database.Connection_Open();
                Database.Fill(Qry, objDataSet1, "tbl_personel", true);
                Database.Connection_Close();

                grdAuthorTitles.AutoGenerateColumns = true;
                grdAuthorTitles.DataSource          = objDataSet1;
                grdAuthorTitles.DataMember          = "tbl_personel";
            }
        }