Posts

Citrus Pay NopCommerce Plugin

Citrus Pay Plugin for NopCommerce 3.40 The plugin is an installation package which contains an easy implementation of The CitrusPay Payment Gateway. This package supports only the Citrus payment method. What you can expect: Support for nopCommerce 3.40 Only Payment description support Secure payments Free support Inline bank selection Plug and play Other versions of nopCommerce available by request if you have any questions please don't hesitate to contact by mail at prajapatisandeepk @gmail.com with subject "Citrus Pay Plugin".

PAYU Plugin for NopCommerce

Image
Hello Download NopCommerce PayU plugin from  http://www.nopcommerce.com/p/1604/payu-india-nopcommerce-plugin.aspx Or Download from  http://codecanyon.net/item/payu-india-nopcommerce-plugin/9427472 To get the Plugin Please mail on prajapatisandeepk@gmail.com  with Subject "PayU Plugin"

Nuget Package for Push Notification on Android and iOS

Continue to my previous post for Push Notification, I have generated a simplified process to implement Push notification for iOS and Android. Anyone can download my Nuget package from https://www.nuget.org/packages/EasyPushNotification/ To install Push Notification for Android and iOS, run the following command in the   Package Manager Console PM> Install-Package EasyPushNotification Web.config settings Add following keys into AppSettings into web.config file. <appSettings> <add key="APIKey" value="SOME_API_KEY"/> <add key="ApnsCertPath" value="CERTIFICATE_PATH"/> <add key="ApnsCertPassword" value="CERT_PASSWORD"/> </appSettings> For Android APIKey    is API key provided by GCM server. Follow the steps from here to generate project and obtain API key. The generated Project ID will be used to generate Device Token from Android devices. For iOS ApnsCertPath ...

Push Notification for Android

Image
Hello, Now a Days in era of smart phones and mobile app developments, a very important feature is "Push Notification". For any Mobile app (Android, iPhone, Blackberry, etc.) Push Notification is part of requirement and complete project. To know more about Push notifications please Google !! here is a quick Wikipedia link . In this post I am going to demonstrate Push notification for Android phones. As of now I don't have any Android device connected with my machine so can't get snapshots of result but one can trust me that whatever I have implemented is fully working. OK.. So Let's Start ..........  Create an Asp.net application .(whatever you like..MVC, or anything)                     I hope you are aware about NuGet Package Manager. if not refer official website of NuGet . visual Studio 2010 + comes up with inbuilt support of NuGet Packages. still can't find NuGet ...

Custom Message box and Confirm window all in one

Image
Hello, I have created a custom message box and confirm window which can be used in all programming languages and all platforms. syntex : AlertCust([Control], {Message Title}, [Message Text], {IconType}, {PromptType}, [OnOk], [OnCancel]); Description : [Control] : Optional, Pass the control which raises the prompt. in Confirm or Alert window when click ‘OK’ button is clicked, the default server event will be executed, if value is passed. if null, clicking on ‘OK’ the prompt window will be closed, no further action. {Message Title} : Required, Message Title. Title will appear in bold font. [Message Text] : Optional, Message text in second line, in normal fonts. {IconType} : Required, Enum values. pass icon type to display icon specific to message. options Error, Warning, Information {PromptType} : Required,   This property helps to decide what kind of prompt we need. e.g. Validation, MessageBox(OkOnly), OKCancel, YesNo. [OnOk] : Optional, To provided custom callback met...

JavaScriptStringEncode : Javascript Compitable encoding

Hello, Recently I was facing very interesting issue. and the solution for the issue was introduced in the new updates in asp.net framework 4.0. Generally when we try to render HTML content on page clientside/ by javascript, it gives error of Potential dangerous content error. http://msdn.microsoft.com/en-us/library/ms972967.aspx There are lot's solutions but have to compromise security of page. by setting <%@ Page Language="C#" AutoEventWireup="true" CodeFile="default.aspx.cs" Inherits="_default" ValidateRequest="false"%>  But now we have perfect solution which is introduced in .net framework 4.0 HttpUtility.JavaScriptStringEncode Method URL encoding makes sure that all browsers correctly encodes text in URL strings. Few Characters such as a question mark (?), ampersand (&), slash (/), and spaces might be truncated or corrupted by some browsers. Therefore, these characters must be encoded in a elem...

Disable Server Validation Control from ClientSide/ Javascript - ValidatorEnable

Hello Friends, Recently I required to disable server validation control (RequiredFieldValidator, CompareValidator, CustomValidator, RangeValidator, RagularExpressionValidator, etc) from clientside/ Javascript. There are few patches to accomplish the  requirement by I liked an approach which is perfect for ClientSide handling. ValidatorEnable is a javascript mathod lying at asp.net framework javascriptscript ValidatorEnable(document.getElementById(myVal), Status); Thanks

