Example #1
0
        /// <summary>
        /// List accounts
        /// </summary>
        /// <returns></returns>
        public async Task<List<Model.Account>> RetrieveAll()
        {
            try
            {
                List<Model.Account> accounts = await this.baseURLAPI
                .AppendPathSegment("accounts")
                .GetJsonAsync<List<Model.Account>>();

                if (accounts.Count > 0)
                {
                    for (var i = 0; i < accounts.Count; i++)
                    {
                        Model.Account account = accounts[i];

                        // TODO: corrigir o construtor do método
                        AccountItemController itemController = new AccountItemController();

                        account.Items = await itemController.RetrieveItemsByAccount(account);

                        accounts[i] = account;
                    }
                }

                return accounts;
            }
            catch (FlurlHttpException)
            {
                return null;
            }
        }
Example #2
0
 private void btnSignUp_Click(object sender, EventArgs e)
 {
     Model.Account acc = new Model.Account();
     acc.Email      = txtEmail.Text;
     acc.Password   = txtPassword.Text;
     acc.Ten        = txtTen.Text;
     acc.SDT        = txtSDT.Text;
     acc.DiaChi     = txtDiaChi.Text;
     acc.SinhNhat   = dtpNgaySinh.Value.Date;
     acc.NoiLamViec = noiLamViec;
     acc.TenQuyen   = "banve";
     if (!ValidateOfMe.ValidateOfMe.isPhoneNumber(ref txtSDT))
     {
         return;
     }
     if (ValidateOfMe.ValidateOfMe.isHaveEmptyTextBox(ref panel1))
     {
         return;
     }
     try
     {
         DataAccess.DAOAccount.InsertNhanVienBanVe(acc);
         MessageBox.Show("tao Account Thanh Cong!!");
     }catch (SqlException ex)
     {
         if (ex.Number == 2627)
         {
             MessageBox.Show("Account da ton tai!!");
         }
     }
 }
Example #3
0
        private void _Insert(Model.InvoiceFT invoice)
        {
            _ValidateForInsert(invoice);
            invoice.Account1Id  = invoice.Account1.AccountId;
            invoice.Account2Id  = invoice.Account2.AccountId;
            invoice.Employee0Id = invoice.Employee0.EmployeeId;

            invoice.Employee1Id = invoice.Employee1.EmployeeId;

            if (invoice.InvoiceStatus == (int)Helper.InvoiceStatus.Normal)
            {
                invoice.Employee2Id   = invoice.Employee2.EmployeeId;
                invoice.InvoiceGZTime = DateTime.Now;
            }

            accessor.Insert(invoice);

            if (invoice.InvoiceStatus == (int)Helper.InvoiceStatus.Normal)
            {
                Model.Account account1 = invoice.Account1;
                Model.Account account2 = invoice.Account2;
                account1.AccountBalance1 -= invoice.InvoiceTotal;
                account2.AccountBalance1 += invoice.InvoiceTotal;

                accountAccessor.Update(account1);
                accountAccessor.Update(account2);
            }
        }
Example #4
0
        private void _Insert(Model.InvoiceQI invoice)
        {
            _ValidateForInsert(invoice);

            invoice.Employee0Id = invoice.Employee0.EmployeeId;
            invoice.AccountId   = invoice.Account.AccountId;

            invoice.Employee1Id = invoice.Employee1.EmployeeId;


            if ((Helper.InvoiceStatus)invoice.InvoiceStatus.Value == Helper.InvoiceStatus.Normal)
            {
                //过账人
                invoice.Employee2Id = invoice.Employee2.EmployeeId;
                //过账时间
                invoice.InvoiceGZTime = DateTime.Now;
            }
            accessor.Insert(invoice);

            foreach (Model.InvoiceQIDetail detail in invoice.Details)
            {
                detail.InvoiceId = invoice.InvoiceId;
                invoiceQIDetailAccessor.Insert(detail);
            }

            if ((Helper.InvoiceStatus)invoice.InvoiceStatus.Value == Helper.InvoiceStatus.Normal)
            {
                Model.Account account = invoice.Account;
                account.AccountBalance1 += invoice.InvoiceTotal;
                accountAccessor.Update(account);
            }
        }
        public Model.Account Update(Model.Account entity)
        {
            Delete(entity.Id);
            Save(entity);

            return(entity);
        }
        public Model.Account Save(Model.Account entity)
        {
            AccountStorage.Accounts.Add(entity);
            AccountStorage.Dictionary.Add(entity.Id, entity);

            return(entity);
        }
