示例#1
0
文件: Appli.cs 项目: jcaillon/3P
 /// <summary>
 /// Opens the application window and go to a specific page
 /// </summary>
 /// <param name="pageName"></param>
 public static void GoToPage(PageNames pageName)
 {
     try {
         if (!_hasBeenShownOnce || !_form.Visible) {
             ToggleView();
         }
         _form.ShowPage(pageName.ToString());
     } catch (Exception e) {
         ErrorHandler.ShowErrors(e, "Error in GoToPage");
     }
 }
示例#2
0
        public static MsCrmResult GetPageContent(Guid portalId, PageNames pageName, SqlDataAccess sda)
        {
            MsCrmResult returnValue = new MsCrmResult();
            try
            {
                #region | SQL QUERY |

                string sqlQuery = @"SELECT
                                        pc.new_content AS Content
                                    FROM
                                        new_pagecontent AS pc (NOLOCK)
                                    WHERE
                                        pc.new_portalId='{0}'
                                    AND
                                        pc.new_page={1}
                                    AND
                                        pc.statecode=0";

                #endregion

                DataTable dt = sda.getDataTable(string.Format(sqlQuery, portalId, ((int)pageName).ToString()));

                if (dt.Rows.Count > 0)
                {
                    if (dt.Rows[0]["Content"] != DBNull.Value)
                    {
                        returnValue.Success = true;
                        returnValue.Result = dt.Rows[0]["Content"].ToString();
                    }
                }
                else
                {
                    returnValue.Result = "M051"; //"Sayfa içeriği hazırlanmamıştır.";
                }
            }
            catch (Exception ex)
            {
                returnValue.Result = ex.Message;
            }
            return returnValue;
        }
示例#3
0
文件: URL.cs 项目: GarikMelkonyan/daf
 public URL(PageNames pageName, FolderNames folderName)
     : this(string.Format("/{0}/{1}", folderName, pageName))
 {
 }
示例#4
0
        /// <summary>
        /// Called when [change screen page event].
        /// </summary>
        /// <param name="pageName">Name of the page.</param>
        private void ChangeScreenPage(string regionName, PageNames pageName)
        {
            // Check the region exists
            if (_regionManager.Regions.ContainsRegionWithName(regionName))
            {
                using (new ShowBusyIndicator())
                {
                    // Find an activate the page with the given name
                    IRegion region = _regionManager.Regions[regionName];
                    region.Activate(region.Views.First(x => ((FrameworkElement)x).Name == pageName.ToString()));

                    //TODO: This is broken since it doesn't account for the second screen page changes
                    _currentScreenPage = pageName;

                    // RaiseCanExecuteChanged method on each toolbar command
                    _toolbarItems.ForEach(item => ((DelegateCommand<object>)item.Command).RaiseCanExecuteChanged());

                    // Publish notification event
                    _eventAggregator.GetEvent<ScreenEvents.ActiveScreenChanged>().Publish(new ScreenEvents.ActiveScreenChanged()
                    {
                        RegionName = regionName,
                        PageName = pageName
                    });
                }
            }
        }
示例#5
0
 public void On_ChangeCertificate(PageNames pageName, IObjectBase senderContext, string sourceName, string sourceContent, out PageNames destinationPageName)
 {
     destinationPageName = PageNames.CurrentPage;
 }
        private bool ShouldBeActive()
        {
            bool   rtn = false;
            string currentController = ViewContext.RouteData.Values["Controller"].ToString();

            string currentAction   = ViewContext.RouteData.Values["Action"].ToString();
            string id              = ViewContext.RouteData.Values["Id"] != null ? ViewContext.RouteData.Values["Id"].ToString() : string.Empty;
            string currentPagename = ViewContext.RouteData.Values["pageName"] != null ? ViewContext.RouteData.Values["pageName"].ToString() : string.Empty;

            List <string> activeControllers = string.IsNullOrEmpty(Controllers) ? new List <string>() : Controllers.ToLower().Split(',').ToList();
            List <string> activeActions     = string.IsNullOrEmpty(Actions) ? new List <string>() : Actions.ToLower().Split(',').ToList();
            List <string> activePageNames   = string.IsNullOrEmpty(PageNames) ? new List <string>() : PageNames.ToLower().Split(',').ToList();

            if (!string.IsNullOrWhiteSpace(Controllers))
            {
                rtn = (string.IsNullOrEmpty(Actions) && string.IsNullOrEmpty(PageNames) && activeControllers.Contains(currentController.ToLower())) ||
                      (
                    activeControllers.Contains(currentController.ToLower()) && // Current Controller
                    activeActions.Contains(currentAction.ToLower()) && // Current Action
                    (string.IsNullOrEmpty(Id) || id == Id) && // Current Details
                    (string.IsNullOrEmpty(PageNames) || activePageNames.Contains(currentPagename.ToLower()))
                      );
            }

            //if (!string.IsNullOrWhiteSpace(Controllers))
            //{
            //    foreach (string controller in Controllers.Split(','))
            //    {
            //        if (currentController.ToLower() == controller.ToLower())
            //        {
            //            rtn = true;
            //            break;
            //        }
            //    }

            //}

            return(rtn);
        }
