public void UploadDoc(int docTypeId, int docId, HttpPostedFileBase file)
        {
            if (docTypeId > 0)
            {
                var docModel = new DocumentModel();
                string fileName = "";
                string fileType = "";
                if (file != null && file.ContentLength > 0)
                {
                    fileName = "doc_" + docId + docTypeId + "_" + CurrentMerchantID + "_" + ContractID + Path.GetExtension(file.FileName);
                    var path = Path.Combine(Server.MapPath("~/ScanDocuments/"), fileName);
                    file.SaveAs(path);
                    fileType = file.ContentType;
                }

                docModel.DocumentId = docId;
                docModel.ContractId = ContractID;
                docModel.MerchantId = CurrentMerchantID;
                docModel.DocumentTypeId = docTypeId;
                docModel.FileName = fileName;
                docModel.FileDetails = fileType;
                docModel.UploadUserId = CurrentUserID;

                docModel.StatusId = (long)StatusTypes.DocUploaded;
                documentsApi.UpdateDocuments(docModel);
            }
        }
示例#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;
                }
            }
        }
        public void Index(ScanDocumentModel mod, HttpPostedFileBase file)
        {
            if (ModelState.IsValid)
            {
                var docModel = new Pecuniaus.Models.Contract.DocumentModel();
                string fileName = "";
                string fileType = "";
                if (file != null && file.ContentLength > 0)
                {
                    fileName = "doc_" + ContractID + "_" + Guid.NewGuid() + Path.GetExtension(file.FileName);
                    var path = Path.Combine(Server.MapPath("~/ScanDocuments/"), fileName);
                    file.SaveAs(path);
                    fileType = file.ContentType;
                    // Save Data
                    // TempData["SuccessMsg"] = "Document Updated.";
                    // return RedirectToAction("Index");
                }

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

                if (mod.IsPending)
                {
                    docModel.StatusId = (long)StatusTypes.DocPending;
                }
                else
                {
                    docModel.StatusId = (long)StatusTypes.DocUploaded;
                }
                documentsApi.UpdateDocuments(docModel);

            }

            //var model = new ScanDocumentModel();
            //mod.DocumentTypes = GetDocTypes();

            //return View("ScanDocument", mod);
        }
示例#4
0
 public void UpdateDocuments(DocumentModel docModel)
 {
     BaseApiData.PutAPIData("documents/UpdateDocuments", docModel);
 }