Пример #1
0
 private void EventRegTimer_Tick(object sender, EventArgs e)
 {
     if (ercollapsed)
     {
         EventReg.BringToFront();
         EventReg.Width += 100;
         if (EventReg.Size == EventReg.MaximumSize)
         {
             EventRegTimer.Stop();
             ercollapsed             = false;
             HomeButton.Enabled      = true;
             EventListButton.Enabled = true;
             EventRegButton.Enabled  = true;
             PrintButton.Enabled     = true;
         }
     }
     else
     {
         EventReg.SendToBack();
         EventReg.Width -= 100;
         if (EventReg.Size == EventReg.MinimumSize)
         {
             EventRegTimer.Stop();
             ercollapsed             = true;
             HomeButton.Enabled      = true;
             EventListButton.Enabled = true;
             EventRegButton.Enabled  = true;
             PrintButton.Enabled     = true;
         }
     }
 }
Пример #2
0
        public async Task <IActionResult> RegisterTeam(Download download)
        {
            try
            {
                List <EventReg> eventRegs = await GetEventRegsAsync("https://localhost:44389/api/1.0/eventReg");

                ViewData["eventRegs"] = eventRegs;
                foreach (var reg in eventRegs)
                {
                    if (reg.EventID == download.Id && reg.TeamID == download.TeamId)
                    {
                        return(RedirectToAction("All"));
                        //return View("Events");
                    }
                }
                EventReg tempReg = new EventReg()
                {
                    EventID = download.Id,
                    TeamID  = download.TeamId
                };
                var url = await CreateEventRegAsync(tempReg);

                //RedirectToAction("All");
                return(RedirectToAction("All"));
            }
            catch (Exception e)
            {
                string message    = e.Message;
                string stackTrace = e.StackTrace;
                HttpContext.Session.SetString("_Error", "true");
                HttpContext.Session.SetString("_ErrorMessage", message);
                HttpContext.Session.SetString("_ErrorTrace", stackTrace);
                return(View("Error"));
            }
        }
Пример #3
0
        /// <summary>
        /// Handels communicating with the API to get a specific EventReg.
        /// </summary>
        /// <param name="path">
        /// The location of the boat that should be retrieved.
        /// </param>
        /// <returns>
        /// Returns the EventReg that was retrieved from the API.
        /// </returns>
        static async Task <EventReg> GetEventRegAsync(string path)
        {
            EventReg            eventReg = null;
            HttpResponseMessage response = await client.GetAsync(path);

            if (response.IsSuccessStatusCode)
            {
                eventReg = await response.Content.ReadAsAsync <EventReg>();
            }
            return(eventReg);
        }
Пример #4
0
        /// <summary>
        /// Handels communicating with the API to create an EventReg.
        /// </summary>
        /// <param name="eventReg">
        /// An object containing the information to be passed to the API.
        /// </param>
        /// <returns>
        /// Returns the location in the API of the newly created EventReg.
        /// </returns>
        static async Task <Uri> CreateEventRegAsync(EventReg eventReg)
        {
            HttpResponseMessage response = await client.PostAsJsonAsync(
                "https://localhost:44389/api/1.0/eventReg", eventReg);

            response.EnsureSuccessStatusCode();
            var tempURL = response.Headers.Location;

            Console.WriteLine(tempURL);
            return(response.Headers.Location);
        }
Пример #5
0
        /// <summary>
        /// Handels communicating with the API to update the information of
        /// a specific event reg
        /// </summary>
        /// <param name="eventReg">
        /// An object containing the information to be passed to the API
        /// </param>
        /// <returns>
        /// Will return the status code of the APIs response, should be 204 No Content
        /// </returns>
        static async Task <HttpStatusCode> UpdateEventRegAsync(EventReg eventReg)
        {
            HttpResponseMessage response = await client.PutAsJsonAsync(
                $"https://localhost:44389/api/1.0/eventReg/{ eventReg.Id}", eventReg);

            response.EnsureSuccessStatusCode();

            // Deserialize the updated product from the response body.
            //eventReg = await response.Content.ReadAsAsync<EventReg>();
            return(response.StatusCode);
        }