Example #7
0
        /// <summary>
        /// Get account items
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        public async Task <List <Model.AccountItem> > RetrieveItemsByAccount(Model.Account account)
        {
            List <Model.AccountItem> items = await this.baseURLAPI
                                             .AppendPathSegment("accounts")
                                             .AppendPathSegment(account.Id)
                                             .AppendPathSegment("items")
                                             .GetJsonAsync <List <Model.AccountItem> >();

            if (items.Count > 0)
            {
                for (var i = 0; i < items.Count; i++)
                {
                    Model.AccountItem accountItem = items[i];

                    // TODO: corrigir o construtor do metodo
                    AccountItemAditionalController aditionalController = new AccountItemAditionalController();

                    accountItem.Aditionals = await aditionalController.RetrieveAditionalsByItem(account, accountItem);

                    items[i] = accountItem;
                }
            }

            return(items);
        }
        /// <summary>
        /// Update an account
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        public async Task <Model.Account> UpdateAccount(Model.Account account)
        {
            var accountEntity = _mapper.Map <Account>(account);
            var result        = await _accountRepository.UpdateAccount(accountEntity);

            return(_mapper.Map <Model.Account>(result));
        }
Example #9
0
        public async Task <AppCore.Result> CheckCredit(Model.Account account, Model.MessageReceiver recMessage)
        {
            var sendCount = QueueHelper.Instance.SendCountDictionary[recMessage.SourceAccount];

            if (sendCount % account.CreditAlertCount == 0)
            {
                var creditValue = await _GetCreditValue(account, recMessage);

                if (!creditValue.Success)
                {
                    return(creditValue);
                }

                if (creditValue.Data <= account.AlertCreditAmount)
                {
                    var sendAlertResult = await _SendAlertAsync(account, recMessage, creditValue.Data);

                    if (!sendAlertResult.Success)
                    {
                        return(sendAlertResult);
                    }
                }
            }

            QueueHelper.Instance.SendCountDictionary[recMessage.SourceAccount] = ++sendCount;
            return(AppCore.Result.Successful());
        }
Example #10
0
        public AccountResult Find(long id)
        {
            Model.Account entity = Dao.Find(id);
            AccountResult result = ResultConverter.Convert(entity);

            return(result);
        }
Example #11
0
        public AccountResult Find(string name)
        {
            Model.Account entity = Dao.Find(name);
            AccountResult result = ResultConverter.Convert(entity);

            return(result);
        }
        private void dataAccount_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int[] indexes = new int[dataAccount.ColumnCount];
            for (int i = 0; i < dataAccount.ColumnCount; i++)
            {
                indexes[i] = i;
            }

            if (indexes.Contains(e.ColumnIndex) == true && e.RowIndex != -1)
            {
                if (dataAccount.Rows[e.RowIndex].Cells["Id"].Value != null)
                {
                    currentAccount = mAccounts.Find(a => string.Compare(a.Id, dataAccount.Rows[e.RowIndex].Cells["Id"].Value.ToString()) == 0);
                    Program.currentSelectedAccount = currentAccount;
                    ViewManager.Instance.ShowViewAccount();
                }
                else
                {
                    currentAccount = null;
                }
            }
            else
            {
                currentAccount = null;
            }
        }
Example #13
0
        public async Task <IActionResult> Register([FromBody] Model.Account account)
        {
            Console.WriteLine(account.UserName);
            var user = new IdentityUser
            {
                UserName = account.UserName,
                Email    = ""
            };
            var rst = await _userManager.CreateAsync(user, account.Password);

            if (rst.Succeeded)
            {
                return(CreatedAtAction(nameof(Register), user));

                //Todo
                return(CreatedAtAction(nameof(Register), new { id = user.Id }, new
                {
                    id = user.Id,
                    name = user.UserName
                }));
            }
            else
            {
                var sb = new StringBuilder();
                foreach (var error in rst.Errors)
                {
                    sb.AppendLine($"{error.Code}:{error.Description}");
                }
                return(BadRequest(rst.ToString()));
            }
        }
