コード例 #1
0
        private void buttonX1_Click(object sender, EventArgs e)
        {
            string sqlUtmp = "UPDATE [P&R] SET Rname = N'" + txtNameMaharat.Text + "' WHERE (Rname = N'" + dataGridViewX1.CurrentRow.Cells[1].Value.ToString() + "')";

            DataManagement.I_U_D(sqlAllReshte, sqlUtmp);

            string sqlIU = "UPDATE reshte SET code = N'" + txtCode.Text + "', name = N'" + txtNameMaharat.Text + "', onvan = N'" + txtOnvan.Text + "',modat = N'" +
                           txtModat.Value.ToString() + "', dateShoroo = N'" + txtShoroo.Text + "',date = N'" + txtAzmoon.Text + "' where (code = N'" + dataGridViewX1.CurrentRow.Cells[0].Value.ToString() + "')";

            DataManagement.I_U_D(sqlAllReshte, sqlIU);
        }
コード例 #2
0
ファイル: persons.cs プロジェクト: abolfazl2112/amuzeshgah
 private void buttonX3_Click(object sender, EventArgs e)
 {
     if (dataGridViewX1.RowCount == 0)
     {
         return;
     }
     if (FMessegeBox.FarsiMessegeBox.Show("آیا برای حذف مطمئن هستید؟", "اخطار", FMessegeBox.FMessegeBoxButtons.YesNo) != DialogResult.Yes)
     {
         return;
     }
     DataManagement.I_U_D("select * from reshte", "DELETE FROM person WHERE (codeMeli = N'" + dataGridViewX1.CurrentRow.Cells[0].Value.ToString() + "')");
     dataGridViewX1.DataSource = DataManagement.Search(sqlAll);
 }
コード例 #3
0
        private void btnSabt_Click(object sender, EventArgs e)
        {
            if (dataGridViewX2.RowCount == 0)
            {
                btnSabt.Enabled = false; return;
            }
            this.UseWaitCursor = true;
            string sqlUpdate = "UPDATE [P&R] SET nomreA = N'" + txtNomreA.Text + "', nomreN = N'" + txtNomreN.Text + "', dateSodoor = N'" + txtSodoor.Text + "', shGovahi = N'" + txtGovahi.Text + "' WHERE (Rname = N'" + txtNameMaharat.Text +
                               "') AND (PID = N'" + dataGridViewX2.CurrentRow.Cells[0].Value.ToString() + "') AND (Ronvan = N'" + txtOnvan.Text + "')";

            DataManagement.I_U_D(sqlAllPerson, sqlUpdate);
            dataGridViewX2.DataSource = DataManagement.Search(sqlAllPerson);
            FMessegeBox.FarsiMessegeBox.Show("اطلاعات با موفقیت ثبت شد");
            this.UseWaitCursor = false;
        }
コード例 #4
0
ファイル: reshte.cs プロジェクト: abolfazl2112/amuzeshgah
        private void btnDel_Click(object sender, EventArgs e)
        {
            if (dataGridViewX1.RowCount == 0)
            {
                return;
            }
            if (FMessegeBox.FarsiMessegeBox.Show("آیا برای حذف مطمئن هستید؟", "توجه", FMessegeBox.FMessegeBoxButtons.YesNo) != DialogResult.Yes)
            {
                return;
            }
            string sqldel = "DELETE FROM reshte WHERE (code = N'" + dataGridViewX1.CurrentRow.Cells[0].Value.ToString() + "')";

            DataManagement.I_U_D(sqlAll, sqldel);
            sqldel = "DELETE FROM [P&R] WHERE (RID = N'" + dataGridViewX1.CurrentRow.Cells[0].Value.ToString() + "')";
            DataManagement.I_U_D(sqlAll, sqldel);

            dataGridViewX1.DataSource = DataManagement.Search(sqlAll);
        }
