//Function to get All tabs
        /// <summary>
        /// Gets the tabs.
        /// </summary>
        /// <returns></returns>
        public ActionResult GetTabs()
        {
            TabsBal     objTabsBal = new TabsBal();
            List <Tabs> tabsList   = objTabsBal.GetAllTabs();

            return(PartialView(PartialViews.TabsList, tabsList));
        }
예제 #2
0
        /// <summary>
        /// Delete the current Tabs based on the Tabs ID passed in the TabsModel
        /// </summary>
        /// <param name="tabId"></param>
        /// <returns></returns>
        public ActionResult DeleteTabs(string tabId)
        {
            using (var tabsBal = new TabsBal())
            {
                //Get Tabs model object by current Tabs ID
                var model = tabsBal.GetTabByTabId(Convert.ToInt32(tabId));

                //Check If Tabs model is not null
                if (model != null)
                {
                    model.IsDeleted   = true;
                    model.DeletedBy   = Helpers.GetLoggedInUserId();
                    model.DeletedDate = Helpers.GetInvariantCultureDateTime();

                    //Update Operation of current Tabs
                    var result = tabsBal.AddUpdateTab(model);

                    //Rebind the Session of Menu Tabs List
                    ReBindTabsMenu();

                    //return deleted ID of current Tabs as Json Result to the Ajax Call.
                    return(Json(result));
                }
            }

            //Return the Json result as Action Result back JSON Call Success
            return(Json(null));
        }
예제 #3
0
 /// <summary>
 /// Checks if duplicate record exists.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="tabId">The tab identifier.</param>
 /// <param name="parentTabId">The parent tab identifier.</param>
 /// <returns></returns>
 public ActionResult CheckIfDuplicateRecordExists(string name, string tabId, string parentTabId)
 {
     using (var bal = new TabsBal())
     {
         var result = bal.CheckIfDuplicateRecordExists(name, string.IsNullOrEmpty(tabId) ? 0 : Convert.ToInt32(tabId), string.IsNullOrEmpty(parentTabId) ? 0 : Convert.ToInt32(parentTabId));
         return(Json(result));
     }
 }
 /// <summary>
 /// Gets the tabs assigned to facility.
 /// </summary>
 /// <param name="corporateId"></param>
 /// <param name="facilityId"></param>
 /// <returns></returns>
 public ActionResult GetTabsByCorporateAndFacility(int corporateId, int facilityId)
 {
     using (var bal = new TabsBal())
     {
         var tabList = bal.GetTabsByCorporateAndFacilityId(facilityId, corporateId);
         return(PartialView(PartialViews.TabsTreeView, tabList));
     }
 }
예제 #5
0
        /// <summary>
        /// Bind all the ModuleAccess list
        /// </summary>
        /// <returns>
        /// action result with the partial view containing the ModuleAccess list object
        /// </returns>
        public ActionResult BindModuleAccessList()
        {
            //Initialize the ModuleAccess BAL object
            using (var moduleAccessBal = new TabsBal())
            {
                var moduleAccessList = moduleAccessBal.GetTabsOnModuleAccessLoad(Helpers.GetLoggedInUserId(), isActive: true);

                //Pass the ActionResult with List of ModuleAccessViewModel object to Partial View ModuleAccessList
                return(PartialView(PartialViews.ModuleAccessTabView, moduleAccessList));
            }
        }
예제 #6
0
        /// <summary>
        /// Get the details of the current Tabs in the view model by ID
        /// </summary>
        /// <param name="tabId"></param>
        /// <returns></returns>
        public ActionResult GetTabById(string tabId)
        {
            using (var tabsBal = new TabsBal())
            {
                //Call the AddTabs Method to Add / Update current Tabs
                var currentTabs = tabsBal.GetTabByTabId(Convert.ToInt32(tabId));

                //Pass the ActionResult with the current TabsViewModel object as model to PartialView TabsAddEdit
                return(PartialView(PartialViews.TabsAddEdit, currentTabs));
            }
        }
        /// <summary>
        /// Gets the add update tab.
        /// </summary>
        /// <returns></returns>
        public ActionResult GetAddUpdateTab()
        {
            TabsBal objTabsBal = new TabsBal();
            TabView objTabView = new TabView
            {
                CurrentTab = new Tabs(),
                TabsList   = objTabsBal.GetAllTabs(),
            };

            return(PartialView(PartialViews.AddUpdateTabs, objTabView));
        }
