Пример #1
0
 public UsersForm()
 {
     InitializeComponent();
     newDBcon = new SprDbConnect("users", "spr_user_rol");
     LoadGrid(dgUsers);
     dgUsers.DataSource = newDBcon.GetDataTable("users");
 }
Пример #2
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;
        }
Пример #3
0
        public SprControls()
        {
            fcm = new FormControlManager();
            InitializeComponent();
            newDBcon = new SprDbConnect("spr_user_controls");
            dgControls.DataSource                  = newDBcon.GetDataTable("spr_user_controls");
            dgControls.Columns[0].HeaderText       = "Код";
            dgControls.Columns[0].Width            = 50;
            dgControls.Columns[0].DataPropertyName = "id";
            dgControls.Columns[0].Visible          = false;
            dgControls.Columns[1].HeaderText       = "Наименование формы";
            dgControls.Columns[1].Width            = 100;
            dgControls.Columns[1].DataPropertyName = "name_form";
            dgControls.Columns[1].Visible          = false;

            dgControls.Columns[2].HeaderText       = "Наименование системное";
            dgControls.Columns[2].Width            = 180;
            dgControls.Columns[2].DataPropertyName = "name";
            dgControls.Columns[2].Visible          = false;

            dgControls.Columns[3].HeaderText       = "Наименование элемента";
            dgControls.Columns[3].Width            = 150;
            dgControls.Columns[3].DataPropertyName = "name_rus";

            dgControls.Columns[4].HeaderText       = "Описание";
            dgControls.Columns[4].Width            = 150;
            dgControls.Columns[4].AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
            dgControls.Columns[4].DataPropertyName = "opisanie";
        }
Пример #4
0
 private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e)
 {
     //this.Cursor = Cursors.WaitCursor;
     DelNotMarkedRec(akusDbCon.GetDataTable("spec"));
     mainDbCon = new SprDbConnect("spec", "spr_edu", "spr_profession", "spr_nation", "spr_mstatus",
                                  "spr_degree", "relations",
                                  "spr_bonus_type", "bonus",
                                  "spr_penalty_type", "spr_performers", "penalty");
 }
Пример #5
0
        //Удалить уже существующие записи
        private int DelExistRec(DataTable dtakus_spec)
        {
            DataTable dt_buf = dtakus_spec.Copy();

            SprDbConnect newDbCon   = new SprDbConnect("spec");
            DataTable    dtivr_spec = newDbCon.GetDataTable("spec");

            int count = CompareTables(dt_buf, dtivr_spec, "last_name", "first_name", "patronymic", "birthdate");

            dtMarkedNotExist = dt_buf;

            return(count);
        }
Пример #6
0
        //private string departmentID;

        public EmployeeForm()
        {
            InitializeComponent();
            newDBcon = new SprDbConnect("employee");
            LoadGrid(dgEmployee);
            dgEmployee.AutoGenerateColumns = false;

            dgEmployee.DataSource = newDBcon.GetDataTable("employee");

            RegistryKey regKey = Registry.CurrentUser;

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

            //this.departmentID = ((MainForm)this.MdiParent).departmentID;
        }
Пример #7
0
        private void AddSpecId(DataTable dtBuf)
        {
            SprDbConnect newDbCon   = new SprDbConnect("spec");
            DataTable    dtivr_spec = newDbCon.GetDataTable("spec");

            foreach (DataRow relRow in dtBuf.Rows)
            {
                foreach (DataRow specRow in dtivr_spec.Rows)
                {
                    if (specRow["id_ptk_akus"].ToString().Trim() == relRow["id_ptk_akus"].ToString().Trim())
                    {
                        relRow["id_spec"] = Convert.ToInt32(specRow["id"]);
                        break;
                    }
                }
            }
        }
Пример #8
0
        public int mapDataMstatus(DataTable dtSrc, DataTable dtDst, SprDbConnect mainDbCon)
        {
            String[] mstatus = { "-", "состоит в браке", "НЕ состоит в браке", "разведен(а)", "вдовец/вдова" };
            Boolean  isfound;
            DataRow  newRow;
            int      newRowCounter = 0;

            for (int i = 0; i < 5; i++)
            {
                isfound = false;
                foreach (DataRow rowivr in dtDst.Rows)
                {
                    if (rowivr["name"].ToString().Trim().ToUpper() == mstatus[i].Trim().ToUpper())
                    {
                        isfound = true;
                        break;
                    }
                }

                if (!isfound)
                {
                    newRow         = dtDst.NewRow();
                    newRow["name"] = mstatus[i];
                    dtDst.Rows.Add(newRow);
                    newRowCounter++;
                }
            }

            mainDbCon.UpdateDataTable("spr_mstatus");

            foreach (DataRow rowakus in dtSrc.Rows)
            {
                foreach (DataRow rowivr in dtDst.Rows)
                {
                    if (mstatus[Convert.ToInt32(rowakus["mstatus"])].Trim() == rowivr["name"].ToString().Trim())
                    {
                        rowakus["mstatus_id"] = rowivr["id"];
                    }
                }
            }

            return(newRowCounter);
        }
