Пример #1
0
        public EditUserRolForm()
        {
            InitializeComponent();

            notSaved = false;

            sqlCon = new SQLDBConnect();

            newDBcon                              = new SprDbConnect("spr_user_rol");
            dgUserRol.DataSource                  = newDBcon.GetDataTable("spr_user_rol");
            dgUserRol.Columns[0].HeaderText       = "Код";
            dgUserRol.Columns[0].Visible          = false;
            dgUserRol.Columns[0].DataPropertyName = "id";
            dgUserRol.Columns[1].HeaderText       = "Наименование";

            dgControls.AutoGenerateColumns = false;

            DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn();

            /*
             * column.HeaderText = "Код";
             * column.Visible = false;
             * column.DataPropertyName = "id";
             * column.Name = "id";
             * dgControls.Columns.Add(column);
             */

            column                  = new DataGridViewTextBoxColumn();
            column.HeaderText       = "Наименование";
            column.Visible          = true;
            column.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
            column.DataPropertyName = "opisanie";
            dgControls.Columns.Add(column);

            DataGridViewCheckBoxColumn columnCheck =
                new DataGridViewCheckBoxColumn();

            {
                columnCheck.Name             = "enabled";
                columnCheck.DataPropertyName = "enabled";
                columnCheck.HeaderText       = "Разрешено";
                columnCheck.Width            = 80;
                columnCheck.AutoSizeMode     = DataGridViewAutoSizeColumnMode.None;
            }
            dgControls.Columns.Add(columnCheck);

            //Заполняем таблицу user_rol_access на случай появления новых контролов или групп пользователей
            sqlCon.DoQuery(@"INSERT INTO user_rol_access
                SELECT spr_user_controls.id AS id_user_controls, spr_user_rol.id AS id_user_rol 
                FROM spr_user_controls, spr_user_rol
                WHERE spr_user_controls.id NOT IN (SELECT DISTINCT id_user_controls FROM user_rol_access) OR 
                spr_user_rol.id NOT IN (SELECT DISTINCT id_user_rol FROM user_rol_access)");

            DataTable dt = sqlCon.GetDataTable("user_access",
                                               @"SELECT user_rol_access.id, user_rol_access.id_user_rol, user_rol_access.enabled, spr_user_controls.opisanie FROM user_rol_access 
                LEFT JOIN spr_user_controls ON (user_rol_access.id_user_controls = spr_user_controls.id)");
            DataView dv = new DataView(dt);

            dgControls.DataSource = dv;
        }
Пример #2
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            RegistryKey regKey = Registry.CurrentUser;

            regKey = regKey.CreateSubKey("Software\\UFSIN\\ivrJournal");
            String dbPath = regKey.GetValue("dbPath", @"C:\Program files\ufsin_rk\Дневник ИВР\divr.mdb").ToString();

            SQLDBConnect newDBcon = new SQLDBConnect();

            if (!newDBcon.DBConCheckBool())
            {
                MessageBox.Show("Ошибка соединения с базой данных. Проверьте настройки.");
                DialogResult = DialogResult.None;
                return;
            }

            String login    = loginBox.Text;
            String password = passwordBox.Text;

            if (newDBcon.checkUser(login, password) == false)
            {
                MessageBox.Show("Пользователь с таким именем и паролем не обнаружен. В доступе отказано. ");
                DialogResult = DialogResult.None;
                return;
            }

            regKey.SetValue("login", login);

            return;
        }
Пример #3
0
        public FormControlManager()
        {
            sqlCon = new SQLDBConnect();
            DataTable dt = sqlCon.GetDataTable("spr_user_controls", "SELECT * FROM spr_user_controls");

            dt = sqlCon.GetDataTable("user_rol_access", "SELECT * FROM user_rol_access");
        }
Пример #4
0
//        internal protected ReportViewer reportviewer;

        public RepBonusAndPenaltyForm(DataRow selRow)
        {
            this.selRow = selRow;
            idSpec      = (Int32)selRow["id"];

            InitializeComponent();
            dbCon = new SQLDBConnect();

            try
            {
                DateTimeFormatInfo fmt = (new CultureInfo("ru-RU")).DateTimeFormat;

                rvBandP.LocalReport.ReportPath = @"ReportBandP.rdlc";

                DataTable dtBonus = dbCon.GetDataTable("bonus", "SELECT COUNT(*) AS numberpp, b1.date_bonus AS date_bonus, b1.bonus_reason AS bonus_reason, spr_bonus_type.name AS bonus_type FROM (bonus AS b1 LEFT JOIN bonus AS b2 ON b2.id<=b1.id) LEFT JOIN spr_bonus_type ON spr_bonus_type.id=b1.bonus_type_id WHERE (b1.id_spec=" + idSpec + ") AND (b2.id_spec=" + idSpec + ") GROUP BY b1.id, b1.date_bonus, b1.bonus_reason, spr_bonus_type.name");
                rvBandP.LocalReport.DataSources.Add(new ReportDataSource("DataSetBandP_DataTableBonus", dtBonus));

                DataTable dtPenalty = dbCon.GetDataTable("penalty", "SELECT COUNT(*) AS numberpp, p1.date_penalty AS date_penalty, p1.reason AS reason, p1.removal AS removal, spr_penalty_type.name AS penalty_type FROM (penalty AS p1 LEFT JOIN penalty AS p2 ON p2.id<=p1.id) LEFT JOIN spr_penalty_type ON spr_penalty_type.id=p1.penalty_type_id WHERE (p1.id_spec=" + idSpec + ") AND (p2.id_spec=" + idSpec + ") GROUP BY p1.id, p1.date_penalty, p1.reason, p1.removal, spr_penalty_type.name");
                rvBandP.LocalReport.DataSources.Add(new ReportDataSource("DataSetBandP_DataTablePenalty", dtPenalty));

                ReportParameter p1 = new
                                     ReportParameter("name", selRow["last_name"].ToString() + " " + selRow["first_name"].ToString() + " " + selRow["patronymic"].ToString());

                rvBandP.LocalReport.SetParameters(new ReportParameter[] { p1 });

                rvBandP.ProcessingMode = ProcessingMode.Local;
                rvBandP.RefreshReport();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "ќшибка при построении отчета");
                Close();
            }
        }
Пример #5
0
        public AboutForm()
        {
            InitializeComponent();
            SQLDBConnect conSql = new SQLDBConnect();

            lblDBVersion.Text  = conSql.GetSystemValue("Database Version");
            lblPrgVersion.Text = AssemblyName.GetAssemblyName(Assembly.Load("ivrJournal").Location).Version.ToString();
        }
Пример #6
0
 private void dgSpr_UserAddedRow(object sender, DataGridViewRowEventArgs e)
 {
     if (nameSpr == "spr_party_number")
     {
         SQLDBConnect sqlCon = new SQLDBConnect();
         dgSpr.CurrentRow.Cells[2].Value = sqlCon.GetSystemValue("Department");
     }
 }
Пример #7
0
 public IVRTransfer()
 {
     sqlConSrc   = new SQLDBConnect();
     sqlConDst   = new SQLDBConnect();
     dataFile    = "dataset.xml";
     zipPassword = "******";
     tempDir     = Environment.GetEnvironmentVariable("TEMP") + @"\" + RandomString(8, true);
     //mapSpr = new Dictionary<int, int>();
 }
Пример #8
0
        private void EditFind(string strSQL)
        {
            DataView IsPresentView = new DataView(newDBcon.GetDataTable("spec"));

            if (strSQL != "")
            {
                SQLDBConnect sqlCon = new SQLDBConnect();
                DataTable    dt     = sqlCon.GetDataTable("dt", strSQL);
                if (dt == null)
                {
                    return;
                }
                String ids = null;
                foreach (DataRow row in dt.Rows)
                {
                    ids = (ids == null) ? row["id"].ToString() :
                          ids + ", " + row["id"].ToString();
                }

                //String strID = (ids == null) ? "-1" : ids;
                //String strFilter = String.IsNullOrEmpty(strID) ? "(is_present = true)" : "(is_present = true) AND (id NOT IN (" + strID + "))";
                String strFilter = String.IsNullOrEmpty(ids) ? "(is_present = true)" : "(is_present = true) AND (id NOT IN (" + ids + "))";
                IsPresentView.RowFilter = strFilter;
            }
            else
            {
                if (cbParty.SelectedIndex > -1)
                {
                    if (tbLastName.Text != String.Empty)
                    {
                        IsPresentView.RowFilter = "(is_present = true) AND (last_name LIKE '%" + tbLastName.Text + "%') AND (party_id = " + cbParty.SelectedValue + ")";
                    }
                    else
                    {
                        IsPresentView.RowFilter = "(is_present = true) AND (party_id = " + cbParty.SelectedValue + ")";
                    }
                }
                else
                {
                    if (tbLastName.Text != String.Empty)
                    {
                        IsPresentView.RowFilter = "(is_present = true) AND (last_name LIKE '%" + tbLastName.Text + "%')";
                    }
                    else
                    {
                        IsPresentView.RowFilter = "is_present = true";
                    }
                }
            }

            dgListPerson.AutoGenerateColumns = false;
            dgListPerson.DataSource          = IsPresentView;
            labelHelp.Text = "Загружено записей: " + dgListPerson.RowCount;
        }
