示例#1
0
        public LetterTypeForm(TableCore parentMatrix, string oldValue)
        {
            InitializeComponent();
            tc = parentMatrix;

            //Show User what was the old value
            letterTypeComboBox.SelectedIndex = letterTypeComboBox.FindString(oldValue);

            //Save old value, in case user will close form without changes
            UsersChoice = UsersChoice = letterTypeComboBox.SelectedItem.ToString();
        }
        /// <summary>
        /// This method opens up a form view with requested Table
        /// </summary>
        /// <param name="query"></param>
        private void OpenForm(TableCore tc)
        {
            if (PersonCanOpen(tc))
            {
                //Creating instance of the new page and sending corespondent query
                MatrixForm mf = new MatrixForm(tc, person);

                mf.Text = tc.TableName;

                mf.ShowDialog();
            }
        }
        /// <summary>
        /// This method will determine if this person can modefy this form
        /// </summary>
        /// <param name="tc"></param>
        /// <returns></returns>
        private bool PersonCanOpen(TableCore tc)
        {
            //Get the tag of the table
            var tableTag = tc.TableGroupNumber;

            //retrieve persons group list
            List <string> groups = person.TableGroups.Split('_').OfType <string>().ToList();

            if (groups.IndexOf(tableTag) == -1)
            {
                System.Windows.MessageBox.Show("Sorry, the access is denyed!");

                return(false);
            }

            return(true);
        }
        public static void GenerateTableCore(this Table table, IEnumerable <TableRowCore> rows, bool hasIndexCell = false)
        {
            var coreTable = TableCore.GenerateTable(rows, hasIndexCell);

            table.Rows.AddRange(coreTable.Rows.Cast <TableRow>().ToArray());
        }