Example #14
0
        public static bool Update(IAccount Account, string Name, string Email)
        {
            Model.Account CloudAccount = GetByID(Account.Number);

            if (CloudAccount == null)
            {
                CloudAccount = new Model.Account();
            }

            CloudAccount.ID         = Account.Number;
            CloudAccount.Name       = Name;
            CloudAccount.Email      = Email;
            CloudAccount.Balance    = (decimal)Account.Balance;
            CloudAccount.Currency   = Account.Currency;
            CloudAccount.BrokerName = Account.BrokerName;
            CloudAccount.Equity     = (decimal)Account.Equity;
            CloudAccount.IsLive     = Account.IsLive;
            CloudAccount.Margin     = (decimal)Account.Margin;
            if (Account.MarginLevel != null)
            {
                CloudAccount.MarginLevel = (float)Account.MarginLevel;
            }
            CloudAccount.PreciseLeverage         = (float)Account.PreciseLeverage;
            CloudAccount.UnrealizedGrossProfit   = (decimal)Account.UnrealizedGrossProfit;
            CloudAccount.UnrealizedNetProfit     = (decimal)Account.UnrealizedNetProfit;
            CloudAccount.DateTimeLastModifiedUTC = DateTime.UtcNow;

            return(Save(CloudAccount));
        }
Example #15
0
        public AccountResult Create(AccountParam param)
        {
            Model.Account entity = ParamConverter.Convert(param, null);

            entity = Dao.Save(entity);

            return(ResultConverter.Convert(entity));
        }
Example #16
0
        public bool ExistsExcept(Model.Account e)
        {
            Hashtable paras = new Hashtable();

            paras.Add("newId", e.Id);
            paras.Add("oldId", Get(e.AccountId) == null?null:Get(e.AccountId).Id);
            return(sqlmapper.QueryForObject <bool>("Account.existsexcept", paras));
        }
        public Task <AppCore.Result> DeleteAsync(Core.IRequestInfo request, Model.Account model)
        {
            if (model.ID.IsNullOrEmpty())
            {
                return(AppCore.Result.FailureAsync());
            }

            return(_dataSource.DeleteAsync(model.ID));
        }
Example #18
0
        public void MyClick(ref ChooseItem item)
        {
            ChooseAccountForm f = new ChooseAccountForm();

            if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Model.Account account = f.SelectedItem as Model.Account;
                item = new ChooseItem(account, account.Id, account.AccountName);
            }
        }
Example #19
0
        public static Model.Account CreateAccountForEmployee(Model.Employee employee)
        {
            Model.Account account = new Model.Account
            {
                RoleId   = 2,
                UserName = employee.FirstName.ToLower() + '.' + employee.LastName.ToLower(),
                Password = '******'
            };

            return(account);
        }
Example #20
0
        public static Model.Account CreateAccountForCustomer(Model.Customer customer)
        {
            Model.Account account = new Model.Account
            {
                RoleId   = 3,
                UserName = customer.FirstName.ToLower() + '.' + customer.LastName.ToLower(),
                Password = '******'
            };

            return(account);
        }
Example #21
0
        public void Empty_TOSAccepted_Will_Yield_False()
        {
            var account = new Model.Account(new Model.Jwk(StaticTestData.JwkJson), new List <string> {
                "*****@*****.**", "*****@*****.**"
            }, null);
            var ordersUrl = "https://orders.example.org/";

            var sut = new HttpModel.Account(account, ordersUrl);

            Assert.False(sut.TermsOfServiceAgreed);
        }
Example #22
0
        protected override void SetValue(string id)
        {
            Model.Account c = BLL.Account.GetModel(int.Parse(id));
            CName.Value        = c.CName;
            SupplierName.Value = c.SupplierName;
            TotalMoney.Value   = c.TotalMoney.ToString();
            ReMoney.Value      = c.ReMoney.ToString();

            yue.Value = BLL.C_Supplier.GetModel(c.SupplierID).OverMoney.ToString();

            fid.Value = c.ID.ToString();
        }
Example #23
0
        public void Update(List <AccountParam> param)
        {
            //List<UniversityDemo.Account> entities = new List<UniversityDemo.Account>();

            foreach (var item in param)
            {
                Model.Account oldEntity = Dao.Find(item.Id);
                Model.Account newEntity = ParamConverter.Convert(item, oldEntity);

                Dao.Update(newEntity);
            }
        }
