Beispiel #1
0
        public ActionResult ProduziUslugu(int id)
        {
            mssql  s = new mssql();
            Ugovor u = s.Ugovor.SingleOrDefault(x => x.Id == id);

            u.produzenje = false;
            u.boja       = "aqua";
            if (u.VpsPaketiId != null || u.DedicatedPaketiId != null)
            {
                u.DatumVazenja = DateTime.Now.AddMonths(1);
            }
            else
            {
                u.DatumVazenja = DateTime.Now.AddYears(1);
            }
            s.SaveChanges();

            Produzenja p = s.Produzenja.Where(x => x.UgovorId == id).OrderByDescending(x => x.Id).First();

            p.DatumRealizacije = DateTime.Now;
            s.SaveChanges();

            var      user = Session["admin"] as Admin;
            AdminLog l    = new AdminLog();

            l.Datum   = DateTime.Now;
            l.Hidden  = false;
            l.IP      = Request.UserHostAddress + " " + Request.UserHostName + " " + Request.Browser.Browser;
            l.AdminId = user.Id;
            l.Poruka  = "Ugovor id: " + u.Id + ", Produzenje";
            s.AdminLog.Add(l);
            s.SaveChanges();

            return(RedirectToAction("Index", "Admin"));
        }
Beispiel #2
0
        public IActionResult Snimi(UgovorDodajVM input)
        {
            if (!ModelState.IsValid)
            {
                GenerisiKlijente(input);
                return(View("Dodaj", input));
            }

            AutentifikacijaVM korisnik = HttpContext.GetLogiraniKorisnik();

            Ugovor noviUgovor = new Ugovor
            {
                BrojUgovora       = input.BrojUgovora,
                Naziv             = input.Naziv,
                DatumPotpisivanja = input.DatumPotpisivanja,
                DatumIsteka       = input.DatumIsteka,
                UgovorStatus      = true,
                KlijentId         = input.KlijentId,
                KorisnikId        = korisnik.KorisnikId
            };

            noviUgovor.UgovorPath = UploadDokumenata.UploadDoc(input.Ugovor, input.BrojUgovora, UploadDokumenata.TipoviDokumenata.Ugovori);

            _context.Ugovori.Add(noviUgovor);
            _context.SaveChanges();

            return(RedirectToAction("Index"));
        }
Beispiel #3
0
        public ActionResult produzi(int id)
        {
            mssql  s = new mssql();
            Ugovor u = s.Ugovor.SingleOrDefault(x => x.Id == id);

            u.produzenje = true;
            u.boja       = "crimson";
            s.SaveChanges();

            Produzenja p = new Produzenja();

            p.UgovorId      = id;
            p.DatumZahtjeva = p.DatumRealizacije = DateTime.Now;
            s.Produzenja.Add(p);
            s.SaveChanges();

            var      user = Session["admin"] as Admin;
            AdminLog l    = new AdminLog();

            l.Datum   = DateTime.Now;
            l.Hidden  = false;
            l.IP      = Request.UserHostAddress + " " + Request.UserHostName + " " + Request.Browser.Browser;
            l.AdminId = user.Id;
            l.Poruka  = "Ugovor id: " + u.Id + ", Produzen";
            s.AdminLog.Add(l);
            s.SaveChanges();

            return(RedirectToAction("KlijentPanel", "Klijent"));
        }
Beispiel #4
0
        public ActionResult Aktiviraj(int id)
        {
            mssql  s = new mssql();
            Ugovor u = s.Ugovor.SingleOrDefault(x => x.Id == id);

            u.DatumOdobrenja = DateTime.Now;
            if (u.VpsPaketiId != null || u.DedicatedPaketiId != null)
            {
                u.DatumVazenja = DateTime.Now.AddMonths(1);
            }
            else
            {
                u.DatumVazenja = DateTime.Now.AddYears(1);
            }
            u.StatusId = 3;
            u.boja     = "aqua";
            s.SaveChanges();


            var      user = Session["admin"] as Admin;
            AdminLog l    = new AdminLog();

            l.Datum   = DateTime.Now;
            l.Hidden  = false;
            l.IP      = Request.UserHostAddress + " " + Request.UserHostName + " " + Request.Browser.Browser;
            l.AdminId = user.Id;
            l.Poruka  = "Ugovor id: " + u.Id + ", Aktiviran ";
            s.AdminLog.Add(l);
            s.SaveChanges();

            return(RedirectToAction("Index", "ugovor"));
        }
        private void btnObrisi_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count == 0)
            {
                MessageBox.Show("Odaberite ugovor!");
                return;
            }

            int ugId = Int32.Parse(listView1.SelectedItems[0].SubItems[0].Text);

            try
            {
                ISession s = DataLayer.GetSession();

                Ugovor u = s.Load <Ugovor>(ugId);

                s.Delete(u);

                s.Flush();
                s.Close();
            }
            catch (Exception ec)
            {
                MessageBox.Show(ec.Message);
            }

            this.PopulateInfos();
        }
