コード例 #1
0
    public void addOrder(OrderInfo orderInfo)
    {
        User    user        = CurrentUser.Current;
        Kingdom userKingdom = new KingdomDAO().GetByUserId(user.UserId);

        OrderType orderType = new OrderTypeDAO().GetByName(orderInfo.orderType);

        Order orderToAdd = new Order();

        orderToAdd.Count              = orderInfo.unitCount;
        orderToAdd.KingdomId          = userKingdom.KingdomId;
        orderToAdd.Epoch              = new EpochDAO().GetCurrentByMapId(userKingdom.MapId).EpochId;
        orderToAdd.FieldId            = orderInfo.sourceTileId;
        orderToAdd.FieldIdDestination = orderInfo.destinationTileId;
        orderToAdd.OrderTypeId        = orderType.OrderTypeId;
        orderToAdd.UnitTypeId         = 1; //Na razie mamy hardcode na piechote

        //db.AddInParameter(cmd, "OrderTypeId", DbType.Int32, this.DataObject.OrderTypeId);
        //db.AddInParameter(cmd, "FieldId", DbType.Int32, this.DataObject.FieldId);
        //db.AddInParameter(cmd, "FieldIdDestination", DbType.Int32, this.DataObject.FieldIdDestination);
        //db.AddInParameter(cmd, "Epoch", DbType.Int32, this.DataObject.Epoch);
        //db.AddInParameter(cmd, "Count", DbType.Int32, this.DataObject.Count);
        //db.AddInParameter(cmd, "UnitTypeId", DbType.Int32, this.DataObject.UnitTypeId);
        // db.AddInParameter(cmd, "KingdomId", DbType.Int32, this.DataObject.KingdomId);


        new OrderDAO().Add(orderToAdd);
    }
コード例 #2
0
ファイル: SeppukuService.cs プロジェクト: Lucasus/sepuku
	public void addOrder(OrderInfo orderInfo)
	{
        User user = CurrentUser.Current;
        Kingdom userKingdom = new KingdomDAO().GetByUserId(user.UserId);

		OrderType orderType = new OrderTypeDAO().GetByName(orderInfo.orderType);

		Order orderToAdd = new Order();

		orderToAdd.Count = orderInfo.unitCount;
        orderToAdd.KingdomId = userKingdom.KingdomId;
		orderToAdd.Epoch = new EpochDAO().GetCurrentByMapId(userKingdom.MapId).EpochId;
		orderToAdd.FieldId = orderInfo.sourceTileId;
		orderToAdd.FieldIdDestination = orderInfo.destinationTileId;
        orderToAdd.OrderTypeId = orderType.OrderTypeId;
        orderToAdd.UnitTypeId = 1; //Na razie mamy hardcode na piechote

        //db.AddInParameter(cmd, "OrderTypeId", DbType.Int32, this.DataObject.OrderTypeId);
        //db.AddInParameter(cmd, "FieldId", DbType.Int32, this.DataObject.FieldId);
        //db.AddInParameter(cmd, "FieldIdDestination", DbType.Int32, this.DataObject.FieldIdDestination);
        //db.AddInParameter(cmd, "Epoch", DbType.Int32, this.DataObject.Epoch);
        //db.AddInParameter(cmd, "Count", DbType.Int32, this.DataObject.Count);
        //db.AddInParameter(cmd, "UnitTypeId", DbType.Int32, this.DataObject.UnitTypeId);
       // db.AddInParameter(cmd, "KingdomId", DbType.Int32, this.DataObject.KingdomId);


		new OrderDAO().Add(orderToAdd);
	}