Пример #9
0
        private void bnCheckCon_Click(object sender, EventArgs e)
        {
            SQLDBConnect newDBcon = new SQLDBConnect();

            if (newDBcon.DBConCheckBool())
            {
                MessageBox.Show("Соединение успешно установлено", "Сообщение");
            }
            else
            {
                MessageBox.Show("Ошибка соединения с базой данных", "Сообщение");
            }
        }
Пример #10
0
        private void PrepareTables()
        {
            try
            {
                OleDbCon.Open();
                OleDbDataAdapter specAdapter    = new OleDbDataAdapter("SELECT * FROM spec ORDER BY last_name, first_name, patronymic", OleDbCon);
                OleDbDataAdapter eduAdapter     = new OleDbDataAdapter("SELECT * FROM spr_edu", OleDbCon);
                OleDbDataAdapter mstatusAdapter = new OleDbDataAdapter("SELECT * FROM spr_mstatus", OleDbCon);
                OleDbDataAdapter profAdapter    = new OleDbDataAdapter("SELECT * FROM spr_profession", OleDbCon);
                OleDbDataAdapter nationAdapter  = new OleDbDataAdapter("SELECT * FROM spr_nation", OleDbCon);

                //OleDbDataAdapter partyAdapter = new OleDbDataAdapter("SELECT * FROM spr_party_number", OleDbCon);
                SQLDBConnect     sqlCon       = new SQLDBConnect();
                String           dep          = sqlCon.GetSystemValue("Department");
                String           sqlStr       = @"SELECT * FROM spr_party_number WHERE department_id='" + dep + @"'";
                OleDbDataAdapter partyAdapter = new OleDbDataAdapter(sqlStr, OleDbCon);


                OleDbDataAdapter spr_profilactAdapter = new OleDbDataAdapter("SELECT * FROM spr_profilact_ychet", OleDbCon);
                OleDbDataAdapter enum_periodAdapter   = new OleDbDataAdapter("SELECT * FROM enum_period", OleDbCon);

                OleDbCommandBuilder specBuilder          = new OleDbCommandBuilder(specAdapter);
                OleDbCommandBuilder mstatusBuilder       = new OleDbCommandBuilder(mstatusAdapter);
                OleDbCommandBuilder profBuilder          = new OleDbCommandBuilder(profAdapter);
                OleDbCommandBuilder eduBuilder           = new OleDbCommandBuilder(eduAdapter);
                OleDbCommandBuilder nationBuilder        = new OleDbCommandBuilder(nationAdapter);
                OleDbCommandBuilder partyBuilder         = new OleDbCommandBuilder(partyAdapter);
                OleDbCommandBuilder spr_profilactBuilder = new OleDbCommandBuilder(spr_profilactAdapter);
//                OleDbCommandBuilder enum_periodBuilder = new OleDbCommandBuilder(enum_periodAdapter);

                DataSet ds = new DataSet();
                specAdapter.Fill(ds, "spec");
                eduAdapter.Fill(ds, "spr_edu");
                mstatusAdapter.Fill(ds, "spr_mstatus");
                profAdapter.Fill(ds, "spr_profession");
                nationAdapter.Fill(ds, "spr_nation");
                partyAdapter.Fill(ds, "spr_party_number");
                spr_profilactAdapter.Fill(ds, "spr_profilact_ychet");
                enum_periodAdapter.Fill(ds, "enum_period");

                BuildTableRelationship(ds);

                MainDataAdapter = specAdapter;
                MainDataSet     = ds;
                OleDbCon.Close();
            }
            catch (OleDbException odbe)
            {
                MessageBox.Show(odbe.Message, "ќшибка");
            }
        }
