예제 #1
0
    // Use this for initialization
    void Start()
    {
        SoundManager = GameObject.Find("SoundManager");
        Charakter    = GameObject.Find("Charakter");
        Inventar     = GameObject.Find("Inventar");
        myCtrl       = Charakter.GetComponent <Ctrl>();
        myInventar   = Inventar.GetComponent <Inventar>();

        // Mit Animator verbinden --------------------------------------------------------
        animatorRod = this.GetComponent <Animator>();
        Rightarm    = GameObject.Find("Rightarm");
        Leftarm     = GameObject.Find("Leftarm");
        Charakter   = GameObject.Find("Charakter");
        Fishsorts   = new List <string>();
        Fishsorts.Add("Carp");
        Fishsorts.Add("Can");
        Fishsorts.Add("Fishbone");
        Fishsorts.Add("Bottlepost");
        Fishsorts.Add("Frog");
        Fishsorts.Add("Snail");
        Fishsorts.Add("Lobster");
        Fishsorts.Add("Blowfish");
        Fishsorts.Add("Lampfish");
        Fishsorts.Add("Shell");
        Fishsorts.Add("Rainbowtrout");
        Fishsorts.Add("Ink");
        Fishsorts.Add("Octopus");
    }
예제 #2
0
        public ActionResult Snimi(UrediVM model)
        {
            Inventar x;

            if (!ModelState.IsValid)
            {
                model.ZaposlenikStavke = ZaposlenikStavke();
                model.SobaStavke       = SobeStavke();

                return(View("Uredi", model));
            }
            if (model.Id == 0)
            {
                x = new Inventar();
                db.Inventari.Add(x);
            }
            else
            {
                x = db.Inventari.Find(model.Id);
            }

            x.Naziv        = model.Naziv;
            x.Opis         = model.Opis;
            x.Cijena       = model.Cijena;
            x.Upotrebljivo = model.Upotrebljivo;
            x.SobaId       = model.SobaId;
            x.ZaposlenikId = model.ZaposlenikId;
            db.SaveChanges();
            return(RedirectToAction("Prikazi"));
        }
        public async Task <IActionResult> Edit(int id, [Bind("InventarId,InventarName,Count,TeamId")] Inventar inventar)
        {
            if (id != inventar.InventarId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(inventar);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InventarExists(inventar.InventarId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TeamId"] = new SelectList(_context.Team, "TeamId", "NameTeam", inventar.TeamId);
            return(View(inventar));
        }
예제 #4
0
 private void Start()
 {
     inventar = FindObjectOfType <Inventar>();
     player   = FindObjectOfType <PlayerUse>();
     HideAllWeapons();
     player.Weapon = inventar.Weapons[(int)EInventar.Weapon1];
     player.Weapon.SetActive(true);
 }
예제 #5
0
파일: Shop.cs 프로젝트: Hotrak/My-Projects
 void Start()
 {
     KeyHelp  = Resources.Load("E") as GameObject;
     player   = FindObjectOfType <PlayerControls>();
     inventar = FindObjectOfType <Inventar>();
     mianMenu = FindObjectOfType <GameMenu>();
     CheckPlayer();
 }
예제 #6
0
        public ActionResult DeleteConfirmed(int id)
        {
            Inventar inventar = db.Inventars.Find(id);

            db.Inventars.Remove(inventar);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #7
0
 public void Delete(Inventar El)
 {
     for (int i = 0; i < cont.Count; i++)
     {
         if (El.Equals(cont[i]))
         {
             cont.RemoveAt(i);
         }
     }
 }
예제 #8
0
 public ActionResult Edit([Bind(Include = "Id,Name,Number,Value,DateReceived,InspectionDate,NextInspectionDate,Expiration,State")] Inventar inventar)
 {
     if (ModelState.IsValid)
     {
         db.Entry(inventar).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(inventar));
 }
예제 #9
0
 // Use this for initialization
 void Start()
 {
     Rightarm   = GameObject.Find("Rightarm");
     Leftarm    = GameObject.Find("Leftarm");
     Mouse      = GameObject.Find("Mouse");
     myMouse    = Mouse.GetComponent <Mouse>();
     Handwerk   = GameObject.Find("Handwerk");
     myCrafting = Handwerk.GetComponent <Crafting>();
     myInventar = Handwerk.GetComponent <Inventar>();
 }
예제 #10
0
    private void Start()
    {
        componentRigidbody = GetComponent <Rigidbody2D>();
        inventar           = FindObjectOfType <Inventar>();
        mazeManager        = FindObjectOfType <MazeManager>();


        //hels = maxHels;

        LvlUp(0);
    }
예제 #11
0
        public ActionResult Create([Bind(Include = "Id,Name,Number,Value,DateReceived,InspectionDate,NextInspectionDate,Expiration,State")] Inventar inventar)
        {
            if (ModelState.IsValid)
            {
                db.Inventars.Add(inventar);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(inventar));
        }
        public async Task <IActionResult> Create([Bind("InventarId,InventarName,Count,TeamId")] Inventar inventar)
        {
            if (ModelState.IsValid)
            {
                _context.Add(inventar);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TeamId"] = new SelectList(_context.Team, "TeamId", "NameTeam", inventar.TeamId);
            return(View(inventar));
        }
예제 #13
0
            public Data()
            {
                ListaUposlenika = new ListaUposlenika();
                Stavke          = new Dictionary <NivoPristupa, List <MeniStavka> >();
                Inventar        = new Inventar();

                Stavke[NivoPristupa.Nivo1] = new List <MeniStavka>();
                Stavke[NivoPristupa.Nivo2] = new List <MeniStavka>();
                Stavke[NivoPristupa.Nivo3] = new List <MeniStavka>();
                Stavke[NivoPristupa.Nivo4] = new List <MeniStavka>();

                kreirajStavke();
            }
예제 #14
0
 private void Init()
 {
     inventar = FindObjectOfType <Inventar>();
     player   = FindObjectOfType <PlayerUse>();
     if (player.Weapon.GetComponent <WeaponController>() != null)
     {
         weaponController = FindObjectOfType <PlayerUse>().Weapon.GetComponent <WeaponController>();
     }
     if (player.Weapon.GetComponent <WeaponUse>() != null)
     {
         weapon = FindObjectOfType <PlayerUse>().Weapon.GetComponent <WeaponUse>();
     }
 }
        public IActionResult Uredi(InventarDodajViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(GetDefaultViewModel(viewModel)));
            }

            Inventar inventar = viewModel.Inventar;

            db.Inventar.Update(inventar);
            db.SaveChanges();

            return(RedirectToAction(nameof(Index)));
        }
예제 #16
0
        // GET: Inventars/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Inventar inventar = db.Inventars.Find(id);

            if (inventar == null)
            {
                return(HttpNotFound());
            }
            return(View(inventar));
        }
        public IActionResult Dodaj(InventarDodajViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(GetDefaultViewModel(viewModel)));
            }

            Inventar inventar = viewModel.Inventar;

            inventar.Ispravno = true;
            inventar.Zauzeto  = false;

            db.Inventar.Add(inventar);
            db.SaveChanges();

            return(RedirectToAction(nameof(Index)));
        }