Beispiel #6
0
        public ActionResult Promjeni(int uid, int status)
        {
            mssql  s = new mssql();
            Ugovor u = s.Ugovor.SingleOrDefault(x => x.Id == uid);

            u.StatusId = status;
            if (status == 2)
            {
                u.boja = "coral";
            }
            if (status == 4)
            {
                u.boja = "indianred";
            }
            s.SaveChanges();

            var      user = Session["admin"] as Admin;
            AdminLog l    = new AdminLog();

            l.Datum   = DateTime.Now;
            l.Hidden  = false;
            l.IP      = Request.UserHostAddress + " " + Request.UserHostName + " " + Request.Browser.Browser;
            l.AdminId = user.Id;
            l.Poruka  = "Ugovor id: " + u.Id + ", status " + u.Status.Naziv;
            s.AdminLog.Add(l);
            s.SaveChanges();


            return(RedirectToAction("Index", "ugovor"));
        }
        public override object Izvrsi(OpstiDomenskiObjekat odo)
        {
            Ugovor u = new Ugovor();

            u.SifraUgovora = Sesija.Broker.dajSesiju().vratiSifru(odo);
            Sesija.Broker.dajSesiju().insert(u);
            return(u);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Ugovor ugovor = db.Ugovors.Find(id);

            db.Ugovors.Remove(ugovor);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public IActionResult Obrisi(int NekretninaID)
        {
            Nekretnina zaBrisanje = db.Nekretnine.Find(NekretninaID);
            Oglas      oglas      = db.Oglas.Where(i => i.NekretninaID == zaBrisanje.NekretninaID).FirstOrDefault();


            var    obilasci = db.Obilasci.Where(i => i.NekretninaID == zaBrisanje.NekretninaID).ToList();
            var    noti     = db.Notifikacije.ToList();
            Ugovor ugovore  = db.Ugovori.Where(i => i.NekretninaID == zaBrisanje.NekretninaID).FirstOrDefault();
            Uplata uplata   = db.Uplate.Where(i => i.NekretninaID == zaBrisanje.NekretninaID).FirstOrDefault();

            if (zaBrisanje != null)
            {
                if (ugovore != null || uplata != null)
                {
                    TempData["warningMessage"] = "Ovu nekretninu je nemoguće obrisati!";
                    return(RedirectToAction("Prikazi"));
                }
                else
                {
                    if (obilasci != null)
                    {
                        //prodji kroz sve notifikacije sa tim obilaskom i obriši ih

                        foreach (var o in obilasci)
                        {
                            foreach (var n in noti)
                            {
                                if (n.ObilazakID == o.ObilazakID)
                                {
                                    db.Notifikacije.Remove(n);
                                    db.SaveChanges();
                                }
                            }
                        }
                        //prodji kroz sve obilaske te  nekretnine i obriši ih
                        foreach (var o in obilasci)
                        {
                            db.Obilasci.Remove(o);
                            db.SaveChanges();
                        }
                    }

                    if (oglas != null)
                    {
                        db.Remove(oglas);
                        db.SaveChanges();
                    }

                    db.Remove(zaBrisanje);
                    db.SaveChanges();
                }
            }

            return(RedirectToAction("Prikazi"));
        }
Beispiel #10
0
        public IActionResult Pregled(int UgovorID)
        {
            Ugovor x = db.Ugovori
                       .Include(i => i.PDF)
                       .Where(i => i.UgovorID == UgovorID)
                       .FirstOrDefault();


            return(View(x));
        }
Beispiel #11
0
 public ActionResult Edit([Bind(Include = "ID,PeriodVazenjaOd,PeriodVazenjaDo,sadrzajUgovora,potpisnikUgovoraSupplier,potpisnikUgovoraManager,dodatneStavke,DobavljacId")] Ugovor ugovor)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ugovor).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DobavljacId = new SelectList(db.Dobavljac, "Id", "Naziv", ugovor.DobavljacId);
     return(View(ugovor));
 }
