Exemplo n.º 1
0
        public ActionResult Index(FundingModel model, HttpPostedFileBase file, string Command)
        {
            if (ModelState.IsValid)
            {
                model.ContractId = (int)ContractID;
                model.MerchantId = (int)CurrentMerchantID;
                model.accountName = string.IsNullOrEmpty(model.accountName) ? string.Empty : model.accountName;
                model.action = Command;
                model.UserId = base.CurrentUserID;

                UploadDocuments(model, file);
                if (Command == "complete")
                {
                    if (model.documentId == 0)
                    {
                        base.SetErrorMessage("Can not complete the task, Please Upload proof of Wire Transfer.");
                        return RedirectToAction("Index", "Funding");
                    }
                    else if (!model.contractFunded || !model.contractReviewed)
                    {
                        base.SetErrorMessage("Can not complete the task, Please select Funded and Review checkboxes.");
                        return RedirectToAction("Index", "Funding");
                    }
                }

                var apiMethod = string.Format("renewals/funded");
                var response = BaseApiData.PostAPIData(apiMethod, model);
                if (response.StatusCode == HttpStatusCode.OK)
                {
                    //UploadDocuments(model, file);
                    base.SetSuccessMessage("Data Updated.");
                    if (Command == "complete")
                    {
                        renewaltApi.CompContractTask(CurrentMerchantID, (int)TaskTypes.RWFunding, (int)WorkflowTypes.Renewal, ContractID);
                        base.SetSuccessMessage("Task Completed.");
                    }
                }
                else
                {
                    base.SetErrorMessage("Update Failure");
                    return RedirectToAction("Index");
                }
            }
            if (Session["Banklist"] != null)
                model.Banklist = (IEnumerable<SelectListItem>)Session["Banklist"];
            return RedirectToAction("Index");
        }
Exemplo n.º 2
0
        private void UploadDocuments(FundingModel mod, HttpPostedFileBase file)
        {
            var docModel = new DocumentModel();
            string fileName = "";
            string fileType = "";

            if (file != null && file.ContentLength > 0)
            {
                fileName = "doc_" + mod.documentId + WireTransferDocumentTypeId + "_" + CurrentMerchantID + "_" + ContractID + file.FileName + Path.GetExtension(file.FileName);
                var path = Path.Combine(Server.MapPath("~/ScanDocuments/"), fileName);
                file.SaveAs(path);
                fileType = file.ContentType;

                docModel.DocumentId = mod.documentId;
                docModel.ContractId = ContractID;
                docModel.MerchantId = CurrentMerchantID;
                docModel.DocumentTypeId = WireTransferDocumentTypeId;
                docModel.FileName = fileName;
                docModel.FileDetails = fileType;
                docModel.UploadUserId = CurrentUserID;

                if (mod.documentId > 0)
                {
                    ApiHelper.BaseApiData.PutAPIData<DocumentModel>("documents/UpdateDocuments", docModel);
                }
                else
                {
                    ApiHelper.BaseApiData.PutAPIData<DocumentModel>("documents/InsertContDocument", docModel);
                    mod.documentId = 8888;
                }
            }
        }