コード例 #1
0
ファイル: ACModuleController.cs プロジェクト: ttcp112/FJ
        public PartialViewResult Edit(string id)
        {
            ModuleModels model = GetDetail(id);

            model.GetParent();
            return(PartialView("_Edit", model));
        }
コード例 #2
0
        public JsonResult GetModules(string UserModeCode)
        {
            ModuleModels mod = new ModuleModels();
            DataTable    dt  = new DataTable();

            dt = mod.GetAvailableModules();
            List <ModuleObject> obj = new List <ModuleObject>();

            //loop the data table and create the module object
            foreach (DataRow dr in dt.Rows)
            {
                bool result   = ModuleModels.checkAccess(UserModeCode, Convert.ToInt32(dr["Id"].ToString()));
                bool hasChild = ModuleModels.hasChild(Convert.ToInt32(dr["Id"].ToString()));
                int  count    = ModuleModels.getChildCount(Convert.ToInt32(dr["Id"].ToString()));
                obj.Add(new ModuleObject
                {
                    Id          = Convert.ToInt32(dr["Id"].ToString()),
                    ParentId    = Convert.ToInt32(dr["ParentId"].ToString()),
                    Name        = dr["Name"].ToString(),
                    Description = dr["Description"].ToString(),
                    IsEnabled   = result,
                    HasChild    = hasChild,
                    ChildCount  = count
                });
            }

            //serialize the object to json
            string json = JsonConvert.SerializeObject(obj);

            //return the json object
            return(Json(json, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
ファイル: ACModuleController.cs プロジェクト: ttcp112/FJ
 public ActionResult Edit(ModuleModels model)
 {
     try
     {
         if (string.IsNullOrEmpty(model.Name))
         {
             ModelState.AddModelError("Name", "Module Name is required");
         }
         if (!ModelState.IsValid)
         {
             model = GetDetail(model.Id);
             Response.StatusCode = (int)HttpStatusCode.BadRequest;
             return(PartialView("_Edit", model));
         }
         model.ModifiedUser = CurrentUser.Email;
         //====================
         string msg    = "";
         var    result = _factory.Update(model, ref msg);
         if (result)
         {
             return(RedirectToAction("Index"));
         }
         else
         {
             ModelState.AddModelError("Name", msg);
             return(PartialView("_Edit", model));
         }
     }
     catch (Exception ex)
     {
         _logger.Error("Module_Edit: " + ex);
         return(new HttpStatusCodeResult(400, ex.Message));
     }
 }
コード例 #4
0
ファイル: ACModuleController.cs プロジェクト: ttcp112/FJ
        public List <ModuleModels> GetListModuleChild(List <ModuleModels> lstModule, string ParentId)
        {
            var lst      = new List <ModuleModels>();
            var listData = lstModule.Where(x => x.ParentID.Equals(ParentId)).ToList();

            foreach (var item in listData)
            {
                var          listChild = GetListModuleChild(lstModule, item.Id);
                ModuleModels module    = new ModuleModels()
                {
                    Controller = item.Controller,
                    Id         = item.Id,
                    Name       = item.Name,

                    ParentName = item.Name,
                    ParentID   = item.ParentID == null ? "" : item.ParentID,

                    Status    = item.Status,
                    ListChild = listChild
                };
                if (ParentId.Equals(""))
                {
                    _ListModule.Add(module);
                }
                else
                {
                    lst.Add(module);
                }
            }
            return(lst);
        }
コード例 #5
0
ファイル: ACModuleController.cs プロジェクト: ttcp112/FJ
        public ActionResult Create()
        {
            ModuleModels model = new ModuleModels();

            model.GetParent();
            return(View(model));
        }
コード例 #6
0
        public JsonResult getUserRights(string username)
        {
            List <string> result = new List <string>();

            result = ModuleModels.getUserRights(username);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
コード例 #7
0
        public JsonResult DeleteUserGroup(int UserModeCode)
        {
            //get the result using ignition web service
            var result = UserModels.DeleteUserGroup(UserModeCode);

            if (result == true)
            {
                result = ModuleModels.DeletePermission(UserModeCode);

                if (result == true)
                {
                    result = UserModels.ResetUserByBatch(UserModeCode);

                    if (result == true)
                    {
                        string position     = "";
                        bool   isNAPosition = false;
                        try
                        {
                            position     = UserModels.GetPosition(Session["Username"].ToString());
                            isNAPosition = false;
                        }
                        catch
                        {
                            position     = "N/A";
                            isNAPosition = true;
                        }

                        HttpContext.Session.Add("Position", position);
                        HttpContext.Session.Add("isNAUser", isNAPosition);

                        try
                        {
                            Response.Cookies["Position"].Expires = DateTime.Now.AddDays(-1);
                            Response.Cookies["isNAUser"].Expires = DateTime.Now.AddDays(-1);
                        }
                        catch { }

                        try
                        {
                            HttpCookie cookiePositon = new HttpCookie("Position");
                            cookiePositon.Value   = position;
                            cookiePositon.Expires = DateTime.Now.AddDays(30);
                            Response.Cookies.Add(cookiePositon);

                            HttpCookie cookieisNAUser = new HttpCookie("isNAUser");
                            cookieisNAUser.Value   = isNAPosition.ToString();
                            cookieisNAUser.Expires = DateTime.Now.AddDays(30);
                            Response.Cookies.Add(cookieisNAUser);
                        }
                        catch { }
                    }
                }
            }

            //return the json data
            return(Json(result.ToString(), JsonRequestBehavior.AllowGet));
        }
コード例 #8
0
ファイル: ACModuleController.cs プロジェクト: ttcp112/FJ
 public ModuleModels GetDetail(string id)
 {
     try
     {
         ModuleModels model = _factory.GetDetail(id);
         return(model);
     }
     catch (Exception ex)
     {
         _logger.Error("Module_Detail: " + ex);
         return(null);
     }
 }
コード例 #9
0
        public JsonResult CheckRights(string UserModeCode, int ModuleId, int ParentId, string Name)
        {
            Dictionary <string, object> response = new Dictionary <string, object>();

            bool result = ModuleModels.checkAccess(UserModeCode, ModuleId);

            response.Add("Result", result);
            response.Add("ID", ModuleId);
            response.Add("ParentID", ParentId);
            response.Add("Name", Name);

            return(Json(response, JsonRequestBehavior.AllowGet));
        }
コード例 #10
0
        public JsonResult GetProducts(string ProductID)
        {
            CoreMVCClassLibrary.DataLayer objDataLayer = new CoreMVCClassLibrary.DataLayer();



            ModuleModels moduleModels = new ModuleModels();


            var objProducts = moduleModels.GetProducts();

            if (!string.IsNullOrEmpty(ProductID))
            {
                objProducts = objProducts.Where(item => item.ProductId == Convert.ToInt16(ProductID)).ToList();
            }


            return(Json(objProducts));
        }
コード例 #11
0
ファイル: ACModuleController.cs プロジェクト: ttcp112/FJ
        public ActionResult Create(ModuleModels model)
        {
            try
            {
                if (model.ParentID != null)
                {
                    //var parentName = model.ListProductType.Find(x => x.Value.Equals(model.ProductTypeID)).Text.ToLower();
                    //if (!parentName.Equals("dish"))
                    //{
                    //    model.ParentID = null;
                    //}
                }
                if (!ModelState.IsValid)
                {
                    model.GetParent();
                    return(View(model));
                }
                //====================
                string msg = "";
                model.CreatedUser  = CurrentUser.Email;
                model.ModifiedUser = CurrentUser.Email;

                bool result = _factory.Insert(model, ref msg);
                if (result)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("Name", msg);
                    return(View(model));
                }
            }
            catch (Exception ex)
            {
                _logger.Error("Module_Create: " + ex);
                return(new HttpStatusCodeResult(400, ex.Message));
            }
        }
コード例 #12
0
ファイル: ACModuleController.cs プロジェクト: ttcp112/FJ
 public ActionResult Delete(ModuleModels model)
 {
     try
     {
         string msg    = "";
         var    result = _factory.Delete(model.Id, ref msg);
         if (!result)
         {
             ModelState.AddModelError("Name", msg);
             Response.StatusCode = (int)HttpStatusCode.BadRequest;
             return(PartialView("_Delete", model));
         }
         return(new HttpStatusCodeResult(HttpStatusCode.OK));
     }
     catch (Exception ex)
     {
         _logger.Error("Module_Delete: " + ex);
         ModelState.AddModelError("Name", "Have an error when you delete a module");
         Response.StatusCode = (int)HttpStatusCode.BadRequest;
         return(PartialView("_Delete", model));
     }
 }
コード例 #13
0
        public JsonResult Save(int UserModeCode, List <string> lstModuleID, List <string> lstIsEnabled)
        {
            bool result = true;

            for (int x = 0; x < lstModuleID.Count; x++)
            {
                int  ModuleID   = Convert.ToInt32(lstModuleID[x]);
                bool isEnabled  = Convert.ToBoolean(lstIsEnabled[x]);
                bool tempResult = ModuleModels.SaveSettings(UserModeCode, ModuleID, isEnabled);
                if (tempResult == false)
                {
                    result = false;
                }
            }

            if (result == true)
            {
                ModuleModels.LogAccessRightsUpdate(UserModeCode);
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
コード例 #14
0
        public bool Insert(ModuleModels model, ref string msg)
        {
            bool result = true;

            using (NuWebContext cxt = new NuWebContext())
            {
                try
                {
                    G_Module item = new G_Module();
                    item.Id = Guid.NewGuid().ToString();

                    item.Name         = model.Name;
                    item.Controller   = model.Controller;
                    item.ParentID     = model.ParentID == null ? "" : model.ParentID;
                    item.CreatedDate  = DateTime.Now;
                    item.CreatedUser  = model.CreatedUser;
                    item.ModifiedDate = DateTime.Now;
                    item.ModifiedUser = model.ModifiedUser;
                    item.IndexNum     = model.IndexNum;

                    cxt.G_Module.Add(item);
                    cxt.SaveChanges();
                }
                catch (Exception ex)
                {
                    _logger.Error(ex);
                    result = false;
                }
                finally
                {
                    if (cxt != null)
                    {
                        cxt.Dispose();
                    }
                }
            }
            return(result);
        }
コード例 #15
0
        public bool Update(ModuleModels model, ref string msg)
        {
            bool result = true;

            using (NuWebContext cxt = new NuWebContext())
            {
                try
                {
                    var itemUpdate = (from tb in cxt.G_Module
                                      where tb.Id == model.Id
                                      select tb).FirstOrDefault();

                    itemUpdate.Id           = model.Id;
                    itemUpdate.Name         = model.Name;
                    itemUpdate.Controller   = model.Controller;
                    itemUpdate.ParentID     = model.ParentID == null ? "" : model.ParentID;
                    itemUpdate.ModifiedUser = model.ModifiedUser;
                    itemUpdate.ModifiedDate = DateTime.Now;
                    itemUpdate.IndexNum     = model.IndexNum;
                    cxt.SaveChanges();
                }
                catch (Exception ex)
                {
                    _logger.Error(ex);
                    result = false;
                }
                finally
                {
                    if (cxt != null)
                    {
                        cxt.Dispose();
                    }
                }
            }
            return(result);
        }
コード例 #16
0
        public ActionResult Index()
        {
            //Check cookie and session variables for retaining login status
            //if true go to page, else return to login page
            if (HttpHandler.CheckSession())
            {
                string username       = Session["Username"].ToString();
                string userType       = UserModels.GetUserType(username);
                string thumbnailPhoto = UserModels.GetThumbnailPhoto(username);
                try
                {
                    HttpContext.Session.Add("ThumbnailPhoto", thumbnailPhoto);
                    HttpContext.Session.Add("Name", Request.Cookies["Name"].Value.ToString());
                    HttpContext.Session.Add("Position", Request.Cookies["Position"].Value.ToString());
                    HttpContext.Session.Add("EmployeeNumber", Request.Cookies["EmployeeNumber"].Value.ToString());
                }
                catch { }

                //get the enrolled equipments of the user
                var enrolledEquipments = HttpHandler.GetEnrolledEquipments(username);

                int count = 0;
                try
                {
                    count = enrolledEquipments.Count;
                }
                catch
                {
                    count = 0;
                }

                //loop the equipments and create cookie
                string equipments = "";
                if (count > 0)
                {
                    foreach (var x in enrolledEquipments)
                    {
                        equipments += x.Equipment + ",";
                    }
                    equipments += ")";
                    equipments  = equipments.Replace(",)", "");
                }

                try
                {
                    HttpContext.Session.Add("Equipments", equipments);
                    HttpCookie cookieEquipments = new HttpCookie("Equipments");
                    cookieEquipments.Value = equipments;
                    DateTime now = DateTime.Now;
                    cookieEquipments.Expires = now.AddDays(30);
                    Response.Cookies.Add(cookieEquipments);
                }
                catch { }

                //get the module
                var modName = "Home";
                var module  = ModuleModels.getModule(modName);

                ViewBag.Title = "Cell Controller";

                bool check = false;

                if (module != null)
                {
                    //generate the menus
                    ViewBag.Menu = custom_helper.GenerateMenu(module.Id, module.ParentId, userType);
                    check        = true;
                    //ViewBag.PageHeader = modName + " / " + "Enrolled Machines";
                    ViewBag.PageHeader  = modName;
                    ViewBag.Breadcrumbs = "Enrolled Machines";
                }

                //check access for module, if no access redirect to error page
                if (ModuleModels.checkAccessForURL(userType, module.Id) && check)
                {
                    try
                    {
                        Session.Remove("ModuleErrorHeader");
                        Session.Remove("ModuleErrorBreadCrumbs");
                    }
                    catch { }
                    return(View(enrolledEquipments));
                }
                else
                {
                    Session.Add("ModuleErrorHeader", ViewBag.PageHeader);
                    Session.Add("ModuleErrorBreadCrumbs", ViewBag.Breadcrumbs);
                    return(RedirectToAction("Index", "Error"));
                }
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
コード例 #17
0
ファイル: ACModuleController.cs プロジェクト: ttcp112/FJ
        public PartialViewResult Delete(string id)
        {
            ModuleModels model = GetDetail(id);

            return(PartialView("_Delete", model));
        }
コード例 #18
0
        public List <MenuObject> GenerateMenu(int child, int parent, string usertype)
        {
            Dictionary <int, MenuObject> header = new Dictionary <int, MenuObject>();
            List <MenuObject>            res    = new List <MenuObject>();
            ModuleModels mod   = new ModuleModels();
            DataTable    dtMod = mod.GetAvailableModules();

            bool is_active = false;

            foreach (DataRow row in dtMod.Rows)
            {
                List <MenuObject> subitems = new List <MenuObject>();
                MenuObject        menuobj  = new MenuObject();

                Dictionary <string, object> details = new Dictionary <string, object>();
                is_active = false;
                if (Int32.Parse(row["ParentId"].ToString()) == 0)
                {
                    try
                    {
                        if (mod.validateParentModule(row["Id"].ToString()))
                        {
                            if (mod.validateAccess(usertype, row["Id"].ToString()))
                            {
                                if (Int32.Parse(row["Id"].ToString()) == parent || Int32.Parse(row["Id"].ToString()) == child)
                                {
                                    is_active = true;
                                }

                                menuobj.Id       = Int32.Parse(row["Id"].ToString());
                                menuobj.Name     = row["Name"].ToString();
                                menuobj.Icon     = row["Icon"].ToString();
                                menuobj.IsActive = is_active;
                                menuobj.URL      = row["URL"].ToString();

                                header.Add(Int32.Parse(row["Id"].ToString()), menuobj);

                                res.Add(menuobj);
                            }
                            else
                            {
                                if (mod.validateMenu(usertype, row["Id"].ToString()))
                                {
                                    if (Int32.Parse(row["Id"].ToString()) == parent || Int32.Parse(row["Id"].ToString()) == child)
                                    {
                                        is_active = true;
                                    }

                                    menuobj.Id       = Int32.Parse(row["Id"].ToString());
                                    menuobj.Name     = row["Name"].ToString();
                                    menuobj.Icon     = row["Icon"].ToString();
                                    menuobj.IsActive = is_active;
                                    menuobj.URL      = row["URL"].ToString();

                                    header.Add(Int32.Parse(row["Id"].ToString()), menuobj);

                                    res.Add(menuobj);
                                }
                            }
                        }
                    }
                    catch { }
                }
                else
                {
                    try
                    {
                        if (mod.validateAccess(usertype, row["Id"].ToString()))
                        {
                            if (Int32.Parse(row["Id"].ToString()) == child)
                            {
                                is_active = true;
                            }

                            menuobj.Id       = Int32.Parse(row["Id"].ToString());
                            menuobj.Name     = row["Name"].ToString();
                            menuobj.Icon     = row["Icon"].ToString();
                            menuobj.IsActive = is_active;
                            menuobj.URL      = row["URL"].ToString();

                            if (header[Int32.Parse(row["ParentId"].ToString())].Items != null)
                            {
                                subitems = header[Int32.Parse(row["ParentId"].ToString())].Items;
                            }

                            subitems.Add(menuobj);

                            header[Int32.Parse(row["ParentId"].ToString())].Items = subitems;
                        }
                    }
                    catch { }
                }
            }

            return(res);
        }
コード例 #19
0
        public Dictionary <string, object> GetAvailableModules(string _id, string _parentid)
        {
            ModuleModels modules = new ModuleModels();

            Dictionary <string, object> response         = new Dictionary <string, object>();
            Dictionary <string, object> menu             = new Dictionary <string, object>();
            Dictionary <string, object> submenu_temp_arr = new Dictionary <string, object>();
            List <object> submenu_header = new List <object>();
            List <object> z             = new List <object>();
            DataTable     dTableModules = modules.GetAvailabeModules();

            foreach (DataRow dataRow in dTableModules.Rows)
            {
                if (dataRow["ParentId"].ToString() == "0")
                {
                    bool   isActive = false;
                    string alvin    = dataRow["Id"].ToString();
                    if (_parentid == alvin)
                    {
                        isActive = true;
                    }
                    menu.Add(dataRow["Id"].ToString(),
                             new Dictionary <string, object> {
                        { "Id", dataRow["Id"].ToString() },
                        { "Name", dataRow["Name"].ToString() },
                        { "Icon", dataRow["Icon"].ToString() },
                        { "items", new List <object>() },
                        { "is_active", isActive },
                        { "URL", dataRow["URL"].ToString() },
                    }
                             );
                }
                else
                {
                    bool isActive = false;
                    if (_id == dataRow["Id"].ToString())
                    {
                        isActive = true;
                    }

                    Dictionary <string, object> submenu_details = new Dictionary <string, object>();
                    Dictionary <string, object> y = new Dictionary <string, object>();
                    submenu_details.Add("Id", dataRow["Id"].ToString());
                    submenu_details.Add("Name", dataRow["Name"].ToString());
                    submenu_details.Add("Icon", dataRow["Icon"].ToString());
                    submenu_details.Add("items", new Dictionary <string, object>());
                    submenu_details.Add("is_active", isActive);
                    submenu_details.Add("URL", dataRow["URL"].ToString());

                    //submenu_temp_arr.Add(dataRow["ParentId"].ToString(), submenu_details);

                    submenu_header.Add(submenu_details);
                    //menu.Add(dataRow["Id"].ToString(), new Dictionary<string, object>() {
                    //    { "items",submenu }
                    //});

                    if (menu.ContainsKey(dataRow["ParentId"].ToString()))
                    {
                        var x = menu[dataRow["ParentId"].ToString()];
                        y = x as Dictionary <string, object>;
                        z = y["items"] as List <object>;
                        z.Add(submenu_details);
                        y["items"] = z;
                    }

                    //foreach (DataColumn column in dTableModules.Columns)
                    //{
                    //    //ColumnName = column.ColumnName;
                    //    //ColumnData = dataRow[column].ToString();
                    //}
                    //Console.WriteLine("--- Row ---"); // Print separator.
                    //foreach (var item in dataRow.ItemArray) // Loop over the items.
                    //{
                    //    Console.Write("Item: "); // Print label.
                    //    Console.WriteLine(item); // Invokes ToString abstract method.
                    //}
                }
            }
            return(menu);
        }
コード例 #20
0
        public List <MenuObject> PrepareMenu(int child, int parent, string usertype, int userId)
        {
            Dictionary <int, MenuObject> header = new Dictionary <int, MenuObject>();
            List <MenuObject>            res    = new List <MenuObject>();
            ModuleModels mod       = new ModuleModels();
            DataTable    dtMod     = mod.GetAvailabeModules();
            DataTable    dtUserMod = mod.GetUserModules(userId);

            bool is_active = false;

            if (usertype == "superadmin")
            {
                foreach (DataRow row in dtMod.Rows)
                {
                    List <MenuObject> subitems = new List <MenuObject>();
                    MenuObject        menuobj  = new MenuObject();

                    Dictionary <string, object> details = new Dictionary <string, object>();
                    is_active = false;
                    if (Int32.Parse(row["ParentId"].ToString()) == 0)
                    {
                        if (Int32.Parse(row["Id"].ToString()) == parent || Int32.Parse(row["Id"].ToString()) == child)
                        {
                            is_active = true;
                        }

                        menuobj.Id       = Int32.Parse(row["Id"].ToString());
                        menuobj.Name     = row["Name"].ToString();
                        menuobj.Icon     = row["Icon"].ToString();
                        menuobj.IsActive = is_active;
                        menuobj.URL      = row["URL"].ToString();

                        header.Add(Int32.Parse(row["Id"].ToString()), menuobj);

                        res.Add(menuobj);
                    }
                    else
                    {
                        if (Int32.Parse(row["Id"].ToString()) == child)
                        {
                            is_active = true;
                        }

                        menuobj.Id       = Int32.Parse(row["Id"].ToString());
                        menuobj.Name     = row["Name"].ToString();
                        menuobj.Icon     = row["Icon"].ToString();
                        menuobj.IsActive = is_active;
                        menuobj.URL      = row["URL"].ToString();

                        if (header[Int32.Parse(row["ParentId"].ToString())].Items != null)
                        {
                            subitems = header[Int32.Parse(row["ParentId"].ToString())].Items;
                        }

                        subitems.Add(menuobj);

                        header[Int32.Parse(row["ParentId"].ToString())].Items = subitems;
                    }
                }
            }
            else
            {
                List <int> p = new List <int>();
                List <int> c = new List <int>();

                foreach (DataRow row in dtUserMod.Rows)
                {
                    p.Add(Int32.Parse(row["ParentId"].ToString()));
                    c.Add(Int32.Parse(row["ObjectId"].ToString()));
                }

                foreach (DataRow row in dtMod.Rows)
                {
                    List <MenuObject> subitems = new List <MenuObject>();
                    MenuObject        menuobj  = new MenuObject();

                    Dictionary <string, object> details = new Dictionary <string, object>();
                    is_active = false;
                    if (Int32.Parse(row["ParentId"].ToString()) == 0)
                    {
                        if (p.Contains(Int32.Parse(row["Id"].ToString())) || c.Contains(Int32.Parse(row["Id"].ToString())))
                        {
                            if (Int32.Parse(row["Id"].ToString()) == parent || Int32.Parse(row["Id"].ToString()) == child)
                            {
                                is_active = true;
                            }

                            menuobj.Id       = Int32.Parse(row["Id"].ToString());
                            menuobj.Name     = row["Name"].ToString();
                            menuobj.Icon     = row["Icon"].ToString();
                            menuobj.IsActive = is_active;
                            menuobj.URL      = row["URL"].ToString();

                            header.Add(Int32.Parse(row["Id"].ToString()), menuobj);

                            res.Add(menuobj);
                        }
                    }
                    else
                    {
                        if (c.Contains(Int32.Parse(row["Id"].ToString())))
                        {
                            if (Int32.Parse(row["Id"].ToString()) == child)
                            {
                                is_active = true;
                            }

                            menuobj.Id       = Int32.Parse(row["Id"].ToString());
                            menuobj.Name     = row["Name"].ToString();
                            menuobj.Icon     = row["Icon"].ToString();
                            menuobj.IsActive = is_active;
                            menuobj.URL      = row["URL"].ToString();

                            if (header[Int32.Parse(row["ParentId"].ToString())].Items != null)
                            {
                                subitems = header[Int32.Parse(row["ParentId"].ToString())].Items;
                            }

                            subitems.Add(menuobj);

                            header[Int32.Parse(row["ParentId"].ToString())].Items = subitems;
                        }
                    }
                }
            }

            return(res);
        }
コード例 #21
0
        public ActionResult Index()
        {
            //Check cookie and session variables for retaining login status
            //if true go to page, else return to login page
            if (HttpHandler.CheckSession())
            {
                string username       = Session["Username"].ToString();
                string userType       = UserModels.GetUserType(username);
                string thumbnailPhoto = UserModels.GetThumbnailPhoto(username);
                try
                {
                    HttpContext.Session.Add("ThumbnailPhoto", thumbnailPhoto);
                    HttpContext.Session.Add("Name", Request.Cookies["Name"].Value.ToString());
                    HttpContext.Session.Add("Position", Request.Cookies["Position"].Value.ToString());
                    HttpContext.Session.Add("EmployeeNumber", Request.Cookies["EmployeeNumber"].Value.ToString());
                }
                catch { }

                //get the module
                var modName = "User";
                var module  = ModuleModels.getModule(modName);

                ViewBag.Title = "Cell Controller";

                bool check = false;

                if (module != null)
                {
                    //generate the menus
                    ViewBag.Menu        = custom_helper.GenerateMenu(module.Id, module.ParentId, userType);
                    ViewBag.PageHeader  = module.ParentName + " / " + module.Name;
                    ViewBag.Breadcrumbs = module.Name;

                    check = true;
                }
                else
                {
                    check = false;
                }

                //check access for module, if no access redirect to error page
                if (ModuleModels.checkAccessForURL(userType, module.Id) && check)
                {
                    try
                    {
                        Session.Remove("ModuleErrorHeader");
                        Session.Remove("ModuleErrorBreadCrumbs");
                    }
                    catch { }
                    return(View());
                }
                else
                {
                    Session.Add("ModuleErrorHeader", ViewBag.PageHeader);
                    Session.Add("ModuleErrorBreadCrumbs", ViewBag.Breadcrumbs);
                    return(RedirectToAction("Index", "Error"));
                }
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }