Exemple #1
0
 private void grooh_Load(object sender, EventArgs e)
 {
     Languge_Keybord.Persian();
     dataGridViewX1.DataSource = DataManagement.Search(sqlAllReshte);
     setData();
     flag = true;
 }
Exemple #2
0
        private void dataGridViewX1_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            if (!flag)
            {
                return;
            }
            this.UseWaitCursor = true;
            clearData();

            if (dataGridViewX1.RowCount != 0)
            {
                sqlAllPerson = "SELECT  person.codeMeli AS کدملی, person.family + ' ' + person.name AS [نام و نام خانوادگی], [P&R].nomreA AS [نمره عملی], [P&R].nomreN AS [نمره نظری], " +
                               " [P&R].dateSodoor AS [تاریخ صدور], [P&R].shGovahi AS [شماره گواهینامه] FROM [P&R] INNER JOIN person ON [P&R].PID = person.codeMeli WHERE ([P&R].Rname = N'" + dataGridViewX1.Rows[e.RowIndex].Cells[1].Value.ToString() +
                               "') AND ([P&R].Ronvan = N'" + dataGridViewX1.Rows[e.RowIndex].Cells[2].Value.ToString() + "') ORDER BY [نام و نام خانوادگی]";
                dataGridViewX2.DataSource = DataManagement.Search(sqlAllPerson);

                txtCode.Text        = dataGridViewX1.Rows[e.RowIndex].Cells[0].Value.ToString();
                txtNameMaharat.Text = dataGridViewX1.Rows[e.RowIndex].Cells[1].Value.ToString();
                txtOnvan.Text       = dataGridViewX1.Rows[e.RowIndex].Cells[2].Value.ToString();
                txtModat.Value      = int.Parse(dataGridViewX1.Rows[e.RowIndex].Cells[3].Value.ToString());
                txtShoroo.Text      = dataGridViewX1.Rows[e.RowIndex].Cells[4].Value.ToString();
                txtAzmoon.Text      = dataGridViewX1.Rows[e.RowIndex].Cells[5].Value.ToString();

                if (dataGridViewX2.RowCount != 0)
                {
                    txtNomreA.Text = dataGridViewX2.Rows[0].Cells[2].Value.ToString();
                    txtNomreN.Text = dataGridViewX2.Rows[0].Cells[3].Value.ToString();
                    txtSodoor.Text = dataGridViewX2.Rows[0].Cells[4].Value.ToString();
                    txtGovahi.Text = dataGridViewX2.Rows[0].Cells[5].Value.ToString();
                }
            }
            btnSabt.Enabled    = false;
            this.UseWaitCursor = false;
        }
