Esempio n. 1
0
        public void StoreLocations()
        {
            SelectedLocation.Clear();
            var lstLocations = new ArrayList();

            if (Settings.Enablelocations == EventModuleSettings.DisplayLocations.SingleSelect)
            {
                lstLocations.Add(ddlLocations.SelectedValue);
            }
            else
            {
                if (ddlLocations.CheckedItems.Count > 0 && ddlLocations.CheckedItems.Count != ddlLocations.Items.Count)
                {
                    foreach (var item in ddlLocations.CheckedItems)
                    {
                        lstLocations.Add(item.Value);
                    }
                }
                else
                {
                    lstLocations.Add("-1");
                }
            }
            SelectedLocation = lstLocations;
        }
Esempio n. 2
0
 private void PictureBox_Paint(object sender, PaintEventArgs e)
 {
     foreach (GraphicLocation location in _locationsList)
     {
         if (categoriesCheckedListBox.CheckedItems.Contains(location.Location.Type_Emplacement.Libelle_Type))
         {
             location.Draw(e, SelectedLocation != null && SelectedLocation.Equals(location), pictureBox);
         }
     }
 }
Esempio n. 3
0
 //autosuggest filter
 private void Suggest(CommandExecutionContext context)
 {
     if (context == null)
     {
         context = new CommandExecutionContext();
     }
     if (!string.IsNullOrEmpty(SelectedLocation))
     {
         Locations = locations.Where(x => x.ToLower().Contains(SelectedLocation.ToLower())).ToList();
     }
 }
Esempio n. 4
0
        public void btnUpdate_Click(object sender, EventArgs e)
        {
            StoreLocations();

            // Fire the LocationSelected event...
            var args = new CommandEventArgs(SelectedLocation.ToString(), null);

            if (LocationSelectedChangedEvent != null)
            {
                LocationSelectedChangedEvent(this, args);
            }
        }
Esempio n. 5
0
 public new IEnumerable NewLocation(PXAdapter adapter)
 {
     if (this.BAccountAccessor.Cache.GetStatus(this.BAccountAccessor.Current) != PXEntryStatus.Inserted)
     {
         CompanyLocationMaint graph = PXGraph.CreateInstance <CompanyLocationMaint>();
         SelectedLocation     loc   = new SelectedLocation();
         loc.BAccountID = this.BAccountAccessor.Current.BAccountID;
         loc            = (SelectedLocation)graph.Location.Insert(loc);
         throw new PXRedirectRequiredException(graph, Messages.CompanyLocationMaint);
     }
     return(adapter.Get());
 }
Esempio n. 6
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            if (OnButtonYes != null)
            {
                OnButtonYes(this, e);
            }

            if (OnLocationSelected != null)
            {
                OnLocationSelected(SelectedLocation.GetLocationRef(), e);
            }

            Controller.RemoveFromContainer();
        }
Esempio n. 7
0
 public void SelectLocation(object o)
 {
     try
     {
         StorageLocation p = SelectedLocation.Last <StorageLocation>();
         LocationID             = p.LocationID;
         Floor                  = p.Floor;
         RoomNumber             = p.RoomNumber;
         ShelfNumber            = p.ShelfNumber;
         Shelf                  = p.Shelf;
         ChangeButton           = true;
         RechnungsNummerTextBox = true;
     }
     catch (System.ArgumentNullException)
     {
         MessageBox.Show("No storage location selected");
     }
 }
Esempio n. 8
0
        private void ExecuteSubmitText()
        {
            Bot botInstance = Controller.Instance.GetBot(SelectedServer);

            if (botInstance != null && botInstance.Connected)
            {
                string message = InputBoxText;
                if (InputBoxText.StartsWith("/"))
                {
                    MessageType type = MessageType.Query;
                    if (SelectedLocation.StartsWith("#") || SelectedLocation.StartsWith("&"))
                    {
                        type = MessageType.Channel;
                    }
                    message = message.Remove(0, 1);
                    message = string.Join("", botInstance.ServerConfig.CommandPrefix, message);
                    botInstance.ExecuteCommand(message, SelectedLocation, type);
                }
                else
                {
                    if (SelectedLocation != " --Server-- ")
                    {
                        if (SelectedLocation.StartsWith("#") || SelectedLocation.StartsWith("&"))
                        {
                            if (botInstance.IRC.Channels.Exists(chan => chan.Name == SelectedLocation))
                            {
                                botInstance.IRC.Command.SendPrivateMessage(SelectedLocation, message);
                            }
                            else
                            {
                                AddToBuffer(SelectedServer, SelectedLocation, "You are not in this channel.");
                            }
                        }
                        else
                        {
                            botInstance.IRC.Command.SendPrivateMessage(SelectedLocation, message);
                        }
                    }
                }
                InputBoxText = string.Empty;
            }
        }
