Exemple #1
0
        private void AddAccountButton_Click(object sender, EventArgs e)
        {
            AccountForm af = new AccountForm(AccountForm.Mode.Add, LoggedUser, UpdateAccountsDisplay, DisabledControls);

            af.Show();
            FormUtilities.DisableControls(DisabledControls.ToArray());
        }
        private void AccountButton_Click(object sender, EventArgs e)
        {
            Hide();
            Form accountForm = new AccountForm(this);

            accountForm.Show();
        }
Exemple #3
0
        private bool LoadData()
        {
            bool res;

            try
            {
                AccountForm.CheckPointsTable(cn, null);
                AccountForm.OrderPoints(cn, null);
                // TODO: This line of code loads data into the 'dsClimbing.Points' table. You can move, or remove it, as needed.
                this.pointsTableAdapter.Fill(this.dsClimbing.Points);
                SqlCommand cmd  = new SqlCommand("SELECT pts FROM Points WHERE pos = 0", cn);
                object     oTmp = cmd.ExecuteScalar();
                if (oTmp == null || oTmp == DBNull.Value)
                {
                    tbLastPoints.Text = "0";
                }
                else
                {
                    tbLastPoints.Text = Convert.ToDouble(oTmp).ToString();
                }
                res = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ошибка загрузки данных:\r\n" + ex.Message);
                res = false;
            }
            return(res);
        }
Exemple #4
0
 //вывод данных об аккаунте
 internal void ShowDataAccountFormAll(AccountForm <int> bankAccountform)
 {
     try
     {
         if (bankAccountform == null)
         {
             Console.WriteLine("Нет объекта для вывода!");
         }
         else
         {
             Console.WriteLine
             (
                 "╔══════════════════════════════════════════════════╗\n" +
                 $"╠ Логин: {bankAccountform.Login}                     \n" +
                 $"╠ Пароль: {bankAccountform.Password}                  \n" +
                 $"╠ Роль пользователя: {bankAccountform.RoleUser}       \n" +
                 $"╠ Роль в ситеме: {bankAccountform.RoleUserSystemAdmin} \n" +
                 //$"╠ Адресс: {bankAccountform.Adress}                   \n" +
                 // $"╠ ФИО: {bankAccountform.FullName}                    \n" +
                 //$"╠ Группа: {bankAccountform.Group}                    \n" +
                 //$"╠ Номер:  {bankAccountform.PhoneNumber}       \n" +
                 // $"╠ Статус пользователя: {bankAccountform.Status}      \n" +
                 $"╠ ID Аккаунта: {bankAccountform.IdAccountForm}      \n" +
                 $"╠ ID Пользователя: {bankAccountform.IdPerson}        \n" +
                 $"╠ Баланс: {bankAccountform.Balance}               \n" +
                 "╚══════════════════════════════════════════════════╝\n"
             );
             //bankAccountform = null;
         }
     }
     catch (Exception e)
     {
         ErrorMessage(e);
     }
 }
 internal void DSAddAllData(AccountForm <int> [] logicGetAccount, int lengthmass)
 {
     if (logicGetAccount != null)
     {
         AccountForm <int> [] accountForms = new AccountForm <int> [lengthmass];
         accountForms = (AccountForm <int> [])logicGetAccount;
         try
         {
             for (int i = 0; i < lengthmass; i++)
             {
                 DGV.Rows.Add( );
                 DGV [0, i].Value = accountForms [i].IdPerson;
                 DGV [1, i].Value = accountForms [i].Login;
                 DGV [2, i].Value = accountForms [i].Name1;
             }
         }
         catch (System.Exception ex)
         {
             notification.ShowTextNotification("Ошибка при работе с данными!", ex.ToString( ), Color.Red, Color.Red);
         }
     }
     else
     {
         notification.ShowTextNotification("Нет данных об аккаунтах", "", Color.Red, Color.Red);
     }
 }
 private void TimerShowForm_Load(object sender, EventArgs e)
 {
     try
     {
         if (cn != null && cn.State != ConnectionState.Closed)
         {
             CloseAll();
         }
         AccountForm af = new AccountForm(String.Empty, true);
         af.ShowDialog();
         if (af.ExitPressed || String.IsNullOrEmpty(af.ConnectionString))
         {
             this.Close();
         }
         cn = new SqlConnection(af.ConnectionString);
         cn.Open();
         this.timerControl.ConnectionString = cn.ConnectionString;
         try
         {
             BoulderTimer.Properties.Settings set = BoulderTimer.Properties.Settings.Default;
             this.timerControl.Font = new Font(set.FontFamily, set.FontSize);
         }
         catch { }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Ошибка соединения:\r\n" + ex.Message);
         this.Close();
     }
 }
