Esempio n. 1
0
        public ActionResult Index(string rfp_key)
        {
            if (string.IsNullOrWhiteSpace(rfp_key))
            {
                var response = _rfpRequestFacade.GetWhere($"co_organization.org_key='{CurrentUser.User.org_key}'");

                if (response != null && response.Count > 0)
                {
                    response.ForEach(p => p.RACIContactList = _contactFacade.GetRACIContacts(new RACIFilter {
                        Org_key = CurrentUser.User.org_key, rfp_key = p.rfp_key.ToString()
                    }));
                    response.ForEach(p => p.ScoreRules = _rfpScoreRuleFacade.GetWhere($"rfp_score_rules.eva_rfp_key='{p.rfp_key.ToString()}'"));
                }

                return(View(response));
            }
            else
            {
                var response = _rfpRequestFacade.Find(rfp_key);

                if (response.Success)
                {
                    response.Result.RACIContactList = _contactFacade.GetRACIContacts(new RACIFilter {
                        Org_key = CurrentUser.User.org_key, rfp_key = response.Result.rfp_key.ToString()
                    });

                    if (CurrentUser.User.org_key.ToString() != response.Result.rfp_org_key.ToString())
                    {
                        _miscFacade.ViewPage(new CoPageView
                        {
                            pv_key           = Guid.NewGuid(),
                            pv_rfp_key       = Guid.Parse(rfp_key),
                            pv_prd_key       = null,
                            pv_source_ct_key = CurrentUser.User.ct_key,
                            pv_add_user      = CurrentUser.User.ct_key.ToString(),
                            pv_view_datetime = DateTime.Now
                        });
                    }

                    TempData["Files"] = _rfpAttachmentFacade.GetWhere($"rfa_key in (select axr_rfa_key from attachment_x_request where axr_rfp_key='{rfp_key}')");
                    return(View("ViewRFP", response.Result));
                }
                else
                {
                    return(View("ViewRFP"));
                }
            }
        }