Posts

Showing posts from February, 2017

mvc jquery save

<form action =" /Plugin/Ajax/ContactUs " class =" form-horizontal " id =" contact-form " method =" post " name =" contact-form "> <div class =" col-sm-6 "> <div class =" form-group "> <div class =" col-sm-12 "> <input class =" validate[required] form-control " id =" FullName " name =" FullName " placeholder =" Name " size =" 30 " type =" text " value ="" /> <label id =" lblName " name =" lblName " class =" errorlbl "> </label> </div> </div> <div class =" form-group "> <

Code first mvc

https://www.codeproject.com/Articles/826571/Code-First-Approach-with-ASP-NET-MVC-Framework

jquery save & fetch asp.net

Default.aspx: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>     <style type="text/css">         <style type="text/css">         body         {             font-family: Verdana;             font-size: 11px;         }             .errMsg         {             width: 200px;             text-align: left;             color: yellow;             font: 12px arial;             background: red;             padding: 5px;             display: none;         }               .tblResult         {             border-collapse: collapse;         }               .tblResult td      

desktop application connection string

namespace Payroll {     class Connection     {         private  static SqlConnection SqlCon;         //private readonly static SqlConnection SqlCon = new SqlConnection("Server=petunia.arvixe.com; database=visiondb; uid=vision1; password=vision2;");         public static SqlConnection CON         {             get             {               return   SqlCon = new SqlConnection("Server=WIN-PC\\SQLEXPRESS; database=Payroll;integrated Security=SSPI");             }         }     } }

Mail Send With Pdf

protected void MailSendWithCoponPdf(string Email,string Coupon)     {         using (StringWriter sw = new StringWriter())         {             using (HtmlTextWriter hw = new HtmlTextWriter(sw))             {                 string companyName = "xxxxxxxx";                 string orderNo = "#2303";                 StringBuilder sb = new StringBuilder();                 sb.Append("<table width='100%' cellspacing='0' cellpadding='2'>");                 sb.Append("<tr><td align='center' style='background-color: #18B5F0' colspan = '2'><b>Coupon</b></td></tr>");                 sb.Append("<tr><td align='center' style='background-color: #18B5F0' colspan = '2'><b>----------------------------------------------------------------</b></td></tr>");                 sb.Append("<tr&

Connection string web.config asp.net

<?xml version="1.0"?> <!--   For more information on how to configure your ASP.NET application, please visit   http://go.microsoft.com/fwlink/?LinkId=169433   --> <configuration>     <system.web>       <compilation debug="true" targetFramework="4.5" />       <httpRuntime targetFramework="4.5" />     </system.web>   <connectionStrings>     <add name="conn" connectionString="Data Source=WIN-PC\SQLEXPRESS;Initial Catalog=st_SubiTechnologies;Integrated Security=True;" providerName="System.Data.SqlClient"/>     <!--<add name="conn" connectionString="Data Source=.\SQLServer2012;Initial Catalog=st_SubiTechnologies;User Id=subi;Password=ysN9o2^6;Connect Timeout=120;" providerName="System.Data.SqlClient" />-->   </connectionStrings> </configuration>

save class

public static int Save(string Name, string Emailid, string PhoneNo, string LaptopBrand, string Model, string SerialNo, string Description, DateTime DOE, string Coupon)     {         int n;         SqlCommand cmd = new SqlCommand();         try         {             cmd.Connection = DataConnection.Con;             cmd.CommandText = "Sp_Register_Save";             cmd.CommandType = CommandType.StoredProcedure;             cmd.Parameters.AddWithValue("@rowId", 0);             cmd.Parameters.AddWithValue("@Name", Name);             cmd.Parameters.AddWithValue("@Emailid", Emailid);             cmd.Parameters.AddWithValue("@PhoneNo", PhoneNo);             cmd.Parameters.AddWithValue("@LaptopBrand", LaptopBrand);             cmd.Parameters.AddWithValue("@Model", Model);             cmd.Parameters.AddWithValue("@SerialNo", SerialNo);             cmd.Parameters.AddWithValue("@Description",

Fetch Store Procedure

USE [st_SubiTechnologies] GO /****** Object:  StoredProcedure [dbo].[Sp_Register_GetLastCoupon]    Script Date: 2/10/2017 10:56:47 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[Sp_Register_GetLastCoupon] --@flag int output AS BEGIN begin transaction select top(1) Coupon from tbl_registration order by rowId desc --if @@ERROR=0 --begin -- set @flag=1 -- commit transaction --end --else --begin -- set @flag=0 -- rollback transaction --end END

Save storeprocedure

USE [st_SubiTechnologies] GO /****** Object:  StoredProcedure [dbo].[Sp_Register_Save]    Script Date: 2/10/2017 10:46:56 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[Sp_Register_Save] @rowId int, @Name varchar(300), @Emailid varchar(300), @PhoneNo varchar(20), @LaptopBrand varchar(50), @Model varchar(50), @SerialNo varchar(200), @Description varchar(700), @DOE datetime, @Coupon varchar(10), @flag int output AS BEGIN begin transaction insert into [dbo].[tbl_registration](Name,Emailid,PhoneNo,LaptopBrand,Model,SerialNo,Description,DOE,Coupon) values(@Name,@Emailid,@PhoneNo,@LaptopBrand,@Model,@SerialNo,@Description,@DOE,@Coupon) if @@ERROR=0 begin set @flag=1 commit transaction end else begin set @flag=0 rollback transaction end END