/// <summary>
    /// Currently we are going through the legacy slxweb.dll and populating an iframe.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.Visible)
        {
            string         UserId         = "";
            SLXUserService slxUserService = Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.Platform.Security.IUserService>() as SLXUserService;
            if (slxUserService != null)
            {
                UserId = slxUserService.GetUser().Id.ToString().Trim();
            }

            LegacySupportCommon.LegacyLogin(UserId, Page);
            string EntityId = (Request.QueryString["entityId"] == null) ? "" : Request.QueryString["entityId"];

            if ((sParams.Length > 0) && (sParams[0] != '&'))
            {
                sParams = "&" + sParams;
            }
            string sUrl = String.Format("/scripts/slxweb.dll/view?name={0}{1}", sTemplate, sParams);
            if (sUrl.ToLower().IndexOf("id=") == -1)
            {
                sUrl = sUrl + "&id=" + EntityId;
            }
            LegacyTabContent.Attributes.Add("src", sUrl);
            LegacyTabContent.Attributes.Add("width", sWidth);
            LegacyTabContent.Attributes.Add("height", sHeight);
            LegacyTabContent.Attributes.Add("border", sBorder);
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     _SlxUserService = ApplicationContext.Current.Services.Get<IUserService>() as SLXUserService;
     _UserId = _SlxUserService.GetUser().Id;
     _UserName = _SlxUserService.GetUser().ToString();
     displayQueue = (Page.Request.QueryString.Get("mode") == "batch");
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        m_SLXUserService = ApplicationContext.Current.Services.Get <IUserService>() as SLXUserService;
        _UserOptions     = ApplicationContext.Current.Services.Get <IUserOptionsService>();
        _Context         = ApplicationContext.Current.Services.Get <IContextService>(true);
        object cacheDisplayRem = _Context.GetContext("ActivityRemindersDisplay");

        if (cacheDisplayRem != null)
        {
            string[] temp = cacheDisplayRem.ToString().Split('|');
            _DisplayReminders = Convert.ToBoolean(temp[0]);
            _Alarms           = Convert.ToBoolean(temp[1]);
            _PastDue          = Convert.ToBoolean(temp[2]);
            _Confirms         = Convert.ToBoolean(temp[3]);
        }
        else
        {
            _DisplayReminders = (_UserOptions.GetCommonOption("DisplayActivityReminders", "Calendar") != "F");
            _Alarms           = (_UserOptions.GetCommonOption("RemindAlarms", "Calendar") != "F");
            _PastDue          = (_UserOptions.GetCommonOption("RemindPastDue", "Calendar") != "F");
            _Confirms         = (_UserOptions.GetCommonOption("RemindConfirmations", "Calendar") != "F");
            string value = string.Format("{0}|{1}|{2}|{3}", _DisplayReminders, _Alarms, _PastDue, _Confirms);
            _Context.SetContext("ActivityRemindersDisplay", value);
        }
        if (!Page.IsPostBack)
        {
            btnShowHideDetail.OnClientClick = String.Format("javascript:btnShowHideDetails('{0}', '{1}', '{2}')",
                                                            ClientID,
                                                            GetLocalResourceObject("btnHideDetail.Caption"),
                                                            GetLocalResourceObject("btnShowDetail.Caption"));
            btnShowHideDetail.Attributes["onClick"] = "return false;";
        }
    }