Exemple #7
0
 //вывод данных об аккаунте
 internal void ShowDataAccountForm(AccountForm <int> bankAccountform)
 {
     try
     {
         if (bankAccountform == null)
         {
             Console.WriteLine("Нет объекта для вывода!");
         }
         else
         {
             Console.WriteLine
             (
                 "╔══════════════════════════════════════════════════╗\n" +
                 //$"╠ ФИО: {bankAccountform.FullName}                     \n" +
                 $"╠ ID Аккаунта:  {bankAccountform.IdAccountForm}       \n" +
                 $"╠ ID Пользователя: {bankAccountform.IdPerson}         \n" +
                 $"╠ Баланс: {bankAccountform.Balance}                   \n" +
                 "╚══════════════════════════════════════════════════╝\n"
             );
         }
     }
     catch (Exception e)
     {
         ErrorMessage(e);
     }
 }
Exemple #8
0
 private void btnLoadDefault_Click(object sender, EventArgs e)
 {
     try
     {
         AccountForm.LoadStandartPoints(cn, null);
         LoadData();
     }
     catch (Exception ex) { MessageBox.Show("Ошибка загрузки таблицы очков:\r\n" + ex.Message); }
 }
        public void SignUp()
        {
            AccountForm signUpForm = new AccountForm("Sign Up", new User(string.Empty, string.Empty, string.Empty));

            signUpForm.OnFormSaved = () =>
            {
                Login(signUpForm["Username"], signUpForm["Password"]);
            };
            signUpForm.Open();
        }
        private void AddAccountButton_Click(object sender, EventArgs e)
        {
            AccountForm newAccount = new AccountForm("");

            if (newAccount.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                BlueVex2.Properties.Settings.Default.Accounts.Add(newAccount.Username + "," + newAccount.Password + "," + newAccount.CharSlot + "," + newAccount.Master + "," + newAccount.Realm);
                PopulateAccountsListView();
            }
        }
 private void ShowAccount(Settings settings)
 {
     using (var accountForm = new AccountForm(new OAuthHelper(settings)))
     {
         var dialogResult = DialogResult.Retry;
         while (dialogResult != DialogResult.Cancel)
         {
             dialogResult = accountForm.ShowDialog(snagitWindow);
         }
     }
 }
Exemple #12
0
 public IActionResult Insert([FromBody, SwaggerRequestBody("Form to insert an Account")] AccountForm form)
 {
     try
     {
         int idCreated = _service.Create(form.ToServiceLayerAccountFormInsert());
         return(Ok(idCreated));
     }
     catch (ArgumentException e)
     {
         return(new BadRequestObjectResult(e.Message));
     }
 }
Exemple #13
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     try
     {
         this.pointsBindingSource.EndEdit();
         SqlTransaction tranOld = this.pointsTableAdapter.Transaction;
         this.pointsTableAdapter.Transaction = cn.BeginTransaction();
         bool transactionSuccess = false;
         try
         {
             this.pointsTableAdapter.Update(dsClimbing);
             AccountForm.OrderPoints(cn, this.pointsTableAdapter.Transaction);
             double lastPts;
             if (tbLastPoints.Text.Length < 1)
             {
                 lastPts = -1.0;
             }
             else if (!getDoubleFromString(tbLastPoints.Text, out lastPts))
             {
                 MessageBox.Show(this, "Очки последним участникам введены неверно");
                 return;
             }
             SqlCommand cmd = new SqlCommand();
             cmd.Connection  = cn;
             cmd.Transaction = this.pointsTableAdapter.Transaction;
             cmd.CommandText = "DELETE FROM Points WHERE pos = 0";
             cmd.ExecuteNonQuery();
             if (lastPts > 0.0)
             {
                 cmd.CommandText = "INSERT INTO Points(pos,pts) VALUES (0,@pts)";
                 cmd.Parameters.Add("@pts", SqlDbType.Float);
                 cmd.Parameters[0].Value = lastPts;
                 cmd.ExecuteNonQuery();
             }
             transactionSuccess = true;
         }
         finally
         {
             if (transactionSuccess)
             {
                 this.pointsTableAdapter.Transaction.Commit();
                 this.Close();
             }
             else
             {
                 try { this.pointsTableAdapter.Transaction.Rollback(); }
                 catch { }
             }
             this.pointsTableAdapter.Transaction = tranOld;
         }
     }
     catch (Exception ex) { MessageBox.Show("Ошибка сохранения данных:\r\n" + ex.Message); }
 }
