示例#1
0
        private async Task <bool> SetSearchModel(HttpContext context, string controller,
                                                 string action, bool isInitView, string partialUriPattern, ISearchService searchService,
                                                 IMemberService memberService)
        {
            //the order that the search params get set is important
            //set general content properties
            this.SearchManagerData.SearchResult = new ContentURI();
            ViewDataHelper vwDataHelper = new ViewDataHelper();

            this.SearchManagerData.SearchResult =
                vwDataHelper.SetInitialModelProperties(_initialURI, context, controller,
                                                       action, partialUriPattern);

            ////2.0.0 contenturi does not init network in constructor, do it here
            //now it's done below with SetNetwork
            //await SetNetworkAsync(searchService, memberService);

            //set up initial club and member
            MemberHelper oMemberHelper = new MemberHelper();
            bool         bHasSet       = await oMemberHelper.SetClubAndMemberAsync(context, isInitView, memberService,
                                                                                   this.SearchManagerData.SearchResult);

            //set the service and, if necessary, change the app
            bHasSet = await SetService(context);

            //set 'rows to return' params sent in the request body
            SetStartRowArgs();
            SetOtherSearchArgs(context);
            SetNetworkType(context);
            return(bHasSet);
        }
 public SearchController(
     ILeadService LeadService,
     IContactService contactService,
     IMembershipService membershipService,
     IRoleService roleService,
     INoteService noteService,
     IActivityService activityService,
     ISaleService saleService,
     ITaskService taskService,
     ViewDataHelper viewdataHelper,
     ICampaignService campaignService,
     ITagService tagService)
 {
     _leadService       = LeadService;
     _contactService    = contactService;
     _membershipService = membershipService;
     _roleService       = roleService;
     _noteService       = noteService;
     _activityService   = activityService;
     _saleService       = saleService;
     _taskService       = taskService;
     _viewdataHelper    = viewdataHelper;
     _campaignService   = campaignService;
     _tagService        = tagService;
 }
        /// <summary>
        /// The index.
        /// </summary>
        /// <returns>
        /// The <see cref="ActionResult"/>.
        /// </returns>
        public ActionResult Index()
        {
            var viewDataHelper = new ViewDataHelper(db);

            ViewBag.data = JsonConvert.SerializeObject(viewDataHelper.FillViewData(CharacteristicCategory.Binary, 1, 1, "Calculate"));
            return(View());
        }
示例#4
0
        /// <summary>
        /// The index.
        /// </summary>
        /// <returns>
        /// The <see cref="ActionResult"/>.
        /// </returns>
        public ActionResult Index()
        {
            var viewDataHelper = new ViewDataHelper(db);

            ViewBag.data = JsonConvert.SerializeObject(viewDataHelper.FillSubsequencesViewData(2, 2, "Compare"));
            return(View());
        }
示例#5
0
        /// <summary>
        /// The index.
        /// </summary>
        /// <returns>
        /// The <see cref="ActionResult"/>.
        /// </returns>
        public ActionResult Index()
        {
            var viewDataHelper = new ViewDataHelper(db);

            ViewBag.data = JsonConvert.SerializeObject(viewDataHelper.FillViewData(1, 1, "Mix"));
            return(View());
        }
