Пример #1
0
 //插入数据
 public void Insert(HistoryStockHoldEntity HSHE)
 {
     SQLiteCommand cmd = new SQLiteCommand(conn);
     cmd.CommandText = "insert into '" + user + "_HistoryStockHold' values(@id,@date,@number,@change,@money)";
     cmd.Parameters.Add(new SQLiteParameter("id", HSHE.id));
     cmd.Parameters.Add(new SQLiteParameter("date", Convert.ToDateTime(HSHE.date.ToString("yyyy-MM-dd"))));
     cmd.Parameters.Add(new SQLiteParameter("number", HSHE.number));
     cmd.Parameters.Add(new SQLiteParameter("change", HSHE.change));
     cmd.Parameters.Add(new SQLiteParameter("money", HSHE.money));
     cmd.ExecuteNonQuery();
 }
Пример #2
0
        //插入数据
        public void Insert(HistoryStockHoldEntity HSHE)
        {
            SQLiteCommand cmd = new SQLiteCommand(conn);

            cmd.CommandText = "insert into '" + user + "_HistoryStockHold' values(@id,@date,@number,@change,@money)";
            cmd.Parameters.Add(new SQLiteParameter("id", HSHE.id));
            cmd.Parameters.Add(new SQLiteParameter("date", Convert.ToDateTime(HSHE.date.ToString("yyyy-MM-dd"))));
            cmd.Parameters.Add(new SQLiteParameter("number", HSHE.number));
            cmd.Parameters.Add(new SQLiteParameter("change", HSHE.change));
            cmd.Parameters.Add(new SQLiteParameter("money", HSHE.money));
            cmd.ExecuteNonQuery();
        }
Пример #3
0
 //按类型转换
 private StockHoldEntity DealList_Insert_StockHold(DealListEntity DLE)
 {
     if (DLE.deal >= dealid)
         dealid = DLE.deal + 1;
     StockHoldEntity SHE = new StockHoldEntity();
     SHE.id = DLE.id;
     SHE.name = DLE.name;
     double c;
     if (DLE.type == "买入")
     {
         SHE.hold = DLE.number;
         c = -(DLE.number * DLE.money);
         MoneyChangeNow(c);
     }
     else if (DLE.type == "卖出")
     {
         SHE.hold = -DLE.number;
         c = DLE.number * DLE.money;
         MoneyChangeNow(c);
     }
     else if (DLE.type == "补仓")
     {
         SHE.hold = DLE.number;
         c = -(DLE.number * DLE.money);
         MoneyChangeNow(c);
     }
     else if (DLE.type == "卖空")
     {
         SHE.hold = -DLE.number;
         c = DLE.number * DLE.money;
         MoneyChangeNow(c);
     }
     else
     {
         SHE.hold = DLE.number;
         c = -(DLE.number * DLE.money);
         MoneyChangeNow(c);
     }
     SHE.money = -c;
     StockHoldEntity SHE_=new StockHoldEntity();
     SHE_.id = SHE.id;
     stockhold.Select(ref SHE_);
     HistoryStockHoldEntity HSHE = new HistoryStockHoldEntity();
     HSHE.id = SHE.id;
     HSHE.number = SHE_.hold;
     HSHE.date = DLE.date;
     HSHE.change = SHE.hold;
     HSHE.money = DLE.money;
     historystockhold.Insert(HSHE);
     if (SHE_.name != null)
     {
         SHE.hold = SHE.hold + SHE_.hold;
         SHE.money = Convert.ToDouble(SHE.money) + Convert.ToDouble(SHE_.money);
         stockhold.Update(SHE);
     }
     else
     {
         stockhold.Insert(SHE);
     }
     return SHE;
     //StockHoldSet(SHE);
 }