Esempio n. 1
0
        public ActionResult WorkFlowsViewRead([DataSourceRequest] DataSourceRequest request, string name, string status)
        {
            short workFlowStatus = default(short);

            if (!String.IsNullOrEmpty(status))
            {
                short.TryParse(status, out workFlowStatus);
            }
            AddCookie("workflowpagesize", request.PageSize.ToString(), 1);
            AddCookie("workflowpagenumber", request.Page.ToString(), 1);
            var sortField = request.Sorts.Count > 0 ? request.Sorts.First().Member : GetPropertyName <WorkFlowViewModel, DateTime?>(t => t.ModifiedOn);
            var direction = request.Sorts.Count > 0 ? request.Sorts.First().SortDirection : System.ComponentModel.ListSortDirection.Descending;
            GetWorkflowListResponse response = workflowService.GetAllWorkFlows(new GetWorkflowListRequest()
            {
                Query         = name,
                Limit         = request.PageSize,
                PageNumber    = request.Page,
                Status        = workFlowStatus,
                AccountId     = UserExtensions.ToAccountID(this.Identity),
                SortField     = sortField,
                SortDirection = direction
            });
            var jsonResult = Json(new DataSourceResult
            {
                Data  = response.Workflows,
                Total = (int)response.TotalHits
            }, JsonRequestBehavior.AllowGet);

            jsonResult.MaxJsonLength = int.MaxValue;
            return(jsonResult);
        }
