Exemplo n.º 1
0
        // create the Request for Proposal and start the workflow
        protected void CreateAndSubmitRfp(object sender, EventArgs e)
        {
            // collect info from the UI and create the RFP
            RequestForProposal rfp = new RequestForProposal()
            {
                Title = txtTitle.Text,
                Description = txtDescription.Text
            };

            // add invited vendors
            for (int counter = 0; counter < chkVendorsList.Items.Count; counter++)
            {
                if (chkVendorsList.Items[counter].Selected)
                {
                    int vendorId = int.Parse(chkVendorsList.Items[counter].Value);
                    rfp.InvitedVendors.Add(VendorRepository.Retrieve(vendorId));
                }
            }

            // get the instance of the host and create and run the new workflow
            PurchaseProcessHost host = GetHost();
            host.CreateAndRun(rfp);

            // return to the main simulation page
            Response.Redirect("Default.aspx");
        }
Exemplo n.º 2
0
        // show the rfp and set the UI
        void ViewRfp_Load(object sender, EventArgs e)
        {
            // retrieve rfp from repository
            RequestForProposal rfp = RfpRepository.Retrieve(this.RfpId);

            // set form caption
            this.Text = string.Format("Submit Proposal (Vendor {0})", this.VendorId);

            // show general info
            this.txtTitle.Text       = rfp.Title;
            this.txtDescription.Text = rfp.Description;
            this.txtCreated.Text     = rfp.CreationDate.ToString();

            // set UI for vendor
            if (rfp.IsInvited(this.VendorId))
            {
                if (this.PurchaseProcessHost.CanSubmitProposalToInstance(this.RfpId, this.VendorId))
                {
                    this.SetProposalUI("Please submit your proposal.", true);
                }
                else
                {
                    this.SetProposalUI("You have already submited your proposal.", false);
                }
            }
            else
            {
                this.SetProposalUI("You are not invited to submit a proposal.", false);
            }
        }
Exemplo n.º 3
0
        // create the Request for Proposal and start the workflow
        protected void CreateAndSubmitRfp(object sender, EventArgs e)
        {
            // collect info from the UI and create the RFP
            RequestForProposal rfp = new RequestForProposal()
            {
                Title       = txtTitle.Text,
                Description = txtDescription.Text
            };

            // add invited vendors
            for (int counter = 0; counter < chkVendorsList.Items.Count; counter++)
            {
                if (chkVendorsList.Items[counter].Selected)
                {
                    int vendorId = int.Parse(chkVendorsList.Items[counter].Value);
                    rfp.InvitedVendors.Add(VendorRepository.Retrieve(vendorId));
                }
            }

            // get the instance of the host and create and run the new workflow
            PurchaseProcessHost host = GetHost();

            host.CreateAndRun(rfp);

            // return to the main simulation page
            Response.Redirect("Default.aspx");
        }
        public ActionResult VendorProposal(Guid id, int vendorId)
        {
            RequestForProposal rfp = _purchasingRepository.Retrieve(id);

            ViewBag.VendorId = vendorId;

            return(View(rfp));
        }
Exemplo n.º 5
0
        // retrieve the Rquest for Proposals and show it in the UI
        protected void Page_Load(object sender, EventArgs e)
        {
            // get data from the request
            Guid instanceId = new Guid(Request["id"]);

            // retrieve the Request for Proposals from the repository
            RequestForProposal rfp = RfpRepository.Retrieve(instanceId);

            // show general info
            this.Title               = string.Format("Showing '{0}'", rfp.Title);
            this.lblTitle.Text       = rfp.Title;
            this.lblDescription.Text = rfp.Description;
            this.lblCreated.Text     = rfp.CreationDate.ToString();

            // show best offer and completion date
            if (rfp.IsFinished())
            {
                this.lblEndDate.Text = rfp.CompletionDate.ToString();
                if (rfp.BestProposal != null)
                {
                    this.pnlBestProposal.Visible    = true;
                    this.lblBestProposalValue.Text  = rfp.BestProposal.Value.ToString();
                    this.lblBestProposalVendor.Text = rfp.BestProposal.Vendor.Name;
                }
            }
            else
            {
                this.lblEndDate.Text = "Not finished yet";
            }

            // show invited vendors
            foreach (Vendor vendor in rfp.InvitedVendors)
            {
                if (this.lblInvitedVendors.Text.Length > 0)
                {
                    this.lblInvitedVendors.Text += ", ";
                }
                this.lblInvitedVendors.Text += vendor.Name;
            }

            // show received proposals in the list
            StringBuilder buffer = new StringBuilder();

            foreach (var proposal in rfp.VendorProposals.Values)
            {
                buffer.Append("<tr>");
                buffer.Append(string.Format("<td>{0}</td>", proposal.Vendor.Name));
                buffer.Append(string.Format("<td>{0}</td>", proposal.Value.ToString()));
                buffer.Append(string.Format("<td>{0}</td>", proposal.Date.ToString()));
                buffer.Append("</tr>");
            }
            this.litVendorProposalsTableRows.Text = buffer.ToString();
        }
