Esempio n. 1
0
    public async void Send_product()
    {
        Data_item_stack item_stac = new Data_item_stack()
        {
            Amount = 1, Id_item = itemId, Id_list = data_building.Id_list
        };
        await SQL_Manager.Insert <Data_item_stack>("Item_stack", item_stac);

        done = true;
    }
Esempio n. 2
0
    public async Task  Send()
    {
        if (building1.Id == building2.Id)
        {
            return;
        }
        gameObject.SetActive(false);             //wylacza interface z widoku

        GameObject car = GameObject.Find("Car"); //wczytuje samochod


        print(building1.Location + " " + building2.Location);
        GameObject buildingA = Building.Find(building1.Id);
        GameObject buildingB = Building.Find(building2.Id);

        //tworze nowe zamowienie
        Data_item_list new_list = new Data_item_list()
        {
            Name = "Order#" + UnityEngine.Random.Range(0, 100000)
        };
        string list_id = await SQL_Manager.Insert <Data_item_list>("Item_list", new_list);

        Data_deliver order = new Data_deliver();

        order.Id_b1   = building1.Id;
        order.Id_b2   = building2.Id;
        order.Date    = DateTime.Now.ToString("MM/dd/yyyy H:mm");
        order.Id_list = int.Parse(list_id);
        await SQL_Manager.Insert <Data_deliver>("Deliver", order);

        //przesylam produkty

        foreach (var item in products)
        {
            item.Id_list = order.Id_list;  //tworze historie zamowieniea
            await SQL_Manager.Insert <Data_item_stack>("Item_stack", item);


            item.Id_list = building2.Id_list;  //zmiana na liste w drugim magazynie
            await SQL_Manager.Update <Data_item_stack>("Item_stack", item.Id, item);
        }
        new A_Deliver(car, buildingA, buildingB, products.Count); //akcja
    }
    async void Send_data()
    {
        Data_item_list data_list = new Data_item_list()
        {
            Name = "List#" + Random.Range(1000, 10000)
        };
        string new_id = await SQL_Manager.Insert <Data_item_list>("Item_list", data_list);

        Data_building b   = (Data_building)B_obj;
        Vector3       pos = A_obj.transform.position;

        data_pb             = new Data_player_building();
        data_pb.Id_building = b.Id;
        data_pb.Id_player   = 1;
        data_pb.Id_list     = int.Parse(new_id);
        data_pb.Location    = Mathf.RoundToInt(pos.x).ToString() + ",0," + Mathf.RoundToInt(pos.z).ToString();

        string building_id = await SQL_Manager.Insert <Data_player_building>("Player_building", data_pb);

        A_obj.GetComponent <Building>().B_data_player_building = data_pb;
        A_obj.GetComponent <Building>().B_data_building        = b;

        A_obj.GetComponent <Building>().B_data_player_building.Id = int.Parse(building_id);
    }
Esempio n. 4
0
 public async void send()//
 {
     await SQL_Manager.Insert(JsonUtility.ToJson(B_obj), table);
 }