Example #1
0
        public ActionResult Create([Bind(Include = "BuildingPermitId,BuildingTypePermit,ApplicationNumber,AreaNumber,LastName,FirstName,MiddleInitial,TIN,FormOfOwnerShip,OwnerStreetNumber,OwnerStreet,OwnerBarangay,OwnerCity,OwnerZipCode,TelephoneNumber,LocationLotNumber,LocationBlockNumber,LocationTCTNumber,LocationTaxDescriptionNumber,LocationStreet,LocationBarangay,LocationCity,ScopeOfWork,ScopeOfWorkOther,BuildingUse,BuildingUseOther,OccupancyClassified,NumberOfUnits,TotalFloorArea,TotalEstimatedCost,ProposedConstructionDate,ExpectedCompletionDate,CreatedOn,Status,PaymentReference,LocationaClearanceReference")] BuildingPermit buildingpermit, HttpPostedFileBase uploadFile)
        {
            if (uploadFile != null)
            {
                LocationalClearance locational = db.LocationalClearance.Where(z => z.ApplicationNumber == buildingpermit.LocationaClearanceReference).FirstOrDefault();

                if (locational == null)
                {
                    ViewBag.BuildingType = new BuildingTypePermit().ToSelectList();
                    ViewBag.ScopeOfWork  = new ScopeOfWork().ToSelectList();
                    ViewBag.BuildingUse  = new BuildingUse().ToSelectList();
                    return(View(buildingpermit));
                }

                buildingpermit.ApplicationNumber     = GenerateApplicationNumber();
                buildingpermit.Attachment            = base.GetFileBytes(uploadFile);
                buildingpermit.CreatedOn             = DateTime.Now;
                buildingpermit.Status                = "Pending";
                buildingpermit.LocationalClearanceId = locational.LocationalClearanceId;
                db.BuildingPermits.Add(buildingpermit);
                db.SaveChanges();
                return(RedirectToAction("ApplicationSuccess"));
            }


            ViewBag.BuildingType = new BuildingTypePermit().ToSelectList();
            ViewBag.ScopeOfWork  = new ScopeOfWork().ToSelectList();
            ViewBag.BuildingUse  = new BuildingUse().ToSelectList();
            return(View(buildingpermit));
        }
Example #2
0
        public static string LocationalClearanceApprovedTemplate(LocationalClearance permit, List <Fee> fees)
        {
            string result = String.Format(@"<br>       
                         Good Day!
                       <br/>
                       <br/>
                       <br/>
                       <br/>
                       <div style=""margin-left:30px;"">
                           This is to inform you that your application for <b>Locational Clearance</b> has been <b>APPROVED</b>.
                      
                       <br/>    
                       <br/>
                       Your Reference Number for the permits payment is <b>{0}</b>
                       <br/>
                       <br/>
                       The following are your fees for this application:
                       <br/>
                       <br/>", permit.PaymentReference);
            float  total  = 0;

            foreach (var item in fees)
            {
                total  += item.Price;
                result += string.Format("P{0}&nbsp;&nbsp;&nbsp;- {1} <br/><br/>", item.Price, item.Description);
            }

            result += "P" + total + " - <b>TOTAL</b> <br/><br/> ";

            result += String.Format("For us to verify your payment, kindly click this <a href=\"{0}\">link</a> upon settling your account. <br/><br/>", GetPaymentUrl());
            result += " </div><br/><br/><br/><br/> Thank you for using the service. Have a nice day!";

            return(result);
        }
Example #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            LocationalClearance locationalclearance = db.LocationalClearance.Find(id);

            db.LocationalClearance.Remove(locationalclearance);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #4
0
 public ActionResult Edit([Bind(Include = "LocationalClearanceId,ApplicationNumber,DateApplied,LCPermitNumber,DateIssued,Project,Location,Address,Firm,FloorArea,LandArea,UsableOpenSpace,TCTNumber,Attachments,EmailAddress")] LocationalClearance locationalclearance)
 {
     if (ModelState.IsValid)
     {
         db.Entry(locationalclearance).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(locationalclearance));
 }
Example #5
0
        public ActionResult DisqualifyApplication(int?id)
        {
            LocationalClearance clearance = db.LocationalClearance.Find(id);

            if (clearance == null)
            {
                return(HttpNotFound());
            }
            clearance.Status          = "Denied";
            db.Entry(clearance).State = EntityState.Modified;
            db.SaveChanges();
            EmailSender.SendMail(clearance.EmailAddress, "Locational Clearance Application : Denied", EmailSender.LocationalClearanceDeniedTemplate());
            return(RedirectToAction("Index"));
        }
Example #6
0
        // GET: /Locational/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LocationalClearance locationalclearance = db.LocationalClearance.Find(id);

            if (locationalclearance == null)
            {
                return(HttpNotFound());
            }
            return(View(locationalclearance));
        }
