Exemplo n.º 1
0
 public static DBManagerScr getInstance()
 {
     if (instance == null)
     {
         instance = new DBManagerScr();
     }
     return(instance);
 }
Exemplo n.º 2
0
    public void buttonEnterClick()
    {
        string finalyStr = "Don`t found product with this ID. Please, enter another ID.";

        try
        {
            int     id   = int.Parse(inputField.GetComponent <Text>().text);
            Product prod = DBManagerScr.getInstance().GetById(id);

            if (prod != null)
            {
                finalyStr = "Id = " + prod.id.ToString() + "\nName: " + prod.name + "\nDescription: " + prod.description + "\n";
            }
        }
        catch (Exception e)
        {
            finalyStr = "ID must consist only numbers!";
        }
        finally
        {
            outField.GetComponent <Text>().text = finalyStr;
        }
    }