public void UcitajMusterije() { using (TextReader tr = new StreamReader(@"C:\Users\Nemanja\Desktop\FAKS\3.GODINA\WEB\TaxiSluzbaWebApp\TaxiService\TaxiSluzbaWebApi\App_Data\Musterije.txt")) { Musterija musterija = null; string informacije = string.Empty; while ((informacije = tr.ReadLine()) != null) { string[] parametri = informacije.Split(';'); musterija = new Musterija() { KorisnickoIme = parametri[0], Sifra = parametri[1], Ime = parametri[2], Prezime = parametri[3], Pol = (parametri[4].Equals("Muski")) ? Enum.Pol.Muski : Enum.Pol.Zenski, JMBG = parametri[5], KontaktTelefon = parametri[6], Email = parametri[7], Blokiran = (parametri[8].Equals("False")) ? false : true }; Musterije.Add(musterija); } } }
public void UpisiUBazuMusterije() { using (TextWriter tw = new StreamWriter(@"C:\Users\Nemanja\Desktop\FAKS\3.GODINA\WEB\TaxiSluzbaWebApp\TaxiService\TaxiSluzbaWebApi\App_Data\Musterije.txt")) { foreach (var item in Musterije) { tw.Write(item.KorisnickoIme); tw.Write(";"); tw.Write(item.Sifra); tw.Write(";"); tw.Write(item.Ime); tw.Write(";"); tw.Write(item.Prezime); tw.Write(";"); tw.Write(item.Pol); tw.Write(";"); tw.Write(item.JMBG); tw.Write(";"); tw.Write(item.KontaktTelefon); tw.Write(";"); tw.Write(item.Email); tw.Write(";"); tw.Write(item.Blokiran.ToString()); if (Musterije.IndexOf(item) != Musterije.Count() - 1) { tw.Write("\n"); } } } }
public void UpisiUBazuMusterije() { try { using (TextWriter tw = new StreamWriter(@"D:\TaxiService\WEBTaxiService\WEBTaxiService\TaxiService\App_Data\musterije.txt")) { foreach (var item in Musterije) { tw.Write(item.Username); tw.Write(";"); tw.Write(item.Password); tw.Write(";"); tw.Write(item.Ime); tw.Write(";"); tw.Write(item.Prezime); tw.Write(";"); tw.Write(item.Pol); tw.Write(";"); tw.Write(item.Jmbg); tw.Write(";"); tw.Write(item.Telefon); tw.Write(";"); tw.Write(item.Email); if (Musterije.IndexOf(item) != Musterije.Count - 1) { tw.Write("\n"); } } } } catch { } }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); Musterije users = new Musterije("~/App_Data/Musterije.txt"); Dispeceri disp = new Dispeceri("~/App_Data/Dispeceri.txt"); Vozaci drivers = new Vozaci("~/App_Data/Vozaci.txt"); Voznje rides = new Voznje("~/App_Data/Voznje.txt"); // Musterije users = new Musterije(@"C:\Users\user\Desktop\WebTaxi\WebAPI\WebAPI\App_Data\Musterije.txt"); //Dispeceri disp = new Dispeceri(@"C:\Users\user\Desktop\WebTaxi\WebAPI\WebAPI\App_Data\Dispeceri.txt"); //Vozaci drivers = new Vozaci(@"C:\Users\user\Desktop\WebTaxi\WebAPI\WebAPI\App_Data\Vozaci.txt"); //Voznje rides = new Voznje(@"C:\Users\user\Desktop\WebTaxi\WebAPI\WebAPI\App_Data\Voznje.txt"); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); string path = System.Web.Hosting.HostingEnvironment.MapPath(@"~/App_Data/Musterije.txt"); Musterije users = new Musterije(path); path = System.Web.Hosting.HostingEnvironment.MapPath(@"~/App_Data/Dispeceri.txt"); Dispeceri disp = new Dispeceri(path); path = System.Web.Hosting.HostingEnvironment.MapPath(@"~/App_Data/Vozaci.txt"); Vozaci drivers = new Vozaci(path); path = System.Web.Hosting.HostingEnvironment.MapPath(@"~/App_Data/Voznje.txt"); Voznje rides = new Voznje(path); }
public void RegistracijaKorisnika(Korisnik k) { Musterije.Add((Musterija)k); using (TextWriter tw = new StreamWriter(@"D:\TaxiService\WEBTaxiService\WEBTaxiService\TaxiService\App_Data\musterije.txt", append: true)) { tw.Write(k.Username); tw.Write(";"); tw.Write(k.Password); tw.Write(";"); tw.Write(k.Ime); tw.Write(";"); tw.Write(k.Prezime); tw.Write(";"); tw.Write(k.Pol); tw.Write(";"); tw.Write(k.Jmbg); tw.Write(";"); tw.Write(k.Telefon); tw.Write(";"); tw.Write(k.Email); tw.Write(";\n"); } }
private void LoadMusterije() { using (TextReader tr = new StreamReader(@"D:\TaxiService\WEBTaxiService\WEBTaxiService\TaxiService\App_Data\musterije.txt")) { Musterija musterija = null; string podaci = ""; while ((podaci = tr.ReadLine()) != null) { string[] parsirani = podaci.Split(';'); musterija = new Musterija() { Username = parsirani[0], Password = parsirani[1], Ime = parsirani[2], Prezime = parsirani[3], Pol = (parsirani[4].Equals("Zenski") ? Pol.Zenski : Pol.Muski), Jmbg = parsirani[5], Telefon = parsirani[6], Email = parsirani[7] }; Musterije.Add(musterija); } } }