예제 #8
0
 /// <summary>
 /// Gets the tab order by parent tab identifier.
 /// </summary>
 /// <param name="tabId">The tab identifier.</param>
 /// <returns></returns>
 public ActionResult GetTabOrderByParentTabId(int tabId)
 {
     if (tabId > 0)
     {
         using (var bal = new TabsBal())
         {
             var maxTabOrder = bal.GetMaxTabOrderByParentTabId(tabId);
             return(Json(maxTabOrder));
         }
     }
     return(Json(1));
 }
예제 #9
0
        /// <summary>
        /// Gets the parent tabs.
        /// </summary>
        /// <returns></returns>
        public ActionResult GetParentTabs()
        {
            //Initialize the Tabs BAL object
            using (var tabsBal = new TabsBal())
            {
                //Get the facilities list
                var list = tabsBal.GetAllTabs();

                //Pass the ActionResult with List of TabsViewModel object to Partial View TabsList
                return(Json(list));
            }
        }
예제 #10
0
        /// <summary>
        /// Bind all the Tabs list
        /// </summary>
        /// <returns>action result with the partial view containing the Tabs list object</returns>
        public ActionResult BindTabsList(bool showIsActive)
        {
            //Initialize the Tabs BAL object
            using (var tabsBal = new TabsBal())
            {
                //Get the facilities list
                var tabsList = new List <TabsCustomModel>(); //tabsBal.GetAllTabList(showIsActive, Helpers.GetLoggedInUserId());

                //Pass the ActionResult with List of TabsViewModel object to Partial View TabsList
                return(PartialView(PartialViews.TabsList, tabsList));
            }
        }
        /// <summary>
        /// Tabs this instance.
        /// </summary>
        /// <returns></returns>
        public ActionResult Tab()
        {
            TabsBal objTabsBal = new TabsBal();
            TabView objTabView = new TabView
            {
                CurrentTab = new Tabs(),
                TabsList   = objTabsBal.GetAllTabs(),
                //ScreenList = objScreenBal.GetAllScreensList()
            };

            return(View(objTabView));
        }
        /// <summary>
        /// Edits the tab.
        /// </summary>
        /// <param name="TabID">The tab identifier.</param>
        /// <returns></returns>
        public ActionResult EditTab(int TabID)
        {
            //ScreenBal objScreenBal = new ScreenBal();
            TabsBal objTabsBal = new TabsBal();
            TabView objTabView = new TabView
            {
                CurrentTab = objTabsBal.GetTabByTabId(TabID),
                TabsList   = objTabsBal.GetAllTabs(),
                //ScreenList = objScreenBal.GetAllScreensList()
            };

            return(PartialView(PartialViews.AddUpdateTabs, objTabView));
        }
        /// <summary>
        /// Deletes the tab.
        /// </summary>
        /// <param name="TabID">The tab identifier.</param>
        /// <returns></returns>
        public ActionResult DeleteTab(int TabID)
        {
            TabsBal objTabsBal = new TabsBal();
            Tabs    objTab     = objTabsBal.GetTabByTabId(TabID);

            objTab.IsDeleted   = true;
            objTab.DeletedBy   = Helpers.GetLoggedInUserId();
            objTab.DeletedDate = Helpers.GetInvariantCultureDateTime(); //To Do change it to server datetime
            var         i        = objTabsBal.AddUpdateTab(objTab);
            List <Tabs> tabsList = objTabsBal.GetAllTabs();

            return(PartialView(PartialViews.TabsList, tabsList));
        }
예제 #14
0
        /// <summary>
        /// Gets the corporate modules by corporate identifier.
        /// </summary>
        /// <param name="coporateId">The coporate identifier.</param>
        /// <returns></returns>
        public ActionResult GetCorporateModulesByCorporateID(int coporateId)
        {
            var tabsList = new List <TabsCustomModel>();

            using (var objTabsBal = new TabsBal())
            {
                tabsList = objTabsBal.GetParentCorporateFacilityTabList(coporateId, 0);
            }
            var selectedTabs = tabsList;

            return(PartialView(PartialViews.ModuleAccessTabView, selectedTabs));
            //return Json(selectedTabs);
        }
        /// <summary>
        /// Gets the tabs default to facility.
        /// </summary>
        /// <returns></returns>
        public ActionResult GetTabsDefaultToFacility()
        {
            var corporateId = Helpers.GetDefaultCorporateId();
            var facilityid  = Helpers.GetDefaultFacilityId();
            var objTabsBal  = new TabsBal();
            //var tabList =
            //    objTabsBal.GetCorporateFacilityTabList(corporateId, facilityid, null)
            //        .Where(t => t.CurrentTab.IsActive && !t.CurrentTab.IsDeleted)
            //        .ToList();

            var tabList = objTabsBal.GetTabsListInRoleTabsView(Helpers.GetLoggedInUserId(), facilityId: facilityid, corporateId: corporateId, isDeleted: false, isActive: true);

            return(PartialView(PartialViews.TabsTreeView, tabList));
        }