Пример #6
0
        public ActionResult <EventReg> Post([FromBody] EventReg eventsReg)
        {
            try
            {
                _eventRegService.Create(eventsReg);

                return(CreatedAtRoute("GetEventReg", new { id = eventsReg.Id.ToString() }, eventsReg));
            }
            catch (Exception e)
            {
                string message    = e.Message;
                string stackTrace = e.StackTrace;

                return(StatusCode(Microsoft.AspNetCore.Http.StatusCodes.Status500InternalServerError));
            }
        }
Пример #7
0
        public IActionResult Put(string id, EventReg eventsIn)
        {
            try
            {
                var events = _eventRegService.Get(id);

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

                _eventRegService.Update(id, eventsIn);

                return(NoContent());
            }
            catch (Exception e)
            {
                string message    = e.Message;
                string stackTrace = e.StackTrace;

                return(StatusCode(Microsoft.AspNetCore.Http.StatusCodes.Status500InternalServerError));
            }
        }
Пример #8
0
 public void Remove(EventReg eventsRegIn)
 {
     _eventReg.DeleteOne(eventsReg => eventsReg.Id == eventsRegIn.Id);
 }
Пример #9
0
 public void Update(string id, EventReg eventsRegIn)
 {
     _eventReg.ReplaceOne(eventsReg => eventsReg.Id == id, eventsRegIn);
 }
Пример #10
0
 public EventReg Create(EventReg eventsReg)
 {
     _eventReg.InsertOne(eventsReg);
     return(eventsReg);
 }
Пример #11
0
 /// <summary>
 /// Автомат Актуальные состояния
 /// </summary>
 /// <param name="statusButton">Кнопка старт автомат</param>
 /// <param name="pathfileinn">Путь к значениям</param>
 /// <param name="pathjurnalerror">Путь к журналу с ошибками</param>
 /// <param name="pathjurnalok">Путь к  отработаным значениям</param>
 public void StateReg(StatusButtonMethod statusButton, string pathfileinn, string pathjurnalerror, string pathjurnalok)
 {
     try
     {
         DispatcherHelper.Initialize();
         if (File.Exists(pathfileinn))
         {
             Task.Run(delegate
             {
                 LibaryXMLAuto.ReadOrWrite.XmlReadOrWrite read = new LibaryXMLAuto.ReadOrWrite.XmlReadOrWrite();
                 var snumodelmass = (Face)read.ReadXml(pathfileinn, typeof(Face));
                 if (snumodelmass.Fid != null)
                 {
                     DispatcherHelper.CheckBeginInvokeOnUI(statusButton.StatusRed);
                     KclicerButton clickerButton = new KclicerButton();
                     EventReg eventqbe           = new EventReg();
                     EventFid regevent           = new EventFid();
                     Exit exit        = new Exit();
                     WindowsAis3 ais3 = new WindowsAis3();
                     if (ais3.WinexistsAis3() == 1)
                     {
                         foreach (var fid in snumodelmass.Fid)
                         {
                             if (statusButton.Iswork)
                             {
                                 if (statusButton.IsChekcs)
                                 {
                                     regevent.AddEvent(eventqbe);
                                     regevent.RemoveEvent(eventqbe);
                                     DispatcherHelper.CheckBeginInvokeOnUI(statusButton.IsCheker);
                                 }
                                 clickerButton.Click8(pathjurnalerror, pathjurnalok, fid.FidFace);
                                 read.DeleteAtributXml(pathfileinn, LibaryXMLAuto.GenerateAtribyte.GeneratorAtribute.GenerateAtributeFaceFid(fid.FidFace));
                                 statusButton.Count++;
                             }
                             else
                             {
                                 break;
                             }
                         }
                         var status          = exit.Exitfunc(statusButton.Count, snumodelmass.Fid.Length, statusButton.Iswork);
                         statusButton.Count  = status.IsCount;
                         statusButton.Iswork = status.IsWork;
                         DispatcherHelper.CheckBeginInvokeOnUI(delegate { statusButton.StatusGrinandYellow(status.Stat); });
                     }
                     else
                     {
                         MessageBox.Show(LibraryAIS3Windows.Status.StatusAis.Status1);
                         DispatcherHelper.CheckBeginInvokeOnUI(statusButton.StatusGrin);
                     }
                 }
                 else
                 {
                     MessageBox.Show(LibraryAIS3Windows.Status.StatusAis.Status7);
                 }
             });
         }
         else
         {
             MessageBox.Show(LibraryAIS3Windows.Status.StatusAis.Status5);
         }
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
 }