Пример #11
0
        public ChooseDepartmentForm()
        {
            InitializeComponent();

            sqlCon = new SQLDBConnect();

            bnBack.Enabled = false;

            dgRegion.Columns.Add(new DataGridViewTextBoxColumn());
            dgRegion.Columns[0].DataPropertyName = "id";
            dgRegion.Columns[0].Name             = "id";
            dgRegion.Columns[0].HeaderText       = "Код ОКПО";
            dgRegion.Columns[0].Width            = 100;

            dgRegion.Columns.Add(new DataGridViewTextBoxColumn());
            dgRegion.Columns[1].DataPropertyName = "name";
            dgRegion.Columns[1].HeaderText       = "Наименование региона";
            dgRegion.Columns[1].AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;

            dgRegion.AutoGenerateColumns = false;

            dgDepartment.Columns.Add(new DataGridViewTextBoxColumn());
            dgDepartment.Columns[0].DataPropertyName = "id";
            dgDepartment.Columns[0].Name             = "id";
            dgDepartment.Columns[0].HeaderText       = "Код ОКПО";
            dgDepartment.Columns[0].Width            = 100;

            dgDepartment.Columns.Add(new DataGridViewTextBoxColumn());
            dgDepartment.Columns[1].DataPropertyName = "name";
            dgDepartment.Columns[1].HeaderText       = "Наименование подразделения";
            dgDepartment.Columns[1].AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;

            dgDepartment.AutoGenerateColumns = false;

            /*
             * RegistryKey regKey = Registry.CurrentUser;
             * regKey = regKey.OpenSubKey("Software\\UFSIN\\ivrJournal");
             * String dbPath = regKey.GetValue("dbPath", @"c:\Program files\ufsin_rk\Дневник ИВР\divr.mdb").ToString();
             */

            departmentID = sqlCon.GetSystemValue("Department");

            dgRegion.DataSource = sqlCon.GetDataTable("region", "SELECT id, name FROM department WHERE higher='0'");

            this.tabControl1.Selected += new TabControlEventHandler(tabControl1_Selected);
        }
Пример #12
0
        public static int GetCurrentUserRol()
        {
            try
            {
                SQLDBConnect sqlCon  = new SQLDBConnect();
                DataRow      userRow = sqlCon.GetUser(GetCurrentUserName());

                if (userRow == null)
                {
                    return(-1);
                }

                int rolID = Convert.ToInt32(userRow["user_rol_id"]);
                return(rolID);
            }catch (Exception) {
                return(-1);
            }
        }
Пример #13
0
        private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            toolStripProgressBar.Enabled = false;
            dgListPerson.DataSource      = IsPresentView;

            SetRights();

            SQLDBConnect sqlCon = new SQLDBConnect();
            String       dep    = sqlCon.GetSystemValue("Department");
            DataTable    dt     = sqlCon.GetDataTable("spr_party_number", @"SELECT * FROM spr_party_number WHERE department_id='" + dep + @"'");

            cbParty.DataSource = dt;

            cbParty.SelectedIndex = -1;

            labelHelp.Text = "Загружено записей: " + dgListPerson.RowCount;

            ((MainForm)this.MdiParent).statusStrip.Items.Clear();
        }