DateTime.ParseExact - culturewise Date Comparision

Hello.. Whenever dealing with cultures, DateTime format is always a headache to handle. to the date format  in Textbox sometimes does not meet the format of culture. in that case DateTime.ParseExact is good option to handle. convert the date into current culture format from display culture format using public static DateTime ParseExact( string str, string Dateformat, IFormatProvider provider) Parameters s tr Type: System.String A string that contains a date and time to convert. Dateformat   Type: System.String A format specifier that defines the required format of s . provider   Type: System.IFormatProvider An object that supplies culture-specific format information about s . example DateTime sessionDate = DateTime.ParseExact(txtDate.Text, "M-d-yyyy", provider); here provide is CultureInfo provider = CultureInfo.InvariantCulture; this will get txtDate.Text (Date) into culture wise date format to compare with database formatted datetime. Hope thi...

Handle Devide By Zero Error

Hi .. set Arithaboth and Ansi_Warnings as OFF to handle devide by Zero or any kind of arithmatic errors SET ARITHABORT OFF SET ANSI_WARNINGS OFF Declare @Denominator int =0 Declare @Numerator int =5 SELECT isnull(@Numerator / @Denominator,0) as Result happy coding....

Improve Performance by using OUTPUT in Insert Or Update Statement in single query

Image
Hello friends, recently I needed to fire a single SQL statement for Insert and Update and using the single statement I also needed to return the result of all Inserted/Updated Records details.. after searching a lot ... I came to know a very interesting way to perform both statement in single Query. Generally for the scenario I got lots of suggestions to use Stored Procedure, but which was difficult for my scenario. so I must get solution for it. ok ok... let's come to point. let's we have created a sample Table using the query Create Table Table_1(Id Int Identity,Name nvarchar(100)) to insert records and get its generated Id basically we perform like this Insert into Table_1(Name) Select 'Sandeep' Select @@IDENTITY and same way for update here the Updated value comes from other process which is not available Directly [My case is only For Insert. but the concept we can use in Update also] Declare @NewValue nvarchar(100)='Sandeep Prajapat...

Sample for WCF using json

