public Account InsertAccount(Account account)
        {
            account.CreateDate = DateTime.Now;
            account.Active = true;
            _dbContext.Accounts.AddObject(account);
            _dbContext.SaveChanges();

            return account;
        }
Ejemplo n.º 2
0
        private void btnInsert_Click(object sender, RoutedEventArgs e)
        {
            Account newAccount = new Account();
            newAccount.TypeID = Convert.ToInt32(cmbMailType.Tag);
            newAccount.UserName = txtUsername.Text;
            newAccount.Password = txtPassword.Text;
            _musubiRepo.InsertAccount(newAccount);

            bindAccounts();
        }
 partial void DeleteAccount(Account instance);
 partial void UpdateAccount(Account instance);
 partial void InsertAccount(Account instance);
 /// <summary>
 /// Create a new Account object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="typeID">Initial value of the TypeID property.</param>
 /// <param name="userName">Initial value of the UserName property.</param>
 /// <param name="password">Initial value of the Password property.</param>
 /// <param name="active">Initial value of the Active property.</param>
 public static Account CreateAccount(global::System.Int32 id, global::System.Int32 typeID, global::System.String userName, global::System.String password, global::System.Boolean active)
 {
     Account account = new Account();
     account.ID = id;
     account.TypeID = typeID;
     account.UserName = userName;
     account.Password = password;
     account.Active = active;
     return account;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Accounts EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToAccounts(Account account)
 {
     base.AddObject("Accounts", account);
 }
        public AccountActivity UpdateAccountActivity(Account account, int activityCount)
        {
            AccountActivity activity = new AccountActivity();
            activity.Date = DateTime.Now;
            activity.EmailSendCount = activity.EmailSendCount + activityCount;
            account.AccountActivities.Add(activity);
            _dbContext.SaveChanges();

            return activity;
        }
        private int getEmailAvailableCount(Account acc)
        {
            decimal emailsSent = 0;
            decimal emailsCap = 0;

            var activities = acc.AccountActivities.Where(ac => ac.Date > DateTime.Now.AddHours(-24));
            decimal sum = activities.Sum(ac => ac.EmailSendCount);
            emailsSent += sum;
            if (acc.TypeID == 0)
            {
                emailsCap += 500;
            }

            return (int)(emailsCap - emailsSent);
        }
Ejemplo n.º 10
0
 public int UpdateAccount(Account account)
 {
     int result = 0;
     try
     {
         String[] columnNames = {userName, password, role, birthday, sex, identifyCode, fullName, address, phone, email, status };
         Object[] values = {account.UserName, account.Password, account.Role, account.Birthday, account.Sex, account.IdentifyCode, account.FullName, account.Address, account.Phone, account.Email, account.Status };
         String[] keyColumnNames = {accountID};
         Object[] keyColumnValues = {account.AccountID};
         result = DALBase.UpdateTable(tableName, columnNames, values, keyColumnNames, keyColumnValues);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return result;
 }