Пример #14
0
        public RepListForm()
        {
            InitializeComponent();

            eurDBcon    = new SQLDBConnect();
            dtListField = eurDBcon.GetDataTable("list_field", "SELECT * FROM stuctur_base");

            DataGridViewComboBoxColumn column = new DataGridViewComboBoxColumn();

            {
                column.HeaderText       = "Поля базы";
                column.DropDownWidth    = 250;
                column.Width            = 90;
                column.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
                column.MaxDropDownItems = 10;
                column.FlatStyle        = FlatStyle.Flat;

                column.DataSource  = dtListField;
                column.ValueMember = "id";
                //column.ValueMember = "spr";
                column.DisplayMember = "field_name_rus";
                column.Name          = "fields";
            }
            dgListField.Columns.Add(column);

            /*
             *          DataGridViewCheckBoxColumn columnCheck = new DataGridViewCheckBoxColumn();
             *          {
             *              columnCheck.Name = "sort";
             *              //                columnCheck.DataPropertyName = "enabled";
             *              columnCheck.HeaderText = "Сортировать";
             *              columnCheck.Width = 100;
             *              columnCheck.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
             *          }
             *          dgListField.Columns.Add(columnCheck);
             */
            column = new DataGridViewComboBoxColumn();
            {
                column.Name             = "field_name_rus";
                column.HeaderText       = "Поля базы";
                column.DropDownWidth    = 250;
                column.Width            = 90;
                column.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
                column.MaxDropDownItems = 10;
                column.FlatStyle        = FlatStyle.Flat;

                column.DataSource = dtListField;
                //column.ValueMember = "spr";
                column.ValueMember   = "id";
                column.DisplayMember = "field_name_rus";
                column.Name          = "fields";
            }
            dgWhere.Columns.Add(column);

            dtSprCondition = eurDBcon.GetDataTable("enum_condition", "SELECT * FROM enum_condition");

            column = new DataGridViewComboBoxColumn();
            {
                column.HeaderText       = "Условие";
                column.DropDownWidth    = 150;
                column.Width            = 90;
                column.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
                column.MaxDropDownItems = 10;
                column.FlatStyle        = FlatStyle.Flat;

                column.DataSource    = dtSprCondition;
                column.ValueMember   = "id";
                column.DisplayMember = "name";
                column.Name          = "conditions";
            }
            dgWhere.Columns.Add(column);

            DataGridViewTextBoxColumn columnText = new DataGridViewTextBoxColumn();

            {
                columnText.Name         = "Value";
                columnText.HeaderText   = "Значение";
                columnText.Width        = 150;
                columnText.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
                columnText.Name         = "value";
            }
            dgWhere.Columns.Add(columnText);
        }