예제 #18
0
    private void Awake()
    {
        Debug.Log("LOAD");
        LoadSave();
        mazeLvl = 0;

        //playerLvl = 3;
        //playerLvlXp = 80;
        mazeSpawner = FindObjectOfType <MazeSpawner>();
        player      = FindObjectOfType <PlayerControls>();
        inventar    = FindObjectOfType <Inventar>();
        try
        {
            mazeLvl = User.USER_INFO.mazeLvl;

            player.lvl   = User.USER_INFO.lvl;
            player.lvlXp = User.USER_INFO.lvlxp;

            player.isFrize     = User.USER_INFO.frize;
            player.isLifeStill = User.USER_INFO.lifeStill;
            player.LvlUp(0);
            player.hels = player.maxHels;

            inventar.shiltCount = User.USER_INFO.shiltCount;
            inventar.boombCount = User.USER_INFO.bombCount;
            inventar.slizeCount = User.USER_INFO.slimeCount;
        } catch (Exception e)
        {
            Debug.Log("Ошибка рпри загрузке 1");
        }



        ColculatwMaze();
        statTrak = 0;
        timer    = 0;
    }
예제 #19
0
 public virtual void iAmPrinting(Inventar invent)
 {
     Console.WriteLine(invent.GetType());
     Console.WriteLine(invent.ToString());
 }
