Skip to main content

Posts

Showing posts from June, 2014

Insert Stored Procedure in SQL Server 2008

This is basically Insert Stored Procedure in SQL Server 2008 USE [testDB] GO /****** Object:  StoredProcedure [dbo].[AddContract]    Script Date: 07/04/2014 21:43:41 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo] . [AddContracts] (      @ID INT   , @CTypeID INT   , @TrialDays INT   , @StartDate DATETIME   , @EndDate DATETIME ) AS BEGIN   Insert Into Contract   (     ID    , CTypeID    , TrialDays    , StartDate    , EndDate   )   values   (     @ID    , @CTypeID    , @TrialDays    , @StartDate    , @EndDate   )   IF ( @@ERROR = 0 )           SELECT 1   ELSE          SELECT - 1 END

get month from datetime in sql server 2008

Hello everyone, I am  going to share the code sample for how to get the month form date-time using the SQL Server 2008 and higher versions of SQL Server. query for get month from sql date-time SELECT DATENAME ( MONTH ,  GETDATE ()) AS [MONTH]

single line if statement c# .net

We can use the  single line if statement c# .net . The below given example is might help you. This is the Default query as given below (if) ? then : else Check the month using single line if in c# .net as given below result = ( month == 1 ) ? "Jan" : DateTime.Now() ;

how to create dynamic div in jQuery and append a lebel and div in that div?

Hello everyone,  I am going to  share the code sample for  [" how to create dynamic div in jquery and append a label and div in a div " ] Table of Contents I . The parent div which contain the id is equal to chartRow. II. jQuery code for creat daynamic div as per your requirements Step 1. < div class ="panel-body">     < div class ="row" id ="chartRow" >         < div class ="usage-chart-1 col-lg-2 col-md-3 col-sm-4 col-xs-12 text-center"></ div >     </ div > </ div > Step 2. < script type ="text/javascript">     $(document).ready( function () {         creatDaynamicDiv();     });     function creatDaynamicDiv() {         $( "<div />" , { "class" : "market-donut cl" , id: "alertChart" })        .append($( "<label />" , { "class" : "chart-title" , id: &

group by multiple columns in linq to sql c#

This is basically used for " How to Group By multiple columns in LINQ to SQL? " [ Route ( "API/Use/GetUsageAlerts/{UserID}/{AccountID}" )] public IEnumerable < UsageAlerts > GetUsageAlerts( int UserID, int AccountID) {        DALUse ObjDalUse = new DALUse ();        Mapper mapper = new Mapper ();        List < UsageAlerts > usedAlerts = mapper.MapDALUsageAlerts2BAL(ObjDalUse.getAllUsageAlerts(UserID, AccountID));       List < UsageAlerts > userUsages = ( from used in usedAlerts                                group used by used.ProductServiceId into res                                select new UsageAlerts                               {                                  UsageIncluded = res.Sum(l => l.UsageIncluded),                                  UsedUnit = Convert .ToString(res.Sum(m => int .Parse(m.UsedUnit))),                                  Product = Convert .ToString(res.Max(l => l.Product)

kendo ui dropdownlist mvc update index

@model MvcApplication1.Models.Contract @{     MvcApplication1.Models.UserSession userSession = (MvcApplication1.Models.UserSession)Session[ "userSession" ]; } @ using (Html.BeginForm()) {     @ Html.AntiForgeryToken()     < div class ="form-group">         @ Html.LabelFor(model => model.CType, new { @class = "control-label col-sm-4" })         < div class ="col-sm-8 col-md-6">             @( Html.Kendo().DropDownListFor(model => model.CType)                     .Name( "CTypeID" )                     )             @ Html.ValidationMessage( "Please select CType" )         </ div >     </ div > } < script type ="text/javascript">     $(document).ready( function (){         try {             $.getJSON( "/api/Company/GetCompany/ @ userSession.TenantID " ,                 function (data) {                     var type

kendo ui chart example

Code Sample for HTML 5 < div class ="panel panel-primary">     < div class ="panel-heading">         < h3 class ="panel-title lg-11"> Data Usage < a href ="#">< i class ="fa fa-refresh pull-right"></ i ></ a > </ h3 >     </ div >     < div class ="panel-body">         < div class ="row">                < div id ="dataChart" ></ div >         </ div >     </ div > </ div > Code Sample for jQuery < script type ="text/javascript">     function dataUsageChart() {         var dataSource = [2000, 4000, 3000, 7000, 10000, 11000, 14000, 14000, 12000, 20000];         var category = [ 'Jan' , 'Feb' , 'Mar' , 'Apr' , 'May' , 'Jun' , 'Jul' , 'Aug' , 'Sep' , 'Oct' , 'Nov&

kendo ui grid total row count

Hello everyone, I am going to share the code sample for  " get total number of rows in a kendo ui grid ". Code sample for MVC 4 kendo Grid @( Html.Kendo().Grid<PCX.Models.Use>()     .Name( "CallByCallUsage" )                     .Groupable()                     .Sortable()                     .Pageable()                     .Scrollable()             .Columns(columns =>             {                 columns.Bound(e => e.AParty_Subscriber).Title( "A Party" );                 columns.Bound(e => e.BParty);                 columns.Bound(e => e.Date_Time).Format( "{0:dd-mm-yyyy / h:mm:ss}" ).Title( "Date & Time" );                 columns.Bound(e => e.NetworkID).Title( "Network" ).ClientTemplate( "#: getNetworkName(NetworkID) #" );                 columns.Bound(e => e.CallType);                 columns.Bound(e => e.Location);                 columns.Bound(e

Kendo ui grid record length count

MVC 4 Controller code sample  //Use api Controller // GET api/use/ public string Get(int id) {     return "value"; }   Kendo MVC4 Grid code sample @( Html. Kendo().Grid <PCX.Models.UsageByPricing>()     .Name( "kndoGridId" )     .Sortable()     .Pageable()     .Scrollable()     .Columns(columns =>     {         columns.Bound(e => e.Product).Title( "Product" );         columns.Bound(e => e.UsageIncluded).Title( "Usage Included" );         columns.Bound(e => e.UsageIncludedTypeID).Title( "Usage Included Type" ).ClientTemplate( "#: getUsageIncludedType(UsageIncludedTypeID) #" );         columns.Bound(e => e.NetworkID).Title( "Network" ).ClientTemplate( "#: getNetworkName(NetworkID) #" );         columns.Bound(e => e.UsageMade);     })     .DataSource(dataSource => dataSource         .Ajax()         .Read(read => read.Action( &q