コード例 #5
0
ファイル: reshte.cs プロジェクト: abolfazl2112/amuzeshgah
        private void btnSabt_Click(object sender, EventArgs e)
        {
            string sqlIU = "", sqlUtmp = "";

            if (DetectForm.F == 1)
            {
                sqlIU = "INSERT INTO reshte (code, name, onvan ,modat, dateShoroo, date, vamali, vnazari) VALUES(N'" + txtCode.Text +
                        "', N'" + txtName.Text + "',N'" + txtonvan.Text + "', N'" + txtmodat.Value.ToString() + "', N'" + txtShoro.Text +
                        "',N'" + txtDate.Text + "',N'" + txtamali.Text + "',N'" + txtnazari.Text + "')";
            }
            else
            {
                sqlUtmp = "UPDATE [P&R] SET Rname = N'" + txtName.Text + "' WHERE (Rname = N'" + dataGridViewX1.CurrentRow.Cells[1].Value.ToString() + "')";
                DataManagement.I_U_D(sqlAll, sqlUtmp);

                sqlIU = "UPDATE reshte SET code = N'" + txtCode.Text + "', name = N'" + txtName.Text + "', onvan = N'" + txtonvan.Text + "',modat = N'" +
                        txtmodat.Value.ToString() + "', dateShoroo = N'" + txtShoro.Text + "',date = N'" + txtDate.Text + "',vamali = N'" + txtamali.Text + "',vnazari = N'" + txtnazari.Text + "' where (code = N'" + DetectForm.Cod + "')";
            }
            DataManagement.I_U_D(sqlAll, sqlIU);
            dataGridViewX1.DataSource = DataManagement.Search(sqlAll);
            btnCancel_Click(null, null);
        }
コード例 #6
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (!flag)
            {
                return;
            }

            string sql = "INSERT INTO person (codeMeli{0}{1}{2}{3}{4}{5}{6}{7}{8}{9})VALUES({10}{11}{12}{13}{14}{15}{16}{17}{18}{19}{20})";

            try
            {
                int       count = 0;
                DataTable ans;
                for (int i = 0; i < dataGridViewX1.RowCount; i++)
                {
                    string Sql = string.Format(sql, (flagName ? ",name" : ""), (flagFamily ? ",family" : ""), (flagfather ? ",father" : ""), (flagShSh ? ",shsh" : ""), (flagmobile ? ",mobile" : ""), (flagtarikht ? ",tarikht" : ""), (flagsadere ? ",sadere" : ""), (flagmtavalod ? ",mtavalod" : ""), (flagsal ? ",sal" : ""), (flagmah ? ",mah" : ""),
                                               "N'" + dataGridViewX1.Rows[i].Cells["codeMeli"].Value.ToString() + "'", (flagName ? ",N'" + dataGridViewX1.Rows[i].Cells["name"].Value.ToString() + "'" : ""), (flagFamily ? ",N'" + dataGridViewX1.Rows[i].Cells["family"].Value.ToString() + "'" : ""), (flagfather ? ",N'" + dataGridViewX1.Rows[i].Cells["father"].Value.ToString() + "'" : ""),
                                               (flagShSh ? ",N'" + dataGridViewX1.Rows[i].Cells["shsh"].Value.ToString() + "'" : ""), (flagmobile ? ",N'" + dataGridViewX1.Rows[i].Cells["mobile"].Value.ToString() + "'" : ""), (flagtarikht ? ",N'" + dataGridViewX1.Rows[i].Cells["tarikht"].Value.ToString() + "'" : ""), (flagsadere ? ",N'" + dataGridViewX1.Rows[i].Cells["sadere"].Value.ToString() + "'" : ""),
                                               (flagmtavalod ? ",N'" + dataGridViewX1.Rows[i].Cells["mtavalod"].Value.ToString() + "'" : ""), (flagsal ? ",N'" + dataGridViewX1.Rows[i].Cells["sal"].Value.ToString() + "'" : ""), (flagmah ? ",N'" + dataGridViewX1.Rows[i].Cells["mah"].Value.ToString() + "'" : ""));

                    if (dataGridViewX1.Rows[i].Cells["codeMeli"].Value.ToString() != "")
                    {
                        ans = DataManagement.I_U_D("select codeMeli from person where codeMeli = N'" + dataGridViewX1.Rows[i].Cells["codeMeli"].Value.ToString() + "'", Sql);
                        if (ans.Rows.Count >= 0)
                        {
                            count++;
                        }
                    }
                }
                if (count > 0)
                {
                    lblAns.Text = "تعداد " + count.ToString() + " ثبت شد";
                }
            }
            catch (Exception ex)
            {
                FMessegeBox.FarsiMessegeBox.Show("مشکل در ثبت اطلاعات\n" + ex.Message, "خطا", FMessegeBox.FMessegeBoxButtons.Ok, FMessegeBox.FMessegeBoxIcons.Error);
            }
        }
コード例 #7
0
 private void buttonX1_Click(object sender, EventArgs e)
 {
     DataManagement.I_U_D("select * from setup", "UPDATE setup SET nazari = N'" + txtNazari.Text + "', amali = N'" + txtAmali.Text + "'");
     btnSabt.Enabled = false;
 }