예제 #16
0
        public JsonResult GetTListJson()
        {
            //Initialize the Tabs BAL object
            var tabsBal = new TabsBal();

            //Get the Entity list
            var list       = tabsBal.GetAllTabList(true, Helpers.GetLoggedInUserId());
            var jsonResult = new
            {
                aaData = list.Select(t => new[] {
                    t.CurrentTab.TabName, t.CurrentTab.TabHierarchy, t.CurrentTab.Controller, t.CurrentTab.Action, t.CurrentTab.RouteValues,
                    t.ParentTabName, t.CurrentTab.TabId.ToString()
                })
            };

            return(Json(jsonResult, JsonRequestBehavior.AllowGet));
        }
예제 #17
0
        public ActionResult Index()
        {
            //Initialize the Tabs BAL object
            var tabsBal = new TabsBal();

            //Get the Entity list
            var list = tabsBal.GetAllTabList(true, Helpers.GetLoggedInUserId());

            //Intialize the View Model i.e. TabsView which is binded to Main View Index.cshtml under Tabs
            var tabsView = new TabsView
            {
                TabsList    = list,
                CurrentTabs = new Tabs {
                    IsActive = true, IsVisible = true
                }
            };

            //Pass the View Model in ActionResult to View Tabs
            return(View(tabsView));
        }
        public ActionResult AddTab(Tabs objTab)
        {
            TabsBal objTabsBal = new TabsBal();

            if (objTab.TabId > 0)
            {
                objTab.ModifiedBy   = Helpers.GetLoggedInUserId();
                objTab.ModifiedDate = Helpers.GetInvariantCultureDateTime();
                objTab.CreatedBy    = Helpers.GetLoggedInUserId();
                objTab.CreatedDate  = Helpers.GetInvariantCultureDateTime();
            }
            else
            {
                objTab.CreatedBy   = Helpers.GetLoggedInUserId();
                objTab.CreatedDate = Helpers.GetInvariantCultureDateTime();
            }
            var         i        = objTabsBal.AddUpdateTab(objTab);
            List <Tabs> tabsList = objTabsBal.GetAllTabs();

            return(PartialView(PartialViews.TabsList, tabsList));
        }
