Posts

Showing posts from 2013

Check code difference

You can easily check the css or other code difference in the link

http://www.diffchecker.com/

sql get month & year from date

Image
SELECT OTDate as Date ,CONVERT(CHAR(4), OTDate, 100) as Month ,CONVERT(CHAR(4), OTDate, 120)as Year FROM Payroll_tblEmployeeOTHour

SQL Query Execution time of you in SQL Management Studio

Image
You can check the Execution time of you SQL Query in SQL Management Studio. like this


It is very simple that you just put your SQL Query in to the Estimated time execution query


DECLARE @StartTime datetime DECLARE @EndTime datetime SELECT @StartTime=GETDATE() -- Write Your Query SELECT @EndTime=GETDATE() --This will return execution time of your query SELECT DATEDIFF(NS,@StartTime,@EndTime) AS [Duration in millisecs]

how replace null to 0 in sql query

Image
If you want to replace the null value in 0 in your sql query like the output:






you have to just write as  ISNULL(DC_Requisition.MainStockID,0) as MainStockId

How to disable specific grid column in kendo ui Grid on inline editing

Image
If you want to stop editing on specific Grid column in Kendo Ui grid like this


Just use theDataAnnotations [Editable(false)] in your custom class for the grid

i am just share my code for your help

using System; using System . Collections . Generic; using System . ComponentModel . DataAnnotations; using System . Linq; using System . Web; namespace FEWO . ViewModel { public class Limitation { public long Id { get; set; } public int? LFDNR { get; set; } public Guid? ob_guid { get; set; } public DateTime? von { get; set; } public DateTime? bis { get; set; } public string einschrank { get; set; } public string wtagvon { get; set; } public string wtagbis { get; set; } public int numtagvon { get; set; } public int? numtagbis { get; set; } public int? nummonvon { get; set; } public int? nummonbis { get; set; } public int? numjahrvon { get; set; } public int? numjahrbi…

kendo ui web selected combobox value set in textbox

Here i am using razor view

<div class="editor-label"> @Html.LabelFor(model => model.ob_guid,"Im Objekt") </div> <div class="editor-field"> @(Html.Kendo().ComboBoxFor(model=>model.ob_guid) .Name("categories") .HtmlAttributes(new { style = "width:300px",id="categories" }) .Placeholder("Select category...") .DataTextField("CategoryName") .DataValueField("CategoryId") .Filter(FilterType.Contains) .DataSource(source => { source.Read(read => { read . Action ( "GetCascadeCategories" , "Limitations" ); }); }) ) </div> <div class="editor-label"> @Html.LabelFor(model => model.von,"Code") </div> <di…

html5 print page

HTML print


Just use the code in your page.

<input type="button" onClick="window.print()" value="Print" name="Print" />

how to import .csv file into sql server using c#

I am using the ASP.NET MVC. here is the code that might help you that how to you convert the CSV file in List and after that you will able to save the List data in to SQL.


[HttpPost] public ActionResult Create(t_NextDevAttendence t_nextdevattendence, IEnumerable<HttpPostedFileBase> files) { // Read the CSV file name & file path // I am usisg here Kendo UI Uploader string path = ""; string filenamee = ""; if (files != null) { foreach (var file in files) { var fileName = Path.GetFileName(file.FileName); path = Path.GetFullPath(file.FileName); filenamee = fileName; } // Read the CSV file data StreamReader sr = new StreamReader(path); string line = sr.ReadLine(); string[] value = line.Split(','); DataTable dt = new DataTable()…

C# remove item from ListObject

private void OnDeleteItemCommand(BO.DC_RequisitionItem reqItem) { if (reqItem.id != 0) { var objReqItem = ViewData.Requisition.DC_RequisitionItemList.SingleOrDefault(m => m.id == reqItem.id); if (objReqItem != null) { //Get deleted item by item id var itemList = new ObservableCollection<BO.DC_RequisitionItem>(); foreach (var mx in ViewData.Requisition.DC_RequisitionItemList.Where(mx => mx.ReqRefNo == reqItem.id)) { itemList.Add(mx); } if (itemList.Any()) { foreach (var m in itemList) { ViewData.Requisition.DC_RequisitionItemList.Remove(m); var da = ViewData.Requisition.DC_RequisitionItemList.FirstOrDefault( mx =>m.ReqRefNo == objReqItem.id); if (da != null) …

Directory Listing -- / in silverlight application

Image
In your silverlight application if can see the error.


It may also arise after get latest from the source safe control.

No need to worry just set up as start up page of your web ASPX file.

Silverlight assembly rename

Image
1. Rename your Silverlight application as you want to give the assembly name of your application.




2. Right click on the project -> properties -> Silverlight  rename the same as you give first on the red marking only.





3. Click on assembly also rename here only marking




4. Buid the project. if you run it you will get error. becoz the aspx file now running the previous xap file.
so you must also have to rename as your newly assembly file/xap file in the aspx file as following figure.



Now build & run you application.

C# Linq Sum from a listObject

we can easily find out the sum from a list of collection. if the list is used in data grid or any other control as a data source we can easily find out the sum of any item field from the list using LINQ.

var totalQty = ViewData.Requisition.DC_RequisitionItemList.Sum(item => item.ItemTotalValue); ViewData.TotalQty = totalQty;

Thanks.

Add service after Migrating a Silverlight application in VS-2012

Image