Beispiel #12
0
        public Object obrisiUgovor(Ugovor u)
        {
            TransferKlasa transfer = new TransferKlasa();

            transfer.Operacija       = Operacije.ObrisiUgovor;
            transfer.TransferObjekat = u;
            formater.Serialize(tok, transfer);

            transfer = formater.Deserialize(tok) as TransferKlasa;
            return(transfer.Rezultat);
        }
Beispiel #13
0
        public async Task <ActionResult <Ugovor> > GetUgovor(int id)
        {
            Ugovor model = await _context.Ugovori
                           .FirstOrDefaultAsync(i => i.id == id);

            if (model == null)
            {
                return(NotFound());
            }

            return(model);
        }
Beispiel #14
0
        // C = CREATE
        public void CreateAgreement(bool isPartTime, DateTime datum_Vazenja, bool specijalizacija, string doktor)
        {
            string vrsta_Ugovora = isPartTime == true ? "part-time" : "full-time";

            Ugovor ugovor = new Ugovor(vrsta_Ugovora, datum_Vazenja, specijalizacija, doktor);

            using (var db = new ClinicDBEntities())
            {
                db.Ugovors.Add(ugovor);
                db.SaveChanges();
            }
        }
 public ActionResult Edit([Bind(Include = "BrojUgovora,Marka,Model,Godiste,Cena,Boja,ImeKupca,PrezimeKupca,ImeProdavca,PrezimeProdavca,JBMGKupca,IDRadnika,IDProdatogVozila")] Ugovor ugovor)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ugovor).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.IDProdatogVozila = new SelectList(db.Prodata_vozila, "IDVozila", "IDVozila", ugovor.IDProdatogVozila);
     ViewBag.IDRadnika        = new SelectList(db.Radniks, "IDRadnika", "IDRadnika", ugovor.IDRadnika);
     return(View(ugovor));
 }
Beispiel #16
0
 public Proizvodjac(string ime, string prezime, string jmbg, string telefon,
                    Ugovor ugovor, double povrsinaParcele, string tekuciRacun, PoreskaIzjava poreskaIzjava)
 {
     this.ime             = ime;
     this.prezime         = prezime;
     this.JMBG            = jmbg;
     this.telefon         = telefon;
     this.ugovor          = ugovor;
     this.povrsinaParcele = povrsinaParcele;
     this.tekuciRacun     = tekuciRacun;
     this.otkupnoMesto    = otkupnoMesto;
     this.poreskaIzjava   = poreskaIzjava;
 }
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Ugovor ugovor = db.Ugovors.Find(id);

            if (ugovor == null)
            {
                return(HttpNotFound());
            }
            return(View(ugovor));
        }
Beispiel #18
0
        // GET: Ugovor/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Ugovor ugovor = db.Ugovor.Find(id);

            if (ugovor == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DobavljacId = new SelectList(db.Dobavljac, "Id", "Naziv", ugovor.DobavljacId);
            return(View(ugovor));
        }
Beispiel #19
0
        static void Main(string[] args)
        {
            Ugovor        ugovor           = new Ugovor();
            PoreskaIzjava poreskaIzjava    = new PoreskaIzjava();
            Proizvodjac   Pero             = Logger.getInstance().createProizvodjac("Pero", "Peric", "06156166", "066123456", ugovor, 20, "123456789", poreskaIzjava);
            OtkupnoMesto  Cacak            = Logger.getInstance().createOtkupnoMest("cacak", Pero, 5, 4, 3);
            List <Voce>   proizvedeneVocke = Logger.getInstance().createVoce(Cacak);
            Hladnjaca     hladnjaca        = new Hladnjaca();

            Pero.setOtkupnoMesto(Cacak);
            Logger.getInstance().otkupiVoce(hladnjaca, proizvedeneVocke);
            Logger.getInstance().pregledVoca(hladnjaca);

            //Nisam stigao sve funkcionalnosti da odradim ,nadam se da ce biti dovoljno...
        }