Beispiel #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     m_SLXUserService = ApplicationContext.Current.Services.Get <IUserService>() as SLXUserService;
     _UserId          = m_SLXUserService.GetUser().Id.ToString();
     _UserOptions     = ActivityAlarmOptions.Load(Server.MapPath(@"App_Data\LookupValues"));
     if (!IsPostBack)
     {
         IList <IUser> users = UserCalendar.GetCalendarUsers(_UserId);
         foreach (IUser item in users)
         {
             if (_UserId.Equals(item.Id))
             {
                 UserList.Items.Insert(0, new ListItem(item.ToString(), item.Id.ToString()));
                 UserList.SelectedIndex = 0;
             }
             else
             {
                 if (item.Id.ToString().ToUpper().Trim() != "ADMIN")
                 {
                     UserList.Items.Add(new ListItem(item.ToString(), item.Id.ToString()));
                 }
             }
         }
     }
     if (UserList.SelectedIndex == -1)
     {
         UserList.SelectedIndex = 0;
     }
     GetContext();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     m_SLXUserService = ApplicationContext.Current.Services.Get<IUserService>() as SLXUserService;
     _UserId = m_SLXUserService.GetUser().Id;
     _UserOptions = ActivityAlarmOptions.Load(Server.MapPath(@"App_Data\LookupValues"));
     if (!IsPostBack)
     {
         IList<IUser> users = UserCalendar.GetCalendarUsers(_UserId);
         foreach (IUser item in users)
         {
             if (_UserId.Equals(item.Id))
             {
                 UserList.Items.Insert(0, new ListItem(item.ToString(), item.Id.ToString()));
                 UserList.SelectedIndex = 0;
             }
             else
             {
                 if (item.Id.ToString().ToUpper().Trim() != "ADMIN")
                 {
                     UserList.Items.Add(new ListItem(item.ToString(), item.Id.ToString()));
                 }
             }
         }
     }
     if (UserList.SelectedIndex == -1)
     {
         UserList.SelectedIndex = 0;
     }
     GetContext();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     _SlxUserService = ApplicationContext.Current.Services.Get <IUserService>() as SLXUserService;
     _UserId         = _SlxUserService.GetUser().Id.ToString();
     _UserName       = _SlxUserService.GetUser().ToString();
     displayQueue    = (Page.Request.QueryString.Get("mode") == "batch");
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        _SlxUserService = ApplicationContext.Current.Services.Get<IUserService>() as SLXUserService;
        _UserId = _SlxUserService.GetUser().Id;

        LiteratureGrid.PageIndexChanging += new GridViewPageEventHandler(LiteratureGrid_PageIndexChanging);
    }
    /// <summary>
    /// Loads the view.
    /// </summary>
    private void LoadView()
    {
        if (this.Visible)
        {
            this._opportunity = GetParentEntity() as IOpportunity;
            string opportunityId = this.EntityContext.EntityID.ToString();
            luOppContact.SeedProperty = "Opportunity.Id";
            luOppContact.SeedValue    = opportunityId;
            txtOpportunityId.Value    = opportunityId;

            //set the current userId
            SLXUserService service = ApplicationContext.Current.Services.Get <IUserService>() as SLXUserService;
            IUser          user    = service.GetUser() as IUser;
            currentUserId.Value = user.Id.ToString();

            //set the primary opp contactid
            IContact primeContact = GetPrimaryOppContact(opportunityId);
            if (primeContact != null)
            {
                primaryOppContactId.Value = primeContact.Id.ToString();
            }
            else
            {
                primaryOppContactId.Value = string.Empty;
            }

            //set the account manager id
            accountManagerId.Value = _opportunity.AccountManager.Id.ToString();

            //Set the opportunity contact count
            txtOppContactCount.Value = Convert.ToString(GetOppContactCount(opportunityId));
            LoadSalesProcessDropDown();
            LoadSalesProcess(opportunityId);
        }
    }
Beispiel #9
0
        public void Load()
        {
            SLXUserService service = (SLXUserService)ApplicationContext.Current.Services.Get <IUserService>();
            RepositoryHelper <IUserLoginAudit> repositoryHelper = EntityFactory.GetRepositoryHelper <IUserLoginAudit>();
            ICriteria criteria = repositoryHelper.CreateCriteria();

            criteria.Add(repositoryHelper.EF.Eq("USERID", service.UserId.Trim()));
            IList <IUserLoginAudit> list = criteria.List <IUserLoginAudit>();

            if ((list != null) && (list.Count > 0))
            {
                foreach (IUserLoginAudit audit in list)
                {
                    if (audit.Login1.HasValue && audit.Login1.Value.Date != DateTime.UtcNow.Date)
                    {
                        audit.Login5 = audit.Login4;
                        audit.Login4 = audit.Login3;
                        audit.Login3 = audit.Login2;
                        audit.Login2 = audit.Login1;
                        audit.Login1 = DateTime.UtcNow;
                        audit.Save();
                    }
                    break;
                }
            }
            else
            {
                IUserLoginAudit audit2 = EntityFactory.Create <IUserLoginAudit>();
                audit2.Login1 = (new DateTime?(DateTime.UtcNow));
                audit2.USERID = service.UserId.Trim();
                audit2.Save();
            }
        }
Beispiel #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _Context = ApplicationContext.Current.Services.Get <ConfigurationManager>();
        if (this.Visible)
        {
            if ((DialogService.SmartPartMappedID == "SpeedSearch") && (DialogService.DialogParameters.Count > 0))
            {
                _ChildPropertyName = DialogService.DialogParameters["ChildName"].ToString();
                _ResultProperty    = DialogService.DialogParameters["EntityProperty"].ToString();
            }
            _Context         = ApplicationContext.Current.Services.Get <ConfigurationManager>();
            m_SLXUserService = ApplicationContext.Current.Services.Get <IUserService>() as SLXUserService;
            if (m_SLXUserService is IWebPortalUserService)
            {
                _UserType = 0;
            }
            SearchResultsGrid.PageIndexChanged +=
                new DataGridPageChangedEventHandler(SearchResultsGrid_PageIndexChanged);
            LoadIndexes();
            CreateIndexControls();
            GenerateScript();
            // instance of the context
            IContextService context = Sage.Platform.Application.ApplicationContext.Current.Services.Get <IContextService>(true);
            // check for query string values first
            if (Request.QueryString["terms"] != null)
            {
                // push it into the front of the process
                terms = Request.QueryString["terms"];
                context.SetContext("SearchRequestText", terms);
            }
            if (context.HasContext("SearchRequestText"))
            {
                InitializeState();
                SearchRequest.Text = (string)context.GetContext("SearchRequestText");
                context.RemoveContext("SearchRequestText");
                SearchButton_Click(null, null);
                return;
            }

            if (Session[ClientID] != null)
            {
                initResults(Session[ClientID].ToString());
                DataSet resultSet = (DataSet)Session[ClientID + "DataSet"];
                ShowPage(resultSet);
                if ((DialogService.SmartPartMappedID == "SpeedSearch") && (DialogService.DialogParameters.Count > 0) && (Page.Request.Browser.Browser != "IE"))
                {
                    Control parent = this.Parent;
                    while (!(parent == null || parent is UpdatePanel))
                    {
                        parent = parent.Parent;
                    }
                    if (parent != null)
                    {
                        ((UpdatePanel)parent).Update();
                    }
                }
            }
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     m_SLXUserService = ApplicationContext.Current.Services.Get <IUserService>() as SLXUserService;
     _UserId          = m_SLXUserService.GetUser().Id.ToString();
     _ActivityId      = m_EntityContextService.EntityID.ToString();
     _CurrentActivity = Activity.GetActivityFromID(_ActivityId);
     _NotifyId        = (Page.Request.QueryString.Get("notifyid"));
     _UserNotify      = (UserNotification)EntityFactory.GetById(typeof(UserNotification), _NotifyId);
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     m_SLXUserService = ApplicationContext.Current.Services.Get<IUserService>() as SLXUserService;
     _UserId = m_SLXUserService.GetUser().Id.ToString();
     _ActivityId = m_EntityContextService.EntityID.ToString();
     _CurrentActivity = Activity.GetActivityFromID(_ActivityId);
     _NotifyId = (Page.Request.QueryString.Get("notifyid"));
     _UserNotify = (UserNotification)EntityFactory.GetById(typeof(UserNotification), _NotifyId);
 }
    /// <summary>
    /// Gets the current user.
    /// </summary>
    /// <returns></returns>
    private static IUser GetCurrentUser()
    {
        IUser          user        = null;
        SLXUserService service     = ApplicationContext.Current.Services.Get <IUserService>() as SLXUserService;
        IUser          currentUser = service.GetUser();

        user = currentUser as IUser;
        return(user);
    }
Beispiel #14
0
    /// <summary>
    /// Gets the name of the default assign to.
    /// </summary>
    /// <returns></returns>
    private string GetDefaultAssignToName()
    {
        IUser          user        = null;
        SLXUserService service     = ApplicationContext.Current.Services.Get <IUserService>() as SLXUserService;
        IUser          currentUser = service.GetUser();

        user = currentUser;
        return(user.ToString());
    }
Beispiel #15
0
    /// <summary>
    /// Raises the <see cref="E:PreRender"/> event.
    /// </summary>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected override void OnPreRender(EventArgs e)
    {
        _connectionString = GetSLXConnectionString();

        m_SLXUserService = ApplicationContext.Current.Services.Get <IUserService>() as SLXUserService;

        LoadView();

        DisplayImage("1");
    }
Beispiel #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _Context = ApplicationContext.Current.Services.Get <ConfigurationManager>();
        if (this.Visible)
        {
            if ((DialogService.SmartPartMappedID == "SpeedSearch") && (DialogService.DialogParameters.Count > 0))
            {
                _ChildPropertyName = DialogService.DialogParameters["ChildName"].ToString();
                _ResultProperty    = DialogService.DialogParameters["EntityProperty"].ToString();
            }
            _Context         = ApplicationContext.Current.Services.Get <ConfigurationManager>();
            m_SLXUserService = ApplicationContext.Current.Services.Get <IUserService>() as SLXUserService;
            if (m_SLXUserService is WebPortalUserService)
            {
                _UserType = 0;
            }
            SearchResultsGrid.PageIndexChanged +=
                new DataGridPageChangedEventHandler(SearchResultsGrid_PageIndexChanged);
            btnAdvanced.NavigateUrl = string.Format("javascript:ToggleAdvanced('{0}')", btnAdvanced.ClientID);
            LoadIndexes();
            CreateIndexControls();
            GenerateScript();

            IContextService context = Sage.Platform.Application.ApplicationContext.Current.Services.Get <IContextService>(true);
            if (context.HasContext("SearchRequestText"))
            {
                SearchRequest.Text = (string)context.GetContext("SearchRequestText");
                context.RemoveContext("SearchRequestText");
                SearchButton_Click(null, null);
                return;
            }

            if (Session[ClientID] != null)
            {
                initResults(Session[ClientID].ToString());
                DataSet resultSet = (DataSet)Session[ClientID + "DataSet"];
                ShowPage(resultSet);
                if ((DialogService.SmartPartMappedID == "SpeedSearch") && (DialogService.DialogParameters.Count > 0) && (Page.Request.Browser.Browser != "IE"))
                {
                    Control parent = this.Parent;
                    while (!(parent == null || parent is UpdatePanel))
                    {
                        parent = parent.Parent;
                    }
                    if (parent != null)
                    {
                        ((UpdatePanel)parent).Update();
                    }
                }
            }
        }
    }
