Ejemplo 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);
                base.SetSuccessMessage("Data Updated.");
                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("contracts/funded");
                var response = BaseApiData.PostAPIData(apiMethod, model);
                if (response.StatusCode == HttpStatusCode.OK)
                {
                    base.SetSuccessMessage("Data Updated.");
                    if (Command == "complete")
                    {
                        base.SetSuccessMessage("Task Completed.");
                        return RedirectToAction("Index", "FinalVerification");
                    }
                    else
                    {
                        base.SetSuccessMessage("Data Updated.");
                        return RedirectToAction("Index", "Funding");
                    }
                }
                else
                {
                    base.SetErrorMessage("Update Failure");
                    return RedirectToAction("Index");
                }
            }
            if (Session["Banklist"] != null)
                model.Banklist = (IEnumerable<SelectListItem>)Session["Banklist"];
            return View(model);
        }
Ejemplo 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 + 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 = 999999;
                }
            }
        }