Hi everyone,

I wanted to add 3 Pages.. If Supervisor login will direct to supersior page, if engineer login will direct to engineer's page and so on.
Here is the code:

protected override void OnPreInit(EventArgs e) {
base.OnPreInit(e);
Page.MasterPageFile = (Session["role"].ToString() == "ME") ? "ME.Master" : "ME.Master";
}
protected List<preventiveRecord> listPrevRecord(string criteria) {
List<preventiveRecord> lpr = new List<preventiveRecord>();
switch (criteria) {
case "dueTomorrow": lpr = sdc.preventiveRecords.Where(a => a.preventive.Site == Session["site"].ToString() && a.Date_Due == DateTime.Today.AddDays(1) && a.Date_Done == null).ToList(); break;
case "allNearestFuture":
foreach (preventive p in sdc.preventives.Where(a => a.Site == Session["site"].ToString())) {
lpr.Add(p.preventiveRecords.Single(b => b.Date_Due == p.preventiveRecords.Where(a => a.Date_Due > DateTime.Today).Min(a => a.Date_Due)));
}
//lpr = sdc.preventiveRecords.Where(a => a.preventive.Site == Session["site"].ToString() && a.Date_Due > DateTime.Today).ToList();
break;
}
return lpr;
}

thanks and regards

Im getting error..

namespace sys.CNS {
 public partial class ME0 : System.Web.UI.Page {
  sqlDataContext sdc = new sqlDataContext();
  protected override void OnPreInit(EventArgs e) {
   base.OnPreInit(e);
   switch (Session["role"].ToString())
   {
       case "1":
         MasterPageFile = "ME.Master";
           //break;
       case "2":
         MasterPageFile= "Spv.Master";
       case "3":
         MasterPageFile = "Mgr.Master";
       default:
         return ME0 ("default");

  }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.