Beispiel #17
0
    /// <summary>
    /// Called when the smartpart has been bound.  Derived components should override this method to run code that depends on entity context being set and it not changing.
    /// </summary>
    protected override void OnFormBound()
    {
        object    sender = this;
        EventArgs e      = EventArgs.Empty;

        SLXUserService service = ApplicationContext.Current.Services.Get <IUserService>(true) as SLXUserService;

        if (service != null)
        {
            IUser UserContext = service.GetUser();
            //if (UserContext != null && UserContext.Manager != null && UserContext.Manager.UserInfo != null)
            //    lblManagerName.Text = UserContext.Manager.UserInfo.FirstName + " " + UserContext.Manager.UserInfo.LastName;
        }
        base.OnFormBound();
    }
Beispiel #18
0
 private void LoadOwner()
 {
     if (this.ownProcessOwner.LookupResultValue == null)
     {
         IUserService   service = ApplicationContext.Current.Services.Get <IUserService>();
         SLXUserService user    = (SLXUserService)service;
         if (user != null)
         {
             Sage.Entity.Interfaces.IUser owner = user.GetUser();
             if (owner != null)
             {
                 this.ownProcessOwner.LookupResultValue = owner;
             }
         }
     }
 }
    /// <summary>
    /// Gets the email address.
    /// </summary>
    /// <param name="emailType">Type of the email.</param>
    /// <param name="ticket">The ticket.</param>
    /// <returns></returns>
    private static string GetEmailAddress(int emailType, ITicket ticket)
    {
        string email = String.Empty;

        if (ticket != null)
        {
            switch (emailType)
            {
            case 0:     //Contact
                if (ticket.Contact != null)
                {
                    email = (string.IsNullOrEmpty(ticket.Contact.Email) ? String.Empty : ticket.Contact.Email);
                }
                break;

            case 1:     //AssignedTo
                if (ticket.AssignedTo != null && ticket.AssignedTo.User != null)
                {
                    email = ((ticket.AssignedTo.User.UserInfo.Email == String.Empty)
                                     ? String.Empty
                                     : ticket.AssignedTo.User.UserInfo.Email);
                }
                break;

            case 2:     //AcctMgr
                if (ticket.Account != null && ticket.Account.AccountManager != null)
                {
                    email = (string.IsNullOrEmpty(ticket.Account.AccountManager.UserInfo.Email)
                                     ? String.Empty
                                     : ticket.Account.AccountManager.UserInfo.Email);
                }
                break;

            case 3:     //MyMgr
                SLXUserService service = ApplicationContext.Current.Services.Get <IUserService>() as SLXUserService;
                if (service != null)
                {
                    //User UserContext = service.GetUser();
                    //if (UserContext != null && UserContext.Manager != null && UserContext.Manager.UserInfo != null)
                    //    email = ((UserContext.Manager.UserInfo.Email == String.Empty) ? String.Empty : UserContext.Manager.UserInfo.Email);
                }
                break;
            }
        }
        return(email != null?PortalUtil.JavaScriptEncode(email.Replace("+", "%20")) : email);
    }
Beispiel #20
0
    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        string         UserId         = "ADMIN";
        SLXUserService slxUserService = Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.Platform.Security.IUserService>() as SLXUserService;

        if (slxUserService != null)
        {
            UserId = slxUserService.GetUser().Id.ToString().Trim();
        }

        LegacySupportCommon.LegacyLogin(UserId, Page);
        HtmlContainerControl div = (HtmlContainerControl)FindControl("prefscookiediv");

        var conn = LegacySupportCommon.GetOpenConnection();
        var cmd  = conn.CreateCommand();

        cmd.Connection = conn;
        string vSQL = String.Format("SELECT USERPREFERENCES FROM SLXWEBUSERINFO WHERE USERID LIKE '{0}%'", UserId);

        try
        {
            cmd.CommandText = vSQL;
            object res     = cmd.ExecuteScalar();
            string cookstr = (res == null) ? "" : res.ToString();
            if (cookstr == "")
            {
                vSQL            = "SELECT PATH FROM SLXWEBALIAS WHERE NAME = 'defprefs' AND ISACTIVE = 'T'";
                cmd.CommandText = vSQL;
                res             = cmd.ExecuteScalar();
                cookstr         = (res == null) ? "" : res.ToString();
            }
            cookstr = cookstr.Replace("<#SYS name=theuserid>", UserId);
            if (cookstr.IndexOf("caldefuser") < 0)
            {
                cookstr += "&caldefuser=" + UserId;
            }
            div.InnerText = cookstr;
        }
        finally
        {
            cmd.Dispose();
            conn.Close();
            conn.Dispose();
        }
    }
    private void LoadOwner()
    {
        if (ownProcessOwner.LookupResultValue != null)
        {
            return;
        }
        IUserService   service = ApplicationContext.Current.Services.Get <IUserService>();
        SLXUserService user    = (SLXUserService)service;

        if (user == null)
        {
            return;
        }
        IUser owner = user.GetUser();

        if (owner != null)
        {
            ownProcessOwner.LookupResultValue = owner;
        }
    }