Exemple #14
0
 private void mnuAccount_Click(object sender, EventArgs e)
 {
     if (accountForm == null || accountForm.IsDisposed)
     {
         accountForm = new AccountForm();
         accountForm.Show();
         accountForm.MdiParent = this;
     }
     else
     {
         accountForm.Activate();
     }
 }
Exemple #15
0
 private void BtnLookup_Click(object sender, EventArgs e)
 {
     if (AccountForm != null)
     {
         AccountForm.Show();
     }
     else
     {
         AccountForm         = new FrmAccounts();
         AccountForm.Closed += AccountFormOnClosed;
         AccountForm.Show();
     }
 }
Exemple #16
0
        private void dgvAbiturient_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            int i = 0;

            while (i < dgvAbiturient.Rows.Count)
            {
                if (dgvAbiturient.Rows[i].Cells[4].Selected)
                {
                    AccountForm frmAccount = new AccountForm(dgvAbiturient.Rows[i]);
                    frmAccount.ShowDialog();
                }
                i++;
            }
        }
 private void EditAccountButton_Click(object sender, EventArgs e)
 {
     if (this.AccountsListView.SelectedItems.Count > 0)
     {
         string      itemString = this.AccountsListView.SelectedItems[0].Text + "," + this.AccountsListView.SelectedItems[0].SubItems[1].Text + "," + this.AccountsListView.SelectedItems[0].SubItems[2].Text + "," + this.AccountsListView.SelectedItems[0].SubItems[3].Text + "," + this.AccountsListView.SelectedItems[0].SubItems[4].Text;
         AccountForm newAccount = new AccountForm(itemString);
         if (newAccount.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             BlueVex2.Properties.Settings.Default.Accounts.Remove(itemString);
             BlueVex2.Properties.Settings.Default.Accounts.Add(newAccount.Username + "," + newAccount.Password + "," + newAccount.CharSlot + "," + newAccount.Master + "," + newAccount.Realm);
             PopulateAccountsListView();
         }
     }
 }
Exemple #18
0
 public ClimbingTimer(string connectionString, TimeSpan rotationInterval, bool isMain = false, bool autoReset = true, bool autoSynchro = true)
     : this(connectionString, autoReset, autoSynchro)
 {
     this.rotationInterval  = rotationInterval;
     this.remainingInterval = this.rotationInterval;
     this.isMain            = isMain;
     if (cn != null)
     {
         AccountForm.CreateQueryData(cn);
     }
     if (isMain)
     {
         OpenListener();
     }
 }
Exemple #19
0
        public override void Run()
        {
            AccountForm form = new AccountForm();

//			IAccountDao dao = new NHibernateAccountDao();
            form.AccountSaveAndClose += delegate(object sender, AccountEventArgs e) {
//				dao.SaveOrUpdate(e.Account);
                e.Account.SaveOrUpdate();
                form.Close();
            };
            form.AccountSaveAndClear += delegate(object sender, AccountEventArgs e) {
//				dao.SaveOrUpdate(e.Account);
                e.Account.SaveOrUpdate();
                form.Account = new Account();
            };
            WorkbenchSingleton.AddChild(form, "Edit Account");
        }
        public IActionResult Register([FromBody] AccountForm account)
        {
            // 檢查參數
            if (!ModelState.IsValid)
            {
                return(Json(new ResponseModel(-2, ModelState.Values.ToString())));
            }
            // 檢查帳號有沒有重複
            if (_accountService.CheckAccountExists(account.account))
            {
                return(Json(new ResponseModel(-1, "Account has exists")));
            }

            _accountService.AddUser(account);

            return(Json(new ResponseModel(account)));
        }
        public IActionResult Login([FromBody] AccountForm account)
        {
            UserData user = _accountService.GetUser(account.account);

            // 檢查帳號有沒有存在
            if (user == null)
            {
                return(Json(new ResponseModel(-1, "Account not exists")));
            }
            string encryptPassword = PasswordTools.GetSHA256Encrypt(account.password + user.Salt);

            // 檢查密碼對不對
            if (!encryptPassword.Equals(user.Password))
            {
                return(Json(new ResponseModel(-1, "Password error")));
            }
            return(Json(new ResponseModel(account)));
        }