Пример #15
0
//        DataTable dt_buf;

        public IVRTransferForm()
        {
            InitializeComponent();

            DataGridViewTextBoxColumn textColumn = new DataGridViewTextBoxColumn();

            {
                textColumn.DataPropertyName = "id";
                textColumn.HeaderText       = "код";
                textColumn.Width            = 30;
                textColumn.MinimumWidth     = 50;
                textColumn.Visible          = false;
                textColumn.AutoSizeMode     = DataGridViewAutoSizeColumnMode.None;
            }
            dgIVRList.Columns.Add(textColumn);

            textColumn = new DataGridViewTextBoxColumn();
            {
                textColumn.DataPropertyName = "last_name";
                textColumn.HeaderText       = "Фамилия";
                textColumn.Width            = 100;
                textColumn.MinimumWidth     = 90;
                textColumn.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
            }
            dgIVRList.Columns.Add(textColumn);

            textColumn = new DataGridViewTextBoxColumn();
            {
                textColumn.DataPropertyName = "first_name";
                textColumn.HeaderText       = "Имя";
                textColumn.Width            = 100;
                textColumn.MinimumWidth     = 90;
                textColumn.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
            }
            dgIVRList.Columns.Add(textColumn);

            textColumn = new DataGridViewTextBoxColumn();
            {
                textColumn.DataPropertyName = "patronymic";
                textColumn.HeaderText       = "Отчество";
                textColumn.Width            = 100;
                textColumn.MinimumWidth     = 90;
                textColumn.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
            }
            dgIVRList.Columns.Add(textColumn);

            textColumn = new DataGridViewTextBoxColumn();
            {
                textColumn.DataPropertyName = "birthdate";
                textColumn.HeaderText       = "Дата рождения";
                textColumn.Width            = 80;
                textColumn.MinimumWidth     = 80;
                textColumn.AutoSizeMode     = DataGridViewAutoSizeColumnMode.None;
            }
            dgIVRList.Columns.Add(textColumn);

            DataGridViewCheckBoxColumn columnCheck =
                new DataGridViewCheckBoxColumn();

            {
                columnCheck.Name             = "selected";
                columnCheck.DataPropertyName = "selected";
                columnCheck.HeaderText       = "Метка";
                columnCheck.Width            = 50;
                columnCheck.AutoSizeMode     = DataGridViewAutoSizeColumnMode.None;
            }
            dgIVRList.Columns.Add(columnCheck);

            sqlCon = new SQLDBConnect();
            DataTable dt_buf = sqlCon.GetDataTable("spec", "SELECT * FROM spec WHERE is_present = true");

            if (dt_buf == null)
            {
                return;
            }

            DataColumn newColumn5 = new DataColumn();

            newColumn5.ColumnName = "selected";
            newColumn5.DataType   = System.Type.GetType("System.Boolean");
            dt_buf.Columns.Add(newColumn5);

            foreach (DataRow row in dt_buf.Rows)
            {
                row["selected"] = false;
            }

            dgIVRList.AutoGenerateColumns = false;
            dgIVRList.DataSource          = dt_buf;

            String    dep      = sqlCon.GetSystemValue("Department");
            DataTable dt_party = sqlCon.GetDataTable("spr_party_number", @"SELECT * FROM spr_party_number WHERE department_id='" + dep + @"'");

            cbParty.DataSource    = dt_party;
            cbParty.ValueMember   = "id";
            cbParty.DisplayMember = "name";
            cbParty.SelectedIndex = -1;
        }