Beispiel #22
0
    /// <summary>
    /// Gets a list of the Adhoc contact groups for the logged in user
    /// </summary>
    /// <returns></returns>
    private List <ListItem> GetUserSyncGroups()
    {
        List <ListItem> results = new List <ListItem>();
        string          _userID = string.Empty;

        // Get the associated user
        SLXUserService _userService = ApplicationContext.Current.Services.Get <Sage.Platform.Security.IUserService>() as SLXUserService;

        if (_userService != null)
        {
            _userID = _userService.UserId;
        }

        string _format = (string)GetLocalResourceObject("adhoc_group_format");

        // Load up all of the adhoc groups
        IDataService _dataService = ApplicationContext.Current.Services.Get <IDataService>();

        if (_dataService != null && !string.IsNullOrEmpty(_userID))
        {
            using (var conn = _dataService.GetOpenConnection())
            {
                string SQL = "SELECT PLUGINID, NAME, (SELECT COUNT (*) FROM ADHOCGROUP WHERE GroupID = PluginID) AS ContactCount FROM PLUGIN WHERE TYPE = 8 AND FAMILY = 'Contact' AND PluginID IN (SELECT DISTINCT GroupID FROM ADHOCGROUP)	AND UserID = '{0}' ";
                SQL = string.Format(SQL, _userID);

                var       adapter = new OleDbDataAdapter(SQL, conn as OleDbConnection);
                DataTable _table  = new DataTable();
                adapter.Fill(_table);

                foreach (DataRow row in _table.Rows)
                {
                    results.Add(new ListItem(string.Format(_format, (string)row[1], row[2]), (string)row[0]));
                }
            }
        }

        return(results);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        const string QueryName = "recentNotes";

        INamedQueryCacheService service = ApplicationContext.Current.Services.Get <INamedQueryCacheService>(false);

        if (service != null)
        {
            if (!service.Contains(QueryName))
            {
                SLXUserService slxUserService = ApplicationContext.Current.Services.Get <Sage.Platform.Security.IUserService>() as SLXUserService;
                NamedQueryInfo queryinfo      = new NamedQueryInfo(); //
                queryinfo.Hql =
                    "select h.id, h.Description, h.Notes from History h where h.Type=262148 and h.UserId=? and h.CreateDate>? order by h.CreateDate desc";
                queryinfo.Name          = QueryName;
                queryinfo.ColumnAliases = new string[] { "id", "description", "notes" };
                queryinfo.SetParameter(0, slxUserService.GetUser().Id);
                queryinfo.SetParameter(1, DateTime.Now.AddDays(-15));

                service.Add(queryinfo);
            }
        }
    }
