Exemple #1
0
        /// <summary>
        /// Update Holding object
        /// </summary>
        /// <param name="holding">Holding object</param>
        public void UpdateHolding(CommonData.Holding holding)
        {
            Holding db_holding = new Holding()
            {
                HoldingID = holding.HoldingID,
                InsID     = holding.InsID,
                LotCount  = holding.LotCount,
                AccountID = holding.AccountID
            };

            _da.DbContext.Update(db_holding);
        }
Exemple #2
0
        /// <summary>
        /// Insert new Holding object into db
        /// </summary>
        /// <param name="holding">Holding object (HoldingID = 0)</param>
        /// <returns>retuan new Id and set HoldingID to new value</returns>
        public int InsertHolding(CommonData.Holding holding)
        {
            Holding db_holding = new Holding()
            {
                HoldingID = holding.HoldingID,
                InsID     = holding.InsID,
                LotCount  = holding.LotCount,
                AccountID = holding.AccountID
            };

            _da.DbContext.Insert(db_holding);
            holding.HoldingID = db_holding.HoldingID;

            return(holding.HoldingID);
        }
Exemple #3
0
        /// <summary>
        /// Get Holdings by account Id
        /// </summary>
        /// <param name="accountID">account Id</param>
        /// <returns>Holdings list</returns>
        public IEnumerable <CommonData.Holding> GetHoldings(int accountID)
        {
            List <CommonData.Holding> holdings = new List <CommonData.Holding>();

            var db_holdings = _da.DbContext.Table <Holding>().Where(r => r.AccountID == accountID).ToList();

            foreach (var db_holding in db_holdings)
            {
                var holding = new CommonData.Holding()
                {
                    HoldingID = db_holding.HoldingID,
                    InsID     = db_holding.InsID,
                    LotCount  = db_holding.LotCount,
                    AccountID = db_holding.AccountID
                };
                holdings.Add(holding);
            }

            return(holdings);
        }