public frmPaketDetalji(int paketId) { _paket = _paketService.Get <List <Paket> >(new PaketSearchRequest { Id = paketId }).FirstOrDefault(); //_paketService.GetById<Paket>(paketId); InitializeComponent(); }
public ActionResult Create([Bind(Include = "ID_Paket,Nama_Paket,Penginapan,Lama_Perjalanan,Keterangan")] Paket paket) { if (db.Pakets.Any(k => k.Nama_Paket == paket.Nama_Paket)) { ModelState.AddModelError("Nama_Paket", "Nama paket sudah ada."); } if (ModelState.IsValid) { paket.Konsumsi = (paket.Lama_Perjalanan == null ? 0 : paket.Lama_Perjalanan.Value) * 2; paket.Jenis_Paket = 0; paket.Status = 1; paket.CreatedBy = (int)Session["ID_Pegawai"]; paket.CreatedDate = DateTime.Now; paket.ModifiedBy = (int)Session["ID_Pegawai"]; paket.ModifiedDate = DateTime.Now; db.Pakets.Add(paket); db.SaveChanges(); TempData["SuccessMessage"] = "Data berhasil ditambah!"; return(RedirectToAction("Details", "Paket", new { @id = paket.ID_Paket })); } return(View(paket)); }
public override object Izvrsi(object odo) { List <int> rez = new List <int>(); List <Object> listaPIL = odo as List <Object>; Paket p = listaPIL[0] as Paket; rez.Add(Broker.DajSesiju().insert(p as OpstiDomenskiObjekat)); Domen.Istorija i = listaPIL[1] as Domen.Istorija; rez.Add(Broker.DajSesiju().insert(i as OpstiDomenskiObjekat)); List <PaketAkt> listaPA = listaPIL[2] as List <PaketAkt>; foreach (PaketAkt pa in listaPA) { rez.Add(Broker.DajSesiju().insert(pa as OpstiDomenskiObjekat)); } foreach (int br in rez) { if (br == 0) { return(0); } } return(1); }
public void PaketVerschicken() { Paket testPaket = new Paket(); testPaket.aendereStatus("Verschicken"); Assert.AreEqual(testPaket.Status, "Verschicken"); }
public static Paket VratiPaket() { Paket p = new Paket(); p.IdPaketa = k.VratiSifruPaketa(); return(p); }
public void PaketTransport() { Paket testPaket = new Paket(); testPaket.aendereStatus("Transport"); Assert.AreEqual(testPaket.Status, "Transport"); }
public ActionResult AddDetails(int ID_Paket, int ID_Destinasi) { Paket paket = db.Pakets.Find(ID_Paket); if (ModelState.IsValid) { Detail_Paket d = new Detail_Paket(); d.ID_Paket = ID_Paket; d.ID_Destinasi = ID_Destinasi; int rowCount = db.Detail_Paket.Where(k => (k.ID_Paket == ID_Paket) && (k.ID_Destinasi == ID_Destinasi)).Count(); if (rowCount > 0) { TempData["ErrorMessage"] = "Data destinasi gagal ditambahkan!"; } else { db.Detail_Paket.Add(d); db.SaveChanges(); TempData["SuccessMessage"] = "Data destinasi berhasil ditambah!"; } } return(RedirectToAction("Details", "Paket", new { @id = ID_Paket })); }
public void A_messed_up_metadata_file_results_in_unchanged_document_1_and_2() { // This metadata file has data that has wrongly named jp2/premis pairs, so it does not line up var metadataFile = Path.Combine(TestContext.CurrentContext.TestDirectory, @"TestDataCopy\jp2_NOK\header\metadata.xml"); var rootFolder = Path.Combine(TestContext.CurrentContext.TestDirectory, @"TestDataCopy\jp2_NOK"); var paket = (PaketDIP)Paket.LoadFromFile(metadataFile); var settings = new ScansZusammenfassenSettings { GroesseInProzent = 100, DefaultAufloesungInDpi = 300, JpegQualitaetInProzent = 80 }; var processor = new ScanProcessor(new FileResolution(settings), settings); // Act processor.ConvertSingleJpeg2000ScansToPdfDocuments(paket, rootFolder); // Assert // Document 1 and 2 are the same // Umschlag 1 got converted to pdf var contentFolder = paket.Inhaltsverzeichnis.Ordner[0]; contentFolder.Ordner.FirstOrDefault(o => o.Name == "D_o_k_u_m_e_n_t_0000001")?.Datei.Count.Should().Be(8); // The original jp2 and premis contentFolder.Ordner.FirstOrDefault(o => o.Name == "D_o_k_u_m_e_n_t_0000002")?.Datei.Count.Should().Be(8); // The original jp2 and premis contentFolder.Ordner.FirstOrDefault(o => o.Name == "U_m_s_c_h_l_a_g_0000001")?.Datei.Count.Should().Be(1); // Just the pdf // Premis Dateien gelöscht? var umschlagDirectory = new DirectoryInfo(Path.Combine(rootFolder, "content", "U_m_s_c_h_l_a_g_0000001")); umschlagDirectory.GetFiles("*.xml").Length.Should().Be(0); }
public static void Write(float value, Paket paket) { UIntFloat floaty = default(UIntFloat); floaty.FloatValue = value; Write(floaty.IntValue, paket); }
public override object Izvrsi(object odo) { Paket p = (Paket)odo; PaketAkt pa = new PaketAkt { IdPaketa = p.IdPaketa }; pa.Uslovi = $"WHERE IdPaket = {pa.IdPaketa}"; //vraca sve paket aktivnosti List <PaketAkt> paketAktivnosti = Broker.DajSesiju().vratiSveZaOpstiUslov(pa).OfType <PaketAkt>().ToList(); List <Aktivnost> aktivnosti = new List <Aktivnost>(); //za svaku paket aktivnost vrati aktivnost foreach (PaketAkt paketAkt in paketAktivnosti) { //poziva vrati jedan za id, gde se prosledjuje aktivnost sa id-em koju ima paketAkt aktivnosti.Add((Aktivnost)Broker.DajSesiju().vratiJedanZaID(new Aktivnost { RbAktivnosti = paketAkt.IdAktivnosti })); } /* * u klasi paket trebalo bi da imas listu aktivnosti za taj paket * dodaj property List<Aktivnost> aktivnost u klasi Paket. * Tako da mozes da, kada vratis aktivnosti za paket, * samo ih dodas paketu i na kraju vratis ceo paket sa aktivnostima * p.Aktivnosti = aktivnosti; * */ return(aktivnosti); }
public void Start() { Task.Run(() => { while (true) { try { byte[] buffer = new byte[_buffersize]; _endPoint = new IPEndPoint(IPAddress.Any, _port); var readed = _socket.ReceiveFrom(buffer, ref _endPoint); buffer = buffer.Take(readed).ToArray(); var paket = new Paket(buffer); if (paket.PaketType == PaketType.Connect && !_clients.Any(client => client.IPEndPoint.Address.ToString() == ((IPEndPoint)_endPoint).Address.ToString() && client.IPEndPoint.Port == ((IPEndPoint)_endPoint).Port)) { _clients.Add(new UdpClientData(((IPEndPoint)_endPoint))); } DataHandler(_endPoint, paket, buffer); } catch (SocketException ex) { Console.WriteLine(ex.Message); } } }); Console.WriteLine($"UdpService running on {_endPoint}"); }
public static void Write(string data, Paket paket) { if (data == null) { Write(0x7fffffff, paket); return; } if (data.Equals(String.Empty)) { Write(0x00000000, paket); return; } if (data.Length > 0x0000ffff) { throw new ArgumentException("len must not exceed 0x0000ffff", nameof(data)); } if (data.Length != 0) { byte[] buf = Encoding.UTF8.GetBytes(data); Write(buf.Length, paket); paket.ReserveSpace(buf.Length); Buffer.BlockCopy(buf, 0, paket.Array, paket.Offset, buf.Length); paket.Offset += buf.Length; } }
public void A_valid_file_is_happily_converted() { var metadataFile = Path.Combine(TestContext.CurrentContext.TestDirectory, @"TestDataCopy\jp2_OK\header\metadata.xml"); var rootFolder = Path.Combine(TestContext.CurrentContext.TestDirectory, @"TestDataCopy\jp2_OK"); var paket = (PaketDIP)Paket.LoadFromFile(metadataFile); var settings = new ScansZusammenfassenSettings { GroesseInProzent = 100, DefaultAufloesungInDpi = 300, JpegQualitaetInProzent = 80 }; var processor = new ScanProcessor(new FileResolution(settings), settings); // Act processor.ConvertSingleJpeg2000ScansToPdfDocuments(paket, rootFolder); // Assert // Every Dokument and Umschlag got converted var contentFolder = paket.Inhaltsverzeichnis.Ordner[0]; contentFolder.Ordner.FirstOrDefault(o => o.Name == "D_o_k_u_m_e_n_t_0000001")?.Datei.Count.Should().Be(1); // Just the pdf contentFolder.Ordner.FirstOrDefault(o => o.Name == "D_o_k_u_m_e_n_t_0000002")?.Datei.Count.Should().Be(1); // Just the pdf contentFolder.Ordner.FirstOrDefault(o => o.Name == "U_m_s_c_h_l_a_g_0000001")?.Datei.Count.Should().Be(1); // Just the pdf // Premis Dateien gelöscht? var dokument1 = new DirectoryInfo(Path.Combine(rootFolder, "content", "D_o_k_u_m_e_n_t_0000001")); var dokument2 = new DirectoryInfo(Path.Combine(rootFolder, "content", "D_o_k_u_m_e_n_t_0000002")); var umschlagDirectory = new DirectoryInfo(Path.Combine(rootFolder, "content", "U_m_s_c_h_l_a_g_0000001")); umschlagDirectory.GetFiles("*.xml").Length.Should().Be(0); dokument1.GetFiles("*.xml").Length.Should().Be(0); dokument2.GetFiles("*.xml").Length.Should().Be(0); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Paket paket = db.PaketDbSet.Find(id); if (paket == null) { return(HttpNotFound()); } PaketUrediVM model = db.PaketDbSet .Where(x => x.Id == id) .Select(f => new PaketUrediVM { Id = f.Id, AktivnaUsluga = f.AktivnaUsluga, AltText = f.AltText, CijenaBezPdv = f.CijenaBezPdv, CijenaSaPdv = f.CijenaSaPdv, DownloadSpeed = f.DownloadSpeed, FlatRate = f.FlatRate, ImageUrl = f.ImageUrl == null ? "http://localhost:57805/Slike/404.jpg" : f.ImageUrl, Naziv = f.Naziv, UploadSpeed = f.UploadSpeed, TipUslugaId = f.TipUslugaId, ListaTipovaUsluga = db.TipUslugaDbSet.ToList() }).Single(); return(View(model)); }
public static string ReadString(Paket paket) { int len = ReadInt(paket); switch (len) { case 0x7fffffff: return(null); case 0: return(""); } if (len < 0) { throw new IndexOutOfRangeException("len must not be below 0"); } if (len > 0x000fffff) { throw new IndexOutOfRangeException("len must not exceed 0x000fffff"); } var buf = new byte[len]; Buffer.BlockCopy(paket.Array, paket.Offset, buf, 0, len); paket.Offset += len; return(Encoding.UTF8.GetString(buf, 0, len)); }
public static float ReadFloat(Paket paket) { UIntFloat floaty = default(UIntFloat); floaty.IntValue = ReadUInt(paket); return(floaty.FloatValue); }
public ActionResult Promjena(ZahtjevPromjenaVM model) { AktivneUsluge a = db.AktivneUslugeDbSet.Find(model.AktivnaUslugaId); if (a == null) { return(HttpNotFound()); } a.AktivnaUsluga = false; a.DatumZatvaranja = DateTime.Now; db.SaveChanges(); // korisnik id Korisnik k = db.KorisnikDbSet.Find(a.KorisnikId); if (k == null) { return(HttpNotFound()); } AktivneUsluge nova = new AktivneUsluge() { KorisnikId = k.Id, AdresaInstalacije = k.Adresa, AktivnaUsluga = true, DatumAktivacije = DateTime.Now, DatumInstalacije = DateTime.Now, PaketId = model.NovaUslugaId }; db.AktivneUslugeDbSet.Add(nova); db.SaveChanges(); ZahtjevPromjena z = db.ZahtjevPromjenaDbSet.Find(model.ZahtjevId); z.DatumZatvaranja = DateTime.Now; z.ZatvorenZahtjev = true; z.ZahtjevstatusId = 3; db.SaveChanges(); Paket stara = db.PaketDbSet.Find(db.AktivneUslugeDbSet.Find(model.AktivnaUslugaId).PaketId); Paket novaa = db.PaketDbSet.Find(model.NovaUslugaId); TempData["code"] = "info"; TempData["Message"] = "Iskljucili ste uslugu: <b>" + stara.TipUsluga.Naziv + " - " + stara.Naziv + "</b> <br><br>" + "Uspjesno ste aktivirali uslugu: <b>" + novaa.TipUsluga.Naziv + " - " + novaa.Naziv + "</b>"; return(RedirectToAction("IndexPromjena", "Zahtjevi", new { area = "Admin" })); }
public ActionResult DeleteConfirmed(int id) { Paket paket = db.PaketDbSet.Find(id); db.PaketDbSet.Remove(paket); db.SaveChanges(); return(RedirectToAction("Index")); }
public static void Write(uint value, Paket paket) { paket.ReserveSpace(4); paket.Array[paket.Offset++] = (byte)((value >> 24) & 255); paket.Array[paket.Offset++] = (byte)((value >> 16) & 255); paket.Array[paket.Offset++] = (byte)((value >> 8) & 255); paket.Array[paket.Offset++] = (byte)(value & 255); }
public void Paket_VersiyonAl_Versiyon2XBasarili() { using (var ms = new MemoryStream(TestComponents.PAKET_V2X_BYTE_ARRAY())) { Assert.AreEqual(PaketVersiyonTuru.Versiyon2X, Paket.PaketVersiyonuAl(ms)); } Assert.AreEqual(PaketVersiyonTuru.Versiyon2X, Paket.PaketVersiyonuAl(TestComponents.PAKET_V2X_FILE_PATH)); }
public void ScreenCapture(EndPoint endPoint, Paket paket, byte[] buffer) { var control = _clients.FirstOrDefault(c => c.JobId == paket.JobId.ToString() && c.IsMaster && c.Connected); if (control != null) { _socket.SendTo(buffer, control.IPEndPoint); } }
public void WriteReadInt_1() { var paket = new Paket(); paket.Offset = 8; SimpleTypeWriter.Write(1, paket); paket.Offset = 8; Assert.Equal(1, SimpleTypeReader.ReadInt(paket)); }
public void FachAggregationFunction() { Paket testPaket = new Paket(); Fach fach = new Fach(12, true, testPaket, true, Groesse.XS); fach.getPaket(); Assert.AreEqual(fach.Packet, null); Assert.AreEqual(fach.IstBelegt(), false); }
public void WriteReadInt_12345678() { var paket = new Paket(); paket.Offset = 5; SimpleTypeWriter.Write(12345678, paket); paket.Offset = 5; Assert.Equal(12345678, SimpleTypeReader.ReadInt(paket)); }
private void btnPaketEkle_Click(object sender, EventArgs e) { Paket p = new Paket(); p.PaketAd = txtPaketAd.Text; p.PaketFiyat = txtPaketFiyat.Text; pbl.PaketEkle(p); RefreshCheckbox(); }
public ActionResult DeleteConfirmed(int id) { Paket paket = db.Pakets.Find(id); paket.Status = 0; db.SaveChanges(); TempData["SuccessMessage"] = "Data berhasil dihapus!"; return(RedirectToAction("Index")); }
public void KundenHatPaketAbzugeben() { List <Paket> PaketListe = new List <Paket>(); Paket p = new Paket("Verschicken"); PaketListe.Add(p); Kunde TestKlaus = new Kunde(1L, "Klaus", "Berndstr. 54", "Klausi", "123456", PaketListe); Assert.AreEqual(TestKlaus.hatPaketabzugeben(), true); }
public void KundenHatPaketAbgeholt() { List <Paket> PaketListe = new List <Paket>(); Paket p = new Paket("abgeholt"); PaketListe.Add(p); Kunde TestKlaus = new Kunde(1L, "Klaus", "Berndstr. 54", "Klausi", "123456", PaketListe); Assert.AreEqual(TestKlaus.hatPaketeabgeholt(), true); }
public ActionResult Edit([Bind(Include = "id,grad,drzava,cijena,tezina")] Paket paket) { if (ModelState.IsValid) { db.Entry(paket).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(paket)); }
public static BindingList <Aktivnost> VratiAktivnostiPaketa(Paket p) { BindingList <Aktivnost> aktivnosti = new BindingList <Aktivnost>(); List <Aktivnost> la = k.VratiAktivnostiPaketa(p);; foreach (Aktivnost a in la) { aktivnosti.Add(a); } return(aktivnosti); }