Example #7
0
        private async Task ApproveLocational(Payment payment)
        {
            LocationalClearance permit = await db.LocationalClearance.SingleOrDefaultAsync(z => z.PaymentReference == payment.ReferenceNumber);

            if (permit != null)
            {
                permit.Status           = "Paid";
                payment.Status          = "Confirmed";
                payment.TotalPayment    = permit.TotalPayment;
                db.Entry(permit).State  = EntityState.Modified;
                db.Entry(payment).State = EntityState.Modified;
                await db.SaveChangesAsync();

                // email ung attachment with congratulations
                EmailSender.SendMail(permit.EmailAddress, "Locational Clearance Certification", EmailSender.LocationalClearanceCertifyTemplate(), EmailSender.CreateAttachment(permit));
            }
        }
Example #8
0
 public ActionResult Create([Bind(Include = "LocationalClearanceId,ApplicationNumber,DateApplied,LCPermitNumber,DateIssued,Project,Location,Address,Firm,FloorArea,LandArea,UsableOpenSpace,TCTNumber,EmailAddress")] LocationalClearance locationalclearance, HttpPostedFileBase attachments)
 {
     if (attachments != null)
     {
         locationalclearance.Attachments       = base.GetFileBytes(attachments);
         locationalclearance.DateApplied       = DateTime.Now;
         locationalclearance.DateIssued        = DateTime.Now;
         locationalclearance.LCPermitNumber    = GenerateApplicationNumber();
         locationalclearance.ApplicationNumber = GenerateApplicationNumber();
         locationalclearance.Status            = "Pending";
         locationalclearance.TCTNumber         = "";
         locationalclearance.Fees = db.Fees.Include(p => p.ApplicationType).Where(p => p.ApplicationType.Description.Contains("Locational")).ToList();
         db.LocationalClearance.Add(locationalclearance);
         db.SaveChanges();
         return(RedirectToAction("ApplicationSuccess"));
     }
     return(View(locationalclearance));
 }
Example #9
0
        public ActionResult ApproveApplication(int?id)
        {
            LocationalClearance clearance = db.LocationalClearance.Find(id);
            List <Fee>          fees      = db.Fees.Include(p => p.ApplicationType).Where(p => p.ApplicationType.Description.Contains("Locational")).ToList();

            if (clearance == null)
            {
                return(HttpNotFound());
            }

            clearance.Status           = "Approved";
            clearance.TotalPayment     = fees.Sum(f => f.Price);
            clearance.PaymentReference = base.RandomString();
            db.Entry(clearance).State  = EntityState.Modified;
            db.SaveChanges();

            EmailSender.SendMail(clearance.EmailAddress, "Locational Clearance Application : Approved", EmailSender.LocationalClearanceApprovedTemplate(clearance, fees));
            return(RedirectToAction("Index"));
        }