예제 #20
0
        static void Main(string[] args)
        {
            // For abstract class
            Console.WriteLine("Полиморфизм (сложение длин строк):");
            Inventar skameika = new Skameika()
            {
                name = "скамейка", count = 8
            };
            string a = "Bed";

            Console.WriteLine($"\0{skameika.V_method(a.Length)}");
            Console.WriteLine();

            // For interface

            Brusia br = new Brusia()
            {
                name = "брусья", count = 3
            };
            string brusia2 = "Brusia";

            Console.WriteLine($"Реализация работы с интерфейсом:\0");
            Console.WriteLine($"\0сумма пар брусьев:\0{br.Summ(br.brusia, 4)}");
            Console.WriteLine($"\0сумма строк:\0{br.Summ(brusia2)}");
            Console.WriteLine();


            Console.WriteLine("Введите общее количество мячей:\0");
            int balls1 = Int32.Parse(Console.ReadLine());

            Console.WriteLine("Введите количество мячей, которые вы можете предоставить:\0");
            int  balls2 = Int32.Parse(Console.ReadLine());
            Ball ball   = new Ball();

            Console.WriteLine($"\0сумма ваших мячей:\0{ball.Summ(balls1, balls2)}");
            Console.WriteLine($"\0произведение ваших мячей:\0{ball.Umn(balls1, balls2)}");
            Console.WriteLine();


            Console.WriteLine("Реализация работы с is:");
            Maty maty = new Maty()
            {
                name = "маты", count = 10
            };

            Console.Write("\0принадлежит ли созданный объект maty классу Ball:\0");
            maty.Proverka(maty);
            Console.WriteLine();


            Tennis one = new Tennis();

            Console.WriteLine("Переопределенные методы:\0");
            Console.WriteLine($"\0Equals:\0{one.Equals("Table")};");
            Console.WriteLine($"\0GetHashCode:\0{one.GetHashCode()};");
            Console.WriteLine($"\0ToString:\0{one.ToString()};");
            Console.WriteLine();


            Console.WriteLine("Информация о классах:\0");
            Console.WriteLine(skameika.ToString());
            Console.WriteLine(br.ToString());
            Bask_ball bas = new Bask_ball();

            Console.WriteLine(bas.ToString());
            Console.WriteLine();


            Console.WriteLine($"Работа класса Printer:\0");

            Inventar[] array = new Inventar[4];
            array[0] = skameika;
            array[1] = maty;
            array[2] = ball;
            array[3] = br;

            Printer pr = new Printer();

            for (int i = 0; i < 4; i++)
            {
                pr.iAmPrinting(array[i]);
            }
            Console.WriteLine();


            Console.WriteLine("Работа со структурой:");
            Zal zal;

            zal.thing = "мяч";
            zal.count = 6;
            zal.Print();
            Console.WriteLine();

            Console.WriteLine("Работа с перечислением:");
            AllThings things;

            things = AllThings.table;
            Console.WriteLine($"Количество столов:\0{(int)things}");
            Console.WriteLine();

            Console.WriteLine("Работа с контейнером:");
            Container_for_Zal cont = new Container_for_Zal();

            cont.Push(skameika);
            cont.Push(br);
            cont.Push(maty);

            Console.WriteLine("\tВесь список вещей:\0");
            cont.Show();

            cont.Delete(br);
            Console.WriteLine("\tСписок вещей после удаления одной из них:\0");
            cont.Show();
            Console.WriteLine();
            Console.Write("\0Общее количество вещей:\0");
            cont.Count_();
            Console.WriteLine();


            Console.WriteLine("Работа с контроллером:");
            Controller cont1 = new Controller(cont);

            cont1.Sort();
        }
예제 #21
0
 // Use this for initialization
 void Start()
 {
     manager = GameObject.Find ("GameManager");
     inv = manager.GetComponent<Inventar>();
     gameObject.tag = this.tag;
 }
예제 #22
0
파일: KeyUse.cs 프로젝트: L0ade33or/unity
 // Use this for initialization
 void Start()
 {
     inv = GameObject.Find ("GameManager").GetComponent<Inventar> ();
     output = GetComponent<Text>();
 }