Exemple #3
0
        private void setData()
        {
            clearData();

            if (dataGridViewX1.RowCount != 0)
            {
                sqlAllPerson = "SELECT person.codeMeli[کدملی], person.family + ' ' + person.name[نام و نام خانوادگی], [P&R].nomreA[نمره عملی], [P&R].nomreN[نمره نظری], [P&R].dateSodoor[تاریخ صدور], [P&R].shGovahi[شماره گواهینامه] " +
                               "FROM [P&R] INNER JOIN person ON [P&R].PID = person.codeMeli WHERE([P&R].Rname = N'" + dataGridViewX1.CurrentRow.Cells[1].Value.ToString() + "') AND ([P&R].Ronvan = N'" + dataGridViewX1.CurrentRow.Cells[2].Value.ToString() + "') ORDER BY [نام و نام خانوادگی]";
                dataGridViewX2.DataSource = DataManagement.Search(sqlAllPerson);

                txtCode.Text        = dataGridViewX1.CurrentRow.Cells[0].Value.ToString();
                txtNameMaharat.Text = dataGridViewX1.CurrentRow.Cells[1].Value.ToString();
                txtOnvan.Text       = dataGridViewX1.CurrentRow.Cells[2].Value.ToString();
                txtModat.Value      = int.Parse(dataGridViewX1.CurrentRow.Cells[3].Value.ToString());
                txtShoroo.Text      = dataGridViewX1.CurrentRow.Cells[4].Value.ToString();
                txtAzmoon.Text      = dataGridViewX1.CurrentRow.Cells[5].Value.ToString();

                if (dataGridViewX2.RowCount != 0)
                {
                    txtNomreA.Text = dataGridViewX2.CurrentRow.Cells[2].Value.ToString();
                    txtNomreN.Text = dataGridViewX2.CurrentRow.Cells[3].Value.ToString();
                    txtSodoor.Text = dataGridViewX2.CurrentRow.Cells[4].Value.ToString();
                    txtGovahi.Text = dataGridViewX2.CurrentRow.Cells[5].Value.ToString();
                }
            }
        }
 private void comboBoxEx4_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (combosal1.Text == "")
     {
         combomah1.Text = ""; combosal1.Focus();
     }
     dataGridViewX1.DataSource = DataManagement.Search(sqlAll + " WHERE ([P&R].Rname = N'" + comboreshte1.SelectedItem.ToString() + "')AND([P&R].Ronvan = N'" + comboonvan1.Text + "')AND(person.sal=N'" + combosal1.Text + "')AND(person.mah=N'" + combomah1.Text + "') ORDER BY [نام و نام خانوادگی]");
 }
 private void textBoxX1_TextChanged(object sender, EventArgs e)
 {
     if (comboreshte2.Text == "")
     {
         return;
     }
     dataGridViewX2.DataSource = datatable = DataManagement.Search(sqlperson + " where([P&R].Rname = N'" + comboreshte2.Text + "') AND (person.codeMeli = N'" + textBoxX1.Text + "') ");
 }
        private void buttonX1_Click(object sender, EventArgs e)
        {
            if (comboreshte2.Text == "" || dataGridViewX2.RowCount == 0)
            {
                return;
            }

            dataGridViewX2.DataSource = datatable = DataManagement.Search(sqlperson + " WHERE ([P&R].Rname = N'" + comboreshte2.Text + "')AND(person.codeMeli = N'" + textBoxX1.Text + "') ORDER BY name");
        }
 void setItemscomboBox()
 {
     dataGridViewX1.DataSource = DataManagement.Search(sqlAll);
     DataManagement.DT         = DataManagement.Search("select distinct name from reshte");
     for (int i = 0; i < DataManagement.DT.Rows.Count; i++)
     {
         comboreshte1.Items.Add(DataManagement.DT.Rows[i][0]);
     }
 }
Exemple #8
0
        private void buttonX1_Click(object sender, EventArgs e)
        {
            Hide();
            NewPerson newp = new NewPerson();

            DetectForm.F = 1;
            newp.ShowDialog(this);
            Show();
            dataGridViewX1.DataSource = DataManagement.Search(sqlAll);
        }
        private void frm_rptsabtenam_Load(object sender, EventArgs e)
        {
            dataGridViewX2.DataSource = datatable = DataManagement.Search(sqlperson);
            DataTable dd = DataManagement.Search("select name from reshte");

            for (int i = 0; i < dd.Rows.Count; i++)
            {
                comboreshte2.Items.Add(dd.Rows[i][0].ToString());
            }
        }
Exemple #10
0
 private void txtReshte_SelectedIndexChanged(object sender, EventArgs e)
 {
     DataManagement.DT = DataManagement.Search("select onvan from reshte where (name = N'" + txtReshte.Text + "')");
     txtonvan.Items.Clear();
     for (int i = 0; i < DataManagement.DT.Rows.Count; i++)
     {
         string tmp = DataManagement.DT.Rows[i][0].ToString();
         txtonvan.Items.Add(tmp);
     }
 }
 private void comboBoxEx1_SelectedIndexChanged(object sender, EventArgs e)
 {
     DataManagement.DT = DataManagement.Search("select distinct onvan from reshte where(name = N'" + comboreshte1.Text + "')");
     comboonvan1.Items.Clear();
     for (int i = 0; i < DataManagement.DT.Rows.Count; i++)
     {
         comboonvan1.Items.Add(DataManagement.DT.Rows[i][0].ToString());
     }
     dataGridViewX1.DataSource = DataManagement.Search(sqlAll + " WHERE ([P&R].Rname = N'" + comboreshte1.SelectedItem.ToString() + "') ORDER BY [نام و نام خانوادگی]");
     comboonvan1.Text          = combosal1.Text = combomah1.Text = "";
 }