Beispiel #20
0
        public async Task <ActionResult <Ugovor> > DeletUgovor(int id)
        {
            Ugovor model = await _context.Ugovori
                           .FirstOrDefaultAsync(i => i.id == id);

            if (model == null)
            {
                return(NotFound());
            }

            _context.Entry(model).State = EntityState.Deleted;
            await _context.SaveChangesAsync();

            return(Ok());
        }
Beispiel #21
0
        public static void SaveUgovor(Ugovor u)
        {
            try
            {
                ISession s = DataLayer.GetSession();

                s.Save(u);
                s.Flush();

                s.Close();
            }
            catch (Exception ec)
            {
                MessageBox.Show(ec.Message);
            }
        }
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Ugovor ugovor = db.Ugovors.Find(id);

            if (ugovor == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IDProdatogVozila = new SelectList(db.Prodata_vozila, "IDVozila", "IDVozila", ugovor.IDProdatogVozila);
            ViewBag.IDRadnika        = new SelectList(db.Radniks, "IDRadnika", "IDRadnika", ugovor.IDRadnika);
            return(View(ugovor));
        }
Beispiel #23
0
        public override object Izvrsi(OpstiDomenskiObjekat odo)
        {
            Ugovor u = odo as Ugovor;

            Sesija.Broker.dajSesiju().updateJedan(u);

            Sesija.Broker.dajSesiju().deleteVise(new SpisakUcenika {
                Ugovor = u, USLOVI = $"SifraUgovora = {u.SifraUgovora}"
            });
            foreach (SpisakUcenika su in u.Ucenici)
            {
                Sesija.Broker.dajSesiju().insert(su);
            }

            return(true);
        }
        internal void kreirajUgovor(TextBox txtID, Button btnKreiraj, GroupBox gbUcenik)
        {
            ugovor = komunikacija.kreirajUgovor() as Ugovor;

            if (ugovor == null)
            {
                MessageBox.Show("Sistem ne može da kreira ugovor!");
                btnKreiraj.Enabled = true;
                gbUcenik.Enabled   = false;
            }
            else
            {
                txtID.Text         = ugovor.SifraUgovora.ToString();
                btnKreiraj.Enabled = false;
                gbUcenik.Enabled   = true;
            }
        }
Beispiel #25
0
        public static void removeUgovor(int id)
        {
            try
            {
                ISession s = DataLayer.GetSession();

                Ugovor u = s.Load <Ugovor>(id);

                s.Delete(u);

                s.Flush();
                s.Close();
            }
            catch (Exception exc)
            {
            }
        }
Beispiel #26
0
        public IActionResult Snimi(UgovorDodajVM input)
        {
            if (!ModelState.IsValid)
            {
                return(Redirect("Dodaj"));
            }

            Ugovor          y = new Ugovor();
            KorisnickiNalog x = HttpContext.GetLogiraniKorisnik();

            if (ModelState.IsValid)
            {
                var    fileName      = Path.GetFileName(input.PDF.FileName);
                string uploadsFolder = Path.Combine(hostingEnvironment.WebRootPath, "files");

                PDF pdfFile = new PDF
                {
                    MyPDF     = fileName,
                    Extension = Path.GetExtension(fileName),
                    PDFID     = Guid.NewGuid()
                };
                y.PDF = pdfFile;


                var filePath = Path.Combine(uploadsFolder, pdfFile.PDFID + pdfFile.Extension);
                input.PDF.CopyTo(new FileStream(filePath, FileMode.Create));

                y.DatumKreiranja = input.DatumVrijeme;
                y.KorisnikID     = input.KupacID;
                y.NekretninaID   = input.NekretninaID;
                y.UposlenikID    = db.Uposlenici.Where(i => i.Korisnik.KorisnickiNalogID == x.KorisnickiNalogID).FirstOrDefault().UposlenikID;
                y.VrstaUgovoraID = input.VrstaUgovoraID;
                y.Oznaka         = input.Oznaka;
                db.Add(y);
                db.SaveChanges();

                //sada treba oglas proglasiti neaktivnim
                Oglas og = db.Oglas.Where(i => i.NekretninaID == y.NekretninaID).FirstOrDefault();
                og.Aktivan = false;
                db.SaveChanges();
            }
            TempData["WarningMessage"] = "Uspješno ste dodali ugovor!";
            return(RedirectToAction("Index"));
        }