예제 #23
0
 public void Delete(Inventar entity)
 {
     throw new NotImplementedException();
 }
        private void btnSalvareC_Click(object sender, RoutedEventArgs e)
        {
            Comenzi order         = null;
            Comenzi selectedOrder = null;

            if (actionComenzi == ActionState.New)
            {
                try
                {
                    //instantiem Comenzi entity
                    Clienti  customer = (Clienti)cmbClienti.SelectedItem;
                    Inventar book     = (Inventar)cmbInventar.SelectedItem;

                    order = new Comenzi()
                    {
                        ClientID = customer.ClientId,
                        CarteID  = book.CarteId,
                    };
                    //adaugam entitatea nou creata in context
                    ctx.Comenzis.Add(order);
                    clientiComenzisViewSource.View.Refresh();
                    //salvam modificarile
                    ctx.SaveChanges();
                }
                //using System.Data;
                catch (DataException ex)
                {
                    MessageBox.Show(ex.Message);
                }

                btnNouC.IsEnabled         = true;
                btnEditareC.IsEnabled     = true;
                btnSalvareC.IsEnabled     = false;
                btnAnulareC.IsEnabled     = false;
                btnStergereC.IsEnabled    = true;
                btnPrecedentulC.IsEnabled = true;
                btnUrmatorulC.IsEnabled   = true;
            }
            else if (actionComenzi == ActionState.Edit)
            {
                selectedOrder = (Comenzi)comenzisDataGrid.SelectedItem;


                //customer = (Clienti)clientiDataGrid.SelectedItem;
                //customer.Nume = numeTextBox.Text.Trim();
                //customer.Prenume = prenumeTextBox.Text.Trim();
                //customer.Telefon = telefonTextBox.Text.Trim();
                try
                {
                    int curr_id     = selectedOrder.ComandaId;
                    var editedOrder = ctx.Comenzis.FirstOrDefault(s => s.ComandaId == curr_id);

                    if (editedOrder != null)
                    {
                        Clienti  customer = (Clienti)cmbClienti.SelectedItem;
                        Inventar book     = (Inventar)cmbInventar.SelectedItem;
                        editedOrder.ClientID = customer.ClientId; // int.Parse(cmbClienti.SelectedValue.ToString());
                        editedOrder.CarteID  = book.CarteId;      // int.Parse(cmbInventar.SelectedValue.ToString());
                        ctx.SaveChanges();
                    }
                    //Clienti customer = (Clienti)cmbClienti.SelectedItem;
                    //Inventar book = (Inventar)cmbInventar.SelectedItem;
                    //order = (Comenzi)comenzisDataGrid.SelectedItem;
                    //order.ClientID = customer;
                    //order.Autor = autorTextBox.Text.Trim();
                    //order.Pret = int.Parse(pretTextBox.Text);
                    //salvam modificarile
                }
                catch (DataException ex)
                {
                    MessageBox.Show(ex.Message);
                }

                // pozitionarea pe item-ul curent
                clientiComenzisViewSource.View.Refresh();
                clientiComenzisViewSource.View.MoveCurrentTo(selectedOrder);

                btnNouC.IsEnabled         = true;
                btnEditareC.IsEnabled     = true;
                btnSalvareC.IsEnabled     = false;
                btnAnulareC.IsEnabled     = false;
                btnStergereC.IsEnabled    = true;
                btnPrecedentulC.IsEnabled = true;
                btnUrmatorulC.IsEnabled   = true;
            }
            else if (actionComenzi == ActionState.Delete)
            {
                try
                {
                    selectedOrder = (Comenzi)comenzisDataGrid.SelectedItem;
                    int curr_id      = selectedOrder.ComandaId;
                    var deletedOrder = ctx.Comenzis.FirstOrDefault(s => s.ComandaId == curr_id);

                    if (deletedOrder != null)
                    {
                        ctx.Comenzis.Remove(deletedOrder);
                        ctx.SaveChanges();
                        MessageBox.Show("Comanda stearsa cu succes!", "Message");
                    }
                }
                catch (DataException ex)
                {
                    MessageBox.Show(ex.Message);
                }
                clientiComenzisViewSource.View.Refresh();
                btnNouC.IsEnabled         = true;
                btnEditareC.IsEnabled     = true;
                btnSalvareC.IsEnabled     = false;
                btnAnulareC.IsEnabled     = false;
                btnPrecedentulC.IsEnabled = true;
                btnUrmatorulC.IsEnabled   = true;
            }
        }
        private void btnSalvareI_Click(object sender, RoutedEventArgs e)
        {
            Inventar book = null;

            if (actionInventar == ActionState.New)
            {
                try
                {
                    //instantiem Inventar entity
                    book = new Inventar()
                    {
                        Titlu = titluTextBox.Text.Trim(),
                        Autor = autorTextBox.Text.Trim(),
                        Pret  = int.Parse(pretTextBox.Text),
                    };
                    //adaugam entitatea nou creata in context
                    ctx.Inventars.Add(book);
                    inventarViewSource.View.Refresh();
                    //salvam modificarile
                    ctx.SaveChanges();
                }
                //using System.Data;
                catch (DataException ex)
                {
                    MessageBox.Show(ex.Message);
                }

                btnNouI.IsEnabled         = true;
                btnEditareI.IsEnabled     = true;
                btnSalvareI.IsEnabled     = false;
                btnAnulareI.IsEnabled     = false;
                btnStergereI.IsEnabled    = true;
                btnPrecedentulI.IsEnabled = true;
                btnUrmatorulI.IsEnabled   = true;

                titluTextBox.Text = "";
                autorTextBox.Text = "";
                pretTextBox.Text  = "";

                titluTextBox.IsEnabled = true;
                autorTextBox.IsEnabled = true;
                pretTextBox.IsEnabled  = true;
            }
            else if (actionInventar == ActionState.Edit)
            {
                try
                {
                    book       = (Inventar)inventarDataGrid.SelectedItem;
                    book.Titlu = titluTextBox.Text.Trim();
                    book.Autor = autorTextBox.Text.Trim();
                    book.Pret  = int.Parse(pretTextBox.Text);
                    //salvam modificarile
                    ctx.SaveChanges();
                }
                catch (DataException ex)
                {
                    MessageBox.Show(ex.Message);
                }

                // pozitionarea pe item-ul curent
                inventarViewSource.View.Refresh();
                inventarViewSource.View.MoveCurrentTo(book);
                btnNouI.IsEnabled         = true;
                btnEditareI.IsEnabled     = true;
                btnSalvareI.IsEnabled     = false;
                btnAnulareI.IsEnabled     = false;
                btnStergereI.IsEnabled    = true;
                btnPrecedentulI.IsEnabled = true;
                btnUrmatorulI.IsEnabled   = true;

                titluTextBox.Text = "";
                autorTextBox.Text = "";
                pretTextBox.Text  = "";

                titluTextBox.IsEnabled = true;
                autorTextBox.IsEnabled = true;
                pretTextBox.IsEnabled  = true;
            }
            else if (actionInventar == ActionState.Delete)
            {
                try
                {
                    book = (Inventar)inventarDataGrid.SelectedItem;
                    ctx.Inventars.Remove(book);
                    ctx.SaveChanges();
                }
                catch (DataException ex)
                {
                    MessageBox.Show(ex.Message);
                }
                inventarViewSource.View.Refresh();
                btnNouI.IsEnabled         = true;
                btnEditareI.IsEnabled     = true;
                btnSalvareI.IsEnabled     = false;
                btnAnulareI.IsEnabled     = false;
                btnPrecedentulI.IsEnabled = true;
                btnUrmatorulI.IsEnabled   = true;

                titluTextBox.Text = "";
                autorTextBox.Text = "";
                pretTextBox.Text  = "";

                titluTextBox.IsEnabled = true;
                autorTextBox.IsEnabled = true;
                pretTextBox.IsEnabled  = true;
            }
        }