Exemple #12
0
        private void NewPerson_Load(object sender, EventArgs e)
        {
            Languge_Keybord.Persian();
            DataManagement.DT = DataManagement.Search("SELECT distinct name FROM reshte");
            for (int i = 0; i < DataManagement.DT.Rows.Count; i++)
            {
                txtReshte.Items.Add(DataManagement.DT.Rows[i][0].ToString());
            }
            Languge_Keybord.Persian();

            txtMeli.Focus();
        }
Exemple #13
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Languge_Keybord.Persian();
            buttonX3_Click_1(null, null);

            DataTable dt = DataManagement.Search("select usernamesms,passwordsms from setup");

            txtUserName.Text = dt.Rows[0][0].ToString();
            txtPass.Text     = dt.Rows[0][1].ToString();

            dataGridView2.DataSource = DataManagement.Search("select mah'ماه',sal'سال' from person");
        }
Exemple #14
0
        private void buttonX2_Click(object sender, EventArgs e)
        {
            if (dataGridViewX1.RowCount == 0)
            {
                return;
            }
            NewPerson np = new NewPerson();

            DetectForm.F = 2;
            np.loadEdit(dataGridViewX1, dataGridViewX1.CurrentRow.Index);
            np.ShowDialog(this);
            dataGridViewX1.DataSource = DataManagement.Search(sqlAll);
        }
Exemple #15
0
        private void setup_Load(object sender, EventArgs e)
        {
            DataTable dt = DataManagement.Search("select nazari, amali, usernamesms, passwordsms from setup");

            if (dt.Rows.Count > 0)
            {
                txtNazari.Text   = dt.Rows[0][0].ToString();
                txtAmali.Text    = dt.Rows[0][1].ToString();
                txtUser.Text     = dt.Rows[0][2].ToString();
                txtPass.Text     = dt.Rows[0][3].ToString();
                buttonX1.Enabled = btnSabt.Enabled = false;
            }
        }
Exemple #16
0
 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);
 }
Exemple #17
0
        private void textBoxX1_TextChanged(object sender, EventArgs e)
        {
            string sql = "";

            if (textBoxX1.Text == "" && textBoxX2.Text == "" && textBoxX3.Text == "")
            {
                dataGridViewX1.DataSource = DataManagement.Search(sqlAll);
            }
            else
            {
                sql = sqlAll + " WHERE (codeMeli LIKE N'" + textBoxX1.Text + "%') AND (name LIKE N'" + textBoxX2.Text + "%') AND (family LIKE N'" + textBoxX3.Text + "%')";
                dataGridViewX1.DataSource = DataManagement.Search(sql);
            }
        }
Exemple #18
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;
        }