Пример #16
0
        public RepDIVRForm(DataRow selRow)
        {
            this.selRow = selRow;
            idSpec      = (int)selRow["id"];

            InitializeComponent();
            dbConSQL = new SQLDBConnectLite();

            try
            {
                rvDIVR.LocalReport.ReportPath = @"ReportIVR.rdlc";
                if (selRow["foto"] != null)
                {
                    rvDIVR.LocalReport.DataSources.Add(new ReportDataSource("DataSetDIVR_DataTableLogo", GetTableLogo(selRow["foto"].ToString())));
                }
                else
                {
                    rvDIVR.LocalReport.DataSources.Add(new ReportDataSource("DataSetDIVR_DataTableLogo", GetTableLogo("")));
                }

                rvDIVR.LocalReport.DataSources.Add(new ReportDataSource("DataSetDIVR_DataTableParty", dbConSQL.GetDataTable("party", "SELECT p.arr_date AS arr_date, p.ord AS ord, p.reason AS reason, spr_party_number.name AS party_number FROM party AS p LEFT JOIN spr_party_number ON spr_party_number.id=p.party_number_id WHERE (p.id_spec=" + idSpec + ")")));

                rvDIVR.LocalReport.DataSources.Add(new ReportDataSource("DataSetDIVR_DataTableRelations", dbConSQL.GetDataTable("relations", "SELECT r.last_name AS last_name, r.first_name AS first_name, r.patronymic AS patronymic, r.address AS address, r.birthdate AS birthdate, spr_degree.name AS degree FROM relations AS r LEFT JOIN spr_degree ON spr_degree.id=r.degree_id WHERE (r.id_spec=" + idSpec + ")")));

                rvDIVR.LocalReport.DataSources.Add(new ReportDataSource("DataSetDIVR_DataTablePsycho_char", dbConSQL.GetDataTable("psycho_char", "SELECT date_meet, orientation, psycho_char, behavior FROM psycho_char WHERE (id_spec=" + idSpec + ")")));

                rvDIVR.LocalReport.DataSources.Add(new ReportDataSource("DataSetDIVR_DataTablePrev_conv", dbConSQL.GetDataTable("prev_conv", "SELECT start_date, period, text_prev, article, release_date FROM prev_conv WHERE (id_spec=" + idSpec + ")")));

                rvDIVR.LocalReport.DataSources.Add(new ReportDataSource("DataSetDIVR_DataTableIvr1", dbConSQL.GetDataTable("ivr1", "SELECT data_ivr, content, description FROM ivr WHERE ((id_spec=" + idSpec + ") AND (id_type_ivr = 1))")));
                rvDIVR.LocalReport.DataSources.Add(new ReportDataSource("DataSetDIVR_DataTableIvr2", dbConSQL.GetDataTable("ivr2", "SELECT ivr.data_ivr AS data_ivr, ivr.content AS content, ivr.description AS description, employee.last_name +  ' ' + employee.first_name + ' ' + employee.patronymic + ', ' + employee.rank + ', ' + employee.post as employee FROM ivr LEFT JOIN employee ON (ivr.employee_id = employee.id)  WHERE ((id_spec=" + idSpec + ") AND (id_type_ivr = 2))")));
                rvDIVR.LocalReport.DataSources.Add(new ReportDataSource("DataSetDIVR_DataTableIvr3", dbConSQL.GetDataTable("ivr3", "SELECT ivr.data_ivr AS data_ivr, ivr.content AS content, ivr.description AS description, employee.last_name + ' ' + employee.first_name + ' ' + employee.patronymic + ', ' + employee.rank + ', ' + employee.post as employee FROM ivr LEFT JOIN employee ON (ivr.employee_id = employee.id) WHERE ((id_spec=" + idSpec + ") AND (id_type_ivr = 3))")));
                rvDIVR.LocalReport.DataSources.Add(new ReportDataSource("DataSetDIVR_DataTableResolution", dbConSQL.GetDataTable("resolution", "SELECT date_resolution, resolution, description FROM resolution WHERE (id_spec=" + idSpec + ")")));

                rvDIVR.LocalReport.DataSources.Add(new ReportDataSource("DataSetDIVR_DataTableBonus", dbConSQL.GetDataTable("bonus", "SELECT bonus.date_bonus AS date_bonus, bonus.bonus_reason AS bonus_reason, spr_bonus_type.name AS bonus_type, spr_performers.name AS performers, bonus.order_date AS order_date, bonus.order_number AS order_number FROM spr_performers RIGHT JOIN (spr_bonus_type RIGHT JOIN bonus ON spr_bonus_type.id=bonus.bonus_type_id) ON spr_performers.id=bonus.performer_id WHERE (bonus.id_spec=" + idSpec + ")")));

                rvDIVR.LocalReport.DataSources.Add(new ReportDataSource("DataSetDIVR_DataTablePenalty1", dbConSQL.GetDataTable("penalty1", "SELECT penalty.date_penalty AS date_penalty, penalty.reason AS reason, spr_penalty_type.name AS penalty_type, penalty.order_date AS order_date, penalty.order_number AS order_number, penalty.removal AS removal, spr_performers.name AS performers FROM spr_performers RIGHT JOIN (spr_penalty_type RIGHT JOIN penalty ON spr_penalty_type.id=penalty.penalty_type_id) ON spr_performers.id=penalty.performer_id WHERE ((penalty.id_spec=" + idSpec + ") AND (oral=true))")));
                rvDIVR.LocalReport.DataSources.Add(new ReportDataSource("DataSetDIVR_DataTablePenalty2", dbConSQL.GetDataTable("penalty2", "SELECT penalty.date_penalty AS date_penalty, penalty.reason AS reason, spr_penalty_type.name AS penalty_type, penalty.order_date AS order_date, penalty.order_number AS order_number, penalty.removal AS removal, spr_performers.name AS performers FROM spr_performers RIGHT JOIN (spr_penalty_type RIGHT JOIN penalty ON spr_penalty_type.id=penalty.penalty_type_id) ON spr_performers.id=penalty.performer_id WHERE ((penalty.id_spec=" + idSpec + ") AND (oral=false))")));

                DateTimeFormatInfo fmt = (new CultureInfo("ru-RU")).DateTimeFormat;

                ReportParameter p1  = new ReportParameter("last_name", selRow["last_name"].ToString());
                ReportParameter p2  = new ReportParameter("first_name", selRow["first_name"].ToString());
                ReportParameter p3  = new ReportParameter("patronymic", selRow["patronymic"].ToString());
                ReportParameter p4  = new ReportParameter("birthdate", getValidDate(selRow["birthdate"]));
                ReportParameter p5  = new ReportParameter("court", selRow["court"].ToString() + " " + getValidDate(selRow["crime_date"]));
                ReportParameter p6  = new ReportParameter("article", selRow["article"].ToString());
                ReportParameter p7  = new ReportParameter("period", selRow["period"].ToString());
                ReportParameter p8  = new ReportParameter("period_start", getValidDate(selRow["period_start"]));
                ReportParameter p9  = new ReportParameter("period_end", getValidDate(selRow["period_end"]));
                ReportParameter p10 = new ReportParameter("period_light", getValidDate(selRow["period_light"]));
                ReportParameter p11 = new ReportParameter("period_normal", getValidDate(selRow["period_normal"]));
                ReportParameter p12 = new ReportParameter("period_kp", getValidDate(selRow["period_kp"]));
                ReportParameter p13 = new ReportParameter("period_udo", getValidDate(selRow["period_udo"]));

                SQLDBConnect sqlCon = new SQLDBConnect();

                String          nameName = sqlCon.GetValue("name", "SELECT * FROM spr_nation WHERE id = " + selRow["nation_id"].ToString());;
                ReportParameter p14      = new ReportParameter("nation", nameName);

                nameName = sqlCon.GetValue("name", "SELECT * FROM spr_mstatus WHERE id = " + selRow["mstatus_id"].ToString());
                ReportParameter p15 = new ReportParameter("mstatus", nameName);

                nameName = sqlCon.GetValue("name", "SELECT * FROM spr_edu WHERE id = " + selRow["edu_id"].ToString());
                ReportParameter p16 = new ReportParameter("edu", nameName);

                nameName = sqlCon.GetValue("name", "SELECT * FROM spr_profession WHERE id = " + selRow["profession_id"].ToString());
                ReportParameter p17 = new ReportParameter("profession", nameName);

                ReportParameter p18 = new ReportParameter("crime_description", (string)selRow["crime_description"].ToString());
                ReportParameter p19 = new ReportParameter("med_description", (string)selRow["med_description"].ToString());
                ReportParameter p20 = new ReportParameter("other", (string)selRow["other"].ToString());
                ReportParameter p21 = new ReportParameter("result", (string)selRow["result"].ToString());

                this.rvDIVR.LocalReport.SetParameters(new ReportParameter[] { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21 });
                this.rvDIVR.ProcessingMode = ProcessingMode.Local;
                this.rvDIVR.RefreshReport();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "ќшибка при построении отчета");
                Close();
            }
        }
Пример #17
0
        private void dgEmployee_UserAddedRow(object sender, DataGridViewRowEventArgs e)
        {
            SQLDBConnect sqlCon = new SQLDBConnect();

            dgEmployee.CurrentRow.Cells[1].Value = sqlCon.GetSystemValue("Department");
        }
Пример #18
0
 public UpdateUnit()
 {
     conSql = new SQLDBConnect();
 }