コード例 #8
0
 private void btnSabt_Click(object sender, EventArgs e)
 {
     DataManagement.I_U_D("select * from setup", "UPDATE setup SET usernamesms = N'" + txtUser.Text + "', passwordsms = N'" + txtPass.Text + "'");
     btnSabt.Enabled = false;
 }
コード例 #9
0
        private void S_Click(object sender, EventArgs e)
        {
            this.UseWaitCursor = true;
            if (txtMeli.Text == "")
            {
                FMessegeBox.FarsiMessegeBox.Show("وارد کردن کد ملی اجباری است");
                this.UseWaitCursor = false;
                return;
            }
            string str = "select codeMeli from person where codeMeli = N'" + txtMeli.Text + "' ";

            if (txtMeli.Text != oldCode)
            {
                if (DataManagement.Search(str).Rows.Count != 0)
                {
                    FMessegeBox.FarsiMessegeBox.Show("کد ملی تکراری است");
                    this.UseWaitCursor = false;
                    return;
                }
            }

            if (!MeliFunction())
            {
                this.UseWaitCursor = false;
                return;
            }


            string sql = "";

            if (DetectForm.F == 1)
            {
                sql = "INSERT INTO person (codeMeli, name, family, father, shsh, tarikht, sadere, mtavalod,sal,mah) VALUES (N'" +
                      txtMeli.Text + "', N'" + txtName.Text + "', N'" + txtFamily.Text + "', N'" + txtFather.Text + "', N'" + txtShsh.Value.ToString() +
                      "', N'" + txtTavalod.Text + "', N'" + txtSadere.Text + "', N'" + txtMtavalod.Text + "', N'" + txtsal.Text + "', N'" + txtmah.Text + "')";
                DataManagement.I_U_D("select * from reshte", sql);
                if (listReshte.Rows.Count != 0)
                {
                    for (int i = 0; i < listReshte.Rows.Count; i++)
                    {
                        DataManagement.DT = DataManagement.Search("SELECT code, name,onvan FROM reshte WHERE(name = N'" + listReshte.Rows[i].Cells[0].Value.ToString() + "')AND(onvan = N'" + listReshte.Rows[i].Cells[1].Value.ToString() + "')");
                        DataManagement.I_U_D("select * from reshte", "INSERT INTO [P&R] (PID, RID, Rname,Ronvan) VALUES (N'" + txtMeli.Text + "', N'" + DataManagement.DT.Rows[0][0].ToString() + "', N'" + listReshte.Rows[i].Cells[0].Value.ToString() + "', N'" + listReshte.Rows[i].Cells[1].Value.ToString() + "')");
                    }
                }
            }
            else
            {
                sql = "UPDATE person SET codeMeli = N'" + txtMeli.Text + "', name = N'" + txtName.Text + "', family = N'" + txtFamily.Text + "', father = N'" + txtFather.Text + "', shsh = N'" + txtShsh.Value.ToString() + "', tarikht = N'" + txtTavalod.Text +
                      "', sadere = N'" + txtSadere.Text + "', mtavalod = N'" + txtMtavalod.Text + "', sal = N'" + txtsal.Text + "', mah = N'" + txtmah.Text + "' WHERE (codeMeli = N'" + oldCode + "')";
                DataManagement.I_U_D("select name from reshte", sql);
                if (listReshte.Rows.Count != 0 && isChange)
                {
                    DataManagement.I_U_D("select name from reshte", "DELETE FROM [P&R] WHERE (PID = N'" + oldCode + "')");
                    for (int i = 0; i < listReshte.Rows.Count; i++)
                    {
                        if (listReshte.Rows[i].Cells[0].ToString() == "")
                        {
                            continue;
                        }
                        DataManagement.DT = DataManagement.Search("SELECT code from reshte WHERE(name = N'" + listReshte.Rows[i].Cells[0].Value.ToString() + "') AND (onvan = N'" + listReshte.Rows[i].Cells[1].Value.ToString() + "')");
                        DataManagement.I_U_D("select name from reshte", "INSERT INTO [P&R] (PID, RID, Rname,Ronvan) VALUES (N'" + txtMeli.Text + "', N'" + DataManagement.DT.Rows[0][0].ToString() + "', N'" + listReshte.Rows[i].Cells[0].Value.ToString() + "', N'" + listReshte.Rows[i].Cells[1].Value.ToString() + "')");
                    }
                }
            }

            this.UseWaitCursor = false;
            FMessegeBox.FarsiMessegeBox.Show("اطلاعات با موفقیت ثبت شد");
            this.Close();
        }