예제 #26
0
        static void Main(string[] args)
        {
            //Ex.7
            Console.WriteLine($"Работа с исключениями (задание1):\0");

            Console.Write($"\0Введите число:\0");
            double element = Convert.ToInt32(Console.ReadLine());

            if (element == 0)
            {
                Debug.Assert(element != 0, "Произойдет деление на нуль!");
            }

            try
            {
                if (element != 0)
                {
                    double y = (8.0 / element);
                    Console.WriteLine(y);
                }

                else
                {
                    throw new Exception_1("\0Нельзя делить на нуль!");
                }
            }

            catch (Exception_1 ex1)
            {
                Console.WriteLine(ex1.Message);
                Console.WriteLine(ex1.StackTrace);
            }
            Console.WriteLine();


            Int64 el = 2;

            Console.WriteLine($"\0Наш элемент:{el.GetType()}\0");

            try
            {
                if (el.GetTypeCode() == TypeCode.Byte)
                {
                    el = 1;
                    Console.WriteLine(el);
                }

                else
                {
                    throw new FromEx2("\0Невозможно преобразовать!");
                }
            }

            catch (FromEx2 u)
            {
                Console.WriteLine(u.Message);
                Console.WriteLine(u.StackTrace);
            }
            Console.WriteLine();

            string h = null;

            try
            {
                if (h != null)
                {
                    string h2 = h.ToUpper();
                    Console.WriteLine(h2);
                }

                else
                {
                    throw new FromEx("\0Невозможно работать с null");
                }
            }

            catch (FromEx ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
            }
            Console.WriteLine();


            int[] array_ = new int[2];

            for (int i = 0; i < array_.Length; i++)
            {
                array_[i] = 6;
            }

            try
            {
                array_[3] = 5;
            }


            catch (IndexOutOfRangeException ex) when(array_.Length < 3)
            {
                Console.WriteLine(ex.Message);
            }
            Console.WriteLine();

            try
            {
                int al   = 8;
                int elll = 0;
                int y    = al / elll;
                Console.WriteLine(y);
            }

            catch
            {
                Console.WriteLine("\0Ошибка!");
            }

            finally
            {
                Console.WriteLine("\0Конец программы!");
            }

            Console.WriteLine("\0Работа с Assert");



            // For abstract class
            Console.WriteLine("Полиморфизм (сложение длин строк):");
            Inventar skameika = new Skameika()
            {
                name = "скамейка", count = 8
            };
            string a = "Bed";

            Console.WriteLine($"\0{skameika.V_method(a.Length)}");
            Console.WriteLine();

            // For interface

            Brusia br = new Brusia()
            {
                name = "брусья", count = 3
            };
            string brusia2 = "Brusia";

            Console.WriteLine($"Реализация работы с интерфейсом:\0");
            Console.WriteLine($"\0сумма пар брусьев:\0{br.Summ(br.brusia, 4)}");
            Console.WriteLine($"\0сумма строк:\0{br.Summ(brusia2)}");
            Console.WriteLine();


            Console.WriteLine("Введите общее количество мячей:\0");
            int balls1 = Int32.Parse(Console.ReadLine());

            Console.WriteLine("Введите количество мячей, которые вы можете предоставить:\0");
            int  balls2 = Int32.Parse(Console.ReadLine());
            Ball ball   = new Ball();

            Console.WriteLine($"\0сумма ваших мячей:\0{ball.Summ(balls1, balls2)}");
            Console.WriteLine($"\0произведение ваших мячей:\0{ball.Umn(balls1, balls2)}");
            Console.WriteLine();


            Console.WriteLine("Реализация работы с is:");
            Maty maty = new Maty()
            {
                name = "маты", count = 10
            };

            Console.Write("\0принадлежит ли созданный объект maty классу Ball:\0");
            maty.Proverka(maty);
            Console.WriteLine();


            Tennis one = new Tennis();

            Console.WriteLine("Переопределенные методы:\0");
            Console.WriteLine($"\0Equals:\0{one.Equals("Table")};");
            Console.WriteLine($"\0GetHashCode:\0{one.GetHashCode()};");
            Console.WriteLine($"\0ToString:\0{one.ToString()};");
            Console.WriteLine();


            Console.WriteLine("Информация о классах:\0");
            Console.WriteLine(skameika.ToString());
            Console.WriteLine(br.ToString());
            Bask_ball bas = new Bask_ball();

            Console.WriteLine(bas.ToString());
            Console.WriteLine();


            Console.WriteLine($"Работа класса Printer:\0");

            Inventar[] array = new Inventar[4];
            array[0] = skameika;
            array[1] = maty;
            array[2] = ball;
            array[3] = br;

            Printer pr = new Printer();

            for (int i = 0; i < 4; i++)
            {
                pr.iAmPrinting(array[i]);
            }
            Console.WriteLine();


            Console.WriteLine("Работа со структурой:");
            Zal zal;

            zal.thing = "мяч";
            zal.count = 6;
            zal.Print();
            Console.WriteLine();

            Console.WriteLine("Работа с перечислением:");
            AllThings things;

            things = AllThings.table;
            Console.WriteLine($"Количество столов:\0{(int)things}");
            Console.WriteLine();

            Console.WriteLine("Работа с контейнером:");
            Container_for_Zal cont = new Container_for_Zal();

            cont.Push(skameika);
            cont.Push(br);
            cont.Push(maty);

            Console.WriteLine("\tВесь список вещей:\0");
            cont.Show();

            cont.Delete(br);
            Console.WriteLine("\tСписок вещей после удаления одной из них:\0");
            cont.Show();
            Console.Write("\0Общее количество вещей:\0");
            cont.Count_();
            Console.WriteLine();


            Console.WriteLine("Работа с контроллером:");
            Controller cont1 = new Controller(cont);

            cont1.Sort();
        }