示例#7
0
        public void On_CreateUsername(PageNames pageName, IObjectBase senderContext, string sourceName, string sourceContent, out PageNames destinationPageName)
        {
            if (SignedInAccount == null)
            {
                destinationPageName = PageNames.CurrentPage;
            }

            else
            {
                ((Account)SignedInAccount).CreateUsername(Username);

                _ChangeMethodIndex  = -1;
                destinationPageName = PageNames.profilePage;
            }
        }
示例#8
0
        private static void SendEvent(bool writeToConsole = true)
        {
            var ev = new Event();

            if (_dateSpans[_dateSpanIndex] != TimeSpan.Zero)
            {
                ev.Date = RandomHelper.GetDateTime(DateTime.Now.Subtract(_dateSpans[_dateSpanIndex]), DateTime.Now);
            }

            ev.Type = EventTypes.Random();
            if (ev.Type == Event.KnownTypes.FeatureUsage)
            {
                ev.Source = FeatureNames.Random();
            }
            else if (ev.Type == Event.KnownTypes.NotFound)
            {
                ev.Source = PageNames.Random();
            }
            else if (ev.Type == Event.KnownTypes.Log)
            {
                ev.Source  = LogSources.Random();
                ev.Message = RandomHelper.GetPronouncableString(RandomHelper.GetRange(5, 15));
            }

            ev.SetUserIdentity(Identities.Random());

            for (int i = 0; i < RandomHelper.GetRange(1, 5); i++)
            {
                string key = RandomHelper.GetPronouncableString(RandomHelper.GetRange(5, 10));
                while (ev.Data.ContainsKey(key) || key == Event.KnownDataKeys.Error)
                {
                    key = RandomHelper.GetPronouncableString(RandomHelper.GetRange(5, 15));
                }

                ev.Data.Add(key, RandomHelper.GetPronouncableString(RandomHelper.GetRange(5, 25)));
            }

            int tagCount = RandomHelper.GetRange(1, 3);

            for (int i = 0; i < tagCount; i++)
            {
                string tag = EventTags.Random();
                if (!ev.Tags.Contains(tag))
                {
                    ev.Tags.Add(tag);
                }
            }

            if (ev.Type == Event.KnownTypes.Error)
            {
                // limit error variation so that stacking will occur
                if (_randomErrors == null)
                {
                    _randomErrors = new List <Error>(Enumerable.Range(1, 25).Select(i => GenerateError()));
                }

                ev.Data[Event.KnownDataKeys.Error] = _randomErrors.Random();
            }

            // use server settings to see if we should include this data
            if (ExceptionlessClient.Default.Configuration.Settings.GetBoolean("IncludeConditionalData", true))
            {
                ev.AddObject(new { Total = 32.34, ItemCount = 2, Email = "*****@*****.**" }, "Conditional Data");
            }

            //ev.AddRecentTraceLogEntries();

            ExceptionlessClient.Default.SubmitEvent(ev);

            if (writeToConsole)
            {
                Console.SetCursorPosition(0, OPTIONS_MENU_LINE_COUNT + 2);
                Console.WriteLine("Sent 1 event.");
                Trace.WriteLine("Sent 1 event.");

                ClearNonOptionsLines();
            }
        }
示例#9
0
 public void On_SendDeleteEmail(PageNames pageName, string sourceName, string sourceContent)
 {
     On_SignOut(pageName, sourceName, sourceContent);
     MessageBox.Show("Email sent");
 }
示例#10
0
        public void On_RemovePassword(PageNames pageName, IObjectBase senderContext, string sourceName, string sourceContent, out PageNames destinationPageName)
        {
            if (!ClearPasswordAndCompare())
            {
                IsPasswordInvalidError = true;
                NotifyPropertyChanged(nameof(IsPasswordInvalidError));

                destinationPageName = PageNames.CurrentPage;
            }
            else
            {
                ((Account)SignedInAccount).RemovePassword();

                _ChangeMethodIndex  = -1;
                destinationPageName = PageNames.profilePage;
            }
        }
