Пример #1
0
        public override bool Equals(object obj)
        {
            var osiagniecia = obj as Osiagniecia;

            if (osiagniecia is null)
            {
                return(false);
            }
            if (Id_prowadzacy != osiagniecia.Id_prowadzacy)
            {
                return(false);
            }
            if (Id_student != osiagniecia.Id_student)
            {
                return(false);
            }
            if (Opis.ToLower() != osiagniecia.Opis.ToLower())
            {
                return(false);
            }
            if (Data.ToLower() != osiagniecia.Data.ToLower())
            {
                return(false);
            }
            if (Rodzaj.ToLower() != osiagniecia.Rodzaj.ToLower())
            {
                return(false);
            }
            return(true);
        }
        public ActionResult Create(int id)
        {
            Opis opis = new Opis();

            opis.SamochodId = id;
            return(View(opis));
        }
Пример #3
0
 public async void DodawanieOpisiku(Opis opis)
 {
     var client     = new HttpClient();
     var jsonOpisik = JsonConvert.SerializeObject(opis);
     var nsc        = new StringContent(jsonOpisik, Encoding.UTF8, "application/json");
     await client.PostAsync(@"https://superapi20200603113044.azurewebsites.net/donkey", nsc);
 }
Пример #4
0
        public async Task <Opis> UpdateSuperOpis(Opis opis)
        {
            if (opis != null && !string.IsNullOrWhiteSpace(opis.Name))
            {
                dbCon.Opisy.Update(opis);
                await dbCon.SaveChangesAsync();

                return(opis);
            }

            throw new Exception("NIE DA SIEE E E E E E");
        }
Пример #5
0
        public async Task <bool> Delete(Opis opis)
        {
            if (opis != null && !string.IsNullOrWhiteSpace(opis.Name))
            {
                dbCon.Opisy.Remove(opis);
                await dbCon.SaveChangesAsync();

                return(true);
            }

            return(false);
        }
        private async void AddOpisik_OnClicked(object sender, EventArgs e)
        {
            var eNazwa = entryNazwa.Text?.Trim();
            var eTresc = editorTresc.Text?.Trim();

            eNazwa = string.IsNullOrEmpty(eNazwa) ? "NowyNiepodanyZostal" : eNazwa;
            eTresc = string.IsNullOrEmpty(eTresc) ? "NowyNiepodanyZostal" : eTresc;
            var nOpis = new Opis {
                Name = eNazwa, Tresc = eTresc
            };
            var w = new WebRestultContent();

            w.DodawanieOpisiku(nOpis);
            await Navigation.PushAsync(new MainPage());
        }
        public ActionResult Create(Opis opis, FormCollection collection)
        {
            if (ModelState.IsValid)
            {
                opisRepository.Add(opis);
                opisRepository.Save();

                TempData["okMessage"] = "Opis został dodany.";
                return(RedirectToAction("Details", "Samochod", new { samId = opis.SamochodId }));
            }
            else
            {
                TempData["errorMessage"] = "Nie dodano opisu";
                return(View(opis));
            }
        }
Пример #8
0
        //#endregion

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            bool unique = false;

            if (Oznakaenabled)
            {
                for (int i = 0; i < MainWindow.Typesc.Len( ); i++)
                {
                    if (Oznaka.Equals(MainWindow.Typesc.GetTypeAtI(i).oznaka) || Oznaka.Equals(""))
                    {
                        unique = true;//greska
                    }
                }
                for (int i = 0; i < MainWindow.Resources.Len( ); i++)
                {
                    if (Oznaka.Equals(MainWindow.Resources.GetResourceAtI(i).oznaka) || Oznaka.Equals(""))
                    {
                        unique = true;//greska
                    }
                }
                for (int i = 0; i < MainWindow.Tags.Len( ); i++)
                {
                    if (Oznaka.Equals(MainWindow.Tags.GetTagAtI(i).oznaka) || Oznaka.Equals(""))
                    {
                        unique = true;//greska
                    }
                }
                if (Oznaka.Equals(" ") || Opis.Equals("") || unique)
                {
                    var s = new messageBox.Window1("Popunite sva polja prema zahtevima");
                    s.ShowDialog( );
                    return;
                }
            }

            Tag t = new Tag(Oznaka, Opis, Boja.ToString());

            if (s.Equals("c"))
            {
                Tag tt = MainWindow.Tags.GetTagById(Oznaka);
                tt.boja = t.boja;
                tt.opis = t.opis;

                /*for (int i = 0; i < MainWindow.Tags.Len( ); i++) {
                 *  if (MainWindow.Tags.GetTagAtI(i).oznaka == t.oznaka) {
                 *      MainWindow.Tags.GetTagAtI(i).opis = t.opis;
                 *      MainWindow.Tags.GetTagAtI(i).boja = t.boja;
                 *      break;
                 *  }
                 * }*/
            }
            else
            {
                MainWindow.Tags.addTag(t);
            }
            MainWindow win = (MainWindow)Application.Current.MainWindow;

            //update mape

            /*if (win.canvas != null) {
             *  foreach (var v in win.canvas.Children) {
             *      if (v is Image) {
             *          Regex reg = new Regex(@"([a-zA-Z]+)(\d+)");
             *          Match result = reg.Match((v as Image).Name);
             *          string n = result.Groups[1].Value;
             *          Res r = MainWindow.Resources.GetResourceById(n);
             *          if (r != null) {
             *              ToolTip tool = MainWindow.makeTooltip(r);
             *              (v as Image).ToolTip = tool;
             *          }
             *      }
             *  }
             * }*/

            for (int i = 0; i < MainWindow.Tags.Len( ); i++)
            {
                win.Test1 += MainWindow.Tags.GetTagAtI(i).oznaka + " " + MainWindow.Tags.GetTagAtI(i).boja;
            }
            this.Close( );
        }