예제 #27
0
 public void Insert(Inventar entity)
 {
     throw new NotImplementedException();
 }
예제 #28
0
 public void Push(Inventar El)
 {
     cont.Add(El);
 }
        private void btnSalveaza1_Click(object sender, RoutedEventArgs e)
        {
            Inventar movie = null;

            if (actionInventar == ActionState.New)
            {
                try
                {
                    //instantiem entitatea Inventar
                    movie = new Inventar()
                    {
                        Titlu     = titluTextBox.Text.Trim(),
                        AnLansare = int.Parse(anLansareTextBox.Text),
                        Pret      = int.Parse(pretTextBox.Text),
                    };
                    //adaugam noua entitate
                    ctx.Inventars.Add(movie);
                    inventarViewSource.View.Refresh();
                    //salvam
                    ctx.SaveChanges();
                }
                //using System.Data;
                catch (DataException ex)
                {
                    MessageBox.Show(ex.Message);
                }

                btnNou1.IsEnabled      = true;
                btnModifica1.IsEnabled = true;
                btnSalveaza1.IsEnabled = false;
                btnAnuleaza1.IsEnabled = false;
                btnSterge1.IsEnabled   = true;
                btnInapoi1.IsEnabled   = true;
                btnInainte1.IsEnabled  = true;

                titluTextBox.Text     = "";
                anLansareTextBox.Text = "";
                pretTextBox.Text      = "";

                titluTextBox.IsEnabled     = true;
                anLansareTextBox.IsEnabled = true;
                pretTextBox.IsEnabled      = true;
            }
            else if (actionInventar == ActionState.Edit)
            {
                try
                {
                    movie           = (Inventar)inventarDataGrid.SelectedItem;
                    movie.Titlu     = titluTextBox.Text.Trim();
                    movie.AnLansare = int.Parse(anLansareTextBox.Text);
                    movie.Pret      = int.Parse(pretTextBox.Text);
                    //salvam
                    ctx.SaveChanges();
                }
                catch (DataException ex)
                {
                    MessageBox.Show(ex.Message);
                }

                // pozitionarea pe item-ul curent
                inventarViewSource.View.Refresh();
                inventarViewSource.View.MoveCurrentTo(movie);
                btnNou1.IsEnabled      = true;
                btnModifica1.IsEnabled = true;
                btnSalveaza1.IsEnabled = false;
                btnAnuleaza1.IsEnabled = false;
                btnSterge1.IsEnabled   = true;
                btnInapoi1.IsEnabled   = true;
                btnInainte1.IsEnabled  = true;

                titluTextBox.Text     = "";
                anLansareTextBox.Text = "";
                pretTextBox.Text      = "";

                titluTextBox.IsEnabled     = true;
                anLansareTextBox.IsEnabled = true;
                pretTextBox.IsEnabled      = true;
            }
            else if (actionInventar == ActionState.Delete)
            {
                try
                {
                    movie = (Inventar)inventarDataGrid.SelectedItem;
                    ctx.Inventars.Remove(movie);
                    ctx.SaveChanges();
                }
                catch (DataException ex)
                {
                    MessageBox.Show(ex.Message);
                }
                inventarViewSource.View.Refresh();
                btnNou1.IsEnabled      = true;
                btnModifica1.IsEnabled = true;
                btnSalveaza1.IsEnabled = false;
                btnAnuleaza1.IsEnabled = false;
                btnInapoi1.IsEnabled   = true;
                btnInainte1.IsEnabled  = true;

                titluTextBox.Text     = "";
                anLansareTextBox.Text = "";
                pretTextBox.Text      = "";

                titluTextBox.IsEnabled     = true;
                anLansareTextBox.IsEnabled = true;
                pretTextBox.IsEnabled      = true;
            }
        }