Exemple #19
0
        private void textBoxX1_TextChanged(object sender, EventArgs e)
        {
            string sql = "", sqlAllPer = "SELECT  person.codeMeli AS کدملی, person.family + ' ' + person.name AS [نام و نام خانوادگی], [P&R].nomreA AS [نمره عملی], [P&R].nomreN AS [نمره نظری], " +
                                         " [P&R].dateSodoor AS [تاریخ صدور], [P&R].shGovahi AS [شماره گواهینامه] FROM [P&R] INNER JOIN person ON [P&R].PID = person.codeMeli WHERE ([P&R].Rname = N'" + dataGridViewX1.Rows[dataGridViewX1.CurrentRow.Index].Cells[1].Value.ToString() +
                                         "') AND ([P&R].Ronvan = N'" + dataGridViewX1.Rows[dataGridViewX1.CurrentRow.Index].Cells[2].Value.ToString() + "') ";

            if (textBoxX1.Text == "" && textBoxX2.Text == "")
            {
                dataGridViewX2.DataSource = DataManagement.Search(sqlAllPer + "ORDER BY [نام و نام خانوادگی]");
            }
            else
            {
                sql = sqlAllPer + " AND (codeMeli LIKE N'" + textBoxX1.Text + "%') AND (person.family + ' ' +  person.name LIKE N'" + textBoxX2.Text + "%') ";
                dataGridViewX2.DataSource = DataManagement.Search(sql + " ORDER BY [نام و نام خانوادگی]");
            }
        }
Exemple #20
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (timer1.Interval >= 50)
            {
                DataManagement.Search("select name from reshte");
                this.Hide();
                flag = true;
            }

            if (flag)
            {
                new Main().Show();
                timer1.Stop();
            }
            timer1.Interval++;
        }
        private void printPerson()
        {
            if (comboreshte2.Text == "" || dataGridViewX2.RowCount == 0)
            {
                return;
            }
            string sqlperson = "SELECT person.family + ' ' +  person.name[name], person.father, person.tarikht[tavalod], " +
                               " person.codeMeli[meli], person.shsh, person.sadere, [P&R].nomreN[nazari],[P&R].nomreA[amali], [P&R].shGovahi[govahiname] " +
                               " FROM person INNER JOIN [P&R] ON person.codeMeli = [P&R].PID WHERE ([P&R].Rname = N'" + comboreshte2.Text + "')AND(person.codeMeli = N'" + textBoxX1.Text + "') ORDER BY name";

            string sqlVariable = "SELECT reshte.code[codeEstandard], reshte.name[nameReshte], reshte.date[DateAzmoon], reshte.onvan[onvanReshte], reshte.dateShoroo[DateShoroo], [P&R].dateSodoor[DateSodoor] " +
                                 "FROM reshte INNER JOIN [P&R] ON reshte.code = [P&R].RID WHERE (reshte.name = N'" + comboreshte2.Text + "')";

            string str = Application.StartupPath + "\\rep\\perrep.mrt";

            DataManagement.DT = DataManagement.Search(sqlperson);
            try
            {
                Stimulsoft.Report.StiReport stikol = new Stimulsoft.Report.StiReport();
                stikol.Load(str);
                stikol.RegData("person", DataManagement.DT);
                stikol.Dictionary.DataSources.Items[0].DataTable = DataManagement.DT;

                DataManagement.DT = DataManagement.Search(sqlVariable);
                DataManagement.DT.Columns.Add("number");
                DataManagement.DT.Columns.Add("nameMarkaz");
                DataManagement.DT.Columns.Add("nahiye");
                DataManagement.DT.Columns.Add("sal");
                DataManagement.DT.Columns.Add("nobat");
                //DataManagement.DT.Rows[0]["number"] = dataGridViewX1.RowCount.ToString();
                //DataManagement.DT.Rows[0]["nameMarkaz"] = txtNameMarkaz.Text;
                //DataManagement.DT.Rows[0]["nahiye"] = txtNahiye.Text;
                //DataManagement.DT.Rows[0]["sal"] = txtSal.Text;
                //DataManagement.DT.Rows[0]["nobat"] = txtNobat.Text;

                stikol.Load(str);
                stikol.RegData("variable", DataManagement.DT);
                stikol.Dictionary.DataSources.Items[0].DataTable = DataManagement.DT;
                stikol.Show();
            }
            catch
            {
                FMessegeBox.FarsiMessegeBox.Show("مشکل در چاپ اطلاعات", "اخطار");
            }
        }
Exemple #22
0
        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);
        }