Example #24
0
        public static async Task UpdateAccount(Model.Account account)
        {
            await SDKProperty.SQLiteComConn.GetAsync <DB.historyAccountDB>(h => h.loginId == account.loginId).ContinueWith(async t =>
            {
                if (!t.IsFaulted)
                {
                    if ((t.Result.loginModel & account.LoginMode) == Model.LoginMode.None)
                    {
                        if ((int)t.Result.loginModel + (int)account.LoginMode >= (int)Model.LoginMode.All)
                        {
                            t.Result.loginModel = Model.LoginMode.All;
                        }
                        else
                        {
                            t.Result.loginModel = account.LoginMode;
                        }
                    }
                    if (!string.IsNullOrEmpty(account.userPass))
                    {
                        t.Result.password = Util.Helpers.Encrypt.DesEncrypt(account.userPass);
                    }
                    t.Result.lastlastLoginTime = account.lastlastLoginTime;
                    if (account.token != t.Result.token || t.Result.FirstLoginTime == null)
                    {
                        t.Result.FirstLoginTime = account.lastlastLoginTime;
                        t.Result.token          = account.token;
                    }
                    t.Result.userName         = account.userName;
                    t.Result.headPic          = account.photo;
                    t.Result.UserId           = account.userID;
                    account.GetOfflineMsgTime = t.Result.GetOffLineMsgTime;
                    await SDKProperty.SQLiteComConn.UpdateAsync(t.Result);
                }
                else
                {
                    var accountList = await SDKProperty.SQLiteComConn.Table <DB.historyAccountDB>().ToListAsync();


                    await SDKProperty.SQLiteComConn.InsertAsync(new DB.historyAccountDB()
                    {
                        lastlastLoginTime = account.lastlastLoginTime,
                        FirstLoginTime    = account.lastlastLoginTime,
                        loginId           = account.loginId,
                        loginModel        = account.LoginMode,
                        headPic           = account.photo,
                        token             = account.token,
                        UserId            = account.userID,
                        userName          = account.userName,
                        password          = Util.Helpers.Encrypt.DesEncrypt(account.userPass)
                    });
                }
            });
        }
        private void editAccountLogic()
        {
            if (showComponent.getCurrentAccount() != null)
            {
                Model.Account tempAccount = showComponent.getCurrentAccount();
                ClearComponentRessources(adminComponentPanel);
                form = new Account.Component.FormAddOrEditAccountComponent(tempAccount);
                ChangeComponent(adminComponentPanel, form);

                isAddOrEditComponentActive = true;
                isShowComponentActive      = false;
            }
        }
Example #26
0
        private (Model.Challenge challenge, string challengeUrl) CreateTestModel()
        {
            var account = new Model.Account(new Model.Jwk(StaticTestData.JwkJson), new List <string> {
                "*****@*****.**"
            }, null);
            var order = new Model.Order(account, new List <Model.Identifier> {
                new Model.Identifier("dns", "www.example.com")
            });
            var authorization = new Model.Authorization(order, order.Identifiers.First(), DateTimeOffset.UtcNow);
            var challenge     = new Model.Challenge(authorization, "http-01");

            return(challenge, "https://challenge.example.com");
        }
Example #27
0
        public async Task <AppCore.Result <decimal> > GetCredit(Model.Account account)
        {
            System.Single statusResults = (await _sms.getCreditAsync(
                                               userName: account.UserName
                                               , password: account.Password
                                               , domain: account.Domain
                                               , useProxy: false
                                               , proxyAddress: string.Empty
                                               , proxyUsername: string.Empty
                                               , proxyPassword: string.Empty));

            return(AppCore.Result <decimal> .Set(true, data : (decimal)statusResults));
        }
Example #28
0
        public FormAddOrEditAccountComponent(Model.Account account)
        {
            mAccount = account;
            InitializeComponent();

            this.nameTxtBox.Text = account.Name;

            this.editBtn.Visible = true;
            this.addBtn.Visible  = false;

            this.budgetTxtBox.Visible = false;
            this.budgetLbl.Visible    = false;
        }
Example #29
0
        public void SetApiSecret_Pass()
        {
            // Arrange
            var account = new Model.Account(new Interface.Model.AccountInfo {
                User = user
            });

            // Act
            account.ApiSecret = "0123456789";

            // Assert
            Assert.IsTrue(account.ApiSecret.Equals("**********"));
            Assert.IsTrue(account.AccountInfo.User.ApiSecret.Equals("0123456789"));;
        }