Beispiel #24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _Context = ApplicationContext.Current.Services.Get<ConfigurationManager>();
        if (this.Visible)
        {
            if ((DialogService.SmartPartMappedID == "SpeedSearch") && (DialogService.DialogParameters.Count > 0))
            {
                _ChildPropertyName = DialogService.DialogParameters["ChildName"].ToString();
                _ResultProperty = DialogService.DialogParameters["EntityProperty"].ToString();
            }
            _Context = ApplicationContext.Current.Services.Get<ConfigurationManager>();
            m_SLXUserService = ApplicationContext.Current.Services.Get<IUserService>() as SLXUserService;
            if (m_SLXUserService is WebPortalUserService)
            {
                _UserType = 0;
            }
            SearchResultsGrid.PageIndexChanged +=
                new DataGridPageChangedEventHandler(SearchResultsGrid_PageIndexChanged);
            btnAdvanced.NavigateUrl = string.Format("javascript:ToggleAdvanced('{0}')", btnAdvanced.ClientID);
            LoadIndexes();
            CreateIndexControls();
            GenerateScript();

            IContextService context = Sage.Platform.Application.ApplicationContext.Current.Services.Get<IContextService>(true);
            if (context.HasContext("SearchRequestText"))
            {
                SearchRequest.Text = (string)context.GetContext("SearchRequestText");
                context.RemoveContext("SearchRequestText");
                SearchButton_Click(null, null);
                return;
            }

            if (Session[ClientID] != null)
            {
                initResults(Session[ClientID].ToString());
                DataSet resultSet = (DataSet)Session[ClientID + "DataSet"];
                ShowPage(resultSet);
                if ((DialogService.SmartPartMappedID == "SpeedSearch") && (DialogService.DialogParameters.Count > 0) && (Page.Request.Browser.Browser != "IE"))
                {
                    Control parent = this.Parent;
                    while (!(parent == null || parent is UpdatePanel))
                    {
                        parent = parent.Parent;
                    }
                    if (parent != null)
                    {
                        ((UpdatePanel)parent).Update();
                    }
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        _Context = ApplicationContext.Current.Services.Get<ConfigurationManager>();
        if (this.Visible)
        {
            if ((DialogService.SmartPartMappedID == "SpeedSearch") && (DialogService.DialogParameters.Count > 0))
            {
                _ChildPropertyName = DialogService.DialogParameters["ChildName"].ToString();
                _ResultProperty = DialogService.DialogParameters["EntityProperty"].ToString();
            }
            _Context = ApplicationContext.Current.Services.Get<ConfigurationManager>();
            m_SLXUserService = ApplicationContext.Current.Services.Get<IUserService>() as SLXUserService;
            if (m_SLXUserService is IWebPortalUserService)
            {
                _UserType = 0;
            }
            SearchResultsGrid.PageIndexChanged +=
                new DataGridPageChangedEventHandler(SearchResultsGrid_PageIndexChanged);
            LoadIndexes();
            CreateIndexControls();
            GenerateScript();
            // instance of the context
            IContextService context = Sage.Platform.Application.ApplicationContext.Current.Services.Get<IContextService>(true);
            // check for query string values first
            if (Request.QueryString["terms"] != null)
            {
                // push it into the front of the process
                terms = Request.QueryString["terms"];
                context.SetContext("SearchRequestText", terms);
            }
            if (context.HasContext("SearchRequestText"))
            {
                InitializeState();
                SearchRequest.Text = (string)context.GetContext("SearchRequestText");
                context.RemoveContext("SearchRequestText");
                SearchButton_Click(null, null);
                return;
            }

            if (Session[ClientID] != null)
            {
                initResults(Session[ClientID].ToString());
                DataSet resultSet = (DataSet)Session[ClientID + "DataSet"];
                ShowPage(resultSet);
                if ((DialogService.SmartPartMappedID == "SpeedSearch") && (DialogService.DialogParameters.Count > 0) && (Page.Request.Browser.Browser != "IE"))
                {
                    Control parent = this.Parent;
                    while (!(parent == null || parent is UpdatePanel))
                    {
                        parent = parent.Parent;
                    }
                    if (parent != null)
                    {
                        ((UpdatePanel)parent).Update();
                    }
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        _SlxUserService = ApplicationContext.Current.Services.Get<IUserService>() as SLXUserService;
        if (_SlxUserService != null)
        {
            _UserId = _SlxUserService.GetUser().Id;
            _UserName = _SlxUserService.GetUser().ToString();
        }

        ActivityGrid.PageIndexChanging += ActivityGrid_PageIndexChanging;
        PerformBinding();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        IContextService context = ApplicationContext.Current.Services.Get <IContextService>(true);

        if (Page.Request["useWelcomeCriteria"] == "T" && !setWelcomeCriteria)
        {
            string         timeFrame      = (string)context.GetContext("WelcomeSearchTimeframe");
            SLXUserService slxUserService = ApplicationContext.Current.Services.Get <IUserService>() as SLXUserService;
            if (slxUserService != null)
            {
                string userid = slxUserService.GetUser().Id.ToString(); // store the Current UserID in the Group context object
                SetCurrentTab("0", true);
                FilterManager.SetPersistedData(FilterManager.AppliedFiltersKey,
                                               FilterManager.GetWelcomeCriteria(userid, "1"));
                setWelcomeCriteria = true;
            }
        }

        //ScriptManager.RegisterClientScriptBlock(
        //        Page,
        //        typeof(Page),
        //        "filter-client-script",
        //        String.Format(
        //            @"<script pin=""pin"" type=""text/javascript"" src=""{0}""></script>",
        //            Page.ClientScript.GetWebResourceUrl(typeof(Sage.SalesLogix.Client.GroupBuilder.BaseFilter), "Sage.SalesLogix.Client.GroupBuilder.jscript.Filter_ClientScript.js")
        //        ),
        //        false);

        /*
         * ScriptManager.GetCurrent(Page).Scripts.Add(
         *  new ScriptReference("Sage.SalesLogix.Client.GroupBuilder.jscript.Filter_ClientScript.js",
         *  "Sage.SalesLogix.Client.GroupBuilder"));
         */

        IUserOptionsService _UserOptions = ApplicationContext.Current.Services.Get <IUserOptionsService>(true);
        StringBuilder       script       = new StringBuilder();

        script.AppendFormat(
            "\nvar {0};$(document).ready(function(){{if (!{0} && (Sage.FilterManager))\n{{ {0} = new Sage.FilterManager({{id: \"{0}\",clientId: \"{1}\", allText: \"({2})\"}});{0}.init();Sage.PopulateFilterList();}}}});\n",
            ID, ClientID, GetLocalResourceObject("All").ToString());
        script.Append("var LocalizedActivityStrings={");
        string[] ActivityTypes = new string[] { "atToDo", "atAppointment", "atPhoneCall", "atPersonal", "atLiterature", "Change", "Confirm", "Deleted", "Leader", "New" };
        foreach (string v in ActivityTypes)
        {
            script.AppendFormat("\"{0}\": \"{1}\", ", v, GetLocalResourceObject(v).ToString());
        }
        script.Append("\"null\": \"null\"};\n");
        script.AppendFormat("Sage.FilterStrings={{\"allText\": \"({0})\"}};\n",
                            GetLocalResourceObject("All").ToString());
        script.AppendFormat("Sage.AppliedActivityFilterData={0};\n", FilterManager.GetPersistedData(FilterManager.AppliedFiltersKey));
        script.AppendFormat("Sage.HiddenActivityFilterData={0};\n", FilterManager.GetPersistedData(FilterManager.HiddenFiltersKey));
        ScriptManager.RegisterStartupScript(this.Page, typeof(Page), ID, script.ToString(), true);

        HyperLink clear = new HyperLink();

        clear.NavigateUrl = string.Format("javascript:{0}.ClearFilters();", ID);
        clear.Attributes.Add("style", "display: block; margin-bottom: 0.5em");
        clear.Text = GetLocalResourceObject("Clear_Filters").ToString();
        this.Controls.Add(clear);

        string[] ActivityEntities = { "Activity", "UserNotification", "LitRequest", "Event" };
        foreach (string table in ActivityEntities)
        {
            IList <BaseFilter> filterList = FilterManager.GetFiltersForEntity(table, this.Page.Server.MapPath(@"Filters\"));
            foreach (BaseFilter f in filterList)
            {
                this.Controls.Add(f);
            }
        }

        edit.NavigateUrl = string.Format("javascript:{0}.EditFilters();", ID);
        edit.Text        = GetLocalResourceObject("Edit_Filters").ToString();
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     m_SLXUserService = ApplicationContext.Current.Services.Get<IUserService>() as SLXUserService;
     _UserOptions = ApplicationContext.Current.Services.Get<IUserOptionsService>();
     _Context = ApplicationContext.Current.Services.Get<IContextService>(true);
     _TimeZone = (TimeZone)_Context.GetContext("TimeZone");
     object cacheDisplayRem = _Context.GetContext("ActivityRemindersDisplay");
     if (cacheDisplayRem != null)
     {
         string[] temp = cacheDisplayRem.ToString().Split('|');
         _DisplayReminders = Convert.ToBoolean(temp[0]);
         _Alarms = Convert.ToBoolean(temp[1]);
         _PastDue = Convert.ToBoolean(temp[2]);
         _Confirms = Convert.ToBoolean(temp[3]);
     }
     else
     {
         _DisplayReminders = (_UserOptions.GetCommonOption("DisplayActivityReminders", "Calendar") != "F");
         _Alarms = (_UserOptions.GetCommonOption("RemindAlarms", "Calendar") != "F");
         _PastDue = (_UserOptions.GetCommonOption("RemindPastDue", "Calendar") != "F");
         _Confirms = (_UserOptions.GetCommonOption("RemindConfirmations", "Calendar") != "F");
         string value = string.Format("{0}|{1}|{2}|{3}", _DisplayReminders, _Alarms, _PastDue, _Confirms);
         _Context.SetContext("ActivityRemindersDisplay", value);
     }
     _UserId = m_SLXUserService.GetUser().Id;
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        // calls the final method when the fulfillment has succeeded
        if (Request.Form["__EVENTTARGET"] != null && Request.Form["__EVENTTARGET"].CompareTo("UpdateFulfillStatus") == 0)
        {
            UpdateFulfillStatus(Request.Form["__EVENTARGUMENT"]);
        }

        if (!IsPostBack)
        {
            // sage-mailmerge.js
            var oMailMergeScript = new HtmlGenericControl("script");
            oMailMergeScript.Attributes.Add("type", "text/javascript");
            string sMailMergeJs = string.Format("jscript/sage-mailmerge/sage-mailmerge{0}.js", (HttpContext.Current.IsDebuggingEnabled) ? "-debug" : "");
            oMailMergeScript.Attributes.Add("src", sMailMergeJs);
            oMailMergeScript.Attributes.Add("id", "sage_mailmerge_script");
            Page.Header.Controls.Add(oMailMergeScript);
        }


        RequestedFor.Required = true;
        try
        {
            SLXUserService slxUserService = ApplicationContext.Current.Services.Get <IUserService>() as SLXUserService;
            if (slxUserService != null)
            {
                UserId   = slxUserService.GetUser().Id.ToString().Trim();
                UserName = slxUserService.GetUser().UserInfo.LastName + ", " +
                           slxUserService.GetUser().UserInfo.FirstName; //UserName;
            }
        }
        catch
        {
            UserId   = "ERROR";
            UserName = "******";
        }
        PopulateTree();
        if (!Page.ClientScript.IsClientScriptIncludeRegistered("LitRequest"))
        {
            Page.ClientScript.RegisterClientScriptInclude("LitRequest", "jscript/LitRequest.js");
        }
        if (!Page.ClientScript.IsClientScriptIncludeRegistered("XMLSupport"))
        {
            Page.ClientScript.RegisterClientScriptInclude("XMLSupport", "jscript/XMLSupport.js");
        }
        Page.ClientScript.RegisterClientScriptBlock(GetType(), "LitRequestWarnings", BuildLitRequestWarnings(), true);
        PopulateRequestedFor();
        btnSave.Attributes.Add("onclick", String.Format("return getValues(this, '{0}');", TemplateId.ClientID));
        lblRequestedBy.Text = String.Format(GetLocalResourceObject("RequestedByOn.Text").ToString(), UserName,
                                            DateTime.Now.ToShortDateString());
        TemplateFindIcon.Attributes["onclick"] = String.Format("ShowMailMergeTemplates('{0}', '{1}', '{2}')",
                                                               TemplateName.ClientID,
                                                               TemplateId.ClientID,
                                                               templateXml.ClientID);
        TemplateName.Attributes["onclick"] = String.Format("ShowMailMergeTemplates('{0}', '{1}', '{2}')",
                                                           TemplateName.ClientID,
                                                           TemplateId.ClientID,
                                                           templateXml.ClientID);
        PopulateLitItems();
        if (!IsPostBack)
        {
            SendBy.DateTimeValue = DateTime.Now;
            SetPickListDefault(SendVia);
            SetPickListDefault(Priority);
            //Set focus on the top element in the form
            SetFocus(RequestedFor.ClientID + "_LookupText");
        }
    }
    protected void Save(object sender, EventArgs e)
    {
        if (SendBy.DateTimeValue < DateTime.Now.AddDays(-1))
        {
            return;
        }
        if (RequestedFor.LookupResultValue != null)
        {
            IContextService        conserv = ApplicationContext.Current.Services.Get <IContextService>(true);
            Sage.Platform.TimeZone tz      = (Sage.Platform.TimeZone)conserv.GetContext("TimeZone");

            ILitRequest    lr             = EntityFactory.Create <ILitRequest>();
            SLXUserService slxUserService = ApplicationContext.Current.Services.Get <IUserService>() as SLXUserService;
            if (slxUserService != null)
            {
                lr.RequestUser = slxUserService.GetUser();
            }
            String[] arClientData = clientdata.Value.ToString().Split('|');
            lr.RequestDate = DateTime.Now.AddMinutes(tz.BiasForGivenDate(DateTime.Now));
            lr.CoverId     = arClientData[0];
            lr.Contact     = (IContact)RequestedFor.LookupResultValue;
            lr.ContactName = lr.Contact.LastName + ", " + lr.Contact.FirstName;
            lr.Description = Description.Text;
            lr.SendDate    = SendBy.DateTimeValue;
            lr.SendVia     = SendVia.PickListValue;
            lr.Priority    = Priority.PickListValue;
            lr.Options     = PrintLiteratureList.SelectedIndex;

            lr.Save();

            Activity act = new Activity();
            act.Type         = ActivityType.atLiterature;
            act.AccountId    = lr.Contact.Account.Id.ToString();
            act.AccountName  = lr.Contact.Account.AccountName;
            act.ContactId    = lr.Contact.Id.ToString();
            act.ContactName  = lr.ContactName;
            act.PhoneNumber  = lr.Contact.WorkPhone;
            act.StartDate    = (DateTime)lr.RequestDate;
            act.Duration     = 0;
            act.Description  = lr.Description;
            act.Alarm        = false;
            act.Timeless     = true;
            act.Rollover     = false;
            act.UserId       = lr.RequestUser.Id.ToString();
            act.OriginalDate = (DateTime)lr.RequestDate;
            act.Save();

            // save litRequest item
            double totalCost = 0.0;
            string coverId   = arClientData[0];

            // get cover name
            for (int i = 1; i < arClientData.Length; i++)
            {
                string[] clientData = arClientData[i].Split('=');
                string   litItemId  = clientData[0];
                int      qty        = Int32.Parse(clientData[1]);

                // get literature item cost
                ILiteratureItem litItem = EntityFactory.GetById <ILiteratureItem>(litItemId);
                totalCost += (double)qty * (litItem.Cost.HasValue ? (double)litItem.Cost.Value : (double)0.0);

                // add the literature request item
                ILitRequestItem lrItem = EntityFactory.Create <ILitRequestItem>();
                lrItem.Qty            = qty;
                lrItem.LitRequest     = lr;
                lrItem.LiteratureItem = litItem;

                lr.LitRequestItems.Add(lrItem);
            }

            lr.TotalCost = totalCost;

            // get cover name
            string coverName = GetCoverName(coverId);
            lr.CoverName = coverName;

            lr.Save();  //must make ids match, and id prop is read only, so....

            SynchronizeLitRequestId(act.Id, lr.Id.ToString());

            // re-get entity with new activity id
            lr = EntityFactory.GetById <ILitRequest>(act.Id);

            // process the lit request if handle fulfillment locally is checked
            if (chkHandleLocal.Checked)
            {
                // show printer dialog for fulfillment
                FulfillRequestLocally(lr);

                // call business rule to update the entity properties
                lr.FulfillLitRequest();
            }
            else
            {
                Response.Redirect("Contact.aspx?entityId=" + lr.Contact.Id.ToString());
            }
        }
    }
    protected void Page_Init(object sender, EventArgs e)
    {
        _connectionString = GetSLXConnectionString();

        m_SLXUserService = ApplicationContext.Current.Services.Get<IUserService>() as SLXUserService;
    }
    /// <summary>
    /// Raises the <see cref="E:PreRender"/> event.
    /// </summary>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected override void OnPreRender(EventArgs e)
    {
        _connectionString = GetSLXConnectionString();

        m_SLXUserService = ApplicationContext.Current.Services.Get<IUserService>() as SLXUserService;

        LoadView();

        DisplayImage("1");
    }
    protected void Page_Init(object sender, EventArgs e)
    {
        _connectionString = GetSLXConnectionString();

        m_SLXUserService = ApplicationContext.Current.Services.Get <IUserService>() as SLXUserService;
    }