Exemplo n.º 6
0
        // show the request for proposals
        void ViewProposal_Load(object sender, EventArgs e)
        {
            // retrieve rfp from the repository
            RequestForProposal rfp = RfpRepository.Retrieve(this.RfpId);

            // general info
            this.txtTitle.Text       = rfp.Title;
            this.txtDescription.Text = rfp.Description;
            this.txtCreated.Text     = rfp.CreationDate.ToString();

            // show best proposal and completion date (depending on the status of the rfp)
            if (rfp.IsFinished())
            {
                this.txtFinished.Text = rfp.CompletionDate.ToString();
                if (rfp.BestProposal != null)
                {
                    this.txtBestProposal.Text      = string.Format("{0} USD from '{1}' ({2}))", rfp.BestProposal.Value, rfp.BestProposal.Vendor.Name, rfp.BestProposal.Date);
                    this.txtBestProposal.ForeColor = Color.Green;
                }
                else
                {
                    this.txtBestProposal.Text = "No vendor proposals received for this RfP";
                }
            }
            else
            {
                this.txtFinished.Text     = "Not finished yet";
                this.txtBestProposal.Text = "Not finished yet";
            }

            // show invited vendors
            foreach (Vendor vendor in rfp.InvitedVendors)
            {
                if (this.txtInvitedVendors.Text.Length > 0)
                {
                    this.txtInvitedVendors.Text += ", ";
                }
                this.txtInvitedVendors.Text += vendor.Name;
            }

            // show received proposals
            this.AddHeaderToList(this.lstReceivedProposals, "Vendor", 150);
            this.AddHeaderToList(this.lstReceivedProposals, "Value", 100);
            this.AddHeaderToList(this.lstReceivedProposals, "Date", 200);
            foreach (var proposal in rfp.VendorProposals.Values)
            {
                ListViewItem item = new ListViewItem(proposal.Vendor.ToString());
                item.SubItems.Add(proposal.Value.ToString());
                item.SubItems.Add(proposal.Date.ToString());
                this.lstReceivedProposals.Items.Add(item);
            }
        }
Exemplo n.º 7
0
        public async Task <StatusCodeResult> CreateRequestForProposalAsync(RequestForProposal requestForProposal, string senderJwt)
        {
            if (requestForProposal.Items != null && requestForProposal.Items.Count > 0 && requestForProposal.Items.First().OrderItemId > 0)
            {
                var result = await _radish34Service.CreateAgreement(requestForProposal, senderJwt);


                return(await Task.Run(() => new OkResult()));
            }
            else
            {
                return(await Task.Run(() => new StatusCodeResult(510)));
            }
        }
Exemplo n.º 8
0
        XElement SerializeRfp(RequestForProposal rfp)
        {
            // main body of the rfp
            XElement ret =
                new XElement("requestForProposal",
                             new XAttribute("id", rfp.ID.ToString()),
                             new XAttribute("status", rfp.Status),
                             new XElement("creationDate", rfp.CreationDate),
                             new XElement("completionDate", rfp.CompletionDate),
                             new XElement("title", rfp.Title),
                             new XElement("description", rfp.Description));

            // add invited vendors
            XElement invitedVendors = new XElement("invitedVendors");

            foreach (Vendor vendor in rfp.InvitedVendors)
            {
                invitedVendors.Add(
                    new XElement("vendor",
                                 new XAttribute("id", vendor.Id)));
            }
            ret.Add(invitedVendors);

            // add vendor proposals
            XElement vendorProposals = new XElement("vendorProposals");

            foreach (VendorProposal proposal in rfp.VendorProposals.Values)
            {
                vendorProposals.Add(
                    new XElement("vendorProposal",
                                 new XAttribute("vendorId", proposal.VendorId),
                                 new XAttribute("date", proposal.Date),
                                 new XAttribute("value", proposal.Value)));
            }
            ret.Add(vendorProposals);

            // add best proposal
            if (rfp.BestProposal != null && rfp.BestProposal.VendorId != 0)
            {
                ret.Add(
                    new XElement("bestProposal",
                                 new XAttribute("vendorId", rfp.BestProposal.VendorId),
                                 new XAttribute("date", rfp.BestProposal.Date),
                                 new XAttribute("value", rfp.BestProposal.Value)));
            }

            return(ret);
        }
Exemplo n.º 9
0
        // create a new Rfp and launch the WF instance
        private void btnCreate_Click(object sender, EventArgs e)
        {
            // create the RFP
            RequestForProposal rfp = new RequestForProposal();

            rfp.Title       = this.txtTitle.Text;
            rfp.Description = this.txtDescription.Text;
            foreach (Vendor vendor in chkVendors.CheckedItems)
            {
                rfp.InvitedVendors.Add(vendor);
            }

            // create the proposal within the host
            this.PurchaseProcessHost.CreateAndRun(rfp);

            // show final message
            this.Hide();
        }
Exemplo n.º 10
0
        // map a Request for Proposal from a Linq to Xml XElement
        public RequestForProposal MapFrom(XElement elem)
        {
            RequestForProposal rfp = new RequestForProposal();

            rfp.ID           = new Guid(elem.Attribute("id").Value);
            rfp.Status       = elem.Attribute("status").Value;
            rfp.Title        = elem.Element("title").Value;
            rfp.Description  = elem.Element("description").Value;
            rfp.CreationDate = DateTime.Parse(elem.Element("creationDate").Value, new CultureInfo("EN-us"));

            if (elem.Element("completionDate") != null)
            {
                rfp.CompletionDate = DateTime.Parse(elem.Element("completionDate").Value, new CultureInfo("EN-us"));
            }

            // invited vendors
            foreach (XElement vendorElem in elem.Element("invitedVendors").Elements("vendor"))
            {
                Vendor vendor = VendorRepository.Retrieve(Convert.ToInt32(vendorElem.Attribute("id").Value, new CultureInfo("EN-us")));
                rfp.InvitedVendors.Add(vendor);
            }

            // map received proposals in the list
            foreach (var proposal in elem.Element("vendorProposals").Elements("vendorProposal"))
            {
                Vendor         vendor         = VendorRepository.Retrieve(int.Parse(proposal.Attribute("vendorId").Value, new CultureInfo("EN-us")));
                VendorProposal vendorProposal = new VendorProposal(vendor.Id);
                vendorProposal.Value = double.Parse(proposal.Attribute("value").Value, new CultureInfo("EN-us"));
                vendorProposal.Date  = DateTime.Parse(proposal.Attribute("date").Value, new CultureInfo("EN-us"));
                rfp.VendorProposals.Add(vendor.Id, vendorProposal);
            }

            // map best proposal
            if (elem.Element("bestProposal") != null)
            {
                Vendor bestVendor = VendorRepository.Retrieve(Convert.ToInt32(elem.Element("bestProposal").Attribute("vendorId").Value, new CultureInfo("EN-us")));
                rfp.BestProposal       = new VendorProposal(bestVendor.Id);
                rfp.BestProposal.Value = double.Parse(elem.Element("bestProposal").Attribute("value").Value, new CultureInfo("EN-us"));
                rfp.BestProposal.Date  = DateTime.Parse(elem.Element("bestProposal").Attribute("date").Value, new CultureInfo("EN-us"));
            }

            return(rfp);
        }
Exemplo n.º 11
0
        // retrieve the Rquest for Proposals and show it in the UI
        void Page_Load(object sender, EventArgs e)
        {
            // get data from the request
            instanceId = new Guid(Request["id"]);
            vendorId   = int.Parse(Request["vendorId"]);

            if (!IsPostBack)
            {
                // retrieve the Request for Proposals from the repository
                RequestForProposal rfp = RfpRepository.Retrieve(instanceId);

                // show general info
                this.Title               = string.Format("Submit Proposal (Vendor {0})", this.vendorId);
                this.lblTitle.Text       = rfp.Title;
                this.lblDescription.Text = rfp.Description;
                this.lblCreated.Text     = rfp.CreationDate.ToString();

                if (rfp.IsInvited(vendorId))
                {
                    if (this.GetHost().CanSubmitProposalToInstance(this.instanceId, this.vendorId))
                    {
                        this.pnlVendorOffer.Visible = true;
                        this.pnlSubmited.Visible    = false;
                        this.pnlNotInvited.Visible  = false;
                    }
                    else
                    {
                        this.pnlSubmited.Visible    = true;
                        this.pnlVendorOffer.Visible = false;
                        this.pnlNotInvited.Visible  = false;
                    }
                }
                else
                {
                    this.pnlNotInvited.Visible  = true;
                    this.pnlSubmited.Visible    = false;
                    this.pnlVendorOffer.Visible = false;
                }
            }
        }
        public ActionResult CreateRfp(RequestForProposal rfp)
        {
            IPurchasingService purchasingService = new PurchasingServiceClient();

            rfp.Status = "active";
            string[] invitedVendors = Request.Form["InvitedVendors"].Split(',');
            foreach (var invitedVendor in invitedVendors)
            {
                rfp.InvitedVendors.Add(VendorRepository.Retrieve(int.Parse(invitedVendor)));
            }

            try
            {
                SubmitPurchasingProposalResponse response = purchasingService.SubmitPurchasingProposal(new SubmitPurchasingProposalRequest(rfp));
            }
            catch (Exception)
            {
                throw;
            }

            return(RedirectToAction("Index"));
        }
        public async Task <StatusCodeResult> PostAsync([FromBody] RequestForProposal value)
        {
            var senderJwt = _radish34Repository.GetJwtFromRequest(Request.Headers);

            return(await _radish34BuyerService.CreateRequestForProposalAsync(value, senderJwt));
        }
Exemplo n.º 14
0
 public ProjectProductDescription(
     ProjectMandate projectMandate,
     ScopingWorkshopDiscussionsWithSeniorUserExecutive scopingWorkshopDiscussionsWithSeniorUserExecutive,
     RequestForProposal requestForProposal
     ) => throw new NotImplementedException();