KES

There are two problems with Dot.Net
1. I love it and i can be a lot of fun coding in.
2. WordPress and php can do just about all of the same thing in about 1/3 the time.

Forcing to ssl/https in a controller action result is quite simple. All you need to do is add the [RequireHttps] attribute to the controller action. If you want to make an entire controller or an entire site do this it can become tedious.
Create a new custom attribute. Mark its target to Class and inheritable.


//#define ssl
using System;
using System.Web.Mvc;
namespace MyNameSpace.Controllers
{
    [AttributeUsage(AttributeTargets.Class, Inherited = true)]
    internal sealed class InheritableAttribute : Attribute { }

Now create a new class that extends Controller. Mark it Inheritable using that new attribute created above. This class is empty and its only purpose is to redirect all controller actions to https. Where this becomes handy is during testing on a local development server without ssl. Here I’m using a compiler directive exactly for this purpose.

   
[Inheritable]
#if ssl
    [RequireHttps]
#endif
    public class ControllerBaseController : Controller {}
}

To apply this to any or all controllers just do the following:


// dummy controler for dem
// inherit from your newly created BaseController just don’t try and name it BaseControler 
    public class CheckOutController : ControllerBaseController
    {
// …action 1,2,3. …
    }

I hope this helps some one
KES

KURT SCHROEDER

977 Harris, Rd. #37                                                                              (847) 800-7563

Grayslake, IL 60030                                                                 kurt@kurtSchroeder.com

CAREER SUMMARY

NOTE: most recent additions and career interests. I am fully committed to the MVC design pattern for websites in combination with Entity Framework. This is not necessarily the same as the MS pattern found in VS2K8/2K10. I tend toward n-Layer projects with a WinForms administrative system. Both the MVC website and the WinForms project are connected to the same Entity FrameWork Project. There are times when a MCF service using JSON or other REST services is the best solution when connecting to JQuery. Over the past year I’ve made just about every mistake and discovered every bug in both MVC and Entity possible. I want to make this clear MVC 2 needs a serious upgrade to 3 ASAP. Entity 4 is not perfect and following a strict Entity pattern can lead to extended development time just to do what a few sp’s can do. I guess this brings me to the next point. I’ve done TSQL for 15+ years and Entity can help things, but after trying to move totally post–relational, I’ve admitted defeat and started focusing on SP for most read only complicated object, especially for items like catalogs.  The MS Web Forms view engine is really not easy for designers. The 3 version will allow for multi-view engines. My preference is Spark, but Razor has potential. I lean toward Spark because it is the most HTML like so far. Asp <% %> is still difficult to understand by designers and it seems Razor is a hybrid more to please back-end developers than designers. I’m developing two projects simultaneously both in Entity4/MVC2/JQUERY/WinForms using the WebForms View Engine. One is integrated with QuickBooks, the other with BusinessWorks. Entity does not support ODBC so I have to rely on an older POCO based n-Layer. This is not a problem for me, however on the MVC side I would have switched both to Spark if it were not so late in the game.  I don’t have a problem at all using the MS View Engine, but I do hear the same complaints from designers I heard when asp was introduced. In spite of my seemingly endless complaints above, I’ll take MVC and Entity over all else even NHibernate.

Results driven web developer with a reputation for providing timely effective solutions based upon clients’ goals, both present and future. Data driven Systems created with equal comfort in Asp.net (cs/vb), Adobe ColdFusion, using data driven.  Design emphasis placed on database and layered systems. 13+ years of web develop development experience. Prior experience includes database administration, WAN administration, C++, RPGII/III/400. Other technologies used during the course of my carrier: php, mySql, COBOL, WinForms. In collaboration with other I have worked on or created over 100 sites. Many site use ecommerce technology.

Projects of Note:

InstituteForInvestors.com (Investor Education Institute). 2004 to present

This system was designed and created, with market technical help from the site owner, by me alone. It tracks all issues listed on the Amex, NYSE, and Nasdaq. Over 40,000 charts are available within one hour of market data becoming available. Key technical features include automated self correction for errors. Auto de-normalization, small foot print; this site can run on a single server if necessary, but can be, as it is in its present form run on multiple servers. This system was built using asp.net (cs.net/vb.net), ColdFusion (for charts), and MSSqlserver (stored procedures and functions)

