public static DNHSiteMapCollection ReadWriteSiteMap(DNHUsers objUser) { DNHSiteMapCollection objSMaps = new DNHSiteMapCollection(); if (objUser != null) { //DNHSiteMapManager.GetAllByUser(objUser.DomainID, objUser.CompanyID, null); //save file string FileName = IOHelper.GetDirectory(string.Format(myConfig.UserSiteMapFolder, objUser.CompanyID) + objUser.UserName) + "\\sitemap.bin"; if (IOHelper.HasFile(FileName)) { //get form the file objSMaps = IOHelper.ReadFromBinaryFile <DNHSiteMapCollection>(FileName); } else { objSMaps = DNHSiteMapManager.GetAllByUser(objUser.UserName, objUser.CompanyID, null); //var nopConfig = if (objSMaps.Count > 0) { IOHelper.WriteToBinaryFile <IList <DNHSiteMap> >(FileName, objSMaps); } } objUser.UserSiteMaps = objSMaps; // Contract objContract = ContractManager.GetById(objEmp.EmployeeCode); //add UserSession HttpContext.Current.Session[SystemConfig.loginKey] = objUser; } return(objSMaps); }
public static DNHSiteMapCollection Search(SearchFilter value) { DNHSiteMapCollection items = new DNHSiteMapCollection(); //string key = string.Format(SETTINGS_Search_KEY, value.CompanyID+value.Keyword+value.Page+value.PageSize+value.OrderBy+value.OrderDirection) string key = string.Format(SETTINGS_Search_KEY, value.CompanyID, value.Keyword, value.Page, value.PageSize, value.OrderBy, value.OrderDirection, value.Condition); //string key = string.Format(SETTINGS_Search_KEY, value.Keyword, value.Page, value.PageSize, value.OrderBy, value.OrderDirection, value.Condition); if (SystemConfig.AllowSearchCache) { object obj2 = HttpCache.Get(key); if ((obj2 != null)) { return((DNHSiteMapCollection)obj2); } } using (var client = WebApiHelper.myclient(HouseEndpoint, SystemConst.APIJosonReturnValue)) { HttpResponseMessage response = client.PostAsJsonAsync(Resource + "?method=search", value).GetAwaiter().GetResult(); if (response.IsSuccessStatusCode) { items = response.Content.ReadAsAsync <DNHSiteMapCollection>().GetAwaiter().GetResult(); } } if (SystemConfig.AllowSearchCache & items.Count > 0) { HttpCache.Max(key, items); } return(items); }
public ContentResult Search(SearchFilter SearchKey) { SearchKey.OrderBy = string.IsNullOrEmpty(SearchKey.OrderBy) ? "NodeID" : SearchKey.OrderBy; DNHSiteMapCollection collection = DNHSiteMapManager.Search(SearchKey); return(Content(JsonConvert.SerializeObject(collection), "application/json")); }
/// <summary> /// use for scrolling page /// </summary> /// <returns></returns> public ContentResult GetPg(int page, int pagesize) { string condition = ""; SearchFilter SearchKey = SearchFilter.SearchPG(CurrentUser.CompanyID, page, pagesize, "NodeID", "NodeID", "Desc", condition); DNHSiteMapCollection objItem = DNHSiteMapManager.Search(SearchKey); return(Content(JsonConvert.SerializeObject(objItem), "application/json")); }
public static DNHSiteMapCollection GetParentSiteMap(int CompanyID) { DNHSiteMapCollection items = new DNHSiteMapCollection(); SearchFilter myFilter = BindSearch(CompanyID); myFilter.Condition = " ParentID is null "; items = Search(myFilter); return(items); }
public static DNHSiteMapCollection GetChildSiteMap(int CompanyID, Guid NodeID) { DNHSiteMapCollection items = new DNHSiteMapCollection(); SearchFilter myFilter = BindSearch(CompanyID); myFilter.Condition = " ParentID = '" + NodeID + "'"; items = Search(myFilter); return(items); }
public JsonResult GetGata([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel) { SearchFilter SearchKey = SearchFilter.SearchData(CurrentUser.CompanyID, requestModel, "NodeID", "NodeID"); DNHSiteMapCollection collection = DNHSiteMapManager.Search(SearchKey); int TotalRecord = 0; if (collection.Count > 0) { TotalRecord = collection[0].TotalRecord; } //DNHSiteMapCollection data = DNHSiteMapManager.GetAll(CurrentUser.CompanyID); return(Json(new DataTablesResponse(requestModel.Draw, collection, TotalRecord, TotalRecord), JsonRequestBehavior.AllowGet)); }
public DNHSiteMapCollection GetNodeByLevel(DNHUsers objUser, int Max) { myTree = new DNHSiteMapCollection(); MaxValue = Max; foreach (DNHSiteMap node in objUser.UserSiteMaps) { if (node.ParentID == null || node.ParentID == Guid.Empty) { DigNode(node, objUser.UserName, objUser.CompanyID, 0); } } return(myTree); }
public JsonResult GetSearchData([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel, string searchprm) { SearchFilter SearchKey = BindSearch(searchprm); SearchKey = SearchFilter.SearchData(SearchKey, requestModel); DNHSiteMapCollection collection = DNHSiteMapManager.Search(SearchKey); int TotalRecord = 0; if (collection.Count > 0) { TotalRecord = collection[0].TotalRecord; } return(Json(new DataTablesResponse(requestModel.Draw, collection, TotalRecord, TotalRecord), JsonRequestBehavior.AllowGet)); }
public static DNHSiteMapCollection Search(SearchFilter SearchKey) { DNHSiteMapCollection collection = new DNHSiteMapCollection(); using (var reader = SqlHelper.ExecuteReader("DNHSiteMap_Search", SearchFilterManager.SqlSearchParam(SearchKey))) { while (reader.Read()) { DNHSiteMap obj = new DNHSiteMap(); obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
public static bool CheckSiteMapPermission(DNHUsers CurrentUser, string controllerName, string actionName) { DNHSiteMapCollection result = CurrentUser.UserSiteMaps; bool isAllow = false; DNHSitemapAction objAction = null; DNHSiteMap objItem; //foreach (DNHSiteMap objItem in result) if (controllerName.ToLower() != "home") { for (int i = 0; i < result.Count; i++) { objItem = result[i]; if (objItem.Url.Trim().ToLower() == controllerName.ToLower()) { isAllow = true; // check user Action //objAction = CommonHelper.CheckActionPermission(objItem, actionName); //if (objAction != null) //{ // isAllow = objAction.Allow; // if (objItem.Access != objAction.ID) // { // objItem.Access = objAction.ID; // result[i] = objItem; // CurrentUser.UserSiteMaps = result; // } //} //isAllow = true; break; } } ; } else { isAllow = true; } if (!isAllow && CurrentUser.IsAdmin) { isAllow = true; } return(isAllow); }
/// <summary> /// ExportExcel File /// </summary> /// <returns></returns> public string ExportExcel() { DNHSiteMapCollection collection = DNHSiteMapManager.GetAll(CurrentUser.CompanyID); DataTable dt = collection.ToDataTable <DNHSiteMap>(); string fileName = "DNHSiteMap_" + SystemConfig.CurrentDate.ToString("MM-dd-yyyy"); string[] RemoveColumn = { "CompanyID", "TargetDisplayID", "ReturnDisplay", "TotalRecord", "CreatedUser", "CreatedDate" }; for (int i = 0; i < RemoveColumn.Length; i++) { if (dt.Columns.Contains(RemoveColumn[i])) { dt.Columns.Remove(RemoveColumn[i]); } } FileInputHelper.ExportExcel(dt, fileName, "DNHSiteMap List", false); return(fileName); }
private void DigNode(DNHSiteMap node, string UserName, int CompanyID, int level) { DNHSiteMapCollection child = DNHSiteMapManager.GetAllByUser(UserName, CompanyID, node.NodeID); if (level > MaxValue) { //Max = lvl; myTree.AddRange(child); } else { foreach (DNHSiteMap b in child) { DigNode(b, UserName, CompanyID, level + 1); } } }
public static DNHSiteMapCollection GetAllItem(int CompanyID) { DNHSiteMapCollection collection = new DNHSiteMapCollection(); var sqlParams = new SqlParameter[] { new SqlParameter("@CompanyID", CompanyID), }; using (var reader = SqlHelper.ExecuteReader("DNHSiteMap_GetAll", sqlParams)) { while (reader.Read()) { DNHSiteMap obj = new DNHSiteMap(); obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
public static DNHSiteMapCollection GetbyUser(string CreatedUser, int CompanyID, Guid?NodeID) { DNHSiteMapCollection collection = new DNHSiteMapCollection(); DNHSiteMap obj; var sqlParams = new SqlParameter[] { new SqlParameter("@UserName", CreatedUser), new SqlParameter("@CompanyID", CompanyID), new SqlParameter("@ParentNodeID", NodeID), }; using (var reader = SqlHelper.ExecuteReader("DNHSiteMap_GetByUserRoles", sqlParams)) { while (reader.Read()) { obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
public static DNHSiteMapCollection GetAll(int CompanyID) { DNHSiteMapCollection items = new DNHSiteMapCollection(); string key = String.Format(SETTINGS_ALL_KEY, CompanyID); object obj2 = HttpCache.Get(key); if ((obj2 != null)) { return((DNHSiteMapCollection)obj2); } using (var client = WebApiHelper.myclient(HouseEndpoint, SystemConst.APIJosonReturnValue)) { HttpResponseMessage response = client.GetAsync(string.Format(Resource + "?CompanyID={0}", CompanyID)).GetAwaiter().GetResult(); if (response.IsSuccessStatusCode) { items = response.Content.ReadAsAsync <DNHSiteMapCollection>().GetAwaiter().GetResult(); } } HttpCache.Max(key, items); return(items); }
public JsonResult GetSitemapNodeID([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel, Guid?NodeID) { SearchFilter SearchKey = SearchFilter.SearchData(CurrentUser.CompanyID, requestModel, "NodeID", "NodeID"); if (NodeID.HasValue && NodeID != Guid.Empty) { SearchKey.Condition = " (ParentID='" + NodeID + "') "; } else { SearchKey.Condition = " (ParentID is null) "; } DNHSiteMapCollection collection = DNHSiteMapManager.Search(SearchKey); int TotalRecord = 0; if (collection.Count > 0) { TotalRecord = collection[0].TotalRecord; } return(Json(new DataTablesResponse(requestModel.Draw, collection, TotalRecord, TotalRecord), JsonRequestBehavior.AllowGet)); }
public static DNHSiteMapCollection GetAllByUser(string CreatedUser, int CompanyID, Guid?NodeID = null) { DNHSiteMapCollection items = new DNHSiteMapCollection(); //string key = String.Format(SETTINGS_User_KEY, CreatedUser, CompanyID, NodeID); //object obj2 = HttpCache.Get(key); //if ((obj2 != null)) //{ // return (DNHSiteMapCollection)obj2; //} using (var client = WebApiHelper.myclient(HouseEndpoint, SystemConst.APIJosonReturnValue)) { HttpResponseMessage response = client.GetAsync(string.Format(Resource + "/GetbyUser?usr={0}&CompanyID={1}&NodeID={2}", CreatedUser, CompanyID, NodeID)).GetAwaiter().GetResult(); if (response.IsSuccessStatusCode) { items = response.Content.ReadAsAsync <DNHSiteMapCollection>().GetAwaiter().GetResult(); } } //HttpCache.Max(key, items); return(items); }
public ContentResult SiteGetAllPage() { DNHSiteMapCollection collection = DNHSiteMapManager.GetAll(CurrentUser.CompanyID); return(Content(JsonConvert.SerializeObject(collection), "application/json")); }