Example #1
0
        public static int buidInGetKey(CarRecord record)
        {
            int i = int.Parse(record.Number.region);
            int s = 0;

            foreach (char ch in record.Number.letters)
            {
                s += ((int)ch);
            }
            int k = int.Parse(record.Number.num);

            return(i * k % s);
        }
Example #2
0
        private void btnDone_Click(object sender, EventArgs e)
        {
            if (!checkMtb() || (tbName.Text.Trim() == "") ||
                (tbSurname.Text.Trim() == "") || (tbPatronymic.Text.Trim() == ""))
            {
                MessageBox.Show("Fill the gaps", "Status", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            int       selectedBrand = cbCarBrand.SelectedIndex + 1;
            CarBrand  brand         = CarBrandClass.CarBrandDict[selectedBrand];
            Person    person        = new Person(tbName.Text.Trim(), tbSurname.Text.Trim(), tbPatronymic.Text.Trim());
            CarNumber number        = new CarNumber(mtbCarNumber.Text);

            this.record       = new CarRecord(brand, person, number);
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Example #3
0
        public bool Add(CarRecord record)
        {
            int key   = GetKey(record);
            int index = IndexOf(key);

            if (Count == N || index != -1)
            {
                return(false);
            }
            index = HashFunction(key);
            while (Table[index].state == CellState.full)
            {
                index = NextCell(index, 1);
            }

            Table[index].record = record;
            Table[index].state  = CellState.full;
            Count++;
            return(true);
        }
Example #4
0
 public FormRecordMake(CarRecord record = null)
 {
     InitializeComponent();
     this.record = record;
     InitFields();
 }