...
Saturday, September 29, 2018
Wednesday, September 19, 2018
Extreme join and group By
var ssgroupAndjoin = (from invoice in _context.Invoices
from contact in _context.Contacts
where contact.ContactID == id && invoice.ContactID == id
join invoiceDetails in _context.InvoiceDetails on invoice.InvoiceID equals invoiceDetails.InvoiceID
join product in _context.Products on invoiceDetails.ProductID equals product.productID
join supplier in _context.Suppliers on product.SupplierID equals supplier.SuppID
select new
{
invoice,
invoiceDetails,
contact,
product,
supplier
} into invoices
group invoices by invoices.invoice.InvoiceID into invoceLists
select new
{
invoceLists
});
foreach(var result in results)
{
foreach(var item in result.invoceLists)
{
invoiceResults.Add(new
{
invoiceId = item.invoice.InvoiceID
});
}
}
#SSTEAM
we are making brotherhood
Sponsored By: Foring
from contact in _context.Contacts
where contact.ContactID == id && invoice.ContactID == id
join invoiceDetails in _context.InvoiceDetails on invoice.InvoiceID equals invoiceDetails.InvoiceID
join product in _context.Products on invoiceDetails.ProductID equals product.productID
join supplier in _context.Suppliers on product.SupplierID equals supplier.SuppID
select new
{
invoice,
invoiceDetails,
contact,
product,
supplier
} into invoices
group invoices by invoices.invoice.InvoiceID into invoceLists
select new
{
invoceLists
});
foreach(var result in results)
{
foreach(var item in result.invoceLists)
{
invoiceResults.Add(new
{
invoiceId = item.invoice.InvoiceID
});
}
}
#SSTEAM
we are making brotherhood
Sponsored By: Foring
Monday, August 27, 2018
mail send in asp.net mvc
var body = EmailDataAccessLayer.GetServiceRequestBody(Id);
MailMessage mailCompany = new MailMessage();
mailCompany.To.Add("mailaddress");
mailCompany.CC.Add("mail address");
mailCompany.From = new MailAddress("mailaddress", "royex.net");
mailCompany.Subject = "Mail Subject";
mailCompany.Body = string.Format(body);
mailCompany.IsBodyHtml = true;
mailCompany.Priority = MailPriority.Normal;
mailCompany.BodyEncoding = System.Text.Encoding.GetEncoding("utf-8");
SmtpClient clientComapny = new SmtpClient();
clientComapny.Host = "hostaddress";
clientComapny.Credentials = new NetworkCredential("username", "password");
clientComapny.EnableSsl = true;
clientComapny.Send(mailCompany);
MailMessage mailCompany = new MailMessage();
mailCompany.To.Add("mailaddress");
mailCompany.CC.Add("mail address");
mailCompany.From = new MailAddress("mailaddress", "royex.net");
mailCompany.Subject = "Mail Subject";
mailCompany.Body = string.Format(body);
mailCompany.IsBodyHtml = true;
mailCompany.Priority = MailPriority.Normal;
mailCompany.BodyEncoding = System.Text.Encoding.GetEncoding("utf-8");
SmtpClient clientComapny = new SmtpClient();
clientComapny.Host = "hostaddress";
clientComapny.Credentials = new NetworkCredential("username", "password");
clientComapny.EnableSsl = true;
clientComapny.Send(mailCompany);
Wednesday, July 18, 2018
Return RedirectToAction in MVC using async & await
[HttpPost]
public async Task<ActionResult> Index(Member model)
{
string pass = PasswordHash.Hash(model.Password);
var search_role = (from n in db.Members where n.UserName == model.UserName && n.Password == pass select n).ToList();
foreach (var role in search_role)
{
//code here
}
HttpClient client = new HttpClient();
var content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("n", "shimul"),
new KeyValuePair<string, string>("em", "shimul@royex.net")
});
content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
await client.PostAsync("http://app.woopsems.com/Email/Customer-Registration.aspx", content);
return RedirectToAction("Index");
}
public async Task<ActionResult> Index(Member model)
{
string pass = PasswordHash.Hash(model.Password);
var search_role = (from n in db.Members where n.UserName == model.UserName && n.Password == pass select n).ToList();
foreach (var role in search_role)
{
//code here
}
HttpClient client = new HttpClient();
var content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("n", "shimul"),
new KeyValuePair<string, string>("em", "shimul@royex.net")
});
content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
await client.PostAsync("http://app.woopsems.com/Email/Customer-Registration.aspx", content);
return RedirectToAction("Index");
}
Thursday, July 5, 2018
Jquery to get SelectedText from dropdown
var tt = $("#areaID option:selected").text();
#SSTEAM
we are making brotherhood
Monday, June 25, 2018
Delete All Table from Master in Sql Server
EXEC sp_MSforeachtable @command1 = "DROP TABLE ?"
Real Time Filtering by Javascript
Html:
Search Div:
<div class="col-xs-6">
<div class="inputbox">
<input type="text" id="myInput" placeholder="Search By Product Name .....">
<input type="submit">
</div>
</div>
Content:
@foreach (var item in Model)
{
XDbContext db = new XDbContext();
var Product = db.Products.Where(e => e.productID == item.ProductID)
.FirstOrDefault();
<div class="row ord platform">
<div class="col-sm-2">
<div class="order_img">
<img src="@imageUrl@Product.ProductImage">
</div>
</div>
<div class="col-sm-10">
<div class="order_text search-me">
<p><span>Product Name:</span><a href="@Url.Action("Details","Product",new { id = Product.productID, title = getEncodedTitle(Product.ProductTitle) })">@Product.ProductTitle</a> </p>
<p><span>Date: @item.LastUpdated.GetValueOrDefault().ToString("dd MMM, yyyy")</span></p>
<h4>AED @Product.SellingPrice</h4>
</div>
</div>
</div>
}
Script:
$("#myInput").on("keyup", function() {
var value = $(this).val().toLowerCase();
$('.platform').hide();
// Search and show
$('.platform .search-me:contains("' + value + '")').closest('.platform').show();
});
Sunday, June 24, 2018
Delete Method in asp.net mvc
public ActionResult DeleteWishList(int id)
{
var search_wishlist = db.ProductWishLists.Find(id);
db.ProductWishLists.Remove(search_wishlist);
db.SaveChanges();
return RedirectToAction("Index");
}
#ssteam
we are making brotherhood
{
var search_wishlist = db.ProductWishLists.Find(id);
db.ProductWishLists.Remove(search_wishlist);
db.SaveChanges();
return RedirectToAction("Index");
}
#ssteam
we are making brotherhood
Sunday, June 3, 2018
Group By with Join in LINQ(SQL Expression)
var tempMostSellerCategory = from n in db.Temp_MostPopular
join m in db.Categories on n.CategoryID equals m.CategoryID
select new { n,m } into t1
group t1 by t1.n.CategoryID into g
select new
{
categoryid = g.FirstOrDefault().n.CategoryID,
title=g.FirstOrDefault().m.Title
};
Group By in LINQ
List<Temp_LeftMenuCategory> categories = db.Temp_LeftMenuCategory.Where(e=>e.CatID==1 && e.Type== "Category").GroupBy(g => new { g.SubCatID })
.Select(g => g.FirstOrDefault())
.ToList();
Best Regards
#SSTEAM
we are making brotherhood
Monday, March 26, 2018
Advantage of Angular JS
Advantages of AngularJS:
- Open source JavaScript MVC framework.
- Supported by Google
- No need to learn another scripting language. It's just pure JavaScript and HTML.
- Supports separation of concerns by using MVC design pattern.
- Built-in attributes (directives) makes HTML dynamic.
- Easy to extend and customize.
- Supports Single Page Application.
- Uses Dependency Injection.
- Easy to Unit test.
- REST friendly.
Sunday, February 4, 2018
How to find server name in sql server
Steps:
1. Open Command Prompt
2. write sqlcmd -L
3. Enter
Then you will see your server name.
#SSTEAM
we are making brotherhood
1. Open Command Prompt
2. write sqlcmd -L
3. Enter
Then you will see your server name.
#SSTEAM
we are making brotherhood
Wednesday, January 17, 2018
null-coalescing operator
The ?? operator is called null-coalescing operator.
abc= (ssTeam.FieldName) ?? 0;
here if ssTeam.FieldName is null then abc will be 0.
Best Regards
#SSTEAM
we are making brotherhood
abc= (ssTeam.FieldName) ?? 0;
here if ssTeam.FieldName is null then abc will be 0.
Best Regards
#SSTEAM
we are making brotherhood
Tuesday, January 9, 2018
Bootstrap Year changed operation
$("#idYear").datepicker({
format: "yyyy",
viewMode: "years",
minViewMode: "years",
autoclose: true
}).on("changeYear",function() {
//console.log("test");
var changedtxt = $('#idYear').val();
var txtcardno = document.getElementById('idCardNo');
$("#idCardNo").val("");
$.getJSON(
"/Passenger/YearChanged_getCardNo", { "Changedtxt": changedtxt },
function (myData) {
txtcardno.value = myData.cardno;
document.getElementById("PSGRNM").focus();
});
});
Subscribe to:
Posts (Atom)