示例#6
0
        //[ChildActionOnly]
        public async Task <ActionResult> GeneralAction(string contenturipattern,
                                                       DataHelpers.SERVER_ACTION_TYPES serverActionType)
        {
            bool bUseContentAction = ViewDataHelper.GetContentAction(serverActionType);
            bool bIsAjaxSubaction  = ViewDataHelper.IsAjaxSubaction(this.Request.HttpContext);

            if (bUseContentAction == true)
            {
                if (bIsAjaxSubaction)
                {
                    return(await this.ContentAjaxAction(contenturipattern));
                }
                else
                {
                    return(await this.ContentAction(contenturipattern));
                }
            }
            else
            {
                if (bIsAjaxSubaction)
                {
                    return(await this.SearchAjaxAction(contenturipattern));
                }
                else
                {
                    return(await this.SearchAction(contenturipattern));
                }
            }
        }
        /// <summary>
        /// The edit.
        /// </summary>
        /// <param name="id">
        /// The id.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            SequenceGroup sequenceGroup = await db.SequenceGroup.FindAsync(id);

            if (sequenceGroup == null)
            {
                return(HttpNotFound());
            }

            using (var db = new LibiadaWebEntities())
            {
                var viewDataHelper   = new ViewDataHelper(db);
                var viewData         = viewDataHelper.FillViewData(1, int.MaxValue);
                var matterRepository = new MatterRepository(db);
                var matterIds        = sequenceGroup.Matters.Select(m => m.Id);
                bool Selected(Matter m) => matterIds.Contains(m.Id);

                viewData["matters"]            = matterRepository.GetMatterSelectList(db.Matter, Selected);
                viewData["sequenceGroupTypes"] = EnumExtensions.ToArray <SequenceGroupType>().ToSelectListWithNature();
                ViewBag.data = JsonConvert.SerializeObject(viewData);
            }

            return(View(sequenceGroup));
        }
        /// <summary>
        /// The index.
        /// </summary>
        /// <returns>
        /// The <see cref="ActionResult"/>.
        /// </returns>
        public ActionResult Index()
        {
            var viewDataHelper = new ViewDataHelper(db);
            var viewData       = viewDataHelper.FillViewData(CharacteristicCategory.Full, 1, int.MaxValue, "Calculate");

            ViewBag.data = JsonConvert.SerializeObject(viewData);
            return(View());
        }
        /// <summary>
        /// The index.
        /// </summary>
        /// <returns>
        /// The <see cref="ActionResult"/>.
        /// </returns>
        public ActionResult Index()
        {
            var viewDataHelper = new ViewDataHelper(db);
            Dictionary <string, object> viewData = viewDataHelper.FillViewData(CharacteristicCategory.Full, 3, int.MaxValue, "Calculate");

            viewData.Add("ClusterizatorsTypes", EnumExtensions.ToArray <ClusterizationType>().ToSelectList());
            ViewBag.data = JsonConvert.SerializeObject(viewData);
            return(View());
        }
 /// <summary>
 /// The index.
 /// </summary>
 /// <returns>
 /// The <see cref="ActionResult"/>.
 /// </returns>
 public ActionResult Index()
 {
     using (var db = new LibiadaWebEntities())
     {
         var viewDataHelper = new ViewDataHelper(db);
         var viewData       = viewDataHelper.FillViewData(CharacteristicCategory.Full, 1, 1, "Calculate");
         ViewBag.data = JsonConvert.SerializeObject(viewData);
         return(View());
     }
 }
示例#11
0
 /// <summary>
 /// The index.
 /// </summary>
 /// <returns>
 /// The <see cref="ActionResult"/>.
 /// </returns>
 public ActionResult Index()
 {
     using (var db = new LibiadaWebEntities())
     {
         var viewDataHelper = new ViewDataHelper(db);
         Dictionary <string, object> viewData = viewDataHelper.GetCharacteristicsData(CharacteristicCategory.Full);
         ViewBag.data = JsonConvert.SerializeObject(viewData);
         return(View());
     }
 }
示例#12
0
        /// <summary>
        /// The create.
        /// </summary>
        /// <returns>
        /// The <see cref="ActionResult"/>.
        /// </returns>
        public ActionResult Create()
        {
            using (var db = new LibiadaWebEntities())
            {
                var viewDataHelper = new ViewDataHelper(db);
                ViewBag.data = JsonConvert.SerializeObject(viewDataHelper.FillMatterCreationViewData());
            }

            return(View());
        }
示例#13
0
        /// <summary>
        /// The index.
        /// </summary>
        /// <returns>
        /// The <see cref="ActionResult"/>.
        /// </returns>
        public ActionResult Index()
        {
            using (var db = new LibiadaWebEntities())
            {
                var viewDataHelper = new ViewDataHelper(db);
                ViewBag.data = JsonConvert.SerializeObject(viewDataHelper.FillSubsequencesViewData(1, int.MaxValue, "Calculate"));
            }

            return(View());
        }
