public int Add(Contact aType) { int returnValue = -1; returnValue = new ContactDataHelper().Insert(aType); return(returnValue); }
public void Execute() { /* State retrieval */ var user = AccountHelper.GetUserAccount(HttpContext); ContactListState contactListState; if (_httpContext.Session[SessionHelper.ContactListState] != null) { contactListState = ( ContactListState )_httpContext.Session[SessionHelper.ContactListState]; } else { contactListState = new ContactListState(); } if (!InputParameters.ContainsKey("ConciergeFilter")) { throw new ArgumentException("StatusFilter was expected!"); } int conciergeFilter = -1; if (!int.TryParse(InputParameters["ConciergeFilter"].ToString(), out conciergeFilter)) { conciergeFilter = 0; } contactListState.ConciergeFilter = conciergeFilter; // on date filter change, reset page number contactListState.CurrentPage = 1; String searchValue = CommonHelper.GetSearchValue(_httpContext); ContactViewModel contactViewModel = ContactDataHelper.RetrieveContactViewModel(contactListState, _httpContext.Session[SessionHelper.UserAccountIds] != null ? (List <int>)_httpContext.Session[SessionHelper.UserAccountIds] : new List <int> { }, user.UserAccountId, _httpContext, searchValue); ContactDataHelper contactDataHelper = new ContactDataHelper(); contactDataHelper.PopulateConciergeFilterList(contactListState, _httpContext, contactViewModel); _viewName = "Queues/_contact"; _viewModel = contactViewModel; /* Persist new state */ _httpContext.Session[SessionHelper.ContactViewModel] = contactViewModel.ToXml(); _httpContext.Session[SessionHelper.ContactListState] = contactListState; }
public BindingList <Contact> Show(Contact aType) { try { var myList = new ContactDataHelper().SelectAll(); var bindingList = new BindingList <Contact>(myList); return(bindingList); } catch (ArgumentNullException) { throw new DataExistence("No Data Found! No Contacts are yet added."); } }
public BindingSource GetList() { ContactDataHelper DH = new ContactDataHelper(); BindingSource BS = new BindingSource(); Hashtable HT = new Hashtable(); List <Contact> myList = DH.SelectAll(); if (myList != null) { foreach (var item in myList) { if (item.State == EntityState.Enabled) { HT.Add(item.ID, item.FullName); } } } HT.Add(-1, "Select Contact"); BS.DataSource = HT; return(BS); }
private void RetrieveContacts(List <int> newUserAccountIds, String searchValue) { ContactListState contactListState = null; if ((base.HttpContext != null) && (base.HttpContext.Session[SessionHelper.ContactListState] != null)) { contactListState = ( ContactListState )base.HttpContext.Session[SessionHelper.ContactListState]; } else { contactListState = new ContactListState(); } // reset page to 1st on user change FilterViewModel userFilterViewModel = null; if ((base.HttpContext != null) && (base.HttpContext.Session[SessionHelper.FilterViewModel] != null)) { userFilterViewModel = new FilterViewModel().FromXml(base.HttpContext.Session[SessionHelper.FilterViewModel].ToString()); userFilterViewModel.FilterContext = FilterContextEnum.Contact; } else { // possible state retrieval? userFilterViewModel = new FilterViewModel(); userFilterViewModel.FilterContext = FilterContextEnum.Contact; } contactListState.CurrentPage = 1; UserAccount user; if (base.HttpContext.Session[SessionHelper.UserData] != null && (( UserAccount )base.HttpContext.Session[SessionHelper.UserData]).Username == base.HttpContext.User.Identity.Name) { user = ( UserAccount )base.HttpContext.Session[SessionHelper.UserData]; } else { user = UserAccountServiceFacade.GetUserByName(base.HttpContext.User.Identity.Name); } if (user == null) { throw new InvalidOperationException("User is null"); } var contactViewData = ContactServiceFacade.RetrieveContactsView(newUserAccountIds, contactListState.BoundDate, contactListState.CurrentPage, EnumHelper.GetStringValue(contactListState.SortColumn), contactListState.SortDirection, user.UserAccountId, searchValue, contactListState.ContactStatusFilter, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, contactListState.LoanPurposeFilter, userFilterViewModel.BranchId, contactListState.ConciergeFilter ); ContactViewModel contactViewModel = new ContactViewModel(); if (contactViewData != null) { contactViewModel.Contacts = contactViewData.ContactsItems; contactViewModel.PageCount = contactViewData.TotalPages; contactViewModel.TotalItems = contactViewData.TotalItems; ContactGridHelper.ApplyClassCollection(contactViewModel); ContactGridHelper.ProcessPagingOptions(contactListState, contactViewModel); } contactViewModel.ProspectLOConciergeList = ContactViewModelHelper.PopulateProspectLoanOfficers(userFilterViewModel, base.HttpContext); // populate prospect statuses ContactViewModelHelper.PopulateProspectStatuses(contactViewModel); contactViewModel.ProspectStatusList = ContactViewModelHelper.PopulateProspectStatusList(contactViewModel); contactViewModel.LoanPurposeList = new List <LoanTransactionType>(Enum.GetValues(typeof(LoanTransactionType)).Cast <LoanTransactionType>().Skip(1)); ContactDataHelper contactDataHelper = new ContactDataHelper(); contactDataHelper.PopulateConciergeFilterList(contactListState, base.HttpContext, contactViewModel); base.ViewName = "Queues/_contact"; base.ViewData = contactViewModel; /* Persist new state */ base.HttpContext.Session[SessionHelper.ContactViewModel] = contactViewModel.ToXml(); base.HttpContext.Session[SessionHelper.ContactListState] = contactListState; base.HttpContext.Session[SessionHelper.FilterViewModel] = userFilterViewModel.ToXml(); }
public void Execute() { /* State retrieval */ ContactViewModel contactViewModel = null; if (_httpContext.Session["ContactViewModel"] != null) { contactViewModel = new ContactViewModel().FromXml(_httpContext.Session["ContactViewModel"].ToString()); } else { contactViewModel = new ContactViewModel(); } ContactListState contactListState = null; if (_httpContext.Session["ContactListState"] != null) { contactListState = (ContactListState)_httpContext.Session["ContactListState"]; } else { contactListState = new ContactListState(); } UserAccount user = null; if (_httpContext.Session[SessionHelper.UserData] != null && ((UserAccount)_httpContext.Session[SessionHelper.UserData]).Username == _httpContext.User.Identity.Name) { user = (UserAccount)_httpContext.Session[SessionHelper.UserData]; } else { user = UserAccountServiceFacade.GetUserByName(_httpContext.User.Identity.Name); } if (user == null) { throw new InvalidOperationException("User is null"); } /* parameter processing */ ContactViewAttribute newSortColumn; if (!InputParameters.ContainsKey("Column")) { throw new ArgumentException("Column value was expected!"); } else { newSortColumn = (ContactViewAttribute)Enum.Parse(typeof(ContactViewAttribute), InputParameters["Column"].ToString()); } // switch direction if (contactListState.SortColumn == newSortColumn) { if (contactListState.SortDirection == "DESC") { contactListState.SortDirection = "ASC"; } else { contactListState.SortDirection = "DESC"; } } else if (String.IsNullOrEmpty(contactListState.SortDirection)) { contactListState.SortDirection = "DESC"; } contactListState.SortColumn = newSortColumn; String searchValue = CommonHelper.GetSearchValue(_httpContext); /* Command processing */ contactViewModel = ContactDataHelper.RetrieveContactViewModel(contactListState, _httpContext.Session["UserAccountIds"] != null ? (List <int>)_httpContext.Session["UserAccountIds"] : new List <int> { }, user.UserAccountId, _httpContext, searchValue); _viewName = "Queues/_contact"; _viewModel = contactViewModel; /* Persist new state */ _httpContext.Session["ContactViewModel"] = contactViewModel.ToXml(); _httpContext.Session["ContactListState"] = contactListState; }
public void Execute() { String searchValue = CommonHelper.GetSearchValue(_httpContext); ContactListState contactListState; if ((_httpContext != null) && (_httpContext.Session[SessionHelper.ContactListState] != null)) { contactListState = ( ContactListState )_httpContext.Session[SessionHelper.ContactListState]; } else { contactListState = new ContactListState(); } FilterViewModel userFilterViewModel; if ((_httpContext != null) && (_httpContext.Session[SessionHelper.FilterViewModel] != null)) { userFilterViewModel = new FilterViewModel().FromXml(_httpContext.Session[SessionHelper.FilterViewModel].ToString()); userFilterViewModel.FilterContext = FilterContextEnum.Contact; } else { // possible state retrieval? userFilterViewModel = new FilterViewModel { FilterContext = FilterContextEnum.Contact }; } Boolean refresh = InputParameters != null && InputParameters.ContainsKey("Refresh") && InputParameters["Refresh"].ToString().Trim() == "true"; // reset Page Number to 1st on Tab change if (!refresh) { contactListState.CurrentPage = 1; } UserAccount user = null; if (_httpContext.Session[SessionHelper.UserData] != null) { user = ( UserAccount )_httpContext.Session[SessionHelper.UserData]; } else { throw new InvalidOperationException("UserData is null"); } var isCallCenter = false; var userAccountIds = new List <Int32>(); if (user.Roles != null) { var filteredRoles = user.Roles.Where( r => r.RoleName.Equals(RoleName.LoanProcessor) || r.RoleName.Equals(RoleName.Concierge) || r.RoleName.Equals(RoleName.LoanOfficerAssistant) || r.RoleName.Equals(RoleName.Administrator) ).OrderBy(r => r.RolePriority); if (filteredRoles != null && filteredRoles.FirstOrDefault() != null) { var topPriorityRole = filteredRoles.FirstOrDefault().RoleName; isCallCenter = topPriorityRole.Equals(RoleName.LoanProcessor); } } if (isCallCenter) { userAccountIds.Add(user.UserAccountId); } else { if (_httpContext.Session[SessionHelper.UserAccountIds] != null) { userAccountIds = (List <int>)_httpContext.Session[SessionHelper.UserAccountIds]; } } var contactViewData = ContactServiceFacade.RetrieveContactsView(_httpContext.Session[SessionHelper.UserAccountIds] != null ? (List <int>)_httpContext.Session[SessionHelper.UserAccountIds] : new List <int> { }, contactListState.BoundDate, contactListState.CurrentPage, contactListState.SortColumn.GetStringValue(), contactListState.SortDirection, user.UserAccountId, searchValue, contactListState.ContactStatusFilter, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, contactListState.LoanPurposeFilter, userFilterViewModel.BranchId, contactListState.ConciergeFilter ); var contactViewModel = new ContactViewModel(); if (contactViewData != null) { contactViewModel.Contacts = contactViewData.ContactsItems; contactViewModel.PageCount = contactViewData.TotalPages; contactViewModel.TotalItems = contactViewData.TotalItems; ContactGridHelper.ApplyClassCollection(contactViewModel); ContactGridHelper.ProcessPagingOptions(contactListState, contactViewModel); } contactViewModel.ProspectLOConciergeList = ContactViewModelHelper.PopulateProspectLoanOfficers(userFilterViewModel, _httpContext); // populate prospect statuses ContactViewModelHelper.PopulateProspectStatuses(contactViewModel); contactViewModel.ProspectStatusList = ContactViewModelHelper.PopulateProspectStatusList(contactViewModel); contactViewModel.LoanPurposeList = new List <LoanTransactionType>(Enum.GetValues(typeof(LoanTransactionType)).Cast <LoanTransactionType>().Skip(1)); ContactDataHelper contactDataHelper = new ContactDataHelper(); contactDataHelper.PopulateConciergeFilterList(contactListState, _httpContext, contactViewModel); _viewName = "Queues/_contact"; _viewModel = contactViewModel; /* Persist new state */ _httpContext.Session[SessionHelper.ContactViewModel] = contactViewModel.ToXml(); _httpContext.Session[SessionHelper.ContactListState] = contactListState; _httpContext.Session[SessionHelper.FilterViewModel] = userFilterViewModel.ToXml(); _httpContext.Session[SessionHelper.CurrentTab] = LoanCenterTab.Prospect; }
public void Execute() { /* State retrieval */ ContactViewModel contactViewModel = null; if (_httpContext.Session["ContactViewModel"] != null) { contactViewModel = new ContactViewModel().FromXml(_httpContext.Session["ContactViewModel"].ToString()); } else { contactViewModel = new ContactViewModel(); } ContactListState contactListState = null; if (_httpContext.Session["ContactListState"] != null) { contactListState = ( ContactListState )_httpContext.Session["ContactListState"]; } else { contactListState = new ContactListState(); } if (!InputParameters.ContainsKey("LoanPurposeFilter")) { throw new ArgumentException("LoanPurposeFilter was expected!"); } if (InputParameters["LoanPurposeFilter"].ToString() == "0") { contactListState.LoanPurposeFilter = ""; } else { contactListState.LoanPurposeFilter = InputParameters["LoanPurposeFilter"].ToString(); } UserAccount user = null; if (_httpContext.Session[SessionHelper.UserData] != null && ((UserAccount)_httpContext.Session[SessionHelper.UserData]).Username == _httpContext.User.Identity.Name) { user = (UserAccount)_httpContext.Session[SessionHelper.UserData]; } else { user = UserAccountServiceFacade.GetUserByName(_httpContext.User.Identity.Name); } if (user == null) { throw new InvalidOperationException("User is null"); } // on date filter change, reset page number FilterViewModel userFilterViewModel = null; if ((_httpContext != null) && (_httpContext.Session[SessionHelper.FilterViewModel] != null)) { userFilterViewModel = new FilterViewModel().FromXml(_httpContext.Session[SessionHelper.FilterViewModel].ToString()); } else { userFilterViewModel = new FilterViewModel(); } contactListState.CurrentPage = 1; contactViewModel = ContactDataHelper.RetrieveContactViewModel(contactListState, _httpContext.Session["UserAccountIds"] != null ? (List <int>)_httpContext.Session["UserAccountIds"] : new List <int> { }, user.UserAccountId, _httpContext, CommonHelper.GetSearchValue(_httpContext)); _viewName = "Queues/_contact"; _viewModel = contactViewModel; /* Persist new state */ _httpContext.Session["ContactViewModel"] = contactViewModel.ToXml(); _httpContext.Session["ContactListState"] = contactListState; }
public void Execute() { String searchValue = CommonHelper.GetSearchValue(_httpContext); /* State retrieval */ ContactListState contactListState; if (_httpContext.Session[SessionHelper.ContactListState] != null) { contactListState = (ContactListState)_httpContext.Session[SessionHelper.ContactListState]; } else { contactListState = new ContactListState(); } UserAccount user; if (_httpContext.Session[SessionHelper.UserData] != null && ((UserAccount)_httpContext.Session[SessionHelper.UserData]).Username == _httpContext.User.Identity.Name) { user = (UserAccount)_httpContext.Session[SessionHelper.UserData]; } else { user = UserAccountServiceFacade.GetUserByName(_httpContext.User.Identity.Name); } if (user == null) { throw new InvalidOperationException("User is null"); } /* parameter processing */ Int32 newPageNumber; if (!InputParameters.ContainsKey("Page")) { throw new ArgumentException("Page number was expected!"); } else { newPageNumber = Convert.ToInt32(InputParameters["Page"]); } contactListState.CurrentPage = newPageNumber; /* Command processing */ FilterViewModel userFilterViewModel; if ((_httpContext != null) && (_httpContext.Session[SessionHelper.FilterViewModel] != null)) { userFilterViewModel = new FilterViewModel().FromXml(_httpContext.Session[SessionHelper.FilterViewModel].ToString()); userFilterViewModel.FilterContext = FilterContextEnum.Contact; } else { // possible state retrieval? userFilterViewModel = new FilterViewModel(); userFilterViewModel.FilterContext = FilterContextEnum.Contact; } var contactViewData = ContactServiceFacade.RetrieveContactsView(_httpContext.Session[SessionHelper.UserAccountIds] != null ? (List <int>)_httpContext.Session[SessionHelper.UserAccountIds] : new List <int> { }, contactListState.BoundDate, contactListState.CurrentPage, contactListState.SortColumn.GetStringValue(), contactListState.SortDirection, user.UserAccountId, searchValue, contactListState.ContactStatusFilter, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, contactListState.LoanPurposeFilter, userFilterViewModel.BranchId, contactListState.ConciergeFilter ); ContactViewModel contactViewModel = new ContactViewModel(); if (contactViewData != null) { contactViewModel.Contacts = contactViewData.ContactsItems; contactViewModel.PageCount = contactViewData.TotalPages; contactViewModel.TotalItems = contactViewData.TotalItems; ContactGridHelper.ApplyClassCollection(contactViewModel); ContactGridHelper.ProcessPagingOptions(contactListState, contactViewModel); } contactViewModel.ProspectLOConciergeList = ContactViewModelHelper.PopulateProspectLoanOfficers(userFilterViewModel, _httpContext); // populate prospect statuses ContactViewModelHelper.PopulateProspectStatuses(contactViewModel); contactViewModel.ProspectStatusList = ContactViewModelHelper.PopulateProspectStatusList(contactViewModel); contactViewModel.LoanPurposeList = new List <LoanTransactionType>(Enum.GetValues(typeof(LoanTransactionType)).Cast <LoanTransactionType>().Skip(1)); ContactDataHelper contactDataHelper = new ContactDataHelper(); contactDataHelper.PopulateConciergeFilterList(contactListState, _httpContext, contactViewModel); _viewName = "Queues/_contact"; _viewModel = contactViewModel; /* Persist new state */ _httpContext.Session[SessionHelper.ContactViewModel] = contactViewModel.ToXml(); _httpContext.Session[SessionHelper.ContactListState] = contactListState; _httpContext.Session[SessionHelper.FilterViewModel] = userFilterViewModel.ToXml(); _httpContext.Session[SessionHelper.CurrentTab] = LoanCenterTab.Prospect; }