Posts

how to change whatsapp number in hindi

Image
C#

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++)           ...

how to Replace null value with 0 Using C#

how to Replace null value with 0 Using C# //here we suppose that objDataTable have data collection as table now access this //datatable object. decimal  j = 0;  j = objDataTable.Rows[0]["Qty"] ==  DBNull .Value ? 0 :  Convert .ToDecimal(objDataTable.Rows[0]["Qty"]); NOTE :- //if   DBNull.value is null  then   "0 " else  "your code here")  // ? = then // : = else Thank You [Sumit Singh Shekhawat]

Calculate simple interst using c sharp in console application

Image
How to calculate SI (Simple Interest) using C# in Console Application _____________________ start _________________________ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Oops_Concepts {     class Program     {         static void Main()         {             Program objProgram = new Program();             objProgram.GetSimpleInterest();             Console.Read();               }          public void GetSimpleInterest()         {             double principle, interst = 0;             int time = 0;                          Console.Write("Enter Principle Am...

Calculate Mortgage in c# using console application

Formula :  M = P [ i(1 + i)^n ] / [ (1 + i)^n – 1] M = monthly mortgage payment P = the principal, or the initial amount you borrowed. i = your monthly interest rate. Your lender likely lists interest rates as an annual figure, so you’ll need to divide by 12, for each month of the year. So, if your rate is 5%, then the monthly rate will look like this: 0.05/12 = 0.004167. n = the number of payments, or the payment period in months. If you take out a 30-year fixed rate mortgage, this means: n = 30 years x 12 months per year, or 360 payments. ___________________________________  Start Code  _________________________________ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Oops_Concepts {     class Program     {         static void Main(string[] args)         {             Program objProgram = new Program();   ...