示例#14
0
        /// <summary>
        /// The index.
        /// </summary>
        /// <returns>
        /// The <see cref="ActionResult"/>.
        /// </returns>
        public ActionResult Index()
        {
            var matterIds = db.DnaSequence.Where(d => d.Notation == Notation.Nucleotides).Select(d => d.MatterId).ToArray();

            var viewDataHelper = new ViewDataHelper(db);
            var data           = viewDataHelper.FillViewData(1, int.MaxValue, m => matterIds.Contains(m.Id), "Transform");

            data.Add("nature", (byte)Nature.Genetic);
            ViewBag.data = JsonConvert.SerializeObject(data);
            return(View());
        }
 /// <summary>
 /// The create.
 /// </summary>
 /// <returns>
 /// The <see cref="ActionResult"/>.
 /// </returns>
 public ActionResult Create()
 {
     using (var db = new LibiadaWebEntities())
     {
         var viewDataHelper = new ViewDataHelper(db);
         var viewData       = viewDataHelper.FillViewData(1, int.MaxValue);
         viewData["sequenceGroupTypes"] = EnumExtensions.ToArray <SequenceGroupType>().ToSelectListWithNature();
         ViewBag.data = JsonConvert.SerializeObject(viewData);
         return(View());
     }
 }
示例#16
0
        //[HttpPost]
        public async Task <ActionResult> LinkedViews(string contenturipattern)
        {
            contenturipattern = (string.IsNullOrEmpty(contenturipattern)) ? DataHelpers.MakeURIPatternStart()
                : contenturipattern;
            DataHelpers.SERVER_ACTION_TYPES eServerActionType
                = DataHelpers.SERVER_ACTION_TYPES.linkedviews;
            ViewDataHelper viewHelper = new ViewDataHelper();

            viewHelper.GetNewAction(this.HttpContext, ref eServerActionType);
            return(await this.GeneralAction(contenturipattern, eServerActionType));
        }
示例#17
0
        public async Task <ActionResult> Search(string contenturipattern)
        {
            contenturipattern = (string.IsNullOrEmpty(contenturipattern)) ?
                                DataHelpers.MakeURIPatternStart() : contenturipattern;
            //check for redirections from ajax content requests or subserveractiontypes
            DataHelpers.SERVER_ACTION_TYPES eServerActionType
                = DataHelpers.SERVER_ACTION_TYPES.search;
            ViewDataHelper viewHelper = new ViewDataHelper();

            viewHelper.GetNewAction(this.HttpContext, ref eServerActionType);
            return(await this.GeneralAction(contenturipattern, eServerActionType));
        }
        /// <summary>
        /// The index.
        /// </summary>
        /// <returns>
        /// The <see cref="ActionResult"/>.
        /// </returns>
        public ActionResult Index()
        {
            var viewDataHelper = new ViewDataHelper(db);
            var data           = viewDataHelper.FillViewData(1, 1, "Transform");

            var transformations = EnumHelper.GetSelectList(typeof(OrderTransformation));

            data.Add("transformations", transformations);

            ViewBag.data = JsonConvert.SerializeObject(data);
            return(View());
        }
示例#19
0
        /// <summary>
        /// The index.
        /// </summary>
        /// <returns>
        /// The <see cref="ActionResult"/>.
        /// </returns>
        public ActionResult Index()
        {
            var imageTransformers = EnumHelper.GetSelectList(typeof(ImageTransformer));

            using (var db = new LibiadaWebEntities())
            {
                var viewDataHelper = new ViewDataHelper(db);
                Dictionary <string, object> viewData = viewDataHelper.GetCharacteristicsData(CharacteristicCategory.Full);
                viewData.Add("imageTransformers", imageTransformers);
                ViewBag.data = JsonConvert.SerializeObject(viewData);
                return(View());
            }
        }
示例#20
0
        /// <summary>
        /// The index.
        /// </summary>
        /// <returns>
        /// The <see cref="ActionResult"/>.
        /// </returns>
        public ActionResult Index()
        {
            var db             = new LibiadaWebEntities();
            var viewDataHelper = new ViewDataHelper(db);
            Dictionary <string, object> data = viewDataHelper.FillViewData(CharacteristicCategory.Full, 1, int.MaxValue, "Calculate");

            var transformations = EnumHelper.GetSelectList(typeof(OrderTransformation));

            data.Add("transformations", transformations);

            ViewBag.data = JsonConvert.SerializeObject(data);
            return(View());
        }