Exemple #22
0
        private void EditButton_Click(object sender, EventArgs e)
        {
            Button editButton = sender as Button;

            string[] accountData =
            {
                DBManager.GetSingleValueWhere("Accounts", "Title",            "Id", editButton.ImageIndex.ToString()),
                DBManager.GetSingleValueWhere("Accounts", "Login",            "Id", editButton.ImageIndex.ToString()),
                DBManager.GetSingleValueWhere("Accounts", "Associated_Email", "Id", editButton.ImageIndex.ToString()),
                DBManager.GetSingleValueWhere("Accounts", "Password",         "Id", editButton.ImageIndex.ToString()),
                editButton.ImageIndex.ToString() /* id */
            };

            AccountForm af = new AccountForm(AccountForm.Mode.Edit, LoggedUser, UpdateAccountsDisplay, DisabledControls, accountData);

            af.Show();
            FormUtilities.DisableControls(DisabledControls.ToArray());
        }
        /// <summary>
        /// 新增帳號
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        public int AddUser(AccountForm account)
        {
            // 取得字尾
            string salt = PasswordTools.GetRandomString(10);
            // 取得加密字串
            string encryptPassword = PasswordTools.GetSHA256Encrypt(account.password + salt);

            UserData userData = new UserData()
            {
                Account  = account.account,
                Password = encryptPassword,
                Salt     = salt
            };
            string sqlStatement = " insert into TB_User (Account, Password, Salt, CreateDate, Status) " +
                                  " values (@Account, @Password, @Salt, now(), 1)";

            return(_databaseService.Insert(
                       new DatabaseObject(_dbConfig.GetLocalDBConnStr(), sqlStatement, userData)));
        }
Exemple #24
0
 /// <summary>
 /// Called when Button is clicked.
 /// </summary>
 protected override void OnClick()
 {
     try
     {
         // Show the Account Form
         AccountForm frm = new AccountForm();
         frm.Username = DataHubConfiguration.Current.UserName;
         frm.Password = DataHubConfiguration.Current.Password;
         if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             //Set the Username and Password
             DataHubConfiguration.Current.UserName = frm.Username;
             DataHubConfiguration.Current.Password = frm.Password;
             DataHubConfiguration.Current.Save();
         }
     }
     catch (Exception ex)
     {
         DataHubExtension.ShowError(ex);
     }
 }
Exemple #25
0
        private void SaveAndExit()
        {
            if (String.IsNullOrEmpty(tbServer.Text))
            {
                MessageBox.Show("Сервер не введён");
                return;
            }
            if (rbUseSQL.IsChecked == true)
            {
                if (String.IsNullOrEmpty(tbUser.Text))
                {
                    MessageBox.Show("Имя пользователя не введено");
                    return;
                }
                if (String.IsNullOrEmpty(tbPassword.Password))
                {
                    MessageBox.Show("Пароль не введён");
                    return;
                }
            }
            if (String.IsNullOrEmpty(cbDatabase.Text))
            {
                MessageBox.Show("База данных не выбрана");
                return;
            }

            if (rbUseSQL.IsChecked == true)
            {
                cnToRet = AccountForm.CreateConnection(tbServer.Text, tbUser.Text, tbPassword.Password, cbDatabase.Text);
            }
            else
            {
                cnToRet = AccountForm.CreateConnection(tbServer.Text, cbDatabase.Text);
            }

            SaveSettings();
            this.DialogResult = true;
            this.Close();
        }
Exemple #26
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( );
            }
        }
Exemple #27
0
        private async void LoadForm(string transaction, Account account = null)
        {
            AccountForm form = new AccountForm()
            {
                TransactionForm   = transaction,
                AccountData       = (account == null) ? new Account() : account,
                PrimaryButtonText = (transaction == "Add Access Account") ? "Save" : "Update",
                IsEditTrans       = (transaction == "Add Access Account")
            };
            var result = await form.ShowAsync();

            if (result == ContentDialogResult.Primary)
            {
                string message = "";

                switch (form.TransactionResult)
                {
                case 0:
                    message = (form.TransactionForm == "Add Access Account") ? "Access Account Inserted to the Database" : "Access Account Updated in the Database";
                    break;

                case 1:
                    message = "The System had run to an Error";
                    break;

                case 2:
                    message = "Information is Already Exists in the Database";
                    break;
                }

                MessageDialog dialog = new MessageDialog(message);
                await dialog.ShowAsync();

                this.InitializePage();
            }
        }
        private void EditAccount(User user)
        {
            AccountForm editAccount = new AccountForm("Edit Account", user, _loggedUser);

            editAccount.Open();
        }
        public void CreateUser()
        {
            AccountForm createAccountScreen = new AccountForm("Create Account", _loggedUser);

            createAccountScreen.Open();
        }
Exemple #30
0
        private void btnAccount_Click(object sender, EventArgs e)
        {
            AccountForm Form = new AccountForm();

            Form.ShowDialog();
        }