Пример #9
0
/*
 *      protected override CreateParams CreateParams
 *      {
 *          get
 *          {
 *              CreateParams myCp = base.CreateParams;
 *              myCp.ClassStyle = myCp.ClassStyle | CP_NOCLOSE_BUTTON ;
 *                 return myCp;
 *          }
 *      }
 */
        public SprForm(String nameSpr, String TextSpr)
        {
            InitializeComponent();

            //this.departmentID = ((MainForm)this.MdiParent).departmentID;
            this.nameSpr = nameSpr;
            newDBcon     = new SprDbConnect(nameSpr);
            this.Text    = TextSpr;

            dgSpr.Columns.Add(new DataGridViewTextBoxColumn());
            dgSpr.Columns[0].HeaderText       = "Код";
            dgSpr.Columns[0].Visible          = false;
            dgSpr.Columns[0].DataPropertyName = "id";
            dgSpr.Columns.Add(new DataGridViewTextBoxColumn());
            dgSpr.Columns[1].HeaderText       = "Наименование";
            dgSpr.Columns[1].DataPropertyName = "name";

            if (nameSpr == "spr_party_number")
            {
                SprDbConnect sprDBcon = new SprDbConnect("department");

                DataGridViewComboBoxColumn column = new DataGridViewComboBoxColumn();
                {
                    column.DataPropertyName = "department_id";
                    column.HeaderText       = "Учреждение";
                    column.DropDownWidth    = 100;
                    column.Width            = 90;
                    column.AutoSizeMode     = DataGridViewAutoSizeColumnMode.None;
                    column.MaxDropDownItems = 10;
                    column.FlatStyle        = FlatStyle.Flat;

                    column.DataSource    = sprDBcon.GetDataTable("department");
                    column.ValueMember   = "id";
                    column.DisplayMember = "name";
                    column.ReadOnly      = true;
                }
                dgSpr.Columns.Add(column);
            }

            dgSpr.DataSource          = newDBcon.GetDataTable(nameSpr);
            dgSpr.AutoGenerateColumns = false;
        }
Пример #10
0
        private void dgWhere_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            if (dgWhere.Columns[dgWhere.CurrentCell.ColumnIndex].Name != "fields")
            {
                return;
            }

            if (dgWhere.Rows[e.RowIndex].Cells["fields"].Value == null)
            {
                return;
            }
            String id      = dgWhere.Rows[e.RowIndex].Cells["fields"].Value.ToString();
            String sprName = null;

            foreach (DataRow row in dtListField.Select("id = '" + id + "'"))
            {
                sprName = row["spr"].ToString();
            }
            //MessageBox.Show(sprName);

            if (sprName == String.Empty)
            {
                DataGridViewTextBoxCell tbcell = new DataGridViewTextBoxCell();
                dgWhere.Rows[e.RowIndex].Cells["value"] = tbcell;
                dgWhere.Rows[e.RowIndex].Cells["conditions"].ReadOnly = false;
                return;
            }

            SprDbConnect             sprCon = new SprDbConnect(sprName);
            DataGridViewComboBoxCell cell   = new DataGridViewComboBoxCell();

            cell.DataSource       = sprCon.GetDataTable(sprName);
            cell.ValueMember      = "id";
            cell.DisplayMember    = "name";
            cell.DropDownWidth    = 100;
            cell.MaxDropDownItems = 7;
            dgWhere.Rows[e.RowIndex].Cells["value"]               = cell;
            dgWhere.Rows[e.RowIndex].Cells["conditions"].Value    = 1;
            dgWhere.Rows[e.RowIndex].Cells["conditions"].ReadOnly = true;
        }