Site Function:

This site is a stock market analysis system based on point and figure charting. This system builds on the standard P&F charting method by adding for Stock issues: Logarithmic Charts, Variable Box Charts, 2 and 4 Percent Relative Strength Charts;  for Index, Sector, Market: Ten week Rising in addition to the standard Ten Week Average Chart, Logarithmic Bullish Percent Charts. Custom Reports noting stocks as prospects for buy/sell, and positioning (Short, Long) other charts and reports include Asset Class Allocation, Personal Portfolios. This is an ecommerce Site using PayPal(verisign) services. demonstrated (recommended) upon request.

EverybodySafe.com (a Trepidus company) 2008-2010.

This site was created by me with UI design help from other team members. Site is written in cs.net and MSSQL Server. EverybodySafe is designed with n-Layers (6) with a focus on expansion to multiple tiers (n-Tier). Currently it is using 2 tiers (Business Logic/Validation, business Entities, Data Access, , UI, Presentation on one tier. Data Base is on Tier 2.

Site Function: EverybodySafe is a personal warning system for individuals. If a member becomes incapacitated an id tag and stickers, carried by the member, can be entered into any internet capable devise in a matter of seconds. The ten character code calls up an image of the person and three alert options, 1. Life Threatening, 2. Non-Life Threatening, 3. I’m OK (to signal the emergency is over or to be used when a natural disaster strikes and a member wants to reassure others). After entering a point of contact hospital phone or other, Email, Text message, and voice phone alerts are sent to predefined individuals and institutions. This is an eCommerce site using Authorize.net web services.

AbrInd.com (noted here for its longevity)

A cable parts company selling custom cable assemblies. This site is currently being redeveloped in MVC.net. AbrInd has been modified over the years, but had existed in its original form for over 13 years. In the original concept it pre-dated asp (not asp.net). Using a simple custom catalog system the site owner manages most operation without assistance. This site was written in ColdFusion (2.0).

PROFESSIONAL EXPERIENCE

I Know Tek, Inc., Grayslake, IL                                                                 2001 to Present

Senior Project Developer - recent projects (list available upon request)

  • Develop websites and AJAX enabled websites using ASP.Net (C# and VB) 1.1-3.5, Adobe ColdFusion, MS MSSqlserver (6.5-2K8), MSAccess, MySQL, JavaScript, CSS
  • Create stock market analysis websites based on point and figure charting.
  • Create customer portfolios that help monitor subscriber investments.
  • Write systems using MS Sqlserver and Adobe ColdFusion.
  • Create “Members-only” websites for business professionals pursuing networking opportunities in various metropolitan centers.
  • Create custom dynamic calendar using DotNet backed by MS Sqlserver, including reminder emails and a members’ exchange.

This is not rocket science, but it is useful for those of us who are simplicity challenged.

q: how do you select a DataGridViewRow when the cell is clicked on.

a: using the cell click (or similar depending on your needs) add this general method

private

void dvg_CellClick(object sender, DataGridViewCellEventArgs e)

{

if

(e.RowIndex > -1)

{

var dgv = (DataGridView) sender;dgv.Rows[e.RowIndex].Selected =

true;

}

}

Simple and to the point. This just plain works. If you ever wanted to send an email receipt using an existing (partial) view for the message body. This is it.

http://msug.vn.ua/blogs/bobasoft/archive/2010/01/07/render-partialview-to-string-asp-net-mvc.aspx

Don’t expect all the additional advice that you already know about.

In the church, I mean as a Christian, I tried very hard to be honest to my self and others. I tried to better myself. This meant challenging my feelings as what I felt was right or felt was wrong. The Bible is the one standard by which we were to measure our direction, ourselves. It is the last authority. Where the Bible and I disagreed, the Bible was right.
My first pastor was/is a very intelligent, honest man. He strongly opposed so called “Blind Faith”. His name is Wayne Hansen and I a proud to have known him. He deserves my gratitude for many things including the tools given to those, like myself, who were under his care as a pastor. Wayne, did not curtail psychology, counseling, and spoke freely of his limitations, always offering alternatives where he felt he lacked. At times he could be rigid, but this more had to do with personal convictions and personal interests. He did not go to movies or listen to contemporary music, but did not stop others. He’d warn that some messages are just not healthy, be careful. That’s no different than any parent. At the time, early 80′s I never once heard him preach damnation on evil liberals, the immoral society destroying homosexuals, the Red threat, and so forth. Very different than many other pastors of the day in the evangelical tradition. I’ll guess this had to do with his honestly, intelligence, and secure personal comfort with himself. I think likewise those of his contemporaries who did likely had unresolved personal issues that caused them to continuously convince themselves of the wrongness, perhaps hoping to save themselves from their evil thoughts or actions. Example: a Pastor I knew preached incessantly about virtually all married men lacking ethics concerning fair treatment of their wives. Soon he was discovered in an extra-marital relationship. Even then he lied, saying it was not “yet” physical. I’ve likewise thrown a few rocks in my time, but to the best of my memory this was not ever true of Wayne. One morning he preached a sermon that was rather uncharacteristically harsh about spousal relations. It turned out this had all to do with him and he made it clear. Another time I believe he did not taking communion with the congregation. It was not talked about for reasons he did not share, but I consider he was taking care of others in his life. Wayne was being honest, making amends in ways that wouldn’t injure them or others. maybe in seeing an event that never occurred, but I do not doubt Wayne’s doing this where circumstances warrant.

This is not hero worship at all. Understand, I cannot start a blog titled thus with out first pointing out the good examples of Christians, believers, I’ve known, their sincerity and devotion to truth. Wayne is the best example by far than any other and there are quite a few!

Before i got fired the one and only time in my life:  My two genius bosses configured a virtual server with 512Mb and were planning to run W2K3, IIS, and sql 2003. I told them at least three times they should consider upping it to 1Gb. I had experience with this, made the same error, and learned from it.

Using ‘Like’ in a query is never good practice, but sometimes it’s unavoidable. This was the case on a join with two tables each containing about 200 records each. They came from difference db’s. This was a one shot query for data checking only. The query, run in SMS, took 24 seconds. I said, “guys, we have a problem”. Rather than admit he made a simple error or at least try adding the extra memory i was told the reason was my use of Like in the query. I was totally shocked and expressed my disbelief at what i just heard. I argued with him. I’m not prone to argument, but this was a huge exception and well warranted! The next day ‘Boss#1’, #1 for short (you got kids? Think about it), publicly reprimanded me not for arguing, but for not accepting #2’s #2 type answer. As I said, I am not prone to arguing and I will not waste my time and emotions on a futile shouting match with an obvious outcome. I came to this conclusion when I opened my mouth to suggest a “possible” reason, and was all but told loudly to shut up and then loudly told, “No #2 said you are wrong.  Kurt, don’t talk, I, #1, say YOU ARE WRONG! And “THE” #2 said YOU ARE WRONG” We will never know if I was right, #2 was right, or if we were both wrong because the physical server hosting the VM died due to a hardware failure on the following Monday. For all I know the guy took a degaussing magnet to the server. I sincerely do not believe this, but for the first time in my life, with 12 years of SQL experience mostly doing complicated queries on stock market data I was just publicly reprimanded for not accepting the conclusions of #2. After that I was ready to believe anything was possible from #1 and #2. Here is an interesting side note they both forgot. I had worked there about 2 years earlier (I was asked to come back by #1) and they both were talking about “Update Joins” not being possible. The concept of aliasing a table was considered confusing and bad practice by them at that time, so of course they couldn’t do it. In less than 1 minute I showed them both how it was done by giving them an example.

Entity Framework is great, Linq to EntityFramework totally sucks. When views get complicated, Selects like “Where a.xxx == 5″ turns the related entityes to repeate the first item and not select the real associated item.

Solution? Kill the view, kill the Entity related to the view, recreate the view as simple as possible, do not add navgation if you plan to do multiple selects.

I know some one will know why i’m wrong and someone else will say i’m cryptic. Eather way the damn thing does not work like all the other query languages SQL or other wise.

That means it sucks!! I’m sure forcing the first item to be selected on the following unrelated item is some great feature. Too bad the rest of us weren’t in on the secrete!

KES

The magic words for me are MVC, Entity Framework, and n-Tier!!. I’ve done some work with NHibernate (it’s good, but has some kinks i never quite got over), but Entity Frame Work 4.0 seems the place where MS hit it on the head. I may be down playing my tsql skills here, but I’m just a big fan of the post-relational trend. Do not misinterpret this to mean sql is out of the picture. I’m still doing views and stored procedures for most data operations, but the model-first pattern is the way to go. It’s the sensible place to start.
OK to the practical. Here’s what I believe: I learned n-Tier/n-Layer concepts using a process developed by http://imar.spaanjaars.com. His system is a great first start for anyone learning the concepts. It is all raw c# and POCO’s. All the code is there. If you are like me you can understand the frustration of not seeing the whole picture. If you have to use a third part library without explanation in a learning environment, not talking production here, it is harder to “get it”, Imar’s does not nor does it claim to work well in a multi-tiered environment. It works well, but if it has done its job, you find yourself seeing the rest of the world. I still use it, but it brought me to the point where I could understand the popular frameworks and the like. At that point I was able to move on to understanding Tiers, most importantly when NOT to use them.
My newer projects are all model first. In a team environment it’s a place where most of us have common ground. We are all have to deal with Visual Studio at least at some point during the development process. By starting here we can all see it and contribute to it before the Database guys decide the correct design based on their current understanding of the project. Likewise the first unit tests can be developed here using a NUnit with Moq or whatever to detach dependency on the Data guys so they don’t have to keep adding and dropping fields, generating test data, adding/dropping cascading deletes, dependencies, constraints, etc. This section, the mock/unit testis can be easy, but it is not always quick. It’s tough to justify the time involved, but you can at least point out that the data guys have not been complaining much recently! The “final” Model will and always will be changed later (End of Story!). However, the cool part is you can push this model to the data server after getting approval from the data guys. Again less work for the data guys/girls.
On the rest of the layers: in an MVC project it is by design already layered, but not exactly the way I’d like. I tend to separate the model as noted above into its own project. To access the model I prefer a quasi-service layer or a service layer/business rules layer. This can be over kill on a small system, but it opens up possibilities. This layer is what provides the MVC controllers, web services, and Windows Forms apps their data insuring they all play by the rules before they get anything. It is also the place where DTO’s can be used instead of the actual model. OK, look, here’s the deal: You have a small site? It’s time to lose your fundamentalism. Strongly typed views are scandalous in some circles, but they work great and fast to create, and most of all, you don’t need the specialist middle layer or db layer to use them. In other words they are just plain easy and are safe if the Business layers done right. However, there is nothing wrong with using DTO’s. Not only that, you can still get strongly typed views just not directly to the model. It is work the Business layer guys/girls are doing anyway. I mean they would argue the strong typing breaks separation so they’d be setting the values here and passing to the mode they care how it gets to them. They just care that all of it gets to them and no one else! Ergo, create DTO’s that can be strongly type for the UI guys. They call the same SaveChanges(), AddObject(), ect just not on the real model. You can use POCOS, create a DTO model and intercept the methods. Whatever, the point is can be done. You can get the best of both worlds and you can Tier the thing without having to use the “real” model on the receiving end. As far as the UI (Service, windows forms, MVC, asp.net classic, etc. is concerned this is the real model and in their universe it is the only model. To them it is a mystery what really happened when their objects go to the great beyond. They just have to have faith that their objects will be taken of in the “hear after” in the same way objects arrive.
I’ll end here. I’ve not covered JSON, or just using a REST service directly, but I think you get the idea of what I’m like as a developer.
Languages and platforms : c#, vb.net, asp.net, mvc.net, ColdFusion, SQLServer, QuickBooks, Business Works, JQuery, and a little extJS, PHP, NHibernate.
Extra note: I have a lot of experience creating analysis and charting systems for the Stock Market including ETF’s, forecasting, portfolio management.

Thank You

Great article for using a Stored Procedure to “select” In Entity Frame Work