Example #30
0
        public void Ctor_Initializes_All_Properties()
        {
            var account = new Model.Account(new Model.Jwk(StaticTestData.JwkJson), new List <string> {
                "*****@*****.**", "*****@*****.**"
            }, DateTimeOffset.UtcNow);
            var ordersUrl = "https://orders.example.org/";

            var sut = new HttpModel.Account(account, ordersUrl);

            Assert.Equal(account.Contacts, sut.Contact);
            Assert.Equal(ordersUrl, sut.Orders);
            Assert.Equal("valid", sut.Status);
            Assert.True(sut.TermsOfServiceAgreed);
        }
Example #31
0
 private void ButtonAccountActionAdd_Click(object sender, EventArgs e)
 {
     var newAccountA = new Model.Account();
     newAccountA = LoadAccount(newAccountA);
     theGateContext.Accounts.Add(newAccountA);
     theGateContext.SaveChanges();
     Response.Redirect("AccountDetails.aspx?id=" + newAccountA.accountID);
 }
Example #32
0
		/// <summary>
		/// GetRoomからのみ呼ばれる想定です。
		/// </summary>
		/// <param name="summary"></param>
		/// <param name="messages"></param>
		private void NewMessage(Summary summary, IEnumerable<Message> messages) {
			foreach (var message in messages) {
				if (message.IsAuth && String.IsNullOrWhiteSpace(message.Name) == false) {
					// アカウント情報を更新
					var account = Model.Account.GetAccount(message.Name);
					if (account == null) {
						account = new Model.Account {
							AccountName = message.Name,
						};
						Model.Account.UpdateAccount(account);
					}
				}

				if (String.IsNullOrWhiteSpace(message.ListenerId) == false) {
					// リスナーが存在しなければ追加します。
					var listener = Model.Listener.GetListener(message.ListenerId);
					if (listener == null || (String.IsNullOrWhiteSpace(listener.ListenerId) == false && message.IsAuth)) {
						listener = new Model.Listener {
							ListenerId = message.ListenerId,
							Name = String.IsNullOrWhiteSpace(message.Name) == false ? message.Name : null,
							Author = summary.Author,
							AccountName = message.IsAuth ? message.Name : null,
						};
						Model.Listener.UpdateListener(listener);
					}
				}
			}

			// DBのコメント情報を更新します。
			var dbMessage = messages.Select(message => new Model.Message {
				RoomId = summary.RoomId,
				Number = message.Number,
				Name = message.Name,
				Comment = message.Comment,
				IsAuth = message.IsAuth,
				IsBan = message.IsBan,
				PostTime = message.PostTime,
				ListenerId = message.ListenerId,
			});
			Model.Message.UpdateMessage(dbMessage);
		}
Example #33
0
		private void NewMessage(Message message) {
			if (this.JoinedRoomSummary == null) {
				return;
			}

			var author = this.JoinedRoomSummary.Author;
			if (String.IsNullOrWhiteSpace(author) == true) {
				return;
			}

			if (message.IsAuth) {
				// アカウント情報を更新
				var account = Model.Account.GetAccount(message.Name);
				if (message.IsAuth && String.IsNullOrWhiteSpace(message.Name) == false) {
					account = new Model.Account {
						AccountName = message.Name,
					};
					Model.Account.UpdateAccount(account);
				}
			}

			if (String.IsNullOrWhiteSpace(message.ListenerId) == false) {
				// リスナーが存在しなければ追加します。
				var listener = Model.Listener.GetListener(message.ListenerId);
				if (listener == null || (String.IsNullOrWhiteSpace(listener.ListenerId) == false && message.IsAuth)) {
					listener = new Model.Listener {
						ListenerId = message.ListenerId,
						Name = String.IsNullOrWhiteSpace(message.Name) == false ? message.Name : null,
						Author = author,
						AccountName = message.IsAuth ? message.Name : null,
					};
					Model.Listener.UpdateListener(listener);
				}
			}
		}
Example #34
0
		/// <returns>GameServer list</returns>
		public IEnumerable<Model.GameServer> Login(string login, string password) // Todo: SocketException
		{
			lock (Sync)
			{
				LoginServer.Connect(Config, Identity = new Model.Account()
				{
					Login = login,
					Password = password
				});

				var result = Wait(r => r is Result.LoginConnected || r is Result.LoginFail);
				if (result is Result.LoginConnected)
					return ((Result.LoginConnected)result).GameServers;
				else
					throw new LoginFailException((Result.LoginFail)result);
			}
		}
Example #35
0
		public void Connect(Model.LoginServer loginServer, Model.Account account)
		{
			this.Server = loginServer;
			this.Account = account;
			LoginThread.Start();
		}