示例#21
0
        /// <summary>
        /// The index.
        /// </summary>
        /// <returns>
        /// The <see cref="ActionResult"/>.
        /// </returns>
        public ActionResult Index()
        {
            using (var db = new LibiadaWebEntities())
            {
                var viewDataHelper = new ViewDataHelper(db);
                var data           = viewDataHelper.GetCharacteristicsData(CharacteristicCategory.Full);

                var transformations = EnumHelper.GetSelectList(typeof(OrderTransformation));
                data.Add("transformations", transformations);

                ViewBag.data = JsonConvert.SerializeObject(data);
                return(View());
            }
        }
示例#22
0
        public void SetStartRowArgs()
        {
            int    iStartRow  = 0;
            string sIsForward = "1";
            int    iPageSize  = DevTreks.Data.Helpers.AppSettings.GetPageSize(this.SearchManagerData.SearchResult);
            //used with content not with search
            int iParentRow = 0;

            ViewDataHelper.GetRowArgs(this.SearchManagerData.SearchResult.URIDataManager.FormInput,
                                      iPageSize, out iStartRow, out sIsForward, out iParentRow);
            this.SearchManagerData.StartRow  = iStartRow;
            this.SearchManagerData.IsForward = sIsForward;
            this.SearchManagerData.PageSize  = iPageSize;
        }
示例#23
0
        public async Task <bool> SetViewAsync(
            RouteData route, HttpContext context,
            ISearchService searchService, IMemberService memberService,
            string partialUriPattern)
        {
            bool   bHasSet            = false;
            string sViewName          = this.ViewName;
            string sTitle             = this.Title;
            bool   bIsInitView        = false;
            string sController        = string.Empty;
            string sAction            = string.Empty;
            string sContenturipattern = string.Empty;

            ViewDataHelper.GetRouteValues(route, out sController,
                                          out sAction, out sContenturipattern);
            //?? can get and post actions can be differentiated by this parameter
            if (partialUriPattern == string.Empty)
            {
                partialUriPattern = sContenturipattern;
            }
            ViewDataHelper.GetViews(route, context, sController,
                                    out bIsInitView, ref sViewName, ref sTitle);
            this.ViewName = sViewName;
            this.Title    = sTitle;
            bHasSet       = await SetSearchModel(context, sController, sAction, bIsInitView,
                                                 partialUriPattern, searchService, memberService);

            bool bIsNetworkingSearch = IsNetworkingSearch();

            bHasSet = await SetSearchDataForAllUsers(context, sController, searchService,
                                                     bIsNetworkingSearch);

            if (!HtmlMemberExtensions.UserIsLoggedIn(context))
            {
                bHasSet = await SetSearchDataForPublicMember(searchService,
                                                             bIsNetworkingSearch);
            }
            else
            {
                bHasSet = await SetSearchDataForLoggedinMember(searchService,
                                                               bIsNetworkingSearch);
            }
            //set the restful addresses
            DataHelpers.SetFullURIs(this.SearchManagerData.SearchResult);
            //publish error messages
            AppHelper.PublishErrorMessage(this.SearchManagerData.SearchResult);
            return(bHasSet);
        }
示例#24
0
 public ContactsController(
     INoteService noteService,
     IContactService contactService,
     ILeadService leadService,
     IQuoteService quoteService,
     IMembershipService membershipService,
     IActivityService activityService,
     ViewDataHelper initHelper)
 {
     _noteService       = noteService;
     _contactService    = contactService;
     _leadService       = leadService;
     _quoteService      = quoteService;
     _membershipService = membershipService;
     _activityService   = activityService;
     _initHelper        = initHelper;
 }
 public async Task <ActionResult> Index()
 {
     if (this.Request.Method != "POST")
     {
         ViewData["Title"] = AppHelper.GetResource("COMMONTREKS_TITLE");
         return(View());
     }
     else
     {
         //vs2012: upload file forms are submitted here
         string sContenturipattern = string.Empty;
         DataHelpers.SERVER_ACTION_TYPES eServerActionType
             = DataHelpers.SERVER_ACTION_TYPES.edit;
         ViewDataHelper viewHelper = new ViewDataHelper();
         viewHelper.GetNewAction(this.HttpContext, ref eServerActionType);
         return(await this.GeneralAction(sContenturipattern, eServerActionType));
     }
 }
