コード例 #1
0
        private void GetParams()
        {
            Filter = new ExecQuery().GetSettings(Filter);
            var param = "";

            if (Filter.PairCallerPosition != null || Filter.PairCallerSize != null)
            {
                param += string.Format("['|Phone',{0},{1},{2},{3}],",
                                       Filter.PairCallerPosition == null ? "" : Filter.PairCallerPosition.First,
                                       Filter.PairCallerPosition == null ? "" : Filter.PairCallerPosition.Second,
                                       Filter.PairCallerSize == null ? "" : Filter.PairCallerSize.First,
                                       Filter.PairCallerSize == null ? "" : Filter.PairCallerSize.Second);
            }
            if (Filter.PairAlertPosition != null || Filter.PairAlertSize != null)
            {
                param += string.Format("['|Alert',{0},{1},{2},{3}],",
                                       Filter.PairAlertPosition == null ? "" : Filter.PairAlertPosition.First,
                                       Filter.PairAlertPosition == null ? "" : Filter.PairAlertPosition.Second,
                                       Filter.PairAlertSize == null ? "" : Filter.PairAlertSize.First,
                                       Filter.PairAlertSize == null ? "" : Filter.PairAlertSize.Second);
            }
            if (!string.IsNullOrEmpty(param) && param.Length > 1)
            {
                param = param.Remove(param.Length - 1, 1);
                JS.Write("itemsParam = [{0}];", param);
            }
        }
コード例 #2
0
        /// <summary>
        ///     Отрисовка списка компаний
        /// </summary>
        /// <param name="w"></param>
        protected void RenderData(TextWriter w)
        {
            if (!string.IsNullOrEmpty(_id))
            {
                List <PersonCustomer> list;
                if (Application["PersonCustomer" + _id] != null)
                {
                    list = (List <PersonCustomer>)Application["PersonCustomer" + _id];
                }
                else
                {
                    list = new ExecQuery().GetCompanyBySubdivision(_id);
                    Application["PersonCustomer" + _id] = list;
                }

                if (list.Count > 0)
                {
                    for (var i = 0; i < list.Count; i++)
                    {
                        if (i > 0)
                        {
                            w.Write(
                                "<hr style=\"height:1px;border:none;color:lightgray;background-color:lightgray;\" />");
                        }
                        else
                        {
                            w.Write("<div style=\"width: 200px;\">");
                        }
                        w.Write(
                            "<a title=\"{0}\" data-id=\"{2}\" class=\"v4_callerControl\" caller-type=\"3\" href=\"javascript: void(0);\" onclick=\"v4_windowOpen('{1}');\">{0}</a>",
                            _lang == "ru" || string.IsNullOrEmpty(list[i].NameLat) ? list[i].Name : list[i].NameLat,
                            Config.person_form + "?id=" + list[i].Id, list[i].Id);
                    }

                    w.Write("</div>");
                }
                else
                {
                    w.Write("<div style=\"width: 100px;\">{0}.</div>", _resx.GetString("lNoData"));
                }
            }
            else
            {
                w.Write("<div style=\"width: 100px;\">{0}.</div>", _resx.GetString("lNoData"));
            }
        }
コード例 #3
0
 private void SetProperty()
 {
     EmployeeId          = Request.QueryString["id"];
     PersonId            = Request.QueryString["personid"];
     PrimaryEmployeeCalc = Request.QueryString["prim"] == "True";
     StartPeriod         = Convert.ToDateTime(Request.QueryString["date"]);
     Tz  = Request.QueryString["tz"];
     _cp = new ExecQuery().GetCardPersonById(EmployeeId);
     if (PrimaryEmployeeCalc)
     {
         ep1.Checked = true;
     }
     else
     {
         ep2.Checked = true;
     }
     SetEmployeeInfo();
     Refresh();
     HelpUrl = Request.Url.Scheme + "://" + Request.Url.Host + Request.ApplicationPath +
               "/Forms/hlp/help.htm?id=2";
 }
コード例 #4
0
        public QueryVM(ServerConnection connection, string dbName)
        {
            Exec = new ExecQuery(connection, dbName);

            RunCommand = new DelegateCommandAsync(
                o => !IsRunning,
                ro =>
            {
                return(RunCmd());
            }
                );

            CancelCommand = new DelegateCommand(
                o => IsRunning,
                ro =>
            {
                Exec.Cancel();
                IsRunning = false;
            }
                );
        }
コード例 #5
0
        private void SetProperty()
        {
            EmployeeId          = Request.QueryString["id"];
            Tz                  = Request.QueryString["tz"];
            PersonId            = new ExecQuery().GetPersonIdByEmployeeId(EmployeeId);
            Period.ValuePeriod  = Request.QueryString["period"];
            PrimaryEmployeeCalc = Request.QueryString["prim"] == "True";
            Period.ValueFrom    = Request.QueryString["from"];
            Period.ValueTo      = Request.QueryString["to"];

            if (PrimaryEmployeeCalc)
            {
                ep1.Checked = true;
            }
            else
            {
                ep2.Checked = true;
            }
            HelpUrl = Request.Url.Scheme + "://" + Request.Url.Host + Request.ApplicationPath +
                      "/Forms/hlp/help.htm?id=1";
        }
