コード例 #1
0
        public static AccountCollection GetAccountCollection()
        {
            AccountCollection coll = new AccountCollection();

            coll.Add(GetAccount1());
            coll.Add(GetAccount2());
            return(coll);
        }
コード例 #2
0
        public static AccountCollection GetAccountCollection2()
        {
            AccountCollection coll = new AccountCollection();

            coll.Add(GetAccount1());

            Account account = GetAccount2();

            account.CredentialHistory.Add(GetCredential1());
            coll.Add(account);
            return(coll);
        }
コード例 #3
0
        public async Task <Customer> Get(Guid id)
        {
            Entities.Customer customer = await _context.Customers.
                                         Find(customer => customer.Id == id)
                                         .SingleOrDefaultAsync();

            List <Guid> accountIds = await _context
                                     .Accounts
                                     .Find(account => account.CustomerId == id)
                                     .Project(p => p.Id)
                                     .ToListAsync();

            AccountCollection accountCollection = new AccountCollection();

            foreach (var accountId in accountIds)
            {
                accountCollection.Add(accountId);
            }

            return(Customer.Load(
                       customer.Id,
                       customer.Name,
                       customer.Aadhar,
                       accountCollection));
        }
コード例 #4
0
        static void ProcessProductAttributes()
        {
            //Read Attributes
            if (File.Exists(RollUpData))
            {
                string[] lines = File.ReadAllLines(RollUpData);

                foreach (string line in lines)
                {
                    /******************************/
                    string[] Split = line.Split(',');

                    Account account = new Account();


                    account.group_account_code  = Split[0].Trim();
                    account.group_account_name  = Split[1].Trim();
                    account.detail_account_code = Split[2].Trim();
                    account.detail_account_name = Split[3].Trim();
                    account.detail = Split[4].Trim();
                    account.calculate_in_report = Split[5].Trim();
                    account.listing_order       = Split[6].Trim();

                    Accounts.Add(account);
                }
            }
        }
コード例 #5
0
        public async Task <Customer> Get(Guid id)
        {
            using (IDbConnection db = new SqlConnection(_connectionString))
            {
                string            customerSQL = "SELECT * FROM Customer WHERE Id = @Id";
                Entities.Customer customer    = await db
                                                .QueryFirstOrDefaultAsync <Entities.Customer>(customerSQL, new { id });

                if (customer == null)
                {
                    return(null);
                }

                string             accountSQL = "SELECT * FROM Account WHERE CustomerId = @Id";
                IEnumerable <Guid> accounts   = await db
                                                .QueryAsync <Guid>(accountSQL, new { id });

                AccountCollection accountCollection = new AccountCollection();

                foreach (Guid accountId in accounts)
                {
                    accountCollection.Add(accountId);
                }

                Customer result = Customer.Load(
                    customer.Id,
                    customer.Name,
                    customer.Aadhar,
                    accountCollection);

                return(result);
            }
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: chickenstick/Arowana
        private static AccountCollection GetTestCollection()
        {
            AccountCollection coll = new AccountCollection();

            Account hotmailAccount = new Account();

            hotmailAccount.Name       = "Hotmail";
            hotmailAccount.Notes      = "Test";
            hotmailAccount.CreateDate = new DateTime(2010, 1, 1);
            coll.Add(hotmailAccount);

            Credential cred1 = new Credential();

            cred1.CreatedDate = DateTime.Now;
            cred1.UserName    = "******";
            cred1.Password    = "******";
            hotmailAccount.ActiveCredential = cred1;
            hotmailAccount.CredentialHistory.Add(cred1);

            Credential cred2 = new Credential();

            cred2.CreatedDate = DateTime.Now;
            cred2.UserName    = "******";
            cred2.Password    = "******";
            hotmailAccount.CredentialHistory.Add(cred2);

            Account yahooAccount = new Account();

            yahooAccount.Name       = "Yahoo!";
            yahooAccount.Notes      = "none";
            yahooAccount.CreateDate = new DateTime(2011, 1, 1);
            coll.Add(yahooAccount);

            Credential cred3 = new Credential();

            cred3.CreatedDate             = DateTime.Now;
            cred3.UserName                = "******";
            cred3.Password                = "******";
            yahooAccount.ActiveCredential = cred3;
            yahooAccount.CredentialHistory.Add(cred3);

            return(coll);
        }
コード例 #7
0
        public void Add()
        {
            var addView = new AddAccountView();

            if (addView.ShowDialog() == true)
            {
                _lookup.Add(addView.NewItem);
                _viewModel.Collection.Add(addView.NewItem);
            }
        }
コード例 #8
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            FormDialogResult <Account> result = DialogUtility.ShowAccountDialog(this, _accountCollection, "Add Account", "Add", true);

            if (result.Result == DialogResult.OK && result.ResultObject != null)
            {
                _accountCollection.Add(result.ResultObject);
                UpdateFileChangedStatus(true);
                SetListDataSource();
            }
        }