示例#26
0
 public async Task <ActionResult> Index()
 {
     if (this.Request.Method != "POST")
     {
         ViewData["Title"] = AppHelper.GetResource("HOMETREKS_TITLE");
         return(View());
     }
     else
     {
         //jquery.ajax form posts to absolute path work around
         string sContenturipattern = string.Empty;
         DataHelpers.SERVER_ACTION_TYPES eServerActionType
             = DataHelpers.SERVER_ACTION_TYPES.edit;
         ViewDataHelper viewHelper = new ViewDataHelper();
         viewHelper.GetNewAction(this.HttpContext, ref eServerActionType);
         return(await this.GeneralAction(sContenturipattern, eServerActionType));
     }
 }
示例#27
0
 public HomeController(
     ILeadService leadService,
     ITaskService taskService,
     IContactService contactService,
     IMembershipService membershipService,
     IRoleService roleService,
     IActivityService activityService,
     ISaleService saleService,
     ViewDataHelper initHelper)
 {
     _leadService       = leadService;
     _taskService       = taskService;
     _contactService    = contactService;
     _membershipService = membershipService;
     _roleService       = roleService;
     _activityService   = activityService;
     _saleService       = saleService;
     _initHelper        = initHelper;
 }
        /// <summary>
        /// The index.
        /// </summary>
        /// <returns>
        /// The <see cref="ActionResult"/>.
        /// </returns>
        public ActionResult Index()
        {
            using (var db = new LibiadaWebEntities())
            {
                var sequencesWithSubsequencesIds = db.Subsequence.Select(s => s.SequenceId).Distinct();

                // TODO: Move list of sequenceTypes into separate entity
                var matterIds = db.DnaSequence.Include(c => c.Matter)
                                .Where(c => !string.IsNullOrEmpty(c.RemoteId) && !sequencesWithSubsequencesIds.Contains(c.Id) &&
                                       (c.Matter.SequenceType == SequenceType.CompleteGenome ||
                                        c.Matter.SequenceType == SequenceType.MitochondrionGenome ||
                                        c.Matter.SequenceType == SequenceType.Plasmid)).Select(c => c.MatterId).ToArray();

                var viewDataHelper = new ViewDataHelper(db);
                var data           = viewDataHelper.FillViewData(1, int.MaxValue, m => matterIds.Contains(m.Id), "Import");
                data.Add("nature", (byte)Nature.Genetic);
                ViewBag.data = JsonConvert.SerializeObject(data);
            }

            return(View());
        }
示例#29
0
 public InvoiceController(
     ILeadService LeadService,
     IContactService contactService,
     IMembershipService membershipService,
     IRoleService roleService,
     INoteService noteService,
     IActivityService activityService,
     IInvoiceService invoiceService,
     ISaleService saleService,
     ViewDataHelper initHelper)
 {
     _leadService       = LeadService;
     _contactService    = contactService;
     _membershipService = membershipService;
     _roleService       = roleService;
     _noteService       = noteService;
     _activityService   = activityService;
     _saleService       = saleService;
     _invoiceService    = invoiceService;
     _initHelper        = initHelper;
 }
示例#30
0
 public async Task <ActionResult> Index()
 {
     //this sets up the 'controller' index page which should be kept separate
     //from the ajax interactive page that follows
     //(easier to reset page when necessary)
     if (this.Request.Method != "POST")
     {
         ViewData["Title"] = AppHelper.GetResource("AGTREKS_TITLE");
         return(View());
     }
     else
     {
         //jquery.ajax form posts to absolute path work around
         string sContenturipattern = string.Empty;
         DataHelpers.SERVER_ACTION_TYPES eServerActionType
             = DataHelpers.SERVER_ACTION_TYPES.edit;
         ViewDataHelper viewHelper = new ViewDataHelper();
         viewHelper.GetNewAction(this.HttpContext, ref eServerActionType);
         return(await this.GeneralAction(sContenturipattern, eServerActionType));
     }
 }
 /// <summary>
 /// The index.
 /// </summary>
 /// <returns>
 /// The <see cref="ActionResult"/>.
 /// </returns>
 public ActionResult Index()
 {
     var viewDataHelper = new ViewDataHelper(db);
     ViewBag.data = JsonConvert.SerializeObject(viewDataHelper.FillViewData(c => c.BinarySequenceApplicable, 1, 1, "Calculate"));
     return View();
 }