示例#1
0
        public ActionResult Index(MerchantInformationOfferModel model, string button)
        {
            var isComplete = 0;
            if (button == "Complete")
            {
                isComplete = 1;
            }

            //model.TypeOfPropertyID = 1;
            if (ModelState.IsValid)
            {
                ///Save Data
               // model.offers = offerSesssionRepository.GetAll();

                if (isComplete == 0)
                {
                    var apiMethod = string.Format("CreditReport/offers/create?merchantId={0}&contractId={1}&isCompleted={2}", CurrentMerchantID, ContractID, isComplete);
                    BaseApiData.PostAPIData(apiMethod, model);
                }
                else
                {
                    var apiMethod = string.Format("CreditReport/offers/create?merchantId={0}&contractId={1}&isCompleted={2}", CurrentMerchantID, ContractID, isComplete);
                    BaseApiData.PostAPIData(apiMethod, model);

                    string apiData = string.Format("Contracts/CompContractTask?merchantId={0}&taskTypeId={1}&workflowId={2}&contractId={3}",
            CurrentMerchantID, (int)TaskTypes.PQOfferCreation, 1, ContractID);
                    BaseApiData.GetAPIResult<object>(apiData, () => new object());
                }

                if (isComplete == 1)
                {
                    base.SetSuccessMessage("Offer - Task Completed.");
                }
                else
                {
                    base.SetSuccessMessage("Data Updated.");

                }
                return RedirectToAction("Index");
            }

            return View(model);
        }
        public ActionResult Index(MerchantInformationOfferModel model, string button)
        {
            var isComplete = 0;
            if (button == "Complete")
            {
                isComplete = 1;
            }

            //model.TypeOfPropertyID = 1;
            if (ModelState.IsValid)
            {
                ///Save Data
                model.offers = offerSesssionRepository.GetAll();

                if (isComplete == 0)
                {
                    var apiMethod = string.Format("CreditReport/offers/create?merchantId={0}&contractId={1}&isCompleted={2}", CurrentMerchantID, ContractID, 0);
                    BaseApiData.PostAPIData(apiMethod, model);
                    base.SetSuccessMessage("Data Updated.");
                }
                else
                {
                    var apiMethod = string.Format("CreditReport/offers/create?merchantId={0}&contractId={1}&isCompleted={2}", CurrentMerchantID, ContractID, 0);
                    BaseApiData.PostAPIData(apiMethod, model);

                    var m = merchantApi.GetOfferDetails(CurrentMerchantID, ContractID);
                    if (m.IsOffersEmailSent)
                    {
                        string apiData = string.Format("Contracts/CompContractTask?merchantId={0}&taskTypeId={1}&workflowId={2}&contractId={3}",
                            CurrentMerchantID, (int)TaskTypes.PQOfferCreation, 1, ContractID);
                        BaseApiData.GetAPIResult<object>(apiData, () => new object());

                        var offerNotes = CreateOfferNote(CurrentMerchantID, ContractID);
                        //Save Notes

                        var notmodel = new NotesModel
                        {
                            MerchantId = base.CurrentMerchantID,
                            Note = offerNotes,
                            WorkFlowId = 1,
                            NoteTypeId = 550001,
                            ContractId = ContractID,
                            ScreenName = "Offer Creation"
                        };

                        ApiHelper.BaseApiData.PostAPIData("notes/save", notmodel);

                        base.SetSuccessMessage("Offer - Task Completed.");
                    }
                    else
                    {
                        base.SetErrorMessage("Can't complete, Please send email first.");
                    }

                }

                return RedirectToAction("Index");
            }

            return View(model);
        }