Ejemplo n.º 1
0
 protected void MyClosedHandlerRecords(object sender, EventArgs e)
 {
     if (newRec.isCorrect)
     {
         carShop.AddProduct(newRec.name, newRec.manufacturer, newRec.price, newRec.amount, newRec.shopNumber, newRec.minimumLot);
         carShop.WriteIn(dataGridView1);
     }
 }
Ejemplo n.º 2
0
 protected void MyClosedHandlerDeleteEl(object sender, EventArgs e)
 {
     if (!deleateEl.isCancel)
     {
         carShop = carShop.DeleateElementIndex(deleateEl.domainValue, deleateEl.value);
         carShop.WriteIn(dataGridView1);
     }
 }
Ejemplo n.º 3
0
        private void создатьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            string path = openFileDialog1.FileName;

            MessageBox.Show(path);
            saveToPath = path;
            carShop    = new CarShop(1);
            using (BinaryReader reader = new BinaryReader(File.Open(path, FileMode.Open)))//Считывание
            {
                isPass = reader.ReadBoolean();
                if (isPass)
                {
                    password = reader.ReadString();
                }
                while (reader.PeekChar() > -1)
                {
                    string name         = reader.ReadString();
                    string manufacturer = reader.ReadString();
                    int    price        = reader.ReadInt32();
                    int    amount       = reader.ReadInt32();
                    int    shopNumber   = reader.ReadInt32();
                    int    minimumLot   = reader.ReadInt32();

                    carShop.AddProduct(name, manufacturer, price, amount, shopNumber, minimumLot);
                }
            }
            if (isPass)
            {
                запаролитьToolStripMenuItem.Text = "Изменить пароль";
            }
            else
            {
                запаролитьToolStripMenuItem.Text = "Запаролить";
            }

            AddRecord.Enabled                              = true;
            dataGridView1.Enabled                          = true;
            groupBox1.Enabled                              = true;
            поискToolStripMenuItem.Enabled                 = true;
            сохранитьToolStripMenuItem.Enabled             = true;
            запаролитьToolStripMenuItem.Enabled            = true;
            редактированиеЗаписейToolStripMenuItem.Enabled = true;
            выводToolStripMenuItem.Enabled                 = true;

            carShop.WriteIn(dataGridView1);
        }
Ejemplo n.º 4
0
        private void файлНа20ЗаписейToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string path = @"C:\Users\rasia\source\repos\CursachV2\Cars";

            saveToPath = path;
            carShop    = new CarShop(1);
            using (BinaryReader reader = new BinaryReader(File.Open(path, FileMode.Open)))//Считывание
            {
                isPass = reader.ReadBoolean();
                if (isPass)
                {
                    password = reader.ReadString();
                }
                while (reader.PeekChar() > -1)
                {
                    string name         = reader.ReadString();
                    string manufacturer = reader.ReadString();
                    int    price        = reader.ReadInt32();
                    int    amount       = reader.ReadInt32();
                    int    shopNumber   = reader.ReadInt32();
                    int    minimumLot   = reader.ReadInt32();

                    carShop.AddProduct(name, manufacturer, price, amount, shopNumber, minimumLot);
                }
            }

            AddRecord.Enabled                              = true;
            dataGridView1.Enabled                          = true;
            groupBox1.Enabled                              = true;
            поискToolStripMenuItem.Enabled                 = true;
            сохранитьToolStripMenuItem.Enabled             = true;
            запаролитьToolStripMenuItem.Enabled            = true;
            редактированиеЗаписейToolStripMenuItem.Enabled = true;
            выводToolStripMenuItem.Enabled                 = true;

            carShop.WriteIn(dataGridView1);
        }