Skip to content

Instantly share code, notes, and snippets.

@joshi-kumar
joshi-kumar / Get current url by JQUERY
Created February 17, 2018 13:26
Get current url by JQUERY
window.location.host : you'll get sub.domain.com:8080 or sub.domain.com:80
window.location.hostname : you'll get sub.domain.com
window.location.protocol : you'll get http:
window.location.port : you'll get 8080 or 80
window.location.pathname : you'll get /virtualPath
window.location.origin : you'll get http://sub.domain.com *****
http://stackoverflow.com/questions/1368264/how-to-extract-the-hostname-portion-of-a-url-in-javascript
@joshi-kumar
joshi-kumar / Play with html
Created February 17, 2018 13:24
Play with html
if (response.actionType == "RemoveCartItem") {
var price = $("#price_" + String(response.productId)).html();
price = price.split("$");
var pr = parseFloat(price[1]);
var totalPrice = $(".totalprice").html();
totalPrice =totalPrice.split("$");
var tPrice = parseFloat(totalPrice[1]);
@joshi-kumar
joshi-kumar / Google and Facebook login
Created February 17, 2018 12:19
Google and Facebook login
https://console.developers.google.com/apis/credentials?project=oneread-d3dc8
To => Creditials =>create credintials =>
Name =estore.one-read.com
Restrictions => 1st box =>http://estore.one-read.com
2nd box=>http://www.estore.one-read.com
*************************************************
@joshi-kumar
joshi-kumar / create log file in application root
Created February 17, 2018 12:14
create log file in application root
/// create log [If file name not exist then create and write file name else write on existing file] ///
private void LogFile(string txt)
{
StringBuilder sb =new StringBuilder();
sb.Append(txt);
System.IO.File.AppendAllText(filePath() + "log.txt", sb.ToString());
}
/// create path on root ///
@joshi-kumar
joshi-kumar / Using linq count duplicate id
Created February 17, 2018 12:12
Using linq count duplicate id
var cusId = from x in record
group x.CustomerId by x.CustomerId into g
let count = g.Count()
select new { Value = g.Key, Count = count };
@joshi-kumar
joshi-kumar / Chart js
Created February 17, 2018 12:10
Chart js
Controller
using DotNet.Highcharts.Options;
using Nop.Core.Domain.Customers;
using Nop.Plugin.OneRead.AnalyticsAndReports.Domain;
using Nop.Plugin.OneRead.AnalyticsAndReports.Models;
using Nop.Plugin.OneRead.AnalyticsAndReports.Services;
using Nop.Services.Common;
using Nop.Services.Customers;
using Nop.Web.Framework.Controllers;
@joshi-kumar
joshi-kumar / return redirect referer url
Created February 17, 2018 12:08
Use for redirect last url, It contains all previous visited page (url/referer).
// It return the just previous url.
returnUrl = HttpContext.Request.UrlReferrer.ToString();
@joshi-kumar
joshi-kumar / full Foreign key table access and data insert
Created February 17, 2018 12:04
Full Foreign key table access and data insert
public partial class Customer_CustomerRole_Mapping
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
public int Customer_Id { get; set; }
public int CustomerRole_Id { get; set; }
}
@joshi-kumar
joshi-kumar / using lambda match item in nested list( list in list)
Created February 17, 2018 12:01
using lambda (LINQ) find item in nested list (list under list)
query = query.Where(c => c.CustomerRoles.Select(cr => cr.SystemName).Contains(customerRole));
@joshi-kumar
joshi-kumar / for ?? and ? operator
Created February 17, 2018 11:57
About ?? and ? operator
http://stackoverflow.com/questions/3815741/what-does-operator-means-in-c
x ?? y is roughly equivalent to this (except that the first argument is only evaluated once):
if (x == null)
{
result = y;
}
else
{