Esempio n. 2
0
        public ActionResult RulesListViewRead([DataSourceRequest] DataSourceRequest request, string name)
        {
            AddCookie("leadscorepagesize", request.PageSize.ToString(), 1);
            AddCookie("leadscorepagenumber", request.Page.ToString(), 1);
            int AccountID = this.Identity.ToAccountID();
            int RoleID    = this.Identity.ToRoleID();
            IEnumerable <UserPermission> userPermissions = cachingService.GetUserPermissions(AccountID);

            userPermissions = userPermissions.Where(i => i.RoleId == RoleID);
            IEnumerable <byte>       userModules = userPermissions.Select(x => x.ModuleId);
            GetLeadScoreListResponse response    = leadScoreService.GetLeadScoresList(new GetLeadScoreListRequest()
            {
                Query         = name,
                Limit         = request.PageSize,
                PageNumber    = request.Page,
                AccountID     = UserExtensions.ToAccountID(this.Identity),
                SortField     = request.Sorts.Count > 0 ? request.Sorts.First().Member : GetPropertyName <LeadScoreRuleViewModel, DateTime>(t => t.ModifiedOn),
                SortDirection = request.Sorts.Count > 0 ? request.Sorts.First().SortDirection : System.ComponentModel.ListSortDirection.Descending,
                Modules       = userModules
            });

            return(Json(new DataSourceResult
            {
                Data = response.LeadScoreViewModel,
                Total = response.TotalHits
            }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 3
0
        public ActionResult UsersViewRead([DataSourceRequest] DataSourceRequest request, string name, string status, string role)
        {
            byte  userstatus = 0;
            short userrole   = 0;

            if (!String.IsNullOrEmpty(status))
            {
                byte.TryParse(status, out userstatus);/*userstatus = Convert.ToByte(status);*/
            }
            if (!String.IsNullOrEmpty(role))
            {
                short.TryParse(role, out userrole);/*userrole = Convert.ToByte(role);*/
            }
            AddCookie("userpagesize", request.PageSize.ToString(), 1);
            AddCookie("userpagenumber", request.Page.ToString(), 1);
            GetUserListResponse response = userService.GetAllUsers(new GetUserListRequest()
            {
                Query      = name,
                Limit      = request.PageSize,
                PageNumber = request.Page,
                Status     = userstatus,
                Role       = userrole,
                AccountID  = UserExtensions.ToAccountID(this.Identity),
                IsSTAdmin  = this.Identity.IsSTAdmin()
            });

            return(Json(new DataSourceResult
            {
                Data = response.Users,
                Total = response.TotalHits
            }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 4
0
        public ActionResult RolesViewRead([DataSourceRequest] DataSourceRequest request, string name)
        {
            AddCookie("leadscorepagesize", request.PageSize.ToString(), 1);
            AddCookie("leadscorepagenumber", request.Page.ToString(), 1);
            GetRolesResponse response = roleService.GetRolesList(new GetRolesRequest()
            {
                Query = name,
                Limit = request.PageSize,
                PageNumber = request.Page,
                AccountId = UserExtensions.ToAccountID(this.Identity)
            });
            if (!this.Identity.IsSTAdmin())
            {
                if(response.SubscriptionId == 2)
                    response.RoleViewModel = response.RoleViewModel.Where(s => s.RoleName != "Account Administrator");
                else
                    response.RoleViewModel = response.RoleViewModel.Where(s => s.RoleName != "Account Administrator" && s.RoleName != "Marketing Administrator" && s.RoleName != "Sales Administrator" && s.RoleName != "Marketing");

            }
            

            int count = response.RoleViewModel.Count();
            return Json(new DataSourceResult
            {
                Data = response.RoleViewModel,
                Total = count
            }, JsonRequestBehavior.AllowGet);
        }
Esempio n. 5
0
        public ActionResult _MergeTag()
        {
            TagViewModel       viewModel = new TagViewModel();
            GetTagListResponse response  = tagService.GetTagsBasedonaccount(UserExtensions.ToAccountID(this.Identity));

            viewModel.Tags = response.Tags;
            return(PartialView("_MergeTag", viewModel));
        }
Esempio n. 6
0
        public ActionResult DeleteRule(string leadScoreData)
        {
            DeleteLeadScoreRequest request = JsonConvert.DeserializeObject <DeleteLeadScoreRequest>(leadScoreData);

            request.accountID = UserExtensions.ToAccountID(this.Identity);
            leadScoreService.UpdateLeadScoreStatus(request);
            return(Json(new
            {
                success = true,
                response = ""
            }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult LeadAdapterList()
        {
            LeadAdapterViewModel viewModel = new LeadAdapterViewModel();

            viewModel.AccountID = UserExtensions.ToAccountID(this.Identity);
            short ItemsPerPage = default(short);

            short.TryParse(this.Identity.ToItemsPerPage(), out ItemsPerPage);
            ViewBag.ItemsPerPage = ItemsPerPage;
            ViewBag.DateFormat   = this.Identity.ToDateFormat();
            return(View("LeadAdapterList", viewModel));
        }
Esempio n. 8
0
        public ActionResult _MergeTagModal(int tagId)
        {
            GetTagResponse     response    = tagService.GetTag(new GetTagRequest(tagId));
            TagViewModel       viewModel   = new TagViewModel();
            GetTagListResponse tagresponse = tagService.GetTagsBasedonaccount(UserExtensions.ToAccountID(this.Identity));

            viewModel.Tags          = tagresponse.Tags;
            viewModel.sourceTagID   = tagId;
            viewModel.sourceTagName = response.TagViewModel.TagName;
            viewModel.Count         = response.TagViewModel.Count;
            ViewBag.IsModal         = true;
            return(PartialView("_MergeTag", viewModel));
        }
Esempio n. 9
0
        public ActionResult SaveFormAs(int formId)
        {
            GetAllContactFieldsRequest  fieldsRequest  = new GetAllContactFieldsRequest();
            GetAllContactFieldsResponse fieldsResponse = formService.GetAllContactFields(fieldsRequest);
            GetFormResponse             response       = formService.GetForm(new GetFormRequest(formId)
            {
                AccountId   = this.Identity.ToAccountID(),
                RequestedBy = this.Identity.ToUserID(),
                RoleId      = this.Identity.ToRoleID()
            });

            response.FormViewModel.Fields = fieldsResponse.ContactFields.Where(c => c.FieldId != (int)ContactFields.PartnerTypeField && c.FieldId != (int)ContactFields.LifecycleStageField && c.FieldId != (int)ContactFields.LeadScore && c.FieldId != (int)ContactFields.DonotEmail && c.FieldId != (int)ContactFields.Owner).ToList();
            GetAllCustomFieldsRequest  customFieldRequest  = new GetAllCustomFieldsRequest(this.Identity.ToAccountID());
            GetAllCustomFieldsResponse customFieldResponse = customFieldService.GetAllCustomFieldsForForms(customFieldRequest);

            response.FormViewModel.CustomFields = customFieldResponse.CustomFields.Where(c => c.StatusId == FieldStatus.Active).ToList();
            var customFieldIds = response.FormViewModel.CustomFields.Select(f => f.FieldId).ToList();
            var communityField = response.FormViewModel.Fields.Where(c => c.FieldId == (int)ContactFields.Community).FirstOrDefault();

            communityField.FieldInputTypeId = FieldType.dropdown;
            var communityFormField = response.FormViewModel.FormFields.Where(c => c.FieldId == (int)ContactFields.Community).FirstOrDefault();

            if (communityFormField != null)
            {
                communityFormField.FieldInputTypeId = FieldType.dropdown;
            }
            var contactFieldIds = Enum.GetValues(typeof(ContactFields)).Cast <ContactFields>().ToList();

            response.FormViewModel.FormFields = response.FormViewModel.FormFields.Where(f => customFieldIds.Contains(f.FieldId) || contactFieldIds.Contains((ContactFields)f.FieldId)).OrderBy(f => f.SortId).ToList();
            foreach (FormFieldViewModel formField in response.FormViewModel.FormFields)
            {
                FieldViewModel fieldViewModel = response.FormViewModel.CustomFields.Where(c => c.FieldId == formField.FieldId).FirstOrDefault();
                if (fieldViewModel != null && fieldViewModel.ValueOptions.IsAny())
                {
                    formField.ValueOptions = fieldViewModel.ValueOptions;
                }
            }
            response.FormViewModel.FormId            = 0;
            response.FormViewModel.Status            = Entities.FormStatus.Active;
            response.FormViewModel.Name              = "";
            response.FormViewModel.CreatedDate       = DateTime.Now.ToUniversalTime();
            response.FormViewModel.AllSubmissions    = 0;
            response.FormViewModel.Submissions       = 0;
            response.FormViewModel.UniqueSubmissions = 0;
            var dateFormat = this.Identity.ToDateFormat();

            response.FormViewModel.DateFormat = dateFormat;
            ViewBag.SaveAs    = true;
            ViewBag.AccountID = UserExtensions.ToAccountID(this.Identity);
            return(View("AddForm", response.FormViewModel));
        }
Esempio n. 10
0
        public ActionResult EditForm(int formId)
        {
            int             accountId = this.Identity.ToAccountID();
            GetFormResponse response  = formService.GetForm(new GetFormRequest(formId)
            {
                AccountId   = accountId,
                RequestedBy = this.Identity.ToUserID(),
                RoleId      = this.Identity.ToRoleID()
            });
            GetAllContactFieldsRequest  fieldsRequest  = new GetAllContactFieldsRequest();
            GetAllContactFieldsResponse fieldsResponse = formService.GetAllContactFields(fieldsRequest);

            response.FormViewModel.Fields = fieldsResponse.ContactFields.ToList();
            GetAllCustomFieldsRequest  customFieldRequest  = new GetAllCustomFieldsRequest(this.Identity.ToAccountID());
            GetAllCustomFieldsResponse customFieldResponse = customFieldService.GetAllCustomFieldsForForms(customFieldRequest);

            response.FormViewModel.CustomFields = customFieldResponse.CustomFields.Where(c => c.StatusId == FieldStatus.Active).ToList();
            var communityField = response.FormViewModel.Fields.Where(c => c.FieldId == (int)ContactFields.Community).FirstOrDefault();

            communityField.FieldInputTypeId = FieldType.dropdown;
            var communityFormField = response.FormViewModel.FormFields.Where(c => c.FieldId == (int)ContactFields.Community).FirstOrDefault();

            if (communityFormField != null)
            {
                communityFormField.FieldInputTypeId = FieldType.dropdown;
            }
            var customFieldIds  = response.FormViewModel.CustomFields.Where(c => c.StatusId == FieldStatus.Active).Select(f => f.FieldId).ToList();
            var contactFieldIds = Enum.GetValues(typeof(ContactFields)).Cast <ContactFields>().ToList();

            response.FormViewModel.FormFields = response.FormViewModel.FormFields.Where(f => customFieldIds.Contains(f.FieldId) || contactFieldIds.Contains((ContactFields)f.FieldId)).OrderBy(f => f.SortId).ToList();
            foreach (FormFieldViewModel formField in response.FormViewModel.FormFields)
            {
                FieldViewModel fieldViewModel = response.FormViewModel.CustomFields.Where(c => c.FieldId == formField.FieldId).FirstOrDefault();
                if (fieldViewModel != null && fieldViewModel.ValueOptions.IsAny())
                {
                    formField.ValueOptions = fieldViewModel.ValueOptions;
                }
            }
            ViewBag.SaveAs    = false;
            ViewBag.AccountID = UserExtensions.ToAccountID(this.Identity);
            var timeZone = this.Identity.ToTimeZone();
            var value    = TimeZoneInfo.FindSystemTimeZoneById(timeZone);
            var newDate  = TimeZoneInfo.ConvertTime(response.FormViewModel.CreatedDate, value);

            response.FormViewModel.LastModifiedOn = newDate;
            var dateFormat = this.Identity.ToDateFormat();

            response.FormViewModel.DateFormat = dateFormat;
            ViewBag.TagPopup = true;
            return(View("AddForm", response.FormViewModel));
        }
Esempio n. 11
0
        public JsonResult GetCampaigns()
        {
            int accountID = UserExtensions.ToAccountID(this.Identity);
            GetCampaignsResponse response = leadScoreService.GetCampaigns(new GetCampaignsRequest()
            {
                accountId = accountID
            });

            return(Json(new
            {
                success = true,
                response = response.Campaigns
            }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 12
0
        public ActionResult InsertImportData(string importViewModel)
        {
            ImportDataListViewModel viewModel = JsonConvert.DeserializeObject <ImportDataListViewModel>(importViewModel);

            viewModel.AccountID = UserExtensions.ToAccountID(this.Identity);
            viewModel.UserId    = UserExtensions.ToUserID(this.Identity);
            ImportDataRequest request = new ImportDataRequest()
            {
                ImportDataListViewModel = viewModel,
                RequestedBy             = viewModel.OwnerId
            };

            accountService.ImportData(request);
            return(Json(new { success = true, response = "" }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 13
0
        public JsonResult GetForms()
        {
            int             accountID = UserExtensions.ToAccountID(this.Identity);
            GetFormResponse response  = leadScoreService.GetForms(new GetFormsRequest()
            {
                AccountId   = accountID,
                RoleId      = this.Identity.ToRoleID(),
                RequestedBy = this.Identity.ToUserID()
            });

            return(Json(new
            {
                success = true,
                response = response.Forms
            }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 14
0
        public ActionResult FormsListView([DataSourceRequest] DataSourceRequest request, string name, string status, string userIds, string StartDate, string EndDate)
        {
            byte accountstatus = 0;

            if (!String.IsNullOrEmpty(status))
            {
                accountstatus = Convert.ToByte(status);
            }
            AddCookie("formpagesize", request.PageSize.ToString(), 1);
            AddCookie("formpagenumber", request.Page.ToString(), 1);
            int[] userIDs = null;
            if (!string.IsNullOrEmpty(userIds))
            {
                userIDs = JsonConvert.DeserializeObject <int[]>(userIds);
            }
            SearchFormsResponse response = formService.GetAllForms(new SearchFormsRequest()
            {
                Query       = name,
                Limit       = request.PageSize,
                PageNumber  = request.Page,
                Status      = accountstatus,
                AccountId   = UserExtensions.ToAccountID(this.Identity),
                RequestedBy = this.Identity.ToUserID(),
                RoleId      = this.Identity.ToRoleID(),
                UserID      = this.Identity.ToUserID(),
                UserIds     = userIDs.IsAny() ? userIDs.ToList() : new List <int>()
                {
                },
                StartDate     = !string.IsNullOrEmpty(StartDate) ? Convert.ToDateTime(StartDate) : (DateTime?)null,
                EndDate       = !string.IsNullOrEmpty(EndDate) ? Convert.ToDateTime(EndDate) : (DateTime?)null,
                SortField     = request.Sorts.Count > 0 ? request.Sorts.First().Member : null,
                SortDirection = request.Sorts.Count > 0 ? request.Sorts.First().SortDirection : System.ComponentModel.ListSortDirection.Descending
            });

            var jsonResult = Json(new DataSourceResult
            {
                Data  = response.Forms,
                Total = (int)response.TotalHits
            }, JsonRequestBehavior.AllowGet);

            jsonResult.MaxJsonLength = int.MaxValue;
            return(jsonResult);
        }
Esempio n. 15
0
        public ActionResult TagsViewRead([DataSourceRequest] DataSourceRequest request, string name)
        {
            string             sortField = request.Sorts.Count > 0 ? request.Sorts.First().Member :null;
            var                direction = request.Sorts.Count > 0 ? request.Sorts.First().SortDirection : System.ComponentModel.ListSortDirection.Descending;
            GetTagListResponse response  = tagService.GetAllTags(new GetTagListRequest()
            {
                Name          = name,
                Limit         = request.PageSize,
                PageNumber    = request.Page,
                AccountId     = UserExtensions.ToAccountID(this.Identity),
                SortField     = sortField,
                SortDirection = direction
            });

            return(Json(new DataSourceResult
            {
                Data = response.Tags,
                Total = response.TotalHits
            }, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// Favourates the advanced search view read.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        public ActionResult FavourateAdvancedSearchViewRead([DataSourceRequest] DataSourceRequest request, string name)
        {
            AddCookie("advancedsearchpagesize", request.PageSize.ToString(), 1);
            AddCookie("advancedsearchpagenumber", request.Page.ToString(), 1);
            GetSavedSearchesResponse response = advancedSearchService.GetAllSavedSearches(new GetSavedSearchesRequest()
            {
                Query              = name,
                Limit              = request.PageSize,
                PageNumber         = request.Page,
                AccountID          = UserExtensions.ToAccountID(this.Identity),
                IsFavoriteSearch   = true,
                IsPredefinedSearch = false,
                RequestedBy        = this.Identity.ToUserID()
            });

            return(Json(new DataSourceResult
            {
                Data = response.SearchResults,
                Total = response.TotalHits
            }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 17
0
        public ActionResult ImportsViewRead([DataSourceRequest] DataSourceRequest request, string name)
        {
            AddCookie("importpagesize", request.PageSize.ToString(), 1);
            AddCookie("importpagenumber", request.Page.ToString(), 1);
            GetImportsResponse response = accountService.GetAllImports(new GetImportsRequest()
            {
                Query      = name,
                Limit      = request.PageSize,
                PageNumber = request.Page,
                AccountId  = UserExtensions.ToAccountID(this.Identity)
            });

            response.Imports.Each(i => i.CreatedDateTime = i.CreatedDateTime.ToUtcBrowserDatetime());
            var imports = response.Imports;

            return(Json(new DataSourceResult
            {
                Data = imports,
                Total = response.TotalHits
            }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 18
0
        public JsonResult ContinueMerging(string tagViewModel)
        {
            TagViewModel viewModel = JsonConvert.DeserializeObject <TagViewModel>(tagViewModel);

            viewModel.AccountID = UserExtensions.ToAccountID(this.Identity);
            SaveTagRequest request = new SaveTagRequest()
            {
                TagViewModel = viewModel
            };

            SaveTagResponse response = tagService.ContinueMergeTag(request);

            return(Json(new
            {
                success = true,
                response = new
                {
                    IsInvolvedInLeadScore = response.IsAssociatedWithLeadScoreRules,
                    IsInvolvedInWorkflows = response.IsAssociatedWithWorkflows
                }
            }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 19
0
        public JsonResult MergeTag(string tagViewModel)
        {
            TagViewModel viewModel = JsonConvert.DeserializeObject <TagViewModel>(tagViewModel);

            viewModel.AccountID = UserExtensions.ToAccountID(this.Identity);
            Logger.Current.Informational("Logging Tag Information while merging tags: TagID " + viewModel.TagID + ", SourceTagId: " + viewModel.sourceTagID);
            SaveTagRequest request = new SaveTagRequest()
            {
                TagViewModel = viewModel
            };

            SaveTagResponse response = tagService.MergeTag(request);

            return(Json(new
            {
                success = true,
                response = new
                {
                    IsInvolvedInLeadScore = response.IsAssociatedWithLeadScoreRules,
                    IsInvolvedInWorkflows = response.IsAssociatedWithWorkflows
                }
            }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult LeadAdaptersViewRead([DataSourceRequest] DataSourceRequest request, string name)
        {
            GetLeadAdapterListRequest leadadapterrequest = new GetLeadAdapterListRequest()
            {
                Query      = name,
                Limit      = request.PageSize,
                PageNumber = request.Page,
                AccountID  = UserExtensions.ToAccountID(this.Identity)
            };
            GetLeadAdapterListResponse response = leadAdapterService.GetAllLeadAdapters(leadadapterrequest);

            response.LeadAdapters.Each(l =>
            {
                if (l.LastProcessed.HasValue)
                {
                    l.LastProcessed = l.LastProcessed.Value.ToUtcBrowserDatetime();
                }
            });
            return(Json(new DataSourceResult
            {
                Data = response.LeadAdapters,
                Total = response.TotalHits
            }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 21
0
        public JsonResult GetTags()
        {
            GetTagListResponse response = tagService.GetTagsBasedonaccount(UserExtensions.ToAccountID(this.Identity));

            return(Json(new { success = true, response.Tags }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 22
0
        public ActionResult DropdownValuesViewRead([DataSourceRequest] DataSourceRequest request, string name)
        {
            GetDropdownListResponse response = dropdownValuesService.GetAll(new GetDropdownListRequest()
            {
                Query = name, Limit = request.PageSize, PageNumber = request.Page, AccountID = UserExtensions.ToAccountID(this.Identity)
            });

            return(Json(new DataSourceResult
            {
                Data = response.DropdownValuesViewModel,
                Total = response.TotalHits
            }, JsonRequestBehavior.AllowGet));
        }