Skip to main content

Posts

Showing posts from 2011

Localization in Chart (Microsoft Chart Control), Localizing DataPoint

I had a scenario where need to localize the data points that are displayed on the chart, that the decimal needs to be localized as comma (,) in Russian and Spanish., Thanks to my friend Gagan for this E.g.: We can assign an EventHandler to FormatNumber Property as Below private MemoryStream RenderGraph() { Chart barchart = new Chart (); //many number codes are removed //Removed other formatting lines barchart.FormatNumber += new EventHandler < FormatNumberEventArgs >(ConvertChartDecimalFormat);             barchart.DataSource = dt;    barchart.Series[0].XValueMember = "XProp" ;             barchart.Series[0].YValueMembers = "YProp" ;             barchart.DataBind(); //return the memory stream image } Followed the event method will look as below.  vo...

knockoutjs with Umbraco and Umbraco base call

I was thinking how we could use knockoutjs with Umbraco, so just thought blog it. Knockout is a JavaScript library that helps you to create rich, responsive display and editor user interfaces with a clean underlying data model. Any time you have sections of UI that update dynamically (e.g., changing depending on the user’s actions or when an external data source changes), KO can help you implement it more simply and maintainably. Features Elegant dependency tracking Declarative bindings Flexible and sophisticated templating Trivially extensible More information reference: http://knockoutjs.com . Well, we start with Umbraco, To know more on umbraco, Please refer below links http://our.umbraco.org/wiki/how-tos/a-complete-newbie's-guide-to-umbraco http://umbraco.com/help-and-support/video-tutorials/getting-started?freeVideos=1 http://our.umbraco.org/wiki/how-tos/getting-started-with-umbraco-what-is-next-after-you-install http://our.umbraco.org/wiki/install-and-set...

Error: ko.mapping.updateFromJS, use ko.mapping.fromJS instead

I had the same issue, (Error: ko.mapping.updateFromJS, use ko.mapping.fromJS instead) I bugged for long time, then i tried the another alternative. fromJS  the functionality is the same, but be aware that updateFromJS's parameter list is just the other away around, so instead of doing:    ko.mapping.updateFromJS( viewModel, jsData); You need to replace this with:    ko.mapping.fromJS( jsData, {}, viewModel );

Localization in Umbraco, Item Page field localization

Umbraco is one of the most deployed Web Content Management Systems on the Microsoft stack. It's in the top five most popular server applications and among the ten most popular open source tools in general. You can directly download and start using it from http://www.umbraco.com If you have not used the application yet, its always worth trying it once. I am sure you will love it. Well, for the first time users, Umbraco provide step by step instruction for initial set up, once you are done you can use some sample template or create a blank website. To know more on umbraco, Please refer below links http://our.umbraco.org/wiki/how-tos/a-complete-newbie's-guide-to-umbraco http://umbraco.com/help-and-support/video-tutorials/getting-started?freeVideos=1 http://our.umbraco.org/wiki/how-tos/getting-started-with-umbraco-what-is-next-after-you-install http://our.umbraco.org/wiki/install-and-setup ,  I have created a blank website, Now we will go step by step. Fi...

Observer Pattern With C# 4.0

Observer Pattern "The Observer Pattern Defines a one-to-many dependency between objects so that when one object changes state, all of its dependents are notified and updated automatically." Publishers + Subscribers = Observer Pattern C# Introduced , IObserver<T> and IObservable<T> which will help push-based notification,also known as the observer design pattern. The IObservable<T> interface represents the class that sends notifications (the provider); the IObserver<T> interface represents the class that receives them (the observer). T represents the class that provides the notification information. An IObserver<T> implementation arranges to receive notifications from a provider (an IObservable<T> implementation) by passing an instance of itself to the provider's IObservable<T>.Subscribe method. This method returns an IDisposable object that can be used to unsubscribe the observer before the provider finishes sending...

CRM to SendEmail

Send email functionality with CRM internal static Boolean SendEmail(string toAddress, Guid? fromPartyGuid, string subjectLine, string body, Guid? contactId,string templateName) { CrmService crmService = GetCrmService(); //[[FROM activity party for the email. activityparty fromParty = new activityparty(); fromParty.partyid = new Lookup(); fromParty.partyid.type = EntityName.queue.ToString(); fromParty.partyid.Value = fromPartyGuid; //]] //[[TO activity party for email activityparty toParty = new activityparty(); toParty.partyid = new Lookup(); toParty.partyid.type = EntityName.contact.ToString(); toParty.partyid.Value = (contactId.HasValue) ? contactId.Value : new Guid(""); //]] //[[Create a new email and set its properties email emailInstance = new email(); //set email parameters emailInstance.from = new ac...

Create Document Dynamically (Umbraco)

You can create document and publish the content during run time, Below code snippets helps you to do it. public class UmbracoUtils { /// <summary> /// Create and publish the document programatically /// </summary> /// <param name="nodeName"></param> /// <param name="properties"></param> /// <param name="documentType"></param> /// <param name="parentId"></param> /// <returns>node id</returns> public static int CreateDocument(string nodeName, Dictionary<string, string> properties, int documentType, int parentId, List<string> roles = null) { DocumentType dt = new DocumentType(documentType); umbraco.BusinessLogic.User u = new umbraco.BusinessLogic.User(0); // Create the document Document d = Document.MakeNew(nodeName, dt, u, parentId); // Add values...

Logger with UmbracoLog

Umbraco logger is powerful tool and It can be extended to use in your Umbraco application to log anything that you want to do, instead of using another logger to do the task. /// <summary> /// Logger to log Error/Debug/Warning to Umbraco log table /// </summary> public class Logger { public enum LogLevels { DEBUG = 1, WARNING = 2, ERROR = 3, NONE = 100 } public static LogLevels CurrentLevel { get; set; } private static string StrLoggedInUserId; public static void SetStrLoggedInUserId() { if (StrLoggedInUserId == null || StrLoggedInUserId == "NA") { if (HttpContext.Current != null) { HttpCookie cookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName]; if (cookie != null) ...