예제 #30
0
 // Use this for initialization
 void Awake()
 {
     text = GetComponent<Text> ();
     invanzeige = GameObject.Find ("GameManager").GetComponent<Inventar> ();
 }
        private void btnSalveaza2_Click(object sender, RoutedEventArgs e)
        {
            Comenzi order         = null;
            Comenzi selectedOrder = null;

            if (actionComenzi == ActionState.New)
            {
                try
                {
                    //instantiem entitatea Comenzi
                    Clienti  customer = (Clienti)cmbClienti.SelectedItem;
                    Inventar video    = (Inventar)cmbInventar.SelectedItem;

                    order = new Comenzi()
                    {
                        ClientId = customer.ClientId,
                        VideoId  = video.VideoId,
                    };
                    //adaugam entitatea nou creata
                    ctx.Comenzis.Add(order);
                    clientiComenzisViewSource.View.Refresh();
                    //salvam
                    ctx.SaveChanges();
                }
                //using System.Data;
                catch (DataException ex)
                {
                    MessageBox.Show(ex.Message);
                }

                btnNou2.IsEnabled      = true;
                btnModifica2.IsEnabled = true;
                btnSalveaza2.IsEnabled = false;
                btnAnuleaza2.IsEnabled = false;
                btnSterge2.IsEnabled   = true;
                btnInapoi2.IsEnabled   = true;
                btnInainte2.IsEnabled  = true;
            }
            else if (actionComenzi == ActionState.Edit)
            {
                selectedOrder = (Comenzi)comenzisDataGrid.SelectedItem;
                try
                {
                    int curr_id     = selectedOrder.ComandaId;
                    var editedOrder = ctx.Comenzis.FirstOrDefault(s => s.ComandaId == curr_id);

                    if (editedOrder != null)
                    {
                        Clienti  customer = (Clienti)cmbClienti.SelectedItem;
                        Inventar video    = (Inventar)cmbInventar.SelectedItem;
                        editedOrder.ClientId = customer.ClientId;
                        editedOrder.VideoId  = video.VideoId;
                        ctx.SaveChanges();
                    }
                    //salvam
                }
                catch (DataException ex)
                {
                    MessageBox.Show(ex.Message);
                }

                // pozitionarea pe item
                clientiComenzisViewSource.View.Refresh();
                clientiComenzisViewSource.View.MoveCurrentTo(selectedOrder);

                btnNou2.IsEnabled      = true;
                btnModifica2.IsEnabled = true;
                btnSalveaza2.IsEnabled = false;
                btnAnuleaza2.IsEnabled = false;
                btnSterge2.IsEnabled   = true;
                btnInapoi2.IsEnabled   = true;
                btnInainte2.IsEnabled  = true;
            }
            else if (actionComenzi == ActionState.Delete)
            {
                try
                {
                    selectedOrder = (Comenzi)comenzisDataGrid.SelectedItem;
                    int curr_id      = selectedOrder.ComandaId;
                    var deletedOrder = ctx.Comenzis.FirstOrDefault(s => s.ComandaId == curr_id);

                    if (deletedOrder != null)
                    {
                        ctx.Comenzis.Remove(deletedOrder);
                        ctx.SaveChanges();
                        MessageBox.Show("Comanda a fost stearsa!", "Message");
                    }
                }
                catch (DataException ex)
                {
                    MessageBox.Show(ex.Message);
                }
                clientiComenzisViewSource.View.Refresh();
                btnNou2.IsEnabled      = true;
                btnModifica2.IsEnabled = true;
                btnSalveaza2.IsEnabled = false;
                btnAnuleaza2.IsEnabled = false;
                btnInapoi2.IsEnabled   = true;
                btnInainte2.IsEnabled  = true;
            }
        }
예제 #32
0
 void Start()
 {
     Inventar     = new Inventar();
     AudioManager = new AudioManager(GetComponents <AudioSource>());
     AudioManager.PustHudbu();
 }
예제 #33
0
 private void Awake()
 {
     _inventar = FindObjectOfType <Inventar>();
 }