コード例 #9
0
ファイル: Account.cs プロジェクト: mudasar/scco
        //public static Account FindByCode(string accountCode)
        //{
        //    var sqlBuilder = new System.Text.StringBuilder();
        //    sqlBuilder.AppendLine("SELECT * FROM");
        //    sqlBuilder.AppendLine(TABLE_NAME);
        //    sqlBuilder.AppendLine("WHERE CODE = ?CODE");

        //    var parameter = new SqlParameter("?CODE", accountCode);

        //    DataTable dataTable = DatabaseController.ExecuteSelectQuery(sqlBuilder, parameter);
        //    if (dataTable.Rows.Count == 0) return null;

        //    var result = new Account();
        //    foreach (DataRow dataRow in dataTable.Rows)
        //    {
        //        result.SetPropertiesFromDataRow(dataRow);
        //    }
        //    return result;
        //}
        //public static Account FindByName(string accountTitle)
        //{
        //    var sqlBuilder = new System.Text.StringBuilder();
        //    sqlBuilder.AppendLine("SELECT * FROM");
        //    sqlBuilder.AppendLine(TABLE_NAME);
        //    sqlBuilder.AppendLine("WHERE TITLE = ?TITLE");

        //    var parameter = new SqlParameter("?TITLE", accountTitle);

        //    DataTable dataTable = DatabaseController.ExecuteSelectQuery(sqlBuilder, parameter);

        //    if (dataTable.Rows.Count == 0) return null;

        //    var result = new Account();
        //    foreach (DataRow dataRow in dataTable.Rows)
        //    {
        //        result.SetPropertiesFromDataRow(dataRow);
        //    }
        //    return result;
        //}

        internal static AccountCollection CollectAll()
        {
            var dataTable  = DatabaseController.ExecuteSelectQuery("SELECT * FROM " + TABLE_NAME);
            var collection = new AccountCollection();

            foreach (DataRow dataRow in dataTable.Rows)
            {
                var item = new Account();
                item.SetPropertiesFromDataRow(dataRow);
                collection.Add(item);
            }
            return(collection);
        }