コード例 #6
0
ファイル: MainVM.cs プロジェクト: rexem/LightSqlProfiler
        public MainVM()
        {
            StartCommand = new DelegateCommandAsync(
                o => Settings.Connections.CurrentConnection != null && Status.Status == AppStatusCodes.Ready,
                o =>
            {
                // show server menu when we need a password or connection
                if ((o as bool?) != true && Settings.Connections.CurrentConnection?.RawPassword == null)
                {
                    ServersCommand.Execute(null);
                    return(Task.FromResult <object>(null));
                }

                return(StartTraceAsync());
            }
                );

            StopCommand = new DelegateCommandAsync(
                o => Status.Status != AppStatusCodes.Ready,
                o => StopTraceAsync()
                );

            ServersCommand = new DelegateCommand(
                o => Status.Status == AppStatusCodes.Ready,
                o => new ConnectWindow(Settings.Connections, () => StartCommand.Execute(true)).Show()
                );

            ClearEventsCommand = new DelegateCommand(
                o => true,
                o => Events.Clear()
                );

            SelectColumnsCommand = new DelegateCommand(
                o => true,
                o =>
            {
                new ColumnSelectorWindow(
                    Settings.Columns,
                    (result) =>
                {
                    EventGrid.BuildColumns(result, Events);
                    Settings.Columns = result.ToList();
                    OnPropertyChanged(nameof(Settings));
                }
                    ).Show();
            }
                );

            CopySqlCommand = new DelegateCommand(
                o => true,
                o => SqlPreview.CopyToClipboard()
                );

            UserSettingsCommand = new DelegateCommand(
                o => true,
                o => new UserSettingsWindow(Settings).Show()
                );

            AboutCommand = new DelegateCommand(
                o => true,
                o => new AboutWindow().Show()
                );

            CheckUpdatesCommand = new DelegateCommandAsync(
                o => true,
                o => CheckForUpdates()
                );

            ExitCommand = new DelegateCommand(
                o => true,
                o => OnExit()
                );

            RunCommand = new DelegateCommand(
                o => Status.Status == AppStatusCodes.Running && SelectedEvent?.EventType != EventClassType.Custom && SqlPreview?.GetText() != null,
                o => RunSqlCode()
                );

            RunBackgroundSqlCommand = new DelegateCommandAsync(
                o => Status.Status == AppStatusCodes.Running && SelectedEvent?.EventType != EventClassType.Custom && SqlPreview?.GetText() != null,
                o =>
            {
                var exec = new ExecQuery((ServerConnection)Status.ActiveConnection.Clone(), CurrentDatabaseName);
                return(exec.ExecSqlAsync(SqlPreview.GetText()));
            }
                );

            // capture new events
            Traces.OnEvent += (status, ev) =>
            {
                if (status == ProfilerEventStatus.NewEvent && !ev.IsInternal)
                {
                    Events.Add(ev);
                }
            };

            // update canExecute() for each command when status changes
            Status.PropertyChanged += (ee, ss) => StatusChanged();
        }
コード例 #7
0
        private void GetParams()
        {
            SetProperty();
            Filter = new ExecQuery().GetSettings(Filter);

            cbNotDisplayEmpty.Checked = _notDisplayEmpty = Filter.IsDetailNoEmpty;
            if (Filter.RowsPerPageDetails > 0)
            {
                pagerBar.RowsPerPage = RowsPerPageSetting = Filter.RowsPerPageDetails;
            }
            else
            {
                pagerBar.RowsPerPage = RowsPerPageSetting;
            }
            pagerBar.MaxPageNumber     = DefaultMaxPage;
            pagerBar.CurrentPageNumber = CurrentPageSetting;
            pagerBar.MaxPageNumber     = 1;

            if (Request.QueryString["prim"] == null)
            {
                PrimaryEmployeeCalc = Filter.IsEmployeePrimary;
            }
            if (PrimaryEmployeeCalc)
            {
                ep1.Checked = true;
            }
            else
            {
                ep2.Checked = true;
            }

            if (Request.QueryString["period"] == null)
            {
                if (Filter.PeriodInfo.DateFrom == null || Filter.PeriodInfo.DateTo == null)
                {
                    Period.ValuePeriod   = ((int)PeriodsEnum.Day).ToString(CultureInfo.InvariantCulture);
                    Period.ValueDateFrom = DateTime.Now;
                }
                else
                {
                    Period.ValuePeriod = Filter.PeriodInfo.PeriodType ?? "";
                    if (Period.ValuePeriod != ((int)PeriodsEnum.Day).ToString(CultureInfo.InvariantCulture))
                    {
                        Period.ValueDateFrom = Filter.PeriodInfo.DateFrom;
                        Period.ValueDateTo   = Filter.PeriodInfo.DateTo;
                    }
                    else
                    {
                        Period.ValueDateFrom = DateTime.Now;
                    }
                }
            }

            var param = "";

            if (Filter.PairCallerPosition != null || Filter.PairCallerSize != null)
            {
                param += string.Format("['|Phone',{0},{1},{2},{3}],",
                                       Filter.PairCallerPosition == null ? "" : Filter.PairCallerPosition.First,
                                       Filter.PairCallerPosition == null ? "" : Filter.PairCallerPosition.Second,
                                       Filter.PairCallerSize == null ? "" : Filter.PairCallerSize.First,
                                       Filter.PairCallerSize == null ? "" : Filter.PairCallerSize.Second);
            }
            if (Filter.PairAlertPosition != null || Filter.PairAlertSize != null)
            {
                param += string.Format("['|Alert',{0},{1},{2},{3}],",
                                       Filter.PairAlertPosition == null ? "" : Filter.PairAlertPosition.First,
                                       Filter.PairAlertPosition == null ? "" : Filter.PairAlertPosition.Second,
                                       Filter.PairAlertSize == null ? "" : Filter.PairAlertSize.First,
                                       Filter.PairAlertSize == null ? "" : Filter.PairAlertSize.Second);
            }
            if (!string.IsNullOrEmpty(param) && param.Length > 1)
            {
                param = param.Remove(param.Length - 1, 1);
                JS.Write("itemsParam = [{0}];", param);
            }

            SetEmployeeInfo();
            RefreshList();
            JS.Write("SetTableDetailsSize();");
        }