Beispiel #27
0
        public ActionResult Snimi(string Domena, int DomenePaketiId, string Ime, string Prezime, string Email,
                                  string Adresa, string Telefon, string Mobitel, string Fax, string JMBG, string IDBroj, string PDVBroj,
                                  string Password,
                                  int Grad)
        {
            mssql    s = new mssql();
            Klijenti k = new Klijenti();

            k.Ime      = Ime;
            k.Prezime  = Prezime;
            k.Email    = Email;
            k.Adresa   = Adresa;
            k.Telefon  = Telefon;
            k.Mobitel  = Mobitel;
            k.Fax      = Fax;
            k.JMBG     = JMBG;
            k.IDBroj   = IDBroj;
            k.PDVBroj  = PDVBroj;
            k.Password = Password;
            k.GradId   = Grad;

            s.Klijenti.Add(k);
            s.SaveChanges();

            Ugovor u = new Ugovor();

            u.DatumKreiranjaZahtjeva = DateTime.Now;
            u.Hidden         = false;
            u.DatumOdobrenja = DateTime.Now;
            u.DatumVazenja   = DateTime.Now;
            u.DomenaId       = DomenePaketiId;

            Klijenti kl = s.Klijenti.Single(x => x.Email == k.Email);

            u.KlijentiId = kl.Id;
            u.StatusId   = 1;
            u.boja       = "crimson";

            s.Ugovor.Add(u);
            s.SaveChanges();

            return(RedirectToAction("KlijentInfoPristup", "Klijent", new { Username = k.Email, Password = k.Password }));
        }
Beispiel #28
0
        public void Create(UgovorDTO ugovorDTO)
        {
            Ugovor ugovor = new Ugovor()
            {
                SifraOsiguranja = ugovorDTO.SifraOsiguranja,

                PutovanjeKojeNudiTuristickaAgencijaPutovanjeId          = ugovorDTO.PutovanjeId,
                PutovanjeKojeNudiTuristickaAgencijaTuristickaAgencijaId = ugovorDTO.PutovanjeTAId,
                PutovanjeKojeNudiTuristickaAgencijaVodicId = ugovorDTO.PutovanjeVodicId,

                KlijentKojiPoslujeSaFilijalomKlijentId  = ugovorDTO.KlijentId,
                KlijentKojiPoslujeSaFilijalomFilijalaId = ugovorDTO.KlijentFilijalaId,
                KlijentKojiPoslujeSaFilijalomFilijalaTuristickaAgencijaId = ugovorDTO.KlijentTAId,

                SekretaricaId = ugovorDTO.SekretaricaId
            };

            ugovorDAO.Insert(ugovor);
        }
        private void btnManyToOneUgovori_Click(object sender, EventArgs e)
        {
            try
            {
                ISession s = DataLayer.GetSession();

                //Ucitavaju se podaci o prodavnici za zadatim brojem
                Ugovor ugovor = s.Load <Ugovor>(56);

                MessageBox.Show(ugovor.ProdavacNekretnina.ID.ToString()); //7
                MessageBox.Show(ugovor.Sklapa_ugovor.Ime);                //Nikola

                s.Close();
            }
            catch (Exception ec)
            {
                MessageBox.Show(ec.Message);
            }
        }
Beispiel #30
0
        public async Task <ActionResult <Predstava> > AddUgovor(Ugovor model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (ValidateModel(model, true))
            {
                _context.Ugovori.Add(model);
                await _context.SaveChangesAsync();

                return(CreatedAtAction("GetUgovor", new { id = model.id }, model));
            }
            else
            {
                return(BadRequest());
            }
        }