Example #10
0
        public static Attachment CreateAttachment(LocationalClearance locational)
        {
            Document doc = new Document(new Rectangle(PageSize.A4));
            //Create PDF Table
            PdfPTable  tableLayout = new PdfPTable(4);
            string     fileName    = string.Format("Locational-{0}-{1}.pdf", locational.ApplicationNumber, DateTime.Now.ToShortDateString().Replace("/", ""));
            string     path        = HttpContext.Current.Server.MapPath(string.Format("~/App_Data/{0}", fileName));
            FileStream fm          = new FileStream(path, FileMode.Create);

            //Create a PDF file in specific path
            PdfWriter.GetInstance(doc, fm);

            //Open the PDF document
            doc.Open();

            Paragraph para = new Paragraph(@"Republic of the Philippines",
                                           new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.NORMAL, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para.Alignment = Element.ALIGN_CENTER;
            doc.Add(para);

            Paragraph para1 = new Paragraph("City of Marikina",
                                            new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.NORMAL, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para1.Alignment = Element.ALIGN_CENTER;
            doc.Add(para1);

            Paragraph para2 = new Paragraph("City Planning and Development Office",
                                            new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.NORMAL, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para2.Alignment = Element.ALIGN_CENTER;
            doc.Add(para2);


            //Add Content to PDF
            Paragraph para3 = new Paragraph("LOCATIONAL CLEARANCE is hereby GRANTED TO " + locational.Project + " which is conforming as to Land Use Classification of the site per Zoning Ordinance No. 161, series of 2006 subject to the following conditions: ",
                                            new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.NORMAL, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para3.SpacingBefore = 25;
            para3.SpacingAfter  = 15;
            para3.Alignment     = Element.ALIGN_LEFT;
            // Adding this 'para' to the Document object
            doc.Add(para3);


            Paragraph para4 = new Paragraph("1.	That this clearance shall be posted in a conspicuous place within the premises/building during construction/operation.",
                                            new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.NORMAL, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para4.FirstLineIndent = 10;
            para4.Alignment       = Element.ALIGN_LEFT;
            // Adding this 'para' to the Document object
            doc.Add(para4);

            Paragraph para5 = new Paragraph("2.	That the proponent cannot undertake any activity other than the project applied for without the approval of this office.",
                                            new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.NORMAL, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para5.FirstLineIndent = 10;
            para5.Alignment       = Element.ALIGN_LEFT;
            // Adding this 'para' to the Document object
            doc.Add(para5);

            Paragraph para6 = new Paragraph("3.	That any material falsehood or misrepresentation of the documents submitted made in connection with the said application shall render the clearance null and void from the beginning.",
                                            new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.NORMAL, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para6.FirstLineIndent = 10;
            para6.Alignment       = Element.ALIGN_LEFT;
            // Adding this 'para' to the Document object
            doc.Add(para6);

            Paragraph para7 = new Paragraph("4.	That the implementation of the proposal should commence within a period of one year from the date of issuance of this clearance otherwise the proponent should re-apply for a new location clearance.",
                                            new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.NORMAL, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para7.FirstLineIndent = 10;
            para7.Alignment       = Element.ALIGN_LEFT;
            // Adding this 'para' to the Document object
            doc.Add(para7);

            Paragraph para8 = new Paragraph("5.	That this office reserves the rights to inspect and review said project/operation and subsequently institute cancellation proceedings should the same be found in violation in any of the herein conditions and other pertinent government policies, rules and regulations.",
                                            new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.NORMAL, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para8.FirstLineIndent = 10;
            para8.Alignment       = Element.ALIGN_LEFT;
            // Adding this 'para' to the Document object
            doc.Add(para8);

            Paragraph para9 = new Paragraph("6.	That this clearance shall not, in any way, be interpreted to vest any title, right of ownership, or the right of possession of the land herein.",
                                            new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.NORMAL, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para9.FirstLineIndent = 10;
            para9.Alignment       = Element.ALIGN_LEFT;
            // Adding this 'para' to the Document object
            doc.Add(para9);

            Paragraph para10 = new Paragraph("7. That no additional structure/expansion shall be done without the approval of this office.",
                                             new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.NORMAL, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para10.FirstLineIndent = 10;
            para10.Alignment       = Element.ALIGN_LEFT;
            // Adding this 'para' to the Document object
            doc.Add(para10);


            Paragraph para11 = new Paragraph("8. The other provisions set forth in the National Building Code (P.D. 1096) relative to this activity shall be complied with.",
                                             new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.NORMAL, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para11.FirstLineIndent = 10;
            para11.Alignment       = Element.ALIGN_LEFT;
            // Adding this 'para' to the Document object
            doc.Add(para11);

            Image sign = Image.GetInstance(HttpContext.Current.Server.MapPath(string.Format("~/Images/Tomas.png")));

            sign.Alignment = Element.ALIGN_RIGHT;
            sign.ScaleToFit(140f, 120f);
            sign.IndentationRight = 55;
            sign.SpacingBefore    = 15;

            doc.Add(sign);


            Paragraph para12 = new Paragraph("Tomas C. Aguilar, Jr.",
                                             new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.BOLD, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para12.IndentationRight = 55;
            para12.Alignment        = Element.ALIGN_RIGHT;
            // Adding this 'para' to the Document object
            doc.Add(para12);

            Paragraph para13 = new Paragraph("Locational Administrator/City Planning and Development Officer",
                                             new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.NORMAL, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para13.Alignment = Element.ALIGN_RIGHT;
            // Adding this 'para' to the Document object
            doc.Add(para13);

            // Closing the document
            doc.Close();

            ContentType ct         = new ContentType(System.Net.Mime.MediaTypeNames.Application.Pdf);
            Attachment  attachment = new Attachment(path);

            attachment.ContentDisposition.FileName = fileName + ".pdf";

            return(attachment);
        }