Пример #1
0
        /// <summary>
        /// This method is checking if the new key field value is unique
        /// </summary>
        /// <param name="tc"></param>
        /// <param name="caseNo"></param>
        /// <returns></returns>
        private bool KeyIsUnique(TableCore tc, string caseNo)
        {
            //make a flag value
            bool unique = true;

            //Get table name
            string tableName = tc.DbTable;

            //Get the key field name
            string keyField = tc.keyField;

            //Query to retrieve a retrieve a record with case name if it is not unique
            string query = "SELECT * FROM " + tableName + " WHERE " + keyField + " = '" + caseNo + "'";

            //process query
            MySqlDataReader reader = db.Reader(query);

            //If there is a value
            while (reader.Read())
            {
                //If there is a line in the reader => name is not unique
                unique = false;
            }

            //close connection
            db.CloseConnection();

            return(unique);
        }
Пример #2
0
 public DateConverterForm(TableCore parentForm)
 {
     InitializeComponent();
     tc = parentForm;
     //Set an empty date by Default:
     newDateTimePicker.CustomFormat = " ";
     newDateTimePicker.Format       = DateTimePickerFormat.Custom;
 }
Пример #3
0
        public TeamMembersDropBox(TableCore parentForm, string SelectedTeam)
        {
            InitializeComponent();
            tc = parentForm;

            //Populate comboBox
            generateTeamOptions(attorneyComboBox, query, keyV, valueV);

            SetDeafultComboBoxChoise(SelectedTeam);
        }
Пример #4
0
        /// <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, user);

                mf.Text = tc.TableName;

                mf.ShowDialog();
            }
        }
Пример #5
0
        /// <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 = user.TableGroups.Split('_').OfType <string>().ToList();

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

                return(false);
            }

            return(true);
        }
Пример #6
0
        bool admin = true;                            //This is a flag, indicating if user can do any changes

        #endregion

        #region Constructor

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="tableCore"> Type of the table object that was passed through the button</param>
        /// <param name="person">Instance of the current User</param>
        public MatrixForm(TableCore tableCore, Person person)
        {
            InitializeComponent();

            //invoke table object
            tc = tableCore;

            //Changethe name of table holder


            //This method will determine what user can do with the table
            CheckUserPemition(person);

            //Show tabel name
            TabelNameLabel.Text = tc.TableName;

            //Load the table
            LoadTable();

            //Cleare a query holder
            updateQueryes = new List <string>();
        }