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"));
                }
            }
        }
Esempio n. 2
0
        public ActionResult Edit(string prdkey)
        {
            ViewData["Product"] = _searchFacade.FindRfpProduct(prdkey);
            var rfq = _rfpFacade.GetRFQDetails(CurrentUser.User.org_key.ToString(), prdkey);

            if (rfq == null)
            {
                rfq = new RfpRequest()
                {
                    rfp_key = Guid.NewGuid()
                };
            }
            else
            {
                rfq.RACIContactList = _contactFacade.GetRACIContacts(new RACIFilter {
                    Org_key = CurrentUser.User.org_key, rfp_key = rfq.rfp_key.ToString()
                });

                var files = _rfpAttachmentFacade.GetWhere($"rfa_key in (select axr_rfa_key from attachment_x_request where axr_rfp_key='{rfq.rfp_key.ToString()}')");

                if (files != null && files.Where(p => p.rfa_type == "QA").Count() > 0)
                {
                    rfq.QuestionnaireFiles = string.Join(",", files.Where(p => p.rfa_type == "QA").Select(p => p.rfa_key));
                }

                if (files != null && files.Where(p => p.rfa_type == "AA").Count() > 0)
                {
                    rfq.RfpAttachments = string.Join(",", files.Where(p => p.rfa_type == "AA").Select(p => p.rfa_key));
                }
            }

            return(View(rfq));
        }