Beispiel #1
0
        //передаём объект серриализации и путь
        public async void Serializ(object obj, string FilePath)
        {
            NotificationForm         notificationForm         = new NotificationForm( );
            GetQuantityDirectoryFile getquantityDirectoryFile = new GetQuantityDirectoryFile();
            BinaryFormatter          serializer = new BinaryFormatter( );

            try
            {
                if (File.Exists(FilePath))
                {
                    using (FileStream SaveFileStream = new FileStream(FilePath + $"_{getquantityDirectoryFile.GetQuantityDataFile()-1}", FileMode.OpenOrCreate))
                    {
                        serializer.Serialize(SaveFileStream, obj);

                        SaveFileStream.Close( );
                    }
                }
                else
                {
                    notificationForm.ShowTextNotification("Ошибка доступа к дирректории или файлу!", "", Color.Red, Color.Red);
                }
            }
            catch (Exception e)
            {
                notificationForm.ShowTextNotification("Ошибка серриализации!", e.ToString(), Color.Red, Color.Red);
                StatusSerializ = false;
            }
        }
Beispiel #2
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            LogicGetAccount logicGetAccount = new LogicGetAccount( );

            if (getQuantityDirectoryFile.GetQuantityDataFile() > 1)
            {
                logicGetAccount.MethodGetAllData( );
            }
            else
            {
                logicGetAccount.MethodGetNoData();
            }
        }
Beispiel #3
0
        public void AddAccout(AccountAddForm addAccountForm)
        {
            AccountForm <int> bankAccountForm  = new AccountForm <int>();
            NotificationForm  notificationForm = new NotificationForm( );

            try
            {
                bankAccountForm.Login               = addAccountForm.textBox_login.Text;
                bankAccountForm.Password            = addAccountForm.textBox_password.Text;
                bankAccountForm.RoleUserSystemAdmin = byte.Parse(addAccountForm.comboBox_roleSystem.SelectedIndex.ToString( ));
                bankAccountForm.RoleUser            = byte.Parse(addAccountForm.comboBox_roleUser.SelectedIndex.ToString( ));
                bankAccountForm.IdPerson            = getQuantityDirectoryFile.GetQuantityDataFile() - 1;
                bankAccountForm.Name1               = addAccountForm.textBox_name1.Text;
                bankAccountForm.Name2               = addAccountForm.textBox_name2.Text;
                bankAccountForm.Name3               = addAccountForm.textBox_name3.Text;
                //bankAccountForm.AdressCountry = addAccountForm.textBox_AdressCountry.Text;
                //bankAccountForm.AdressRegion = addAccountForm.textBox_AdressRegion.Text;
                //bankAccountForm.AdressPostcode = addAccountForm.textBox_AdressPostcode.Text;
                //bankAccountForm.AdressCity = addAccountForm.textBox_AdressCity.Text;
                //bankAccountForm.AdressStreet = addAccountForm.textBox_AdressStreet.Text;
                //bankAccountForm.AdressNumberHome = addAccountForm.textBox_AdressNumberHome.Text;
                //bankAccountForm.AdressNumberApartment = addAccountForm.textBox_AdressNumberApartment.Text;
                bankAccountForm.Email        = addAccountForm.textBox_Email.Text;
                bankAccountForm.PhoneNumber1 = addAccountForm.textBox_PhoneNumber1.Text;
                // bankAccountForm.Group = byte.Parse(addAccountForm.comboBox_Group.SelectedIndex.ToString());
                //bankAccountForm.Status = byte.Parse(addAccountForm.comboBox_Status.SelectedIndex.ToString());

                serializerClass.Serializ(bankAccountForm, constantClassData.FileNameBinary);

                notificationForm.ShowTextNotification("Успешное добавление данных!", "ОК!", Color.Green, Color.Green);
                notificationForm.Show( );
            }
            catch (Exception e)
            {
                notificationForm.ShowTextNotification("Произошла ошибка при добавлении данных!", e.ToString( ), Color.Red, Color.Green);
                notificationForm.Show( );
            }
        }
Beispiel #4
0
 public LogicGetAccount( )
 {
     data = new AccountForm <int> [getQuantityDirectoryFile.GetQuantityDataFile( ) - 1];
 }
Beispiel #5
0
 public MainProgram( )
 {
     data = new AccountForm <int> [getQuantityDirectoryFile.GetQuantityDataFile()];
 }