Пример #11
0
        public SprProfilactForm()
        {
            InitializeComponent();

            newDBcon = new SprDbConnect("spr_profilact_ychet", "enum_period");

            dgListProfilact.Columns.Add(new DataGridViewTextBoxColumn());
            dgListProfilact.Columns[0].DataPropertyName = "id";
            dgListProfilact.Columns[0].HeaderText       = "код";
            dgListProfilact.Columns[0].Visible          = false;
            dgListProfilact.Columns.Add(new DataGridViewTextBoxColumn());
            dgListProfilact.Columns[1].DataPropertyName = "name";
            dgListProfilact.Columns[1].HeaderText       = "Наименование";
            dgListProfilact.Columns[1].Width            = 150;
            dgListProfilact.Columns[1].MinimumWidth     = 150;
            dgListProfilact.Columns[1].AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;

            DataGridViewCheckBoxColumn columnCheck =
                new DataGridViewCheckBoxColumn();

            {
                columnCheck.DataPropertyName = "pasport";
                columnCheck.HeaderText       = "Паспорт";
                columnCheck.Width            = 50;
                columnCheck.AutoSizeMode     = DataGridViewAutoSizeColumnMode.None;
            }
            dgListProfilact.Columns.Add(columnCheck);

            columnCheck =
                new DataGridViewCheckBoxColumn();
            {
                columnCheck.DataPropertyName = "plan";
                columnCheck.HeaderText       = "План";
                columnCheck.Width            = 50;
                columnCheck.AutoSizeMode     = DataGridViewAutoSizeColumnMode.None;
            }
            dgListProfilact.Columns.Add(columnCheck);

            DataGridViewComboBoxColumn column =
                new DataGridViewComboBoxColumn();

            {
                column.DataPropertyName  = "psiho_korrec_id";
                column.HeaderText        = "Периодичность коррекции";
                column.DropDownWidth     = 100;
                column.Width             = 90;
                columnCheck.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
                column.MaxDropDownItems  = 3;
                column.FlatStyle         = FlatStyle.Flat;

                column.DataSource    = newDBcon.GetDataTable("enum_period");
                column.ValueMember   = "id";
                column.DisplayMember = "name";
            }
            dgListProfilact.Columns.Add(column);

            column =
                new DataGridViewComboBoxColumn();
            {
                column.DataPropertyName  = "psiho_obsled_id";
                column.HeaderText        = "Периодичность обследования";
                column.DropDownWidth     = 100;
                column.Width             = 90;
                columnCheck.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
                column.MaxDropDownItems  = 3;
                column.FlatStyle         = FlatStyle.Flat;

                column.DataSource    = newDBcon.GetDataTable("enum_period");
                column.ValueMember   = "id";
                column.DisplayMember = "name";
            }
            dgListProfilact.Columns.Add(column);

            dgListProfilact.DataSource = newDBcon.GetDataTable("spr_profilact_ychet");
        }
Пример #12
0
        private void LoadGrid(DataGridView dg)
        {
            DataGridViewTextBoxColumn textColumn = new DataGridViewTextBoxColumn();

            {
                textColumn.DataPropertyName = "id";
                textColumn.Visible          = false;
            }
            dg.Columns.Add(textColumn);

            SprDbConnect sprDBcon = new SprDbConnect("department");

            DataGridViewComboBoxColumn column = new DataGridViewComboBoxColumn();

            {
                column.DataPropertyName = "department_id";
                column.HeaderText       = "Учреждение";
                column.DropDownWidth    = 100;
                column.Width            = 90;
                column.AutoSizeMode     = DataGridViewAutoSizeColumnMode.None;
                column.MaxDropDownItems = 10;
                column.FlatStyle        = FlatStyle.Flat;

                column.DataSource    = sprDBcon.GetDataTable("department");
                column.ValueMember   = "id";
                column.DisplayMember = "name";
                column.ReadOnly      = true;
            }
            dg.Columns.Add(column);

//            textColumn = new DataGridViewTextBoxColumn();
//            {
//                textColumn.DataPropertyName = "department_id";
//                textColumn.Visible = false;
//            }
//            dg.Columns.Add(textColumn);

            textColumn = new DataGridViewTextBoxColumn();
            {
                textColumn.DataPropertyName = "last_name";
                textColumn.HeaderText       = "Фамилия";
                textColumn.Width            = 80;
                textColumn.MinimumWidth     = 70;
                textColumn.AutoSizeMode     = DataGridViewAutoSizeColumnMode.None;
            }
            dg.Columns.Add(textColumn);

            textColumn = new DataGridViewTextBoxColumn();
            {
                textColumn.DataPropertyName = "first_name";
                textColumn.HeaderText       = "Имя";
                textColumn.Width            = 80;
                textColumn.MinimumWidth     = 70;
                textColumn.AutoSizeMode     = DataGridViewAutoSizeColumnMode.None;
            }
            dg.Columns.Add(textColumn);

            textColumn = new DataGridViewTextBoxColumn();
            {
                textColumn.DataPropertyName = "patronymic";
                textColumn.HeaderText       = "Отчество";
                textColumn.Width            = 80;
                textColumn.MinimumWidth     = 70;
                textColumn.AutoSizeMode     = DataGridViewAutoSizeColumnMode.None;
            }
            dg.Columns.Add(textColumn);

            textColumn = new DataGridViewTextBoxColumn();
            {
                textColumn.DataPropertyName = "rank";
                textColumn.HeaderText       = "Звание";
                textColumn.Width            = 80;
                textColumn.MinimumWidth     = 70;
                textColumn.AutoSizeMode     = DataGridViewAutoSizeColumnMode.None;
            }
            dg.Columns.Add(textColumn);

            textColumn = new DataGridViewTextBoxColumn();
            {
                textColumn.DataPropertyName = "post";
                textColumn.HeaderText       = "Должность";
                textColumn.Width            = 80;
                textColumn.MinimumWidth     = 70;
                textColumn.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
            }
            dg.Columns.Add(textColumn);
        }