Exemple #23
0
        public void loadEdit(DataGridView dgv, int index)
        {
            oldCode          = txtMeli.Text = dgv.Rows[index].Cells[0].Value.ToString();
            txtName.Text     = dgv.Rows[index].Cells[1].Value.ToString();
            txtFamily.Text   = dgv.Rows[index].Cells[2].Value.ToString();
            txtFather.Text   = dgv.Rows[index].Cells[3].Value.ToString();
            txtShsh.Text     = dgv.Rows[index].Cells[4].Value.ToString();
            txtTavalod.Text  = dgv.Rows[index].Cells[5].Value.ToString();
            txtSadere.Text   = dgv.Rows[index].Cells[6].Value.ToString();
            txtMtavalod.Text = dgv.Rows[index].Cells[7].Value.ToString();
            txtmobile.Text   = dgv.Rows[index].Cells[8].Value.ToString();
            txtsal.Text      = dgv.Rows[index].Cells[9].Value.ToString();
            txtmah.Text      = dgv.Rows[index].Cells[10].Value.ToString();

            DataManagement.DT = DataManagement.Search("select Rname,Ronvan from [P&R] where (PID = N'" + txtMeli.Text + "')");
            for (int i = 0; i < DataManagement.DT.Rows.Count; i++)
            {
                listReshte.Rows.Add(DataManagement.DT.Rows[i][0].ToString(), DataManagement.DT.Rows[i][1].ToString());
            }
        }
        private void dataGridViewX1_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                string sqls = "SELECT modat, date, onvan, name FROM reshte WHERE (onvan = N'" + dataGridViewX1.Rows[e.RowIndex].Cells[11].Value.ToString() + "') AND (name = N'" +
                              dataGridViewX1.Rows[e.RowIndex].Cells[12].Value.ToString() + "')";

                DataTable dts = DataManagement.Search(sqls);
                if (dts.Rows.Count > 0)
                {
                    txtAzmoon.Text = dts.Rows[0]["date"].ToString();
                    txtModat.Text  = dts.Rows[0]["modat"].ToString();
                    txtOnvan.Text  = dts.Rows[0]["onvan"].ToString();
                }
            }
            catch (Exception eX)
            {
                FMessegeBox.FarsiMessegeBox.Show("عنوان رشته یا نام رشته برای این شخص ثبت نشده است\nبعد از بروزرسانی اطلاعات مجددا سعی کنید");
            }
        }
        private void btnfaragir_Click(object sender, EventArgs e)
        {
            string sqlselectperson = "SELECT codeMeli, name, family, father, shsh, tarikht, sadere, mtavalod, sal, mah, mobile " +
                                     " FROM person WHERE(codeMeli = N'" + dataGridViewX2.CurrentRow.Cells[3].Value.ToString() + "')";

            string sqlselectreshte = "SELECT name, onvan, vamali, vnazari FROM reshte WHERE (name = N'" + comboreshte2.Text + "')";


            string sqlRP = "SELECT [P&R].PID, reshte.name, reshte.onvan, reshte.vamali, reshte.vnazari " +
                           " FROM [P&R] INNER JOIN reshte ON [P&R].RID = reshte.code " +
                           " WHERE([P&R].PID = N'" + dataGridViewX2.CurrentRow.Cells[3].Value.ToString() + "') AND (reshte.name = N'" + comboreshte2.Text + "')";



            try
            {
                string str = Application.StartupPath + "\\rep\\Sabtnam.mrt";
                Stimulsoft.Report.StiReport stikol = new Stimulsoft.Report.StiReport();
                Stimulsoft.Report.StiReport stitmp = new Stimulsoft.Report.StiReport();
                stitmp.Load(str);
                //DataSet ds = new DataSet();
                DataTable dt1 = DataManagement.Search(sqlselectperson);
                //ds.Tables.Add(dt1);
                DataTable dt2 = DataManagement.Search(sqlRP);
                //ds.Tables.Add(dt2);
                //ds.Tables[0].TableName = "khate1";
                //ds.Tables[1].TableName = "variable1";
                stitmp.RegData("khate1", dt1);
                stitmp.RegData("variable1", dt2);

                //stikol.Report = stitmp;


                stikol.Show(this);

                //stikol.Dictionary.DataSources.Items[0].Dictionary.DataSources = ds;
                //stikol.RegData("variable1", dtPerson);
                //stikol.Dictionary.DataSources.Items[1].DataTable = dtPerson;
            }
            catch (Exception ex) { FMessegeBox.FarsiMessegeBox.Show(ex.Message); }
        }
 private void comboBoxEx2_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboreshte1.Text == "")
     {
         comboonvan1.Text = ""; comboreshte1.Focus();
     }
     DataManagement.DT = DataManagement.Search("SELECT code, name, modat, date, onvan, dateShoroo FROM reshte where (name = N'" + comboreshte1.SelectedItem.ToString() + "')AND(onvan = N'" + comboonvan1.Text + "')");
     if (DataManagement.DT.Rows.Count == 0)
     {
         return;
     }
     txtCode.Text              = DataManagement.DT.Rows[0]["code"].ToString();
     txtAzmoon.Text            = DataManagement.DT.Rows[0]["date"].ToString();
     txtNameMaharat.Text       = DataManagement.DT.Rows[0]["name"].ToString();
     txtModat.Text             = DataManagement.DT.Rows[0]["modat"].ToString();
     txtNameMarkaz.Text        = "آموزشگاه آزاد هنری معرق روشن";
     txtNum.Text               = DataManagement.DT.Rows.Count.ToString();
     txtOnvan.Text             = DataManagement.DT.Rows[0]["onvan"].ToString();
     txtshoroo.Text            = DataManagement.DT.Rows[0]["dateShoroo"].ToString();
     dataGridViewX1.DataSource = DataManagement.Search(sqlAll + " WHERE ([P&R].Rname = N'" + comboreshte1.SelectedItem.ToString() + "')AND([P&R].Ronvan = N'" + comboonvan1.Text + "') ORDER BY [نام و نام خانوادگی]");
     combosal1.Text            = combomah1.Text = "";
 }
