示例#1
0
    public void MakeNewHistory(int index)
    {
        if (CoinInfo.Instance.m_HistoryList[index].Month == 0)
        {
            return;
        }
        GameObject  obj     = Instantiate(pf_HistoryObj, m_Content.transform);
        HistoryInfo info    = obj.GetComponent <HistoryInfo>();
        SellHistory history = CoinInfo.Instance.m_HistoryList[index];

        info.m_SellDayTxt.text  = history.Year.ToString() + "/" + history.Month.ToString() + "/" + history.Day.ToString();
        info.m_SellTimeTxt.text = history.Hour.ToString() + ":" + history.Minute.ToString() + ":" + history.second.ToString();
        info.m_CoinIcon.sprite  = m_CoinSelect.m_Coins[history.CoinIndex].m_Icon.sprite;
        info.m_CoinNameTxt.text = m_CoinSelect.m_Coins[history.CoinIndex].m_CoinName.text;
        info.m_CoinSymTxt.text  = m_CoinSelect.m_Coins[history.CoinIndex].m_CoinSym.text;
        if (history.Money > 0)
        {
            info.m_ProfitTxt.color = new Color32(255, 0, 0, 255);
            info.m_ProfitTxt.text  = "+" + string.Format("{0:n0}", history.Money) + " 원(+" + string.Format("{0:F2}", history.Profit) + "%)";
        }
        else
        {
            info.m_ProfitTxt.color = new Color32(0, 0, 255, 255);
            info.m_ProfitTxt.text  = string.Format("{0:n0}", history.Money) + " 원(" + string.Format("{0:F2}", history.Profit) + "%)";
        }
        m_HistoryObjList.Add(obj);
        obj.transform.SetAsFirstSibling();
    }
        public void Save(SellHistory aSellHistory)
        {
            Connection.Open();
            Query    = "insert into SellHistory_tbl values('" + aSellHistory.Date + "'," + aSellHistory.Quantity + "," + aSellHistory.ItemId + ")";
            Command  = new SqlCommand(Query, Connection);
            RowCount = Command.ExecuteNonQuery();

            Connection.Close();
        }
示例#3
0
        public void GetSellHistoryTest()
        {
            foreach (AppId.AppName appId in Enum.GetValues(typeof(AppId.AppName)))
            {
                int page = 1;
                List <SellHistoryRecord> sellHistoryRecords = SellHistory.GetSellHistory(appId, page);
                while (sellHistoryRecords.Count != 0)
                {
                    page++;
                    sellHistoryRecords = SellHistory.GetSellHistory(appId, page);
                }
            }

            Assert.IsTrue(true);
        }
        public void Sell(List <StockOutChartVM> chartList, int whatToDo)
        {
            Dictionary <int, int> itemIdMap = new Dictionary <int, int>();

            foreach (StockOutChartVM astock in chartList)
            {
                int itemId   = astock.ItemId;
                int quantity = 0;
                int res;
                if (!itemIdMap.TryGetValue(astock.ItemId, out res))
                {
                    itemIdMap.Add(astock.ItemId, 1);

                    foreach (StockOutChartVM aInnerstock in chartList)
                    {
                        if (aInnerstock.ItemId == itemId)
                        {
                            quantity += aInnerstock.Quantity;
                        }
                    }

                    Stock baseStock = new Stock();

                    baseStock           = aStockManager.GetAStockByItemId(itemId);
                    baseStock.Quantity -= quantity;
                    int row = aStockGateway.Update(baseStock);

                    if (row > 0 && whatToDo == 1)
                    {
                        SellHistory aSellHistory = new SellHistory();
                        aSellHistory.Date     = DateTime.Today;
                        aSellHistory.Quantity = quantity;
                        aSellHistory.ItemId   = itemId;
                        aSellGateway.Save(aSellHistory);
                    }
                }
            }
        }