Exemplo n.º 1
0
        public string UploadSureDeposit(HttpPostedFileBase fileBaseUploadInsurenceDoc, long ProspectId)
        {
            string          msg         = string.Empty;
            ShomaRMEntities db          = new ShomaRMEntities();
            string          filePath    = "";
            string          fileName    = "";
            string          sysFileName = "";
            string          Extension   = "";

            if (fileBaseUploadInsurenceDoc != null && fileBaseUploadInsurenceDoc.ContentLength > 0)
            {
                filePath = HttpContext.Current.Server.MapPath("~/Content/assets/img/SureDeposit/");
                DirectoryInfo di        = new DirectoryInfo(filePath);
                FileInfo      _FileInfo = new FileInfo(filePath);
                if (!di.Exists)
                {
                    di.Create();
                }
                fileName    = Path.GetFileNameWithoutExtension(fileBaseUploadInsurenceDoc.FileName);
                Extension   = Path.GetExtension(fileBaseUploadInsurenceDoc.FileName);
                sysFileName = fileName + ProspectId + Path.GetExtension(fileBaseUploadInsurenceDoc.FileName);
                fileBaseUploadInsurenceDoc.SaveAs(filePath + "//" + sysFileName);
                if (!string.IsNullOrWhiteSpace(fileBaseUploadInsurenceDoc.FileName))
                {
                    string afileName = HttpContext.Current.Server.MapPath("~/Content/assets/img/SureDeposit/") + "/" + sysFileName;
                }

                var moveInDet = db.tbl_SureDeposit.Where(p => p.ProspectID == ProspectId).FirstOrDefault();
                if (moveInDet == null)
                {
                    var saveSD = new tbl_SureDeposit()
                    {
                        ProspectID   = ProspectId,
                        SDUploadName = sysFileName.ToString(),
                    };
                    db.tbl_SureDeposit.Add(saveSD);
                    db.SaveChanges();
                }
                else
                {
                    moveInDet.SDUploadName = sysFileName.ToString();
                    db.SaveChanges();
                }
                msg = "File Uploaded Successfully |" + sysFileName.ToString();
            }
            else
            {
                msg = "Something went wrong file not Uploaded";
            }
            return(msg);
        }
Exemplo n.º 2
0
        public string SaveUpdateSureDeposit(SureDepositManagementModel model)
        {
            string          msg       = "";
            ShomaRMEntities db        = new ShomaRMEntities();
            var             getSDdata = db.tbl_SureDeposit.Where(p => p.ProspectID == model.ApplyNowID).FirstOrDefault();

            if (getSDdata == null)
            {
                var saveSD = new tbl_SureDeposit()
                {
                    SDNumber       = model.SDNumber,
                    ProspectID     = model.ApplyNowID,
                    ParentTOID     = model.TenantID,
                    UploadDate     = DateTime.Now,
                    ExpirationDate = model.ExpirationDate,
                    Status         = model.Status,
                    BondAmount     = model.BondAmount,
                };
                db.tbl_SureDeposit.Add(saveSD);
                db.SaveChanges();

                msg = "Sure Deposit Saved Successfully";
            }

            else
            {
                getSDdata.ParentTOID     = model.TenantID;
                getSDdata.SDNumber       = model.SDNumber;
                getSDdata.UploadDate     = DateTime.Now;
                getSDdata.ExpirationDate = model.ExpirationDate;
                getSDdata.Status         = model.Status;
                getSDdata.BondAmount     = model.BondAmount;
                db.SaveChanges();
                msg = "Sure Deposit Saved Successfully";
            }

            db.Dispose();
            return(msg);
        }