Posts

Showing posts from 2016

EntityFramework and Migration with database

 <connectionStrings>     <add name=" MainModel " connectionString="server=Localhost;database=dbMVCProject;Integrated Security = true;" providerName="System.Data.SqlClient"/> </connectionStrings> after adding your connection string in web.config  Open  Package Manager Console write : Install-Package EntityFramework After installation... Create the Class of collection of database tables In Class "MainModel". MainModel.cs ------ start ----------- using System.Data.Entity; // This for DbContext using System.ComponentModel.DataAnnotations; // this for DataAnnotations namespace MVCProject.Models {     public class MainModel : DbContext     {         public DbSet<tbl_product> tbl_product { get; set; }         public DbSet<tbl_SliderMaster> tbl_SliderMaster { get; set; }     }     public class tbl_product     { ...

EntityFramework and Migration with database

 <connectionStrings>     <add name=" MainModel " connectionString="server=Localhost;database=dbMVCProject;Integrated Security = true;" providerName="System.Data.SqlClient"/> </connectionStrings> after adding your connection string in web.config  Open  Package Manager Console write : Install-Package EntityFramework After installation... Create the Class of collection of database tables In Class "MainModel". MainModel.cs ------ start ----------- using System.Data.Entity; // This for DbContext using System.ComponentModel.DataAnnotations; // this for DataAnnotations namespace MVCProject.Models {     public class MainModel : DbContext     {         public DbSet<tbl_product> tbl_product { get; set; }         public DbSet<tbl_SliderMaster> tbl_SliderMaster { get; set; }     }     public class tbl_product     { ...

Water Mark on File Type : PDF, JPEG, JPG, PNG, GIF, DOC, DOCX, XLS and XLSX Using C#

Water Mark on File Type : PDF, JPEG, JPG, PNG, GIF, DOC, DOCX, XLS and XLSX Using C# --- On Click button for Convert -- -- start code -- string name = ""; name = "pdffile.pdf"; // Select File string FILEATTACHMENT = "../../Upload/Attachments/pdffile.pdf"; // Add Font family and Font Size. iTextSharp.text.Font f = new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 25); Phrase p = new Phrase("Printed by " + user, f); if (ext == ".pdf" || ext == ".PDF") { string FilePath = FILEATTACHMENT.Replace(FILEATTACHMENT.Substring(0, 5), "~"); PdfReader pdfReader = new PdfReader(Server.MapPath(FilePath)); FileStream stream = new FileStream(Server.MapPath("~/Upload/PDFFolder/" + name), FileMode.OpenOrCreate); PdfStamper pdfStamper = new PdfStamper(pdfReader, stream);                    for (int pageIndex = 1; pageIndex <= pdfReader.NumberOfPages; pageIndex++)           ...