예제 #1
0
        public static void interwalOsiagniety(string taskname, object iloscDni, CacheItemRemovedReason removalReason)
        {
            Entities baza = new Entities();

            foreach (ServiceGuard SG in baza.ServiceGuard.ToList())
            {
                if (!port.IsOpen)
                {
                    port.Open();
                }
                Thread.Sleep(250);
                port.Write("AT+CMGF=1\r");
                Thread.Sleep(250);
                port.WriteLine("AT+CMGS=\"" + SG.nr_tel + "\"\r");
                Thread.Sleep(250);
                port.WriteLine("F" + "\x11" + "C" + '\x001a');  //komenda na wysłanie żądania o aktualnym stanie
                Thread.Sleep(250);
                Biling daneDoZapisu = new Biling();
                Guid   s            = Guid.NewGuid();
                daneDoZapisu.ServiceGuard_id_sg = SG.serial_number;
                daneDoZapisu.tresc = "F_C";
                daneDoZapisu.Id_b  = s.ToString();
                daneDoZapisu.data  = DateTime.Now;
                daneDoZapisu.login = "******";
                baza.Biling.Add(daneDoZapisu);
                baza.SaveChangesAsync();
            }
            HttpRuntime.Cache.Insert("AktualizacjaInterwal", null, null, DateTime.UtcNow.AddDays(iloscDniTimer), Cache.NoSlidingExpiration, CacheItemPriority.NotRemovable, timer);
        }
예제 #2
0
        public void zmienNumerServiceManager(string nrServiceGuard, string nrServiceManager)
        {
            Entities     baza       = new Entities();
            ServiceGuard sg         = baza.ServiceGuard.Find(nrServiceGuard);
            var          uzytkownik = baza.AspNetUsers.Find(User.Identity.GetUserId());
            Logi         nowyWpis   = new Logi();

            nowyWpis.id_uzytkownik = User.Identity.GetUserId();
            nowyWpis.co_zrobil     = "Dealer o loginie " + uzytkownik.UserName + " zmienia numer ServiceManager na SG o numerze " + nrServiceGuard + " na " + nrServiceManager + ".";
            nowyWpis.czas          = DateTime.Now;
            baza.Logi.Add(nowyWpis);
            if (!port.IsOpen)
            {
                port.Open();
            }
            port.Write("AT+CMGF=1\r");
            Thread.Sleep(250);
            port.WriteLine("AT+CMGS=\"" + sg.nr_tel + "\"\r");
            Thread.Sleep(100);
            port.WriteLine("F" + "\x11" + "G" + "\x11" + nrServiceManager + '\x001a');
            Biling daneDoZapisu = new Biling();

            daneDoZapisu.data  = DateTime.Now;
            daneDoZapisu.login = User.Identity.Name;
            Guid s = Guid.NewGuid();

            daneDoZapisu.ServiceGuard_id_sg = nrServiceGuard;
            daneDoZapisu.Id_b  = s.ToString();
            daneDoZapisu.tresc = "F_G_" + nrServiceManager;
            baza.Biling.Add(daneDoZapisu);
            sg.ServiceManager.nr_tel_temp = nrServiceManager;
            baza.SaveChanges();
        }
예제 #3
0
        public void ustawCzasTotal(string nrServiceGuard, string iloscGodzin)
        {
            Entities     baza       = new Entities();
            ServiceGuard sg         = baza.ServiceGuard.Find(nrServiceGuard);
            var          uzytkownik = baza.AspNetUsers.Find(User.Identity.GetUserId());
            Logi         nowyWpis   = new Logi();

            nowyWpis.id_uzytkownik = User.Identity.GetUserId();
            nowyWpis.co_zrobil     = "Dealer o loginie " + uzytkownik.UserName + " ustawia czas total na SG o numerze " + nrServiceGuard + " na " + iloscGodzin + ".";
            nowyWpis.czas          = DateTime.Now;
            baza.Logi.Add(nowyWpis);
            if (!port.IsOpen)
            {
                port.Open();
            }
            port.Write("AT+CMGF=1\r");
            Thread.Sleep(250);
            port.WriteLine("AT+CMGS=\"" + sg.nr_tel + "\"\r");
            Thread.Sleep(100);
            port.WriteLine("F" + "\x11" + "GA" + "\x11" + iloscGodzin + '\x001a');
            Biling daneDoZapisu = new Biling();

            daneDoZapisu.data     = DateTime.Now;
            daneDoZapisu.login    = User.Identity.Name;
            daneDoZapisu.tresc    = "F_GA_" + iloscGodzin;
            sg.aktualny_czas_temp = Convert.ToInt16(iloscGodzin);
            baza.Biling.Add(daneDoZapisu);
            baza.SaveChanges();
        }