Пример #9
0
 public string KrotkiToString()
 {
     return("Opis: " + Opis.ToString() + " Data_zakupu: " + DataZakupu.ToString("yyyy-MM-dd") + "_" + DataZakupu.ToString("HH:mm"));
 }
Пример #10
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            bool unique = false;

            if (Oznakaenabled)
            {
                for (int i = 0; i < MainWindow.Typesc.Len( ); i++)
                {
                    if (Oznaka.Equals(MainWindow.Typesc.GetTypeAtI(i).oznaka) || Oznaka.Equals(""))
                    {
                        unique = true;//greska
                    }
                }
                for (int i = 0; i < MainWindow.Resources.Len( ); i++)
                {
                    if (Oznaka.Equals(MainWindow.Resources.GetResourceAtI(i).oznaka) || Oznaka.Equals(""))
                    {
                        unique = true;//greska
                    }
                }
                for (int i = 0; i < MainWindow.Tags.Len( ); i++)
                {
                    if (Oznaka.Equals(MainWindow.Tags.GetTagAtI(i).oznaka) || Oznaka.Equals(""))
                    {
                        unique = true;//greska
                    }
                }
                if (Oznaka.Equals(" ") || Ime.Equals(" ") || Opis.Equals("") || unique)
                {
                    var s = new messageBox.Window1("Popunite sva polja prema zahtevima");
                    s.ShowDialog( );
                    return;
                }
            }
            Type       t   = new Type(Oznaka, Ime, Opis, Ikonica);
            MainWindow win = (MainWindow)Application.Current.MainWindow;

            /*for (int i = 0; i < MainWindow.Typesc.Len( ); i++) {
             *  win.Test1 += MainWindow.Typesc.GetTypeAtI(i).ime + " "+  MainWindow.Typesc.GetTypeAtI(i).ikonica;
             * }*/
            if (s.Equals("c"))
            {
                Type tt = MainWindow.Typesc.GetTypeById(Oznaka);
                tt.opis    = t.opis;
                tt.ime     = t.ime;
                tt.ikonica = t.ikonica;

                //menja sliku na dugnemu
                for (int i = 0; i < MainWindow.Resources.Len(); i++)
                {
                    if (MainWindow.Resources.GetResourceAtI(i).tip == tt.oznaka)
                    {
                        Res re = MainWindow.Resources.GetResourceAtI(i);
                        System.Windows.Controls.Image newImg = new Image( );
                        re.tipImg = tt.ikonica;
                        try {
                            newImg.Source = new BitmapImage(new Uri(uriString: @re.ikonica));
                        } catch {
                            try {
                                newImg.Source = new BitmapImage(new Uri(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, re.tipImg)));
                            } catch {
                                newImg.Source = new BitmapImage(new Uri(@"../../resources/image.png", UriKind.Relative));
                            }
                        }

                        foreach (Button b in win.ResourcePanel.Children)  //zasto ovo ne radi :O
                        {
                            String pom = (b.Name).Substring(1);
                            if (pom == re.oznaka)
                            {
                                b.Content = newImg;
                            }
                        }

                        if (win.canvas != null)
                        {
                            foreach (var v in win.canvas.Children)
                            {
                                if (v is Image)
                                {
                                    Regex  reg    = new Regex(@"([a-zA-Z]+)(\d+)");
                                    Match  result = reg.Match((v as Image).Name);
                                    string n      = result.Groups[1].Value;

                                    if (n.Equals(re.oznaka))
                                    {
                                        (v as Image).Source = newImg.Source;
                                        ToolTip tool = MainWindow.makeTooltip(re);
                                        (v as Image).ToolTip = tool;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                MainWindow.Typesc.addType(t);
            }
            this.Close( );
        }
Пример #11
0
 public override string ToString()
 {
     return(Id.ToString() + ";" + Opis.ToString() + ";" + DatumObjave.ToString() + ";" + Voznja.ToString() + ";" + OcenaVoznje.ToString() + ";");
 }