CREATE PROCEDURE [dbo].[usp_savePurchaseDetails]( @customerId varchar(50), @productId varchar(50), @userName varchar(50), @bomEmailId varchar(50), @amazonId varchar(50), @phoneNumber varchar(50), @status smallint, @firstName varchar(50), @middleName varchar(50), @lastName varchar(50), @homeName varchar(50), @street varchar(50), @city varchar(50), @state varchar(50), @country varchar(50), @zipCode varchar(50), @mobile varchar(50), @homePhone varchar(50) ) AS BEGIN BEGIN TRANSACTION INSERT INTO BomAmazonCustomers (customerId,productId,userName,bomEmailId,phoneNumber,amazonId,purchasedDate,status) VALUES (@customerId,@productId,@userName,@bomEmailId,@phoneNumber,@amazonId, GETDATE(),@status) IF @@ERROR = 0 BEGIN INSERT INTO bomAmazonCustomersAddress (bomEmailId,firstName,middleName,lastName,houseName,street,city,state,country,zipCode,mobile,homePhone) VALUES (@bomEmailId,@firstName,@middleName,@lastName,@homeName,@street,@city,@state,@country,@zipCode,@mobile,@homePhone) IF @@ERROR = 0 BEGIN COMMIT TRANSACTION END ELSE BEGIN ROLLBACK TRANSACTION RETURN END END ELSE BEGIN ROLLBACK TRANSACTION RETURN END END
Wednesday, October 31, 2012
Ms Sql Transation
Monday, October 29, 2012
unique radom string
private static string uniquestring(string bomEmailId) { using (MD5 md5 = MD5.Create()) { //byte[] hash = md5.ComputeHash(Encoding.Default.GetBytes(bomEmailId)); byte[] array = Encoding.ASCII.GetBytes(bomEmailId); Guid result = new Guid(array); return result.ToString(); } }
Saturday, October 27, 2012
custom jquery validation
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"></script> <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css" type="text/css" rel="Stylesheet" /> <script type="text/javascript" language="javascript"> function customvalidation(element) { isvalid = true; var classname = $(element).attr('class'); var value = $(element).val(); if (classname.indexOf("optional") == -1 && value == "") { $(element).next("span").text('Field Required'); isvalid = false; } else { $(element).next("span").text(''); if (classname.indexOf("phoneno") != -1) { var numpattern = /^\d{8,12}$/; if (value.match(numpattern)) { $(element).next("span").text(''); } else { $(element).next("span").text('Invalid Number'); isvalid = false; } } if (classname.indexOf("email") != -1) { //verify email start var pattern = /^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$/; if (value.match(pattern)) { $(element).next("span").text(''); if (classname.indexOf("emaildb") != -1) { $.ajax({ type: "post", url: "Default5.aspx/checkEmail", data: "{emaiId:'" + value + "' }", async: false, contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { if (data.d == "2") { $(element).next("span").text(''); } else if (data.d == "1") { $(element).next("span").text('Purchased Already'); isvalid = false; } else if (data.d == "0") { $(element).next("span").text('Not Exist in Bom Tv'); isvalid = false; } else if (data.d == "-1") { $(element).next("span").text('SQL Error'); isvalid = false; } else { $(element).next("span").text('Error'); isvalid = false; } }, error: function () { alert('Problem'); isvalid = false; } }); } } else { $(element).next("span").text('Invalid Email'); isvalid = false; } //verify email end } } return isvalid; } $(document).ready(function () { $('#purchasetable').dialog({ autoOpen: false, modal: true, title: "Enter Purchase Details", width: 600, resizable: false }); $('#userdetails').dialog({ autoOpen: false, modal: true, title: "Enter User Details", width: 700, resizable: false }); $("#purchasetable :input").blur(function () { var element = $(this); customvalidation(element); }); $("#userdetails :input").blur(function () { var element = $(this); customvalidation(element); }); $("#Purchasebtn").click(function () { var invalidcount = 0; $("#purchasetable :input[type=text]").each(function (index, element) { if (customvalidation(element) == false) invalidcount = invalidcount + 1; }); if (invalidcount == 0) { $('#userdetails').dialog('open'); $('.ui-widget-overlay').click(function () { $('#userdetails').dialog('close'); }); } }); $("#PurchaseCompletebtn").click(function () { var invalidcount2 = 0; $("#userdetails :input[type=text]").each(function (index, element) { if (customvalidation(element) == false) invalidcount2 = invalidcount2 + 1; }); alert(invalidcount2); if (invalidcount2 == 0) { $.ajax({ type: "post", url: "Default5.aspx/saveUserDetails", data: "{productId:'productxt',userName:'" + $("#nametxt").val() + "',bomEmailId:'" + $("#bomEmailtxt").val() + "',amazonEmailId:'" + $("#amazonEmailtxt").val() + "',phoneNumber:'" + $("#phoneNumbertxt").val() + "',firstName:'" + $("#firstNametxt").val() + "',middleName:'" + $("#middleNametxt").val() + "',lastName:'" + $("#lastNametxt").val() + "',homeName:'" + $("#houseNametxt").val() + "',street:'" + $("#streettxt").val() + "',city:'" + $("#citytxt").val() + "',state:'" + $("#statetxt").val() + "',country:'" + $("#countrytxt").val() + "',zipCode:'" + $("#ziptxt").val() + "',mobile:'" + $("#mobiletxt").val() + "',homePhone:'" + $("#homePhonetxt").val() + "'}", async: false, contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { if (data.d = "1") { alert('Complete Process'); $('#purchasetable').dialog('close'); $('#userdetails').dialog('close'); } }, error: function () { alert('Problem'); } }); } }); }); function purchasepopup() { $('#purchasetable').dialog('open'); $('.ui-widget-overlay').click(function () { $('#purchasetable').dialog('close'); }); } </script>
Friday, October 26, 2012
Jquery Custom Validation Function
$("#form1").validate({ rules: { txtemail: { //start txtemail required: true, email: true, newpattern: function () { var pattern = /^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$/; var email = $("#emailId").val(); if (email.match(pattern)) { $.ajax({ type: "post", url: "Default2.aspx/checkEmail", data: "{emaiId:'" + email + "' }", async: false, contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { $("#form1").submit(function () { if (data.d == 1) { $.ajax({ type: "post", url: "Default2.aspx/saveUserDetails", data: "{emaiId:'abcd1234' }", async: false, contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { return true; }, error: function () { alert('Problem'); } }); } else return false; }); }, error: function () { alert('Problem'); } }); } } //ends txtemail }, txtFirstName: { required: true } }, messages: { txtemail: { required: "Email Requrid", email: "Enter a valid Email Addres" }, txtFirstName: { required: "First Name Required" } } });
jquery pop up validation
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jQuery.Validate/1.6/jQuery.Validate.min.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"></script> <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css" type="text/css" rel="Stylesheet" /> <script type="text/javascript" language="javascript"> $(document).ready(function () { $("#player").detach().appendTo("body").click(function () { $('#form1').dialog('open'); return false; }); $('#form1').dialog({ autoOpen: false, modal: true, title: "RFMD Video", width: 500, resizable: false, buttons: { "Validate": function () { $("#form1").submit(); } } }); // $("#").validate(); $("#form1").validate({ rules: { field: { required: true, email: true } } }); }); </script> <a href="#" id="player">Click to play</a> <div id="videoPlayerDiv"> <input class="left" id="field" name="field" /> <br/> <input type="submit" value="Validate!" /> </div>
Jquery Validation
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jQuery.Validate/1.6/jQuery.Validate.min.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"></script> <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css" type="text/css" rel="Stylesheet" /> <script type="text/javascript" language="javascript"> $(document).ready(function () { $('#videoPlayerDiv').dialog({ autoOpen: false, modal: true, title: "RFMD Video", width: 500, resizable: false }); // $("#").validate(); $("#form1").validate({ rules: { field: { required: true, email: true } } }); }); function SetVideo() { $('#videoPlayerDiv').dialog('open'); $('.ui-widget-overlay').click(function () { $('#videoPlayerDiv').dialog('close'); }); }; </script> <div id="Div1" style="display:block"> <input class="left" id="field" name="field" /> <br/> <input type="submit" value="Validate!" /> </div>
jquery tabs
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"></script> <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css" type="text/css" rel="Stylesheet" /> <script type="text/javascript" language="javascript"> $(document).ready(function () { $("#mytab").tabs(); }); </script> <div id="mytab" style="display:block"> <ul> <li><a href="#tabs-1">Step 1</a></li> <li><a href="#tabs-2">Step 2</a></li> <li><a href="#tabs-3">Step 3</a></li> </ul> <div id="tabs-1"> <input type="text" class="required" name="step1" id="step1" /> </div> <div id="tabs-2"> <input type="text" class="required" name="step2" id="step2" /> </div> <div id="tabs-3"> <input type="text" class="required" name="step3" id="step3" /> <input type="submit" name="submit" value="Submit" /> </div> </div>
Thursday, October 25, 2012
Jquery Popup
<script type="text/javascript" language="javascript"> $(document).ready(function () { $('#mypopup').dialog({ autoOpen: false, modal: true, title: "my pop up window", width: 500, resizable: false }); }); function popup() { $('#mypopup').dialog('open'); $('.ui-widget-overlay').click(function () { $('#mypopup').dialog('close'); }); }; </script> <a href="#" onclick="javascript:popup('');return false;">Click to play</a> <div id="mypopup"> <input id="abc" /> </div>
Subscribe to:
Posts (Atom)