예제 #19
0
        /// <summary>
        /// Rebind tabs menu.
        /// </summary>
        private void ReBindTabsMenu()
        {
            //using (var usersBal = new UsersBal())
            //{
            //    if (Session[SessionNames.SessionClass.ToString()] != null)
            //    {
            //        var objSession = Session[SessionNames.SessionClass.ToString()] as SessionClass;
            //        if (objSession != null)
            //        {
            //            var tabsList = usersBal.GetTabsByUserName(objSession.UserName);
            //            objSession.MenuSessionList = tabsList;
            //        }
            //    }
            //}

            if (Session[SessionNames.SessionClass.ToString()] != null)
            {
                var s = Session[SessionNames.SessionClass.ToString()] as SessionClass;
                using (var bal = new TabsBal())
                    s.MenuSessionList = bal.GetTabsByRole(s.UserName, s.RoleId);
            }
        }
        /// <summary>
        /// Gets the modules assigned to facility.
        /// </summary>
        /// <param name="corporateId">The corporate identifier.</param>
        /// <param name="facilityId">The facility identifier.</param>
        /// <returns></returns>
        public ActionResult GetModulesAssignedToFacility(int corporateId, int facilityId)
        {
            using (var moduleRoleBal = new ModuleAccessBal())
            {
                //var moduleAccessList =
                //    moduleRoleBal.GetModulesAccessList(corporateId, facilityId)
                //        .ToList();

                //var objTabsBal = new TabsBal();
                //var tabList =
                //    objTabsBal.GetCorporateFacilityTabList(corporateId, facilityId, null)
                //        .Where(t => t.CurrentTab.IsActive && !t.CurrentTab.IsDeleted)
                //        .ToList();
                //var newlist = tabList.Where(
                //    t => (moduleAccessList.Any(z => z.TabID == t.CurrentTab.TabId))).ToList();
                IEnumerable <TabsCustomModel> newlist = new List <TabsCustomModel>();
                using (var tBal = new TabsBal())
                {
                    newlist = tBal.GetTabsListInRoleTabsView(Helpers.GetLoggedInUserId(), facilityId: facilityId, corporateId: corporateId, isDeleted: false, isActive: true);
                }
                return(PartialView(PartialViews.TabsTreeView, newlist));
            }
        }
 /// <summary>
 /// Gets the tabs assigned to facility.
 /// </summary>
 /// <param name="roleid">The roleid.</param>
 /// <returns></returns>
 public ActionResult GetTabsAssignedToFacility(int roleid)
 {
     using (var facilityRole = new FacilityRoleBal())
     {
         var facilityrole   = facilityRole.GetFacilityRolesByRoleId(roleid).FirstOrDefault();
         var corporateId    = Helpers.GetDefaultCorporateId();
         var facilityid     = Helpers.GetDefaultFacilityId();
         var loggedinuserid = Helpers.GetLoggedInUserId();
         if (facilityrole != null)
         {
             corporateId = facilityrole.CorporateId;
             facilityid  = facilityrole.FacilityId;
         }
         var objTabsBal = new TabsBal();
         var tabList    = objTabsBal.GetCorporateFacilityTabList(corporateId, facilityid, roleid).Where(t => t.CurrentTab.IsActive && !t.CurrentTab.IsDeleted)
                          .ToList();
         //IEnumerable<TabsCustomModel> tabList;
         //using (var mBal = new TabsBal())
         //{
         //    tabList = mBal.GetTabsOnModuleAccessLoad(loggedinuserid, roleid, facilityid, corporateId, false, true);
         //}
         return(PartialView(PartialViews.TabsTreeView, tabList));
     }
 }
예제 #22
0
        /// <summary>
        /// Add New or Update the Tabs based on if we pass the Tabs ID in the TabsViewModel object.
        /// </summary>
        /// <param name="model">pass the details of Tabs in the view model</param>
        /// <returns>returns the newly added or updated ID of Tabs row</returns>
        public ActionResult SaveTabs(Tabs model)
        {
            var pView = string.Empty;
            var rId   = Helpers.GetDefaultRoleId();

            using (var b = new TabsBal())
            {
                var result = b.SaveTab(model, Convert.ToInt64(rId), Helpers.GetLoggedInUserId(), Helpers.GetInvariantCultureDateTime());

                if (result.ExecutionStatus > 0)
                {
                    var vn = $"{partialViewPath}{PartialViews.TabsList}";
                    pView = RenderPartialViewToStringBase(vn, result.AllTabs);

                    if (Session[SessionNames.SessionClass.ToString()] != null && result.TabsByRole.Any())
                    {
                        var s = Session[SessionNames.SessionClass.ToString()] as SessionClass;
                        using (var bal = new TabsBal())
                            s.MenuSessionList = result.TabsByRole;
                    }
                }

                return(Json(new { pView, status = result.ExecutionStatus }, JsonRequestBehavior.AllowGet));
            }

            ////Initialize the newId variable
            //var newId = -1;

            ////Check if Tabs Model is not null
            //if (model != null)
            //{
            //    using (var bal = new TabsBal())
            //    {
            //        var isExists = bal.CheckIfDuplicateRecordExists(model.TabName, model.TabId, model.ParentTabId);
            //        if (isExists)
            //            return Json("-1");

            //        if (model.TabId > 0)
            //        {
            //            model.CreatedBy = Helpers.GetLoggedInUserId();
            //            model.CreatedDate = Helpers.GetInvariantCultureDateTime();
            //            model.ModifiedBy = Helpers.GetLoggedInUserId();
            //            model.ModifiedDate = Helpers.GetInvariantCultureDateTime();
            //        }
            //        else
            //        {
            //            model.CreatedBy = Helpers.GetLoggedInUserId();
            //            model.CreatedDate = Helpers.GetInvariantCultureDateTime();
            //        }

            //        //Call the AddTabs Method to Add / Update current Tabs
            //        newId = bal.AddUpdateTab(model);

            //        if (!bal.IsExistInRoleTabs(newId))
            //            bal.AddToRoleTab(newId);

            //        //Rebind the Session of Menu Tabs List
            //        ReBindTabsMenu();
            //    }
            //}
            //return Json(newId);
        }