Exemple #1
0
        public ActionResult savedocuments(FileUploadEntity fileUploadEntity, string SendCompanyName)
        {
            ClientBLL clientBLL = new ClientBLL();
            string    path      = Server.MapPath("~/Documents/");

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            string DocumentName = Path.GetFileNameWithoutExtension(fileUploadEntity.UploadFile.FileName);
            string Extention    = Path.GetExtension(fileUploadEntity.UploadFile.FileName).Replace(".", "");
            string Ext          = Path.GetExtension(fileUploadEntity.UploadFile.FileName);
            string fileName     = DocumentName + Ext;

            fileUploadEntity.UploadFile.SaveAs(path + fileName);
            fileUploadEntity.DocumentName = DocumentName;
            fileUploadEntity.Extension    = Extention;

            if (fileUploadEntity.Monthly != "")
            {
                fileUploadEntity.Quaterly = "";
            }
            if (fileUploadEntity.Quaterly != "")
            {
                fileUploadEntity.Monthly = "";
            }
            if (fileUploadEntity.DocumentType == "Other")
            {
                fileUploadEntity.DocumentType = fileUploadEntity.OtherDocuments;
            }
            clientBLL.Savedocuments(fileUploadEntity);
            clientBLL.InsertDocumentType(fileUploadEntity.DocumentType);
            //clientBLL.InsertDocumentType(fileUploadEntity.DocumentType);
            tblUser tbluser = pablaAccountsEntities.tblUsers.SingleOrDefault(b => b.UserId == fileUploadEntity.UserId);

            string htmlBody   = "";
            string headerText = "Hi <b> " + tbluser.FirstName + " " + tbluser.LastName + " ,</b>";
            string startTable = "<table>";
            string emailText  = "<tr><td><br/>A document has been uploaded for the person name  <b> " + fileUploadEntity.PersonName + " </b> of the company " + SendCompanyName + " with document type  <b> " + fileUploadEntity.DocumentType + " </b>. Please find an attachment below:-</br></br></td></tr>";

            emailText += "<tr><td>Regards</td></tr>";
            emailText += "<tr><td><b>Pabla Accounting And Tax Services</b></td></tr>";
            string endTable = "<br/></table> </br> </br> Thanks";

            htmlBody = headerText + startTable + emailText + endTable;
            string fullfilepath = path + fileName;

            customMethod.SendEmail(tbluser.Email, "Document Uploaded", htmlBody, fullfilepath);
            TempData["Message"] = "3";
            return(RedirectToAction("client_view", new { ClientId = fileUploadEntity.UserId }));
        }
Exemple #2
0
        public ActionResult add_document(FileUploadEntity fileUploadEntity)
        {
            ClientBLL clientBLL = new ClientBLL();
            string    path      = Server.MapPath("~/Documents/");

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            string DocumentName = Path.GetFileNameWithoutExtension(fileUploadEntity.UploadFile.FileName);
            string Extention    = Path.GetExtension(fileUploadEntity.UploadFile.FileName).Replace(".", "");
            string Ext          = Path.GetExtension(fileUploadEntity.UploadFile.FileName);
            string fileName     = DocumentName + Ext;

            fileUploadEntity.UploadFile.SaveAs(path + fileName);
            fileUploadEntity.DocumentName = DocumentName;
            fileUploadEntity.Extension    = Extention;
            if (fileUploadEntity.DocumentType == "Other")
            {
                fileUploadEntity.DocumentType = fileUploadEntity.Other;
            }
            clientBLL.Savedocuments(fileUploadEntity);
            clientBLL.InsertDocumentType(fileUploadEntity.DocumentType);
            var     result  = pablaAccountsEntities.tbl_RequestedDocument.SingleOrDefault(b => b.RequestDocumentId == fileUploadEntity.RequestedDocumentId);
            tblUser tbluser = new tblUser();

            if (result != null)
            {
                result.IsUploaded = true;
                pablaAccountsEntities.SaveChanges();
                tbluser = pablaAccountsEntities.tblUsers.SingleOrDefault(b => b.UserId == result.RequestedBy);
            }
            string htmlBody   = "";
            string headerText = "Hi <b> " + tbluser.FirstName + " " + tbluser.LastName + " ,</b>";
            string startTable = "<table>";
            string emailText  = "<tr><td><br/>As per Your request for addition of document named as <b> " + result.DocumentName + " </b> of Document Type <b> " + result.DocumentType + " </b> for <b> " + fileUploadEntity.PersonName + " </b> , We have uploaded a document, Please find an attachment below:-</br></br></td></tr>";

            emailText += "<tr><td>Regards</td></tr>";
            emailText += "<tr><td><b>Pabla Accounting And Tax Services</b></td></tr>";
            string endTable = "<br/></table> </br> </br> Thanks";

            htmlBody = headerText + startTable + emailText + endTable;
            string fullfilepath = path + fileName;

            customMethod.SendEmail(tbluser.Email, "Document Uploaded", htmlBody, fullfilepath);
            TempData["Messsage"] = "3";
            return(RedirectToAction("requested_document", "admin"));
        }