예제 #4
0
        public void ustawCzasStartowy(string nrServiceGuard, string iloscGodzin)
        {
            //   UstawTrybWiadomosci();
            Entities baza       = new Entities();
            var      uzytkownik = baza.AspNetUsers.Find(User.Identity.GetUserId());
            Logi     nowyWpis   = new Logi();

            nowyWpis.id_uzytkownik = User.Identity.GetUserId();
            nowyWpis.co_zrobil     = "Dealer o loginie " + uzytkownik.UserName + " ustawia czas startowy na SG o numerze " + nrServiceGuard + " na " + iloscGodzin + ".";
            nowyWpis.czas          = DateTime.Now;
            baza.Logi.Add(nowyWpis);
            ServiceGuard sg = baza.ServiceGuard.Find(nrServiceGuard);

            if (!port.IsOpen)
            {
                port.Open();
            }
            port.Write("AT+CMGF=1\r");
            Thread.Sleep(250);
            port.WriteLine("AT+CMGS=\"" + sg.nr_tel + "\"\r");
            Thread.Sleep(100);
            port.WriteLine("F" + "\x11" + iloscGodzin + '\x001a');
            Biling daneDoZapisu = new Biling();
            Guid   s            = Guid.NewGuid();

            daneDoZapisu.ServiceGuard_id_sg = nrServiceGuard;
            daneDoZapisu.Id_b  = s.ToString();
            daneDoZapisu.data  = DateTime.Now;
            daneDoZapisu.login = User.Identity.Name;
            daneDoZapisu.tresc = "F_" + iloscGodzin; //wiecej w bazie nie grzebie przez design - to jest ok
            baza.Biling.Add(daneDoZapisu);
            baza.SaveChanges();
        }
예제 #5
0
        public void zmienPrzedzialSerwisu(string nrServiceGuard, string liczbaGodzin, string rodzajSerwisu)
        {
            //   UstawTrybWiadomosci();
            Entities     baza       = new Entities();
            ServiceGuard sg         = baza.ServiceGuard.Find(nrServiceGuard);
            var          uzytkownik = baza.AspNetUsers.Find(User.Identity.GetUserId());
            Logi         nowyWpis   = new Logi();

            nowyWpis.id_uzytkownik = User.Identity.GetUserId();
            nowyWpis.co_zrobil     = "Dealer o loginie " + uzytkownik.UserName + " zmienia przedział serwisowy na SG o numerze " + nrServiceGuard + " na liczbe godzin " + liczbaGodzin + " i rodzaj serwisu " + rodzajSerwisu + ".";
            nowyWpis.czas          = DateTime.Now;
            baza.Logi.Add(nowyWpis);
            string d = ViewBag.nrServiceGuard;

            if (!port.IsOpen)
            {
                port.Open();
            }
            port.Write("AT+CMGF=1\r");
            Thread.Sleep(250);
            port.WriteLine("AT+CMGS=\"" + sg.nr_tel + "\"\r");
            Thread.Sleep(100);
            port.WriteLine("F" + "\x11" + "GS" + '\x11' + liczbaGodzin + "#" + rodzajSerwisu + '\x001a');
            Biling daneDoZapisu = new Biling();
            Guid   s            = Guid.NewGuid();

            daneDoZapisu.ServiceGuard_id_sg = nrServiceGuard;
            daneDoZapisu.Id_b  = s.ToString();
            daneDoZapisu.data  = DateTime.Now;
            daneDoZapisu.login = User.Identity.Name;
            daneDoZapisu.tresc = "F_GS_" + liczbaGodzin + "#" + rodzajSerwisu;
            baza.Biling.Add(daneDoZapisu);
            sg.przedzial_serwisowy_temp = liczbaGodzin + rodzajSerwisu;
            baza.SaveChanges();
        }
