It’s been 7 episodes and I still don’t see the Dead People who ended season 2. what’s happening with GOT?
Windows Azure and the local developer’s concerns
Has it ever happened to you that when a .NET application is endorsed to you, that you need to run a dozen of apps and services just to see what the application is about. Database, Website, APIs, Configuration Credentials, etc. And then you go to the next concern, WHERE DO I RUN THESE THINGS? should i use my extra laptop? or my desktop? should i use my current development machine?
Enter Windows Azure ( Window’s Cloud Computing Service ). Azure offers you all the machines, services, apis that you will need.
AJAX Start and Stop
Have you had problems in Javascript ajax calls where in you dont know if all calls have been finished or not?
Have you met some untraceable errors in your js code and later on found out that it was because an AJAX call was still running and the values from it has not loaded yet?
Enter ajaxStart() and ajaxStop …. this attaches an event for any AJAX call still running and if it has stopped.
How to save a form via ajax and not map each property
function updateBookingDetails() {
var isvalid = $(‘form’).valid();
if (isvalid) {
var URL = ‘/BookingsManagement/AjaxUpdateBooking’;
//load gif image
$(“#divLoadingImage”).html(‘<center><img id=”imgLoading” src=”/Content/images/common/loading-image.gif” /></center>’);
var form = $(‘form’);
var formCollection = form.serialize();
$.post(URL, formCollection,
function (response, status, xhr) {
$(“#divLoadingImage”).html(response);
showToast();
//redirect to Main Booking Grid if hidden field ‘BookingResult’ = true
if ($(“#BookingResult”).val() == “true”) {
//delay
setTimeout(function () {
window.location = “/BookingsManagement”;
}, 3000);
}
},
“html”
);
}
}
How to map .NET class properties with same keys
usually, when we want to map 2 objects with same properties, we set a.key1 = b.key2 , a.key2 = b.key2 , so on….
there’s a class in .NET that makes this easier … System.Reflection
so in your C# class, put a using System.Reflection
then do something like below in your method. Mine is a sample where I am updating a class name SiteFeatures. Parameter is also of the same class, and I also have the id.
CODE STARTS HERE
public bool Edit(SiteFeature aSiteFeature, int id)
{
try
{
SiteFeature item = context.SiteFeatures.Where(b => b.SiteFeatureID == id).SingleOrDefault();
if (item != null)
{
// Iterate the Properties of the destination instance and
// populate them from their source counterparts
PropertyInfo[] destinationProperties = item.GetType().GetProperties();
foreach (PropertyInfo destinationPI in destinationProperties)
{
//dont include index PK
if (destinationPI.Name == “SiteID”) continue;
PropertyInfo sourcePI = aSiteFeature.GetType().GetProperty(destinationPI.Name);
destinationPI.SetValue(item, sourcePI.GetValue(aSiteFeature, null), null);
}
context.SaveChanges();
}
return true;
}
catch (Exception ex)
{
return false;
}
}
CODE ENDS HERE
Captcha pang PINOY
I saw these 2 questions in a registration form which is uniquely Pinoy:
1. Who is the King of Comedy?
2. What is larger than McDo?
Eh di Pinoy lang makakasagot nito diba?
Son, it’s not about if it’s malignant or benign, it’s about your faith in God one of the best advises i got happened when i had a cyst removed from my ass
you know why Starbucks is such a hit here in RP? not because of the coffee, we got lots of arabica and robusta mills here. It’s because it gives us a taste of America, and just a few minutes inside that store makes us feel that we got a chance of immigrating or being there in the US of A. So if you want to buy a franchise of a popular US brand, make sure you bring with it something that will transport us to the snows of Boston, the beaches of Miami, the limelight of Hollywood. Don’t just bring the brand, bring the country.
Talk N Text Unli Promo
Unli text to All Network for 30 days
TEXT
UA300 to 4545