コード例 #10
0
        public static AccountCollection GetAllItem()
        {
            AccountCollection collection = new AccountCollection();

            using (var reader = SqlHelper.ExecuteReader("Account_GetAll", null))
            {
                while (reader.Read())
                {
                    Account obj = new Account();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
コード例 #11
0
        public static AccountCollection Search(SearchFilter SearchKey)
        {
            AccountCollection collection = new AccountCollection();

            using (var reader = SqlHelper.ExecuteReader("Account_Search", SearchFilterManager.SqlSearchParam(SearchKey)))
            {
                while (reader.Read())
                {
                    Account obj = new Account();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
コード例 #12
0
        public static AccountCollection GetbyUser(string CreatedUser)
        {
            AccountCollection collection = new AccountCollection();
            Account           obj;

            using (var reader = SqlHelper.ExecuteReader("Account_GetAll_byUser", new SqlParameter("@CreatedUser", CreatedUser)))
            {
                while (reader.Read())
                {
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
コード例 #13
0
        public async Task <Customer> Get(Guid customerId)
        {
            var customer = await _context.Customers
                           .Find(e => e.Id == customerId)
                           .SingleOrDefaultAsync();

            var accounts = await _context.Accounts
                           .Find(e => e.Id == customerId)
                           .Project(p => p.Id)
                           .ToListAsync();

            AccountCollection accountCollection = new AccountCollection();

            accountCollection.Add(accounts.AsEnumerable());

            return(new Customer(customer.Id, customer.Name, customer.SSN, accountCollection));
        }
コード例 #14
0
        public void Customer_Should_Be_Loaded()
        {
            AccountCollection accounts = new AccountCollection();

            accounts.Add(Guid.NewGuid());

            Guid customerId = Guid.NewGuid();

            Customer customer = Customer.Load(
                customerId,
                "Uncle bob",
                "1234567890123",
                accounts);

            Assert.Equal(customerId, customer.Id);
            Assert.Equal("Uncle bob", customer.Name);
            Assert.Equal("1234567890123", customer.Aadhar);
        }
コード例 #15
0
        public async Task <Customer> Get(Guid id)
        {
            Entities.Customer customer = await _context.Customers
                                         .FindAsync(id);

            List <Guid> accounts = await _context.Accounts
                                   .Where(e => e.CustomerId == id)
                                   .Select(p => p.Id)
                                   .ToListAsync();

            AccountCollection accountCollection = new AccountCollection();

            foreach (var accountId in accounts)
            {
                accountCollection.Add(accountId);
            }

            return(Customer.Load(customer.Id, customer.Name, customer.Aadhar, accountCollection));
        }
コード例 #16
0
        public void Customer_Should_Be_Loaded()
        {
            //
            // Arrange
            AccountCollection accounts = new AccountCollection();

            accounts.Add(Guid.NewGuid());

            Guid customerId = Guid.NewGuid();

            Customer customer = Customer.LoadFromDetails(
                customerId,
                "Sammy Fredriksson",
                "741214-3054",
                accounts);

            Assert.Equal(customerId, customer.Id);
            Assert.Equal("Sammy Fredriksson", customer.Name);
            Assert.Equal("741214-3054", customer.SSN);
        }
コード例 #17
0
        public async Task GetCustomerDetails_ValidId_ShouldReturnAnCustomer()
        {
            //ARRANGE
            var customerId = Guid.NewGuid();
            var ssn        = new SSN("0101010000");
            var name       = new Name("Test_Customer");

            var accountList = new AccountCollection();
            var account     = new Account(customerId);

            accountList.Add(account.Id);

            var customer = Customer.Load(customerId, name, ssn, accountList);

            _accountReadOnlyRepository.Setup(m => m.Get(account.Id)).Returns(Task.FromResult(account));
            _customerReadOnlyRepository.Setup(m => m.Get(customerId)).Returns(Task.FromResult(customer));

            //ACT
            CustomerOutput customerOutPut = await getCustomerDetailsUseCase.Execute(customerId);

            //ASSERT
            _accountReadOnlyRepository.Verify(v => v.Get(account.Id), Times.Once());
            Assert.Equal(customerOutPut.CustomerId, customerId);
        }
コード例 #18
0
ファイル: Account.cs プロジェクト: mudasar/scco
        internal static AccountCollection Where(Dictionary <string, object> dictionary)
        {
            var conditions = dictionary.Select(item => string.Format("?{0} = {0}", item.Key)).ToList();

            var queryBuilder = new StringBuilder();

            queryBuilder.AppendLine("SELECT * FROM");
            queryBuilder.AppendLine(Account.TableName);
            queryBuilder.AppendLine("WHERE");
            queryBuilder.AppendLine(string.Join(" AND ", conditions.ToArray()));

            var parameters = dictionary.Select(item => new SqlParameter(string.Format("?{0}", item.Key), item.Value)).ToList();

            var dataTable  = DatabaseController.ExecuteSelectQuery(queryBuilder.ToString(), parameters.ToArray());
            var collection = new AccountCollection();

            foreach (DataRow dataRow in dataTable.Rows)
            {
                var item = new Account();
                item.SetPropertiesFromDataRow(dataRow);
                collection.Add(item);
            }
            return(collection);
        }
コード例 #19
0
 public void LoadAccounts(IEnumerable <Guid> accounts)
 {
     Accounts = new AccountCollection();
     Accounts.Add(accounts);
 }
コード例 #20
0
 public void AddAccount(UserAccount user, bool staySignedIn)
 {
     var currentAccount = new Account(user, staySignedIn);
     CurrentAccountId = currentAccount.Id;
     AccountCollection.Add(currentAccount);
 }
コード例 #21
0
 public AccountCollection QueryAccount(string _accountName)
 {
     AccountCollection collection = new AccountCollection();
     using (SqlConnection connection = new SqlConnection(connectionString))
     {
         SqlCommand command = new SqlCommand();
         command.Connection = connection;
         command.CommandText = "SP_SEL_Table";
         SqlParameter _param = command.Parameters.Add("@value1", System.Data.SqlDbType.VarChar);
         _param.Value = "Entity_Account";
         SqlParameter _param2 = command.Parameters.Add("@value2", System.Data.SqlDbType.VarChar);
         _param2.Value = "4";
         SqlParameter _param3 = command.Parameters.Add("@value3", System.Data.SqlDbType.VarChar);
         _param3.Value = _accountName;
         SqlParameter _param4 = command.Parameters.Add("@order_by1", System.Data.SqlDbType.VarChar);
         _param4.Value = "1";
         SqlParameter _param5 = command.Parameters.Add("@order_by2", System.Data.SqlDbType.TinyInt);
         _param5.Value = 0;
         command.CommandType = System.Data.CommandType.StoredProcedure;
         connection.Open();
         SqlDataReader reader = command.ExecuteReader();
         if (reader.HasRows)
         {
             while (reader.Read())
             {
                 Account _account = new Account();
                 _account.ID = Convert.ToInt32(reader["ID"]);
                 _account.EntityID = Convert.ToInt32(reader["Entity_ID"]);
                 _account.Company = Convert.ToInt32(reader["Company"]);
                 _account.AccountName = reader["Account_Name"].ToString();
                 _account.Password = reader["Password"].ToString();
                 _account.AccountType = (AccountType)Convert.ToInt32(reader["Account_Type"]);
                 _account.BettingLimit = Convert.ToDecimal(reader["Betting_Limit"]);
                 _account.Factor = reader["Factor"].ToString();
                 _account.DateOpen = reader["DateOpen"].ToString();
                 _account.Personnel = reader["Personnel"].ToString();
                 _account.IP = reader["IP"].ToString();
                 _account.Odds = reader["Odds"].ToString();
                 _account.IssuesConditions = reader["IssuesConditions"].ToString();
                 _account.RemarksAcc = reader["RemarksAcc"].ToString();
                 if (!reader["Perbet"].ToString().Equals(""))
                     _account.Perbet = Convert.ToDecimal(reader["Perbet"]);
                 else
                     _account.Perbet = 0;
                 _account.Status = (Status)Convert.ToDecimal(reader["Status"]);
                 collection.Add(_account);
             }
         }
         reader.Close();
         return collection;
     }
 }
コード例 #22
0
ファイル: EmailTrigger.cs プロジェクト: peterkhoa/hdtl
        public static long SendComment(long comment_id_parent, string content, Account commenter, Account receiver, string objectType, long objectID, string target_link, string target_object_name, int objecttypeID, string userAgent, string status, string UserHostName, bool for_group)
        {
            long commentID = 0;
            if (for_group)
            {

                AccountCollection listReceiver = new AccountCollection();
                CommentCollection listOldComment = CommentDA.SelectByPerformOnObjectID(objectID);
                if (receiver.ID != commenter.ID)
                    listReceiver.Add(receiver);
                foreach (Comment cm in listOldComment)
                {
                    if (cm.AccountID != commenter.ID && cm.AccountID != receiver.ID)
                    {
                        Account a = AccountDA.SelectByID(cm.AccountID);
                        if (a != null && (listReceiver.Find(l=>l.ID == a.ID)==null))
                            listReceiver.Add(a);
                    }
                }

                content = content.Replace("\n", "<br />");

                Comment c = new Comment();

                c.AccountID = commenter.ID;
                c.Author_IP = UserHostName;
                c.Content = content;
                c.ObjID = objectID;
                c.ObjectType = objectType;
                c.ObjectType = objectType;
                c.Agent = userAgent;
                c.Status = status;
                c.ReceiverID = receiver.ID; //owner
                c.ReceiverUsername = receiver.Username;
                c.ParentID = comment_id_parent;
                c.Target_link = target_link;
                c.Target_object_name = target_object_name;
                c.Username = commenter.Username;

                commentID = CommentDA.Insert(c);
                List<long> emailed_accounts = new List<long>();
                //Account commenter = AccountDA.SelectByID(senderID);//((Account)S-ession["Account"]);
                string emailcontent = commenter.Username + " đã viết lời bình luận  <b>" + target_object_name + "</b><br/> "
                                     + "<br/><br/> \"" + c.Content + "\" <br/><br/>"
                                     + "Bạn có thể xem chi tiết và trả lời bằng cách sử dụng link dưới đây: <br/> <a href='" + target_link + " '> " + target_link + "</a>"
                                     + "<br/>" + DateTime.Now.ToString();
                foreach (Account r in listReceiver)
                {
                    //ActionLogDA.Add(receiver.ID, receiver.Username,

                    //       objecttypeID,
                    //        objectID,
                    //        "viết bình luận <a href='" + target_link + "'>" + target_object_name + "</a> của nhóm <a href='" + target_link + "'>" + team.Name + "</a>"
                    //        , r.ID
                    //        , ""
                    //        , ""
                    //        , ""//Request.RawUrl
                    //        , c.ObjectID.ToString() + "+" + ObjectTypeID.Goal.ToString()

                    //        );

                    ActionLog acl = new ActionLog();
                    acl.AuthorID = commentID;
                    acl.Date = DateTime.Now;
                    acl.TargetAccount = r.ID;
                    acl.PerformOnObjectID = objectID;
                    acl.Username = r.Username;
                    acl.Href = " viết bình luận trên <a href='" + target_link + "' target='_blank'>" + target_object_name + "</a>";
                    acl.XCommentID = c.ObjID + "+" + objectType;
                    acl.ShortDescription = "Bạn <a href='" + LinkBuilder.getLinkProfile(commenter) + "' target='_blank'>" + commenter.Username + "</a> vừa" + acl.Href;
                    acl.ToUser = r.Username;

                    ActionLogDA.Insert(acl);

                    emailed_accounts.Add(r.ID);

                    //notify to
                    if (commenter.ID != r.ID)
                        //SendMail.sendMail(emailcontent, commenter.Username + " viết lời bình luận  " + target_object_name, commenter.Email, commenter.FirstName + " " + commenter.LastName, r.Email, r.FirstName + " " + r.LastName, email_type.goal_comment, r.ID);
                        SendMail.SendNotification(emailcontent, commenter.Username + " viết lời bình luận  " + target_object_name, commenter.Email, commenter.FullName, r.Email, r.FullName, email_type.goal_comment, r.ID);

                }

            }
            return commentID;
        }
コード例 #23
0
        public AccountCollection GetAccounts(User user)
        {
            AccountCollection collection = new AccountCollection();
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand();
                command.Connection = connection;
                command.CommandText = "SP_Frank_TEST";

                SqlParameter ColumnParam = command.Parameters.Add("@User_ID", System.Data.SqlDbType.Int);
                ColumnParam.Value = user.UserID;
                command.CommandType = System.Data.CommandType.StoredProcedure;
                connection.Open();
                SqlDataReader reader = command.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Account account = new Account();
                        account.AccountName = reader["Name"].ToString();
                        account.AccountType = (AccountType)(Convert.ToInt32(reader["Type"]));
                        account.BettingLimit = Convert.ToDecimal(reader["Betting_Limit"]);
                        account.Status = (Status)(Convert.ToInt32(reader["Status"]));
                        collection.Add(account);
                    }
                }
                return collection;
            }
        }