예제 #6
0
        public void aktualizujDane(string nrServiceGuard)
        {
            // UstawTrybWiadomosci();
            Entities     baza       = new Entities();
            ServiceGuard sg         = baza.ServiceGuard.Find(nrServiceGuard);
            var          uzytkownik = baza.AspNetUsers.Find(User.Identity.GetUserId());
            //  var uzytkownik = baza.AspNetUsers.Find(User.Identity.GetUserId());
            Logi nowyWpis = new Logi();

            nowyWpis.id_uzytkownik = User.Identity.GetUserId();
            nowyWpis.co_zrobil     = "Dealer o loginie " + uzytkownik.UserName + " aktualizuje dane na SG o numerze " + nrServiceGuard + ".";
            nowyWpis.czas          = DateTime.Now;
            baza.Logi.Add(nowyWpis);
            port.Write("AT+CMGF=1\r");
            Thread.Sleep(250);
            port.WriteLine("AT+CMGS=\"" + sg.nr_tel + "\"\r");
            Thread.Sleep(100);
            port.WriteLine("F" + "\x11" + "C" + '\x001a');
            Biling daneDoZapisu = new Biling();
            Guid   s            = Guid.NewGuid();

            daneDoZapisu.ServiceGuard_id_sg = nrServiceGuard;
            daneDoZapisu.tresc = "F_C";
            daneDoZapisu.Id_b  = s.ToString();
            daneDoZapisu.data  = DateTime.Now;
            daneDoZapisu.login = User.Identity.Name;
            baza.Biling.Add(daneDoZapisu);
            baza.SaveChanges();
        }
예제 #7
0
        public ActionResult DeleteConfirmed(int id)
        {
            Biling biling = db.Biling.Find(id);

            db.Biling.Remove(biling);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #8
0
 public ActionResult Edit([Bind(Include = "Id_b,data,tresc,login,ServiceGuard_id_sg")] Biling biling)
 {
     if (ModelState.IsValid)
     {
         db.Entry(biling).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ServiceGuard_id_sg = new SelectList(db.ServiceGuard, "serial_number", "nr_karty", biling.ServiceGuard_id_sg);
     return(View(biling));
 }
예제 #9
0
        // GET: Bilings/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Biling biling = db.Biling.Find(id);

            if (biling == null)
            {
                return(HttpNotFound());
            }
            return(View(biling));
        }
예제 #10
0
        // GET: Bilings/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Biling biling = db.Biling.Find(id);

            if (biling == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ServiceGuard_id_sg = new SelectList(db.ServiceGuard, "serial_number", "nr_karty", biling.ServiceGuard_id_sg);
            return(View(biling));
        }
예제 #11
0
        public void wyslijDowolnySMS(string nrTel, string tresc)
        {
            //   UstawTrybWiadomosci();
            string numerTel        = nrTel;
            String komenda         = "AT+CMGS=\"" + numerTel + "\"";
            string tekstDoWyslania = tresc;
            string tekstWyslany    = string.Format("{0}{1}{2}{3}", komenda, enter, tekstDoWyslania, ctrlZ);

            port.WriteLine(tekstWyslany);
            Entities baza         = new Entities();
            Biling   daneDoZapisu = new Biling();
            Guid     s            = Guid.NewGuid();

            daneDoZapisu.Id_b  = s.ToString();
            daneDoZapisu.data  = DateTime.Now;
            daneDoZapisu.login = User.Identity.Name;
            daneDoZapisu.tresc = tekstWyslany;
            baza.Biling.Add(daneDoZapisu);
            baza.SaveChanges();
        }