示例#11
0
 public void On_ConfirmDelete(PageNames pageName, IObjectBase senderContext, string sourceName, string sourceContent, out PageNames destinationPageName)
 {
     if (MessageBox.Show("This will delete your account, and cannot be recovered, are you sure?", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
     {
         destinationPageName = PageNames.delete_accountPage;
     }
     else
     {
         destinationPageName = PageNames.CurrentPage;
     }
 }
示例#12
0
        public void On_ChangeUsername(PageNames pageName, IObjectBase senderContext, string sourceName, string sourceContent, out PageNames destinationPageName)
        {
            if (IsPasswordRequired && !ClearPasswordAndCompare())
            {
                IsPasswordInvalidError = true;
                NotifyPropertyChanged(nameof(IsPasswordInvalidError));

                destinationPageName = PageNames.CurrentPage;
            }

            else if (string.IsNullOrEmpty(NewUsername) || SignedInAccount == null)
            {
                destinationPageName = PageNames.CurrentPage;
            }

            else
            {
                ((Account)SignedInAccount).ChangeUsername(NewUsername);
                destinationPageName = PageNames.profilePage;
            }
        }
示例#13
0
        public void On_ChangeEmail(PageNames pageName, IObjectBase senderContext, string sourceName, string sourceContent, out PageNames destinationPageName)
        {
            if (!ClearPasswordAndCompare())
            {
                IsPasswordInvalidError = true;
                NotifyPropertyChanged(nameof(IsPasswordInvalidError));

                destinationPageName = PageNames.CurrentPage;
            }
            else
            {
                destinationPageName = PageNames.profilePage;
            }
        }
示例#14
0
文件: URL.cs 项目: GarikMelkonyan/daf
 public URL(PageNames pageName)
     : this(string.Format("~/{0}", pageName))
 {
 }
示例#15
0
        public void On_CreateUsernameAndPassword(PageNames pageName, IObjectBase senderContext, string sourceName, string sourceContent, out PageNames destinationPageName)
        {
            if (SignedInAccount == null || string.IsNullOrEmpty(NewPassword))
            {
                destinationPageName = PageNames.CurrentPage;
            }

            else
            {
                ((Account)SignedInAccount).CreateUsernameAndPassword(Username, NewPassword);

                _ChangeMethodIndex  = -1;
                destinationPageName = PageNames.profilePage;
            }
        }
示例#16
0
 protected void Redirect(PageNames pageToRedirect)
 {
     Response.Redirect(string.Format("~/{0}.aspx", pageToRedirect));
 }
示例#17
0
        public void PopulateEvent(Event ev)
        {
            if (MinDate.HasValue || MaxDate.HasValue)
            {
                ev.Date = RandomData.GetDateTime(MinDate ?? DateTime.MinValue, MaxDate ?? DateTime.MaxValue);
            }

            ev.Type = EventTypes.Random();
            if (ev.Type == Event.KnownTypes.FeatureUsage)
            {
                ev.Source = FeatureNames.Random();
            }
            else if (ev.Type == Event.KnownTypes.NotFound)
            {
                ev.Source = PageNames.Random();
            }
            else if (ev.Type == Event.KnownTypes.Log)
            {
                ev.Source  = LogSources.Random();
                ev.Message = RandomData.GetString();

                string level = LogLevels.Random();
                if (!String.IsNullOrEmpty(level))
                {
                    ev.Data[Event.KnownDataKeys.Level] = level;
                }
            }

            if (RandomData.GetBool(80))
            {
                ev.Geo = RandomData.GetCoordinate();
            }

            if (RandomData.GetBool(20))
            {
                ev.Value = RandomData.GetDecimal();
            }

            ev.SetVersion(RandomData.GetVersion("2.0", "4.0"));

            ev.AddRequestInfo(new RequestInfo {
                //ClientIpAddress = ClientIpAddresses.Random(),
                Path = PageNames.Random()
            });

            ev.Data.Add(Event.KnownDataKeys.EnvironmentInfo, new EnvironmentInfo {
                IpAddress   = MachineIpAddresses.Random() + ", " + MachineIpAddresses.Random(),
                MachineName = MachineNames.Random()
            });

            for (int i = 0; i < RandomData.GetInt(1, 3); i++)
            {
                string key = RandomData.GetWord();
                while (ev.Data.ContainsKey(key) || key == Event.KnownDataKeys.Error)
                {
                    key = RandomData.GetWord();
                }

                ev.Data.Add(key, RandomData.GetString());
            }

            int tagCount = RandomData.GetInt(1, 3);

            for (int i = 0; i < tagCount; i++)
            {
                string tag = EventTags.Random();
                if (!ev.Tags.Contains(tag))
                {
                    ev.Tags.Add(tag);
                }
            }

            if (ev.Type == Event.KnownTypes.Error)
            {
                if (RandomData.GetBool())
                {
                    // limit error variation so that stacking will occur
                    if (_randomErrors == null)
                    {
                        _randomErrors = new List <Error>(Enumerable.Range(1, 25).Select(i => GenerateError()));
                    }

                    ev.Data[Event.KnownDataKeys.Error] = _randomErrors.Random();
                }
                else
                {
                    // limit error variation so that stacking will occur
                    if (_randomSimpleErrors == null)
                    {
                        _randomSimpleErrors = new List <SimpleError>(Enumerable.Range(1, 25).Select(i => GenerateSimpleError()));
                    }

                    ev.Data[Event.KnownDataKeys.SimpleError] = _randomSimpleErrors.Random();
                }
            }
        }