Exemple #27
0
        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);
        }
Exemple #28
0
 private void persons_Load(object sender, EventArgs e)
 {
     Languge_Keybord.Persian();
     dataGridViewX1.DataSource = DataManagement.Search(sqlAll);
 }
        private void printGovahi(string type)
        {
            string CodeMeli = "", NameReshte = "";
            string sqlGovahi = "";
            string str       = Application.StartupPath + "\\rep\\govarpt.mrt";

            Stimulsoft.Report.StiReport stikol = new Stimulsoft.Report.StiReport();
            try
            {
                stikol.Load(str);
            }
            catch (Exception ex)
            {
                FMessegeBox.FarsiMessegeBox.Show(ex.Message);
            }
            if (type == "one")
            {
                CodeMeli   = dataGridViewX1.CurrentRow.Cells[0].Value.ToString();
                NameReshte = comboreshte1.Text;

                sqlGovahi = "SELECT person.codeMeli AS meli, person.name + ' ' + person.family AS name, person.father, person.shsh, person.tarikht AS tavalod, person.sadere, [P&R].nomreA, " +
                            "[P&R].nomreN, [P&R].dateSodoor AS sodoor, [P&R].shGovahi AS govahi, person.mtavalod AS shahr, [P&R].RID AS codeStandard FROM person INNER JOIN [P&R] ON person.codeMeli = [P&R].PID " +
                            "WHERE (person.codeMeli = N'" + CodeMeli + "') AND ([P&R].Rname = N'" + dataGridViewX1.CurrentRow.Cells[12].Value.ToString() +
                            "')AND([P&R].Ronvan = N'" + dataGridViewX1.CurrentRow.Cells[11].Value.ToString() + "')";

                //sqlGovahi = "SELECT person.codeMeli[meli], person.name + ' ' + person.family[name], person.father, person.shsh, person.tarikht[tavalod], person.sadere, [P&R].nomreA, " +
                //               "[P&R].nomreN, [P&R].dateSodoor[sodoor], [P&R].shGovahi[govahi], reshte.onvan, reshte.date[azmon], reshte.modat, reshte.code[codeStandard], person.mtavalod[shahr] " +
                //               "FROM person INNER JOIN [P&R] ON person.codeMeli = [P&R].PID INNER JOIN reshte ON [P&R].RID = reshte.code " +
                //               "WHERE (person.codeMeli = N'" + CodeMeli + "') AND ([P&R].Rname = N'" + comboBoxEx1.SelectedItem.ToString() +
                //               "')AND([P&R].Ronvan = N'" + comboBoxEx2.Text + "')";

                DataManagement.DT = DataManagement.Search(sqlGovahi);
                try
                {
                    stikol.RegData("variable", DataManagement.DT);

                    DataManagement.DT.Columns.Add("mahal");
                    DataManagement.DT.Columns.Add("onvan");
                    DataManagement.DT.Columns.Add("azmon");
                    DataManagement.DT.Columns.Add("modat");
                    DataManagement.DT.Rows[0]["mahal"] = txtNameMarkaz.Text;
                    DataManagement.DT.Rows[0]["onvan"] = txtOnvan.Text;
                    DataManagement.DT.Rows[0]["azmon"] = txtAzmoon.Text;
                    DataManagement.DT.Rows[0]["modat"] = txtModat.Text;

                    stikol.Dictionary.DataSources.Items[0].DataTable = DataManagement.DT;
                    stikol.Show(this);
                }
                catch (Exception ex)
                {
                    FMessegeBox.FarsiMessegeBox.Show(ex.Message, "اخطار");
                }
            }/*
              * else
              * {
              * NameReshte = comboBoxEx1.Text;
              *
              * for (int i = 0; i< dataGridViewX1.RowCount; i++)
              * {
              *     CodeMeli = dataGridViewX1.Rows[i].Cells[0].Value.ToString();
              *     sqlGovahi = "SELECT person.codeMeli[meli], person.name + ' ' + person.family[name], person.father, person.shsh, person.tarikht[tavalod], person.sadere, [P&R].nomreA, " +
              *                    "[P&R].nomreN, [P&R].dateSodoor[sodoor], [P&R].shGovahi[govahi], reshte.onvan, reshte.date[azmon], reshte.modat, reshte.code[codeStandard], person.mtavalod[shahr] " +
              *                    "FROM person INNER JOIN [P&R] ON person.codeMeli = [P&R].PID INNER JOIN reshte ON [P&R].RID = reshte.code " +
              *                    "WHERE (person.codeMeli = N'" + CodeMeli + "') AND (reshte.name = N'" + NameReshte + "')";
              *
              *     DataManagement.DT = DataManagement.Search(sqlGovahi);
              *     try
              *     {
              *
              *         DataManagement.DT.Columns.Add("mahal");
              *         DataManagement.DT.Columns.Add("onvan");
              *         DataManagement.DT.Columns.Add("azmon");
              *         DataManagement.DT.Columns.Add("modat");
              *         DataManagement.DT.Rows[0]["mahal"] = txtNameMarkaz.Text;
              *         DataManagement.DT.Rows[0]["onvan"] = txtOnvan.Text;
              *         DataManagement.DT.Rows[0]["azmon"] = txtAzmoon.Text;
              *         DataManagement.DT.Rows[0]["modat"] = txtModat.Text;
              *
              *         stikol.RegData("variable", DataManagement.DT);
              *         stikol.Dictionary.DataSources.Items[0].DataTable = DataManagement.DT;
              *
              *         stikol.Print();
              *     }
              *     catch(Exception ex)
              *     {
              *         FMessegeBox.FarsiMessegeBox.Show(ex.Message, "اخطار");
              *         break;
              *     }
              * }
              * }*/
        }
        private void printPerson()
        {
            if (comboreshte1.Text == "" || dataGridViewX1.RowCount == 0 || comboonvan1.Text == "")
            {
                return;
            }

            string sqlperson = "SELECT person.family + ' ' +  person.name[name], person.father, person.tarikht[tavalod], " +
                               " person.codeMeli[meli], person.shsh, person.sadere, [P&R].nomreN[nazari],[P&R].nomreA[amali], [P&R].shGovahi[govahiname] " +
                               " FROM person INNER JOIN [P&R] ON person.codeMeli = [P&R].PID WHERE ([P&R].Rname = N'" + comboreshte1.Text + "'){0}{1}{2} ORDER BY name";

            string.Format(sqlperson, (comboonvan1.Text == "" ? "" : "AND([P&R].Ronvan = N'" + comboreshte1.Text + "')"), (combosal1.Text == "" ? "" : "AND(person.sal = N'" + combosal1.Text + "')")
                          , (combomah1.Text == "" ? "" : "AND(person.mah = N'" + combomah1.Text + "')"));

            string sqlVariable = "SELECT reshte.code[codeEstandard], reshte.name[nameReshte], reshte.date[DateAzmoon], reshte.onvan[onvanReshte], reshte.dateShoroo[DateShoroo], [P&R].dateSodoor[DateSodoor] " +
                                 "FROM reshte INNER JOIN [P&R] ON reshte.code = [P&R].RID WHERE (reshte.name = N'" + comboreshte1.Text + "')AND(reshte.onvan = N'" + comboonvan1.Text + "')";

            string str = Application.StartupPath + "\\rep\\perrep.mrt";

            DataManagement.DT = DataManagement.Search(sqlperson);
            try
            {
                for (int i = 0; i < DataManagement.DT.Rows.Count; i++)
                {
                    bool x = false;
                    int  j = 0;
                    for (; j < dataGridViewX1.SelectedRows.Count; j++)
                    {
                        if (dataGridViewX1.SelectedRows[j].Cells[0].Value.ToString()
                            == DataManagement.DT.Rows[i][0].ToString())
                        {
                            x = true;
                            break;
                        }
                    }
                    if (x)
                    {
                        continue;
                    }
                    DataManagement.DT.Rows.RemoveAt(i);
                    i--;
                }
                Stimulsoft.Report.StiReport stikol = new Stimulsoft.Report.StiReport();
                stikol.Load(str);
                stikol.RegData("person", DataManagement.DT);
                stikol.Dictionary.DataSources.Items[0].DataTable = DataManagement.DT;

                DataManagement.DT = DataManagement.Search(sqlVariable);
                DataManagement.DT.Columns.Add("number");
                DataManagement.DT.Columns.Add("nameMarkaz");
                DataManagement.DT.Columns.Add("nahiye");
                DataManagement.DT.Columns.Add("sal");
                DataManagement.DT.Columns.Add("nobat");
                DataManagement.DT.Rows[0]["number"]     = dataGridViewX1.RowCount.ToString();
                DataManagement.DT.Rows[0]["nameMarkaz"] = txtNameMarkaz.Text;
                DataManagement.DT.Rows[0]["nahiye"]     = txtNahiye.Text;
                DataManagement.DT.Rows[0]["sal"]        = txtSal.Text;
                DataManagement.DT.Rows[0]["nobat"]      = txtNobat.Text;

                stikol.Load(str);
                stikol.RegData("variable", DataManagement.DT);
                stikol.Dictionary.DataSources.Items[0].DataTable = DataManagement.DT;
                stikol.Show();
            }
            catch
            {
                FMessegeBox.FarsiMessegeBox.Show("مشکل در چاپ اطلاعات", "اخطار");
            }
        }