Here is a sample for start WCF using json in aspx page <script type="text/javascript"> function ajaxService2() { serviceUrl = "http://localhost/WCFS/Service1.svc/GetData"; var time = new Object(); time.value = "1"; $.ajax({ type: "POST", url: serviceUrl, data: JSON.stringify(time), contentType: "application/json; charset=utf-8", dataType: "json", success: function (transport) { var string = transport; $("#<%= Text2.ClientID %>").val(string); }, error: function (ex) { alert("error" + ex.responseText); } }); } function ajaxService1() { serviceUrl = "http://localhost/WCFS/Service1.svc/GetAllPr...

Session Timeout in IIS 7 - Worker Process of ApplicationPool

Image
Problem Recently while testing my application, I was facing problem of Session time out. By Default Session time is 20 mins and I wanted to extend it Attempts if we want to extend it we can set in web.config within System.web tag <sessionState mode="InProc" timeout="30"></sessionState> that I already have done. I set it as 30 mins. but still my session was getting timed out after 20 min. So I doubt that it doesn’t apply to my Code so I set It by code also like System.Web.HttpContext.Current.Session.Timeout = 30; still no progress Resolutions after a long invastigation I came to know Its because Of Default Settings of ApplicationPool for the application in IIS. There is a setting for Worker process of IIS which will set memory and resource to allot to application application wide. in my case I was testing my application alone. So application was being idle for more than 20 min to check weather session is alive or not.. To open the set...

Steps to Remove Menu options in Export for Report Page in SSRS

Hi, In SSRS(Sql Server Reporting Service), I wanted to remove extra options to export my report. Here are the steps to remove option to export like (word, Excel, PDF, MHTML etc...) in SSRS (Sql Server Reporting Service) Installation folder may be different from MSSQL.1, can be MSSQL.x (search for rsreportserver.config under Program Files\Microsoft SQL Server if not found) Here are the steps for Disabling Excel Export Option in Reporting Services - Go to Database server where reporting services is installed, open the rsreportserver.config file located at <Drive Letter>:\ Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer   Go to section.   Change this entry to i.e. add Visible="false" for Excel rendering extension   Same for PDF.   Happy Reporting

Create Excel File From DataTable

Hello Friends, Many times we need to create Excel files in our application using existing Data. I have figured out a class which will help to create excel file by just passing DataTable and preferred location to generate on server. please download the cs file from here .. and use it :) here is full code using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using System.Xml; public class ExcelHelper { private static readonly ExcelHelper _instance = new ExcelHelper(); public static ExcelHelper Instance { get { return _instance; } } /// <summary> /// Create one Excel-XML-Document with SpreadsheetML from a DataTable /// </summary> /// <param name="dataSource">Datasource which would be exported in Excel</param> /// <param name="fileName">Name of exported file</param> public ...

Scroll to particular record in GridView

Hello Friends, here is a tip to scroll the gridview to particular record. the basic concept is html scrolling. to scroll at particular position create an anchor tag with name as address (eg. #ScrollPoint '# is must') now redirect the page to the location using javascript call window.location.href = "#ScrollPoint";   same thing can be achieved by anchorlink href here is sample code HTML Page <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return MoveTo();" /> <div style="height: 100px; overflow: auto;"> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"> <Columns> <asp:TemplateField HeaderText="ID" SortExpression="ID"> <EditItemTemplate...

Power of common table expression (CTE)

Image
Hello friends, Recently I came across a case where I was supposed to generate report for Customer based on services availed to him and for that I used A common table expression (CTE) and it really impressed. initially I referred this great document of MSDN http://msdn.microsoft.com/en-us/library/ms190766.aspx here is my Table of data.(Actual Tables are not like this, I have managed a simplified Table for the Demo.) Here is query to generate Table declare @t table (id int identity,CustID int, AgreementName varchar(100), ServDate Datetime,Price float) insert @t select 70 ,'First Agreement',CONVERT(datetime,'2011-01-05'),10 insert @t select 70 ,'Second Agreement',CONVERT(datetime,'2011-01-06'),10 insert @t select 75 ,'First Agreement',CONVERT(datetime,'2011-03-14'),10 insert @t select 70 ,'Second Agreement',CONVERT(datetime,'2011-01-05'),30 insert @t select 75 ,'Third Agreement',CO...

Access UserControl from Page

Image
Hi.. To perform some reparative operation in application, its preferred to use UserControls. Not necessary to have same display and bindings at everyplace. In that case we need to set values or call methods or pass values accordingly. Here I have tried to figure out three cases, Hope it is helpful. Pass Table to Usercontrol and Set dynamically value to Controls Set Properties of control Call Usercontrol's Methods

Set Default Value as Function to column of a Table

Image
Hello, Generally we need to set default value to particular column in Database Table like isActive is true, IsDeleted is false. same way many times we set CreatedOn Date as CurrentDate and that is by query of insert GetDate(). Static Values : Its very easy to set some static value as Default value for column and that is as follow : Functions : Set Default Date for Createdon Field as Follow : User Defined Functions : Set User Defined function as Default Value as follow: In my case I am supposed to get Random Hexa Code for Color. so I Have created an User Defined function for that CREATE FUNCTION [dbo].[GetRandomColorCode] ( ) RETURNS varchar(6) AS BEGIN Declare @Color varchar(6) RETURN (SELECT MyNewID FROM dbo.MyNewID) END Now set the function in columns as follow : If this do not allow us to set Default value try following query to set ALTER TABLE dbo.Table_1 ADD CONSTRAINT DF_Table_1_ColorCode DEFAULT ([dbo].[GetRandomColorCode]()) FOR ColorCode GO Al...

Track Error in Javascript Page

Hi Many times we have faced problems to find what is javascript errors and exactly where?? To track javascript error, It is a good practice to write code in Try..Catch but sometimes some small syntax error are not allowing to execute the whole js file. so to track such error during development, we can track by this sample code <script type="text/javascript"> onerror = CallOnError; function CallOnError(msg, url, line) { var strErrMessage = ""; strErrMessage += "Message: " + msg + "\n"; strErrMessage += "Page: " + url + "\n"; strErrMessage += "Line Number: " + line + "\n\n"; alert(strErrMessage); return true; } </script> Here is a sample error try to put on your page <script type="text/javascript"> alert('This is First Test Page); </script...

Second Highest Salary- Sql Query

Image
Create Table #Emp(id int identity primary key, Emp varchar(100), Salary int) insert into #Emp select 'XXXX',17000 union all select 'DDDD',21000 union all select 'WWWW',30000 union All Select 'HHHH',21000 union All select 'CCCC',30000 union All Select 'TTTT',21000 union All SElect 'PPPP',21000 select * from #Emp select #Emp.* from (select ROW_NUMBER() over (order by salary desc) as RowNumber, Salary from #Emp group by Salary) as tempEmp inner join #Emp on tempEmp.Salary = #Emp.Salary where tempEmp.RowNumber=2 Drop Table #Emp Data Will Look like this Output will be like this