Exemple #1
0
        public ActionResult MySearchesView(int viewId, string globalId, int siteSearchId)
        {
            var          searchResults = Session["SearchResults"] as Dictionary <int, SearchResult>;
            SearchResult desiredSearchResultFromSession = null;

            if (searchResults != null && searchResults.ContainsKey(siteSearchId))
            {
                desiredSearchResultFromSession = searchResults[siteSearchId];
            }
            if (desiredSearchResultFromSession != null)
            {
                return(Json(desiredSearchResultFromSession.SearchBoxFilters));
            }

            var searchSiteId = Session["search-global-" + globalId];

            var searchDetails = new object();

            if (searchSiteId != null)
            {
                var allSearchResults = Session["SearchResults"];
                var searchResult     = SearchResult.FindSearchResult(int.Parse(searchSiteId.ToString()), allSearchResults);
                searchDetails = searchResult.SearchBoxFilters;
            }
            else
            {
                searchDetails = UserSearches.GetUserSearchDetails(viewId);
            }

            return(Json(searchDetails));
        }
Exemple #2
0
        public ActionResult MySearches(string periodId, string typeName)
        {
            if (periodId == null || periodId == "" || string.IsNullOrEmpty(periodId))
            {
                periodId = "0";
            }

            var periodIdAsInt = int.Parse(periodId);
            var period        = (UserSearchDatePeriod)periodIdAsInt;

            if (typeName == null || typeName == "" || string.IsNullOrEmpty(typeName))
            {
                typeName = "All";
            }

            var type         = (UserSearchType)Enum.Parse(typeof(UserSearchType), typeName);
            int curProductId = 1;

            if (Session["SelectedProductId"] != null)
            {
                curProductId = int.Parse(Session["SelectedProductId"].ToString());
            }

            var model = UserSearches.GetSearchesFromDB(UserData.UserId, period, type, curProductId);

            return(Json(model));
        }
Exemple #3
0
        public ActionResult MySearches()
        {
            if (UserData.Username.ToLower() == "sysdemo")
            {
                if (ProductId == 1) // EuroCases
                {
                    return(RedirectToAction("ProductFeaturesInfo", "User", new { funcTypeId = (int)FunctionalityTypes.MySearches }));
                }
                else // Tax & Financial Standarts
                {
                    return(RedirectToAction("ProductFeaturesInfoFinances", "User", new { funcTypeId = (int)FunctionalityTypes.MySearches }));
                }
            }

            var userId = UserData.UserId;

            int curProductId = 1;

            if (Session["SelectedProductId"] != null)
            {
                curProductId = int.Parse(Session["SelectedProductId"].ToString());
            }

            var model = UserSearches.GetSearchesFromDB(userId, UserSearchDatePeriod.All, UserSearchType.All, curProductId);

            ViewData["UserSearchType"] = model.Filters.Type.ToSelectList();

            return(View(model));
        }
Exemple #4
0
        // Fills UserSearches object
        private void getIP(string userSearch)
        {
            UserSearches us = new UserSearches();
            var          remoteIpAddress = Request.HttpContext.Connection.RemoteIpAddress;

            us.ipAddress   = remoteIpAddress.ToString();
            us.searchQuery = userSearch;
        }
        private void LoadAutoCompleteClients()
        {
            txtSearch.AutoCompleteCustomSource.Clear();

            foreach (DataRow dr in UserSearches.Get(frmMainParent.CurrentUser.UserId, "Accounts").Rows)
            {
                txtSearch.AutoCompleteCustomSource.Add(dr["SearchText"].ToString());
            }
        }
Exemple #6
0
        public async Task <int> Add(int userId, string userQuery)
        {
            var userSearches = new UserSearches
            {
                SearchDateTime = DateTime.Now,
                UserInfoId     = userId,
                UserQuery      = userQuery
            };
            await _context.UserSearchese.AddAsync(userSearches);

            await _context.SaveChangesAsync();

            return(userSearches.Id);
        }
Exemple #7
0
        public ActionResult DeleteAll()
        {
            int userid = int.Parse(UserData.UserId.ToString());

            try
            {
                UserSearches.DelAllUserRecentDocuments(userid);
                return(Json("Ok"));
            }
            catch
            {
                return(Json("Failed"));
            }
        }
Exemple #8
0
        public ActionResult MySearchesDeleteAll()
        {
            int userid       = int.Parse(UserData.UserId.ToString());
            int curProductId = 1;

            if (Session["SelectedProductId"] != null)
            {
                curProductId = int.Parse(Session["SelectedProductId"].ToString());
            }

            try
            {
                UserSearches.DelAllUserSearches(userid, curProductId);
                return(Json("Ok"));
            }
            catch
            {
                return(Json("Failed"));
            }
        }
        private void txtSearchClnts_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                e.Handled = true;

                _pagination = new Pagination(dgvClients, Account.GetActiveCustomers(txtSearch.Text));
                dgvClients.Columns[0].Visible = false;

                if (!String.IsNullOrWhiteSpace(txtSearch.Text))
                {
                    UserSearches.Insert(frmMainParent.CurrentUser.UserId, txtSearch.Text, "Accounts");
                    txtSearch.AutoCompleteCustomSource.Clear();

                    foreach (DataRow dr in UserSearches.Get(frmMainParent.CurrentUser.UserId, "Accounts").Rows)
                    {
                        txtSearch.AutoCompleteCustomSource.Add(dr["SearchText"].ToString());
                    }
                }
            }
        }
Exemple #10
0
        public ActionResult MySearchesDelete(int delid)
        {
            UserSearches.DelUserSearch(delid);

            return(new EmptyResult());
        }