Esempio n. 9
0
        private void DoEditLocation()
        {
            Effect = true;

            dynamic parameters = new ExpandoObject();

            parameters.IsManualSettings = true;
            parameters.Location         = SelectedLocation.Clone();
            Show.Dialog <LocationDetailView>(parameters, new Action <LocationDetailView>((view) =>
            {
                if (view.DialogResult ?? false)
                {
                    var index = Settings.Default.Locations.IndexOf(SelectedLocation);
                    Settings.Default.Locations[index] = (Location.Location)view.DataContext;
                    Settings.Save();
                    Locations        = Settings.Default.Locations;
                    SelectedLocation = Settings.Default.Locations[index];
                }

                Effect = false;
            }));
        }
Esempio n. 10
0
 private void RemoveLocationButton_Click(object sender, RoutedEventArgs e)
 {
     if (SelectedLocation != XManager.DefaultLocation)
     {
         MessageBoxResult message = MessageBox.Show($"Jesteś pewny, że chcesz usunąć {SelectedLocation.ToString()}?", "Potwierdź", MessageBoxButton.YesNo, MessageBoxImage.Question);
         if (message == MessageBoxResult.Yes)
         {
             RemoveLocation(SelectedLocation);
         }
     }
     else
     {
         MessageBox.Show("Nie można usnąć domyślnej lokalizacji, zmień domyślną lokalizację a następnie spróbuj usnąć lokalizację ponownie", "Błąd");
     }
 }
