public async Task <IActionResult> Get(long locid)
        {
            LocationForm locationForm = new LocationForm
            {
                Location         = await _divectx.Locations.FirstOrDefaultAsync(a => a.Id == locid),
                ListLocCountries = _divectx.Countries.ToList(),
            };

            return(Ok(locationForm));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Edit product button click
        /// </summary>
        private async Task ActionEditClickAsync(int locationId)
        {
            Spinner.InitSpinner();
            Location location = await AppServices.LocationService.GetByIdAsync(locationId);

            Spinner.StopSpinner();

            LocationForm locationForm = new LocationForm(this);

            locationForm.ShowLocationForm(location);
        }
Exemplo n.º 3
0
        private void DgvInccident_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            Incident incident = dgvInccident.CurrentRow.DataBoundItem as Incident;

            if (incident == null)
            {
                return;
            }

            LocationForm form = new LocationForm(incident);

            form.ShowDialog();
        }
Exemplo n.º 4
0
        public async Task <IActionResult> GetByID([FromBody] LocationForm requestForm, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (!ModelState.IsValid) //Because form object implements IValidatableObject the validation has already occured!
            {
                return(ValidationErrors(ModelState));
            }

            var cts = TaskHelper.CreateChildCancellationTokenSource(cancellationToken, ClientDisconnectedToken());

            var request  = Mapper.Map <LocationForm, LocationRequestDto>(requestForm);
            var response = await _flightSearchService.GetLocationAsync(request, cts.Token);

            return(Success(response));
        }
Exemplo n.º 5
0
        void buttonBuild(Form form)
        {
            allLocations = new AllLocations();
            List <Location> locations = allLocations.getAllLocations();

            foreach (Location location in locations)
            {
                Button button = new Button();
                button.Text  = location.name;
                button.Top   = buttonStartX;
                button.Left  = buttonStartY;
                button.Width = buttonWidth;

                labelBuild(button, form, location);

                if (locationEnabled(location))
                {
                    button.Enabled = true;
                }
                else
                {
                    button.Enabled = false;
                }

                button.Click += (object sender, EventArgs e) =>
                {
                    new MainMenu().changeLocationLabel(location);
                    form.Hide();
                    LocationForm locationForm = new LocationForm(location);
                    this.travel.travelTo(location);
                    locationForm.Show();
                };

                form.Controls.Add(button);

                buttonStartX += 30;
            }
        }
Exemplo n.º 6
0
        public async Task <ActionResult <IEnumerable <City> > > CitiesList(LocationForm form)
        {
            if (form == null)
            {
                return(BadRequest());
            }

            var token = Request.Cookies["token"];

            if (token != null && CheckToken(token))
            {
                var degree = form.Radius / 111;

                var cities = await db.Cities.Where(c => c.Latitude >= (form.Latitude - degree) && c.Latitude <= (form.Latitude + degree) &&
                                                   c.Longitude >= (form.Longitude - degree) && c.Longitude <= (form.Longitude + degree))
                             .OrderBy(c => c.Longitude).ToListAsync();

                return(Ok(new { status = true, result = cities }));
            }


            return(Ok(new { status = false, result = new { } }));
        }
Exemplo n.º 7
0
        public BaseApiResponse InsertLocationForm(LocationForm model)
        {
            var response = new BaseApiResponse();

            try
            {
                SqlParameter[] param =
                {
                    new SqlParameter("LocID",         (object)model.LocID ?? (object)DBNull.Value),
                    new SqlParameter("IsRequestForm", (object)model.IsRequestForm ?? (object)DBNull.Value),
                    new SqlParameter("CreatedBy",     (object)model.CreatedBy ?? (object)DBNull.Value),
                    new SqlParameter("FolderPath",    (object)model.FolderPath ?? (object)DBNull.Value),
                    new SqlParameter("FolderName",    (object)model.FolderName ?? (object)DBNull.Value),
                    new SqlParameter("DocFileName",   (object)model.DocFileName ?? (object)DBNull.Value)
                };
                var result = _repository.ExecuteSQL <int>("InsertLocationForm", param).FirstOrDefault();
                if (result > 0)
                {
                    response.Success = true;
                }
                else if (result == -1)
                {
                    response.Success = false;
                    response.Message.Add("The document already exists for this location.");
                }
                else if (result == -2)
                {
                    response.Success = false;
                    response.Message.Add("The document does not exist in the DB(table: documents).");
                }
            }
            catch (Exception ex)
            {
                response.Message.Add(ex.Message);
            }
            return(response);
        }
Exemplo n.º 8
0
        private void Location_btn_Click(object sender, EventArgs e)
        {
            LocationForm locFrm = new LocationForm();

            locFrm.ShowDialog();
        }
Exemplo n.º 9
0
 public EstablishmentForm()
 {
     Type     = new EstablishmentTypeForm();
     Names    = new List <EstablishmentNameForm>();
     Location = new LocationForm();
 }
Exemplo n.º 10
0
 public void ShowStartForm()
 {
     locationForm = new LocationForm();
     locationForm.Init(GetForm("LocationForm", guiCanvasTransform));
     locationForm.Show();
 }
Exemplo n.º 11
0
        /// <summary>
        /// Create location button click
        /// </summary>
        private void btnCreate_Click(object sender, EventArgs e)
        {
            LocationForm locationForm = new LocationForm(this);

            locationForm.ShowLocationForm();
        }