Beispiel #1
0
        public UserTransactionsBO GetUserInvestimentDetailsByUserId(int userId, decimal cuprice)
        {
            //UserTransactionsBO objResponseBO = objProfileInfoDAO.GetUserInvestimentDetailsByUserId(userId);
            UserTransactionsBO objPartialResponseBO = GetUserProfileChangeValsForPercentageCalc(userId, cuprice);

            if (cuprice > 0)
            {
                decimal previousdayLastTradePrice = objPartialResponseBO.LastTradeSharePrice;
                decimal currentLastTradePrice     = Convert.ToDecimal(cuprice);
                try
                {
                    objPartialResponseBO.pricechange     = currentLastTradePrice - previousdayLastTradePrice;
                    objPartialResponseBO.PercentageValue = ((currentLastTradePrice - previousdayLastTradePrice) / previousdayLastTradePrice) * 100;
                    objPartialResponseBO.PercentageValue = Math.Floor(objPartialResponseBO.PercentageValue * 100) / 100;
                }
                catch (Exception)
                {
                    objPartialResponseBO.pricechange     = 0;
                    objPartialResponseBO.PercentageValue = 0;
                }
                objPartialResponseBO.color = "red";
                if (currentLastTradePrice >= previousdayLastTradePrice)
                {
                    objPartialResponseBO.color = "green";
                }
            }
            return(objPartialResponseBO);
        }
Beispiel #2
0
        public UserTransactionsBO GetUserProfileDetailsByUserIdNUserProfileId(int userId, int userProfileId)
        {
            UserTransactionsBO objResponseBO        = objProfileInfoDAO.GetUserProfileDetailsByUserIdNUserProfileId(userId, userProfileId);
            decimal            cuprice              = objResponseBO.LastTradeSharePrice;
            UserTransactionsBO objPartialResponseBO = GetUserProfileChangeValsForPercentageCalc(userProfileId, cuprice);

            if (cuprice > 0)
            {
                decimal previousdayLastTradePrice = objPartialResponseBO.LastTradeSharePrice;
                decimal currentLastTradePrice     = Convert.ToDecimal(cuprice);
                try
                {
                    objResponseBO.pricechange     = objResponseBO.LastTradeSharePrice - objResponseBO.LastDayClosePrice; //currentLastTradePrice - previousdayLastTradePrice;
                    objResponseBO.PercentageValue = ((objResponseBO.LastTradeSharePrice - objResponseBO.LastDayClosePrice) / objResponseBO.LastDayClosePrice) * 100;
                    //objResponseBO.PercentageValue = Math.Round(objResponseBO.PercentageValue); //Math.Floor(objResponseBO.PercentageValue * 100) / 100;
                }
                catch (Exception)
                {
                    objResponseBO.pricechange     = 0;
                    objResponseBO.PercentageValue = 0;
                }
                if (objResponseBO.LastTradeSharePrice >= objResponseBO.LastDayClosePrice)
                {
                    objResponseBO.color = "text-green";
                    objResponseBO.pricechangeinnegitive = false;
                }
                else
                {
                    objResponseBO.color                 = "text-red";
                    objResponseBO.pricechange           = Math.Abs(objResponseBO.pricechange);
                    objResponseBO.PercentageValue       = Math.Abs(objResponseBO.pricechange);
                    objResponseBO.pricechangeinnegitive = true;
                }
            }
            return(objResponseBO);
        }
Beispiel #3
0
 public bool SaveUserBuySellTransactions(UserTransactionsBO objUserTransactionBO)
 {
     return(objProfileInfoDAO.SaveUserBuySellTransactions(objUserTransactionBO));
 }
Beispiel #4
0
 public string SaveUserBuySellTransactionDetails(UserTransactionsBO objUserTransactionsBO)
 {
     return(objProfileInfoDAO.SaveUserBuySellTransactionDetails(objUserTransactionsBO));
 }
 public IHttpActionResult SaveUserBuySellTransactionDetails([FromBody] UserTransactionsBO objUserTransactionsBO)
 {
     return(ResponseMessage(Request.CreateResponse(HttpStatusCode.OK, objProfileInfoService.SaveUserBuySellTransactionDetails(objUserTransactionsBO))));
 }