Esempio n. 11
0
        private void PictureBox_MouseMove(object sender, MouseEventArgs e)
        {
            if (SelectedLocation != null)
            {
                RectangleF position = SelectedLocation.Position;
                if (_mode == MapMode.Edit)
                {
                    if (!_moving)
                    {
                        if (new RectangleF(position.X - 2, position.Y, 4, position.Height).Contains(e.Location))
                        {
                            Cursor        = Cursors.SizeWE;
                            _cursorAction = CursorAction.ResizeW;
                        }
                        else if (new RectangleF(position.X + position.Width, position.Y, 4, position.Height).Contains(e.Location))
                        {
                            Cursor        = Cursors.SizeWE;
                            _cursorAction = CursorAction.ResizeE;
                        }
                        else if (new RectangleF(position.X, position.Y - 2, position.Width, 4).Contains(e.Location))
                        {
                            Cursor        = Cursors.SizeNS;
                            _cursorAction = CursorAction.ResizeN;
                        }
                        else if (new RectangleF(position.X, position.Y + position.Height, position.Width, 4).Contains(e.Location))
                        {
                            Cursor        = Cursors.SizeNS;
                            _cursorAction = CursorAction.ResizeS;
                        }
                        else if (position.Contains(e.Location))
                        {
                            Cursor        = Cursors.SizeAll;
                            _cursorAction = CursorAction.Move;
                        }
                        else
                        {
                            Cursor = Cursors.Default;
                        }
                    }
                }
                else
                {
                    Cursor = Cursors.Default;
                }
            }
            else
            {
                Cursor = Cursors.Default;
            }
            if (_moving && SelectedLocation != null)
            {
                PointF newPosition = new Point();
                bool   move        = false;
                switch (_cursorAction)
                {
                case CursorAction.Move:
                {
                    PointF movePoint = new PointF
                    {
                        X = e.Location.X - _offsetMoving.X,
                        Y = e.Location.Y - _offsetMoving.Y
                    };
                    if (movePoint.X < 0)
                    {
                        movePoint.X = 0;
                    }
                    if (movePoint.Y < 0)
                    {
                        movePoint.Y = 0;
                    }
                    if (movePoint.X > (pictureBox.Width - SelectedLocation.Position.Width))
                    {
                        movePoint.X = pictureBox.Width - SelectedLocation.Position.Width;
                    }
                    if (movePoint.Y > (pictureBox.Height - SelectedLocation.Position.Height))
                    {
                        movePoint.Y = pictureBox.Height - SelectedLocation.Position.Height;
                    }
                    SelectedLocation.Move(movePoint, pictureBox);
                }
                break;

                case CursorAction.ResizeE:
                {
                    SizeF newSize = new SizeF
                    {
                        Height = _oldSize.Height,
                        Width  = _oldSize.Width + (e.Location.X - _startClick.X)
                    };
                    SelectedLocation.Resize(newSize, pictureBox);
                }
                break;

                case CursorAction.ResizeN:
                {
                    newPosition.Y = e.Location.Y;
                    newPosition.X = _oldPosition.X;
                    SizeF newSize = new SizeF
                    {
                        Height = _oldSize.Height - (e.Location.Y - _startClick.Y),
                        Width  = _oldSize.Width
                    };
                    SelectedLocation.Resize(newSize, pictureBox);
                    move = true;
                }
                break;

                case CursorAction.ResizeS:
                {
                    SizeF newSize = new SizeF
                    {
                        Height = _oldSize.Height + (e.Location.Y - _startClick.Y),
                        Width  = _oldSize.Width
                    };
                    SelectedLocation.Resize(newSize, pictureBox);
                }
                break;

                case CursorAction.ResizeW:
                {
                    newPosition.Y = _oldPosition.Y;
                    newPosition.X = e.Location.X;
                    SizeF newSize = new SizeF
                    {
                        Height = _oldSize.Height,
                        Width  = _oldSize.Width - (e.Location.X - _startClick.X)
                    };
                    SelectedLocation.Resize(newSize, pictureBox);
                    move = true;
                }
                break;

                case CursorAction.Default:
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                if (SelectedLocation.Location.Taille_X < 1)
                {
                    SelectedLocation.Location.Taille_X = 1;
                    move = false;
                }
                if (SelectedLocation.Location.Taille_Y < 1)
                {
                    SelectedLocation.Location.Taille_Y = 1;
                    move = false;
                }
                if (move)
                {
                    SelectedLocation.Move(newPosition, pictureBox);
                }
                pictureBox.Refresh();
            }
        }
Esempio n. 12
0
        public void Save()
        {
            if (SelectedPatient != null && SelectedPatient.NewlyAdded)
            {
                PatientsList.Add(SelectedPatient);
                SelectedPatient.NewlyAdded = false;
            }
            try
            {
                bool   shouldDisplayMessage;
                double cost             = MaterialCost.HasValue ? MaterialCost.Value : 0;
                var    itemsNotSelected = GetNotAddedInformation(out shouldDisplayMessage);
                if (shouldDisplayMessage)
                {
                    MessageBox.Show("Inainte de a salva adaugati :" + itemsNotSelected);
                    return;
                }
                var duration = TimeSpan.FromMinutes(Convert.ToDouble(Durata));
                EndTIme = StartingHour.Add(duration);
                double percentage = SelectedPercentage != null
                    ? SelectedPercentage.Percentage / 100
                    : (SelectedWork != null && SelectedWork.Percent != 0 ? SelectedWork.Percent / 100 : 1);

                var intervention = new LocalIntervention()
                {
                    Id       = Id,
                    Area     = SelectedArea != null ? (SelectedArea.SettingTOarea()) : null,
                    Location = SelectedLocation != null?SelectedLocation.SettingToLocation() : null,
                                   DateHourDetail = new LocalDateHourDetail()
                    {
                        Date       = Date,
                        StartHour  = StartingHour,
                        Mili       = Convert.ToInt64(DateTime.Now.TimeOfDay.TotalMilliseconds),
                        EndingHour = EndTIme,
                        Duration   = duration
                    },
                    Lucrare          = SelectedWork,
                    PatientName      = SelectedPatient.AllName,
                    Material         = SelectedMaterial,
                    Observation      = Observation,
                    Revenue          = Revenue.HasValue ? Revenue.Value : 0,
                    PatientId        = SelectedPatient.Id,
                    Percent          = Convert.ToDouble((Revenue - cost) * percentage),
                    WasPayedByDental = WasPayedByDental,
                    TechnicianId     = SelectedTechnician != null ? SelectedTechnician.Id : (int?)null,
                    MaterialCost     = MaterialCost,
                    Technician       = SelectedTechnician
                };

                ChangeTotalInfo(intervention, IsInEditMode);
                intervention.Id = DatabaseHandler.Instance.AddIntervention(intervention, LocalCache.Instance.CurrentUser.Id);
                if (IsInEditMode)
                {
                    LocalIntervention = intervention;
                }
                else
                {
                    LocalCache.Instance.AddIntervention(intervention);
                    var patient = LocalCache.Instance.PatientsRepository.Patients.FirstOrDefault(item => item.Id == SelectedPatient.Id);
                    if (patient != null)
                    {
                        patient.Interventions.Add(intervention);
                    }
                }
                SetNewIntervenionDetails(intervention);
                IsPatientComboFocused = false;
                IsPatientComboFocused = true;
                InitData();
            }
            catch (Exception ex)
            {
                MessageBox.Show("A intervenit o eroare la salvare.");
                Log.Error("Error inserting intervention --> Save");
            }
        }
Esempio n. 13
0
        private void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // Add the external Validation.js to the Page
                const string csname = "ExtValidationScriptFile";
                var          cstype = MethodBase.GetCurrentMethod().GetType();
                var          cstext = "<script src=\"" + ResolveUrl("~/DesktopModules/Events/Scripts/Validation.js") +
                                      "\" type=\"text/javascript\"></script>";
                if (!Page.ClientScript.IsClientScriptBlockRegistered(csname))
                {
                    Page.ClientScript.RegisterClientScriptBlock(cstype, csname, cstext, false);
                }

                ddlLocations.EmptyMessage = Localization.GetString("NoLocations", LocalResourceFile);
                ddlLocations.Localization.AllItemsCheckedString =
                    Localization.GetString("AllLocations", LocalResourceFile);
                ddlLocations.Localization.CheckAllString =
                    Localization.GetString("SelectAllLocations", LocalResourceFile);
                if (Settings.Enablelocations == EventModuleSettings.DisplayLocations.SingleSelect)
                {
                    ddlLocations.CheckBoxes = false;
                }

                if (!Page.IsPostBack)
                {
                    //Bind DDL
                    var ctrlEventLocations = new EventLocationController();
                    var lstLocations       = ctrlEventLocations.EventsLocationList(PortalId);

                    var arrLocations = new ArrayList();
                    if (Settings.Restrictlocations)
                    {
                        foreach (EventLocationInfo dbLocation in lstLocations)
                        {
                            foreach (int location in Settings.ModuleLocationIDs)
                            {
                                if (dbLocation.Location == location)
                                {
                                    arrLocations.Add(dbLocation);
                                }
                            }
                        }
                    }
                    else
                    {
                        arrLocations.AddRange(lstLocations);
                    }

                    if (lstLocations.Count == 0)
                    {
                        Visible = false;
                        SelectedLocation.Clear();
                        return;
                    }

                    //Restrict locations by events in time frame.
                    if (Settings.RestrictLocationsToTimeFrame)
                    {
                        //Only for list view.
                        var whichView = string.Empty;
                        if (!(Request.QueryString["mctl"] == null) && ModuleId ==
                            Convert.ToInt32(Request.QueryString["ModuleID"]))
                        {
                            if (Request["mctl"].EndsWith(".ascx"))
                            {
                                whichView = Request["mctl"];
                            }
                            else
                            {
                                whichView = Request["mctl"] + ".ascx";
                            }
                        }
                        if (whichView.Length == 0)
                        {
                            if (!ReferenceEquals(
                                    Request.Cookies.Get("DNNEvents" + Convert.ToString(ModuleId)), null))
                            {
                                whichView = Request.Cookies.Get("DNNEvents" + Convert.ToString(ModuleId)).Value;
                            }
                            else
                            {
                                whichView = Settings.DefaultView;
                            }
                        }

                        if (whichView == "EventList.ascx" || whichView == "EventRpt.ascx")
                        {
                            var objEventInfoHelper =
                                new EventInfoHelper(ModuleId, TabId, PortalId, Settings);
                            var lstEvents = default(ArrayList);

                            var getSubEvents = Settings.MasterEvent;
                            var numDays      = Settings.EventsListEventDays;
                            var displayDate  = default(DateTime);
                            var startDate    = default(DateTime);
                            var endDate      = default(DateTime);
                            if (Settings.ListViewUseTime)
                            {
                                displayDate = DisplayNow();
                            }
                            else
                            {
                                displayDate = DisplayNow().Date;
                            }
                            if (Settings.EventsListSelectType == "DAYS")
                            {
                                startDate = displayDate.AddDays(Settings.EventsListBeforeDays * -1);
                                endDate   = displayDate.AddDays(Settings.EventsListAfterDays * 1);
                            }
                            else
                            {
                                startDate = displayDate;
                                endDate   = displayDate.AddDays(numDays);
                            }

                            lstEvents = objEventInfoHelper.GetEvents(startDate, endDate, getSubEvents,
                                                                     new ArrayList(Convert.ToInt32(new[] { "-1" })),
                                                                     new ArrayList(Convert.ToInt32(new[] { "-1" })), -1,
                                                                     -1);

                            var eventLocationIds = new ArrayList();
                            foreach (EventInfo lstEvent in lstEvents)
                            {
                                eventLocationIds.Add(lstEvent.Location);
                            }
                            foreach (EventLocationInfo lstLocation in lstLocations)
                            {
                                if (!eventLocationIds.Contains(lstLocation.Location))
                                {
                                    arrLocations.Remove(lstLocation);
                                }
                            }
                        }
                    }

                    //Bind locations.
                    ddlLocations.DataSource = arrLocations;
                    ddlLocations.DataBind();

                    if (Settings.Enablelocations == EventModuleSettings.DisplayLocations.SingleSelect)
                    {
                        ddlLocations.Items.Insert(
                            0,
                            new RadComboBoxItem(Localization.GetString("AllLocations", LocalResourceFile),
                                                "-1"));
                        ddlLocations.SelectedIndex = 0;
                    }
                    ddlLocations.OnClientDropDownClosed =
                        "function() { btnUpdateClick('" + btnUpdate.UniqueID + "','" + ddlLocations.ClientID +
                        "');}";
                    ddlLocations.OnClientLoad = "function() { storeText('" + ddlLocations.ClientID + "');}";
                    if (Settings.Enablelocations == EventModuleSettings.DisplayLocations.SingleSelect)
                    {
                        foreach (int location in SelectedLocation)
                        {
                            ddlLocations.SelectedIndex =
                                ddlLocations.FindItemByValue(location.ToString()).Index;
                            break;
                        }
                    }
                    else
                    {
                        foreach (int location in SelectedLocation)
                        {
                            foreach (RadComboBoxItem item in ddlLocations.Items)
                            {
                                if (item.Value == location.ToString())
                                {
                                    item.Checked = true;
                                }
                            }
                        }

                        if (Convert.ToInt32(SelectedLocation[0]) == -1)
                        {
                            foreach (RadComboBoxItem item in ddlLocations.Items)
                            {
                                item.Checked = true;
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                //ProcessModuleLoadException(Me, exc)
            }
        }
Esempio n. 14
0
        /// <summary>
        /// Connect to a ExpressVPN location.
        /// </summary>
        /// <param name="args">Connection arguments</param>
        /// <param name="timeout">Timeout waiting for the connection to be established</param>
        public async Task Connect(ConnectArgs args, int timeout = 10000)
        {
            AssertHelperConnected();

            if (LatestStatus.state != State.connected)
            {
                // A SelectLocation call is required for the browser extension
                // to show the correct location
                var selected = new SelectedLocation()
                {
                    id                = args.id,
                    name              = string.IsNullOrEmpty(args.country) ? args.name : args.country,
                    is_country        = !string.IsNullOrEmpty(args.country),
                    is_smart_location = args.is_default
                };

                if (LatestStatus.selected_location.name != selected.name)
                {
                    var    source  = new TaskCompletionSource <bool>();
                    Action handler = () => source.SetResult(true);
                    StatusUpdate += handler;

                    Call("XVPN.SelectLocation", new SelectArgs()
                    {
                        selected_location = new SelectedLocation()
                        {
                            id                = args.id,
                            name              = string.IsNullOrEmpty(args.country) ? args.name : args.country,
                            is_country        = !string.IsNullOrEmpty(args.country),
                            is_smart_location = args.is_default
                        }
                    });

                    try {
                        await WithTimeout(source.Task);
                    } finally {
                        StatusUpdate -= handler;
                    }
                }
            }

            Call("XVPN.Connect", args);

            float?progress = null;

            Action <float> progressHandler = (p) => progress = p;

            ConnectionProgress += progressHandler;

            var lastStateWasConnected = (LatestStatus.state == State.connected);
            var start = DateTimeOffset.Now.ToUnixTimeMilliseconds();

            while (
                (
                    LatestStatus.state == State.ready ||
                    LatestStatus.state == State.connecting ||
                    LatestStatus.state == State.disconnecting ||
                    (lastStateWasConnected && LatestStatus.state == State.connected)
                ) &&
                (DateTimeOffset.Now.ToUnixTimeMilliseconds() - start) < timeout
                )
            {
                await Task.Delay(20);

                if (progress != null)
                {
                    Log.LogInformation($"Connecting... {progress:0.##}%");
                    progress = null;
                }
                if (lastStateWasConnected &&
                    (LatestStatus.state != State.connected && LatestStatus.state != State.disconnecting)
                    )
                {
                    lastStateWasConnected = false;
                }
            }
            ConnectionProgress -= progressHandler;

            if (LatestStatus.state == State.connected)
            {
                Log.LogInformation($"Finished connection with state: {LatestStatus.state}");
            }
            else if (LatestStatus.state == State.ready || LatestStatus.state == State.connecting)
            {
                throw new TimeoutException($"Timed out waiting to connect.");
            }
            else
            {
                throw new Exception($"Error while connecting, ended up in state '{LatestStatus.state}'");
            }
        }