public List <MenuPagingDto> GetTreeMenu(SurePortalModules module, string code) { try { using (_dbContextScopeFactory.CreateReadOnly()) { var iquery = _menuRepository.GetAll() .Where(x => x.ActiveFag != CommonUtility.ActiveFag.Delete) .GroupJoin(_navNodeRepository.GetAll() .Where(x => x.ActiveFag == CommonUtility.ActiveFag.Active && x.Status != CommonValues.NavNode.NavNodeStatus.Ignore), mn => mn.NavNodeId, nav => nav.Id, (mn, nav) => new { mn, nav = nav.DefaultIfEmpty() }) .SelectMany(z => z.nav.Select(nv => new { z.mn, nv })) .Select(x => new { x.mn, NavName = x.nv.Name, x.nv.Areas, x.nv.Controller, x.nv.Action, x.nv.Params, NavURL = x.nv.URL, }); iquery = iquery.Where(x => x.mn.Code.ToLower().Contains(code) && x.mn.TypeModule == module); var total = iquery.Count(); var data = iquery .OrderBy(x => x.mn.Code) .ThenBy(x => x.mn.Order) .Select(x => new MenuPagingDto { Id = x.mn.Id, Code = x.mn.Code, ParentId = x.mn.ParentId, NavNodeId = x.mn.NavNodeId, Layout = x.mn.Layout, TypeModule = x.mn.TypeModule, Status = x.mn.Status, Name = x.mn.Name, Icon = x.mn.Icon, Areas = x.Areas, Controller = x.Controller, Action = x.Action, Params = x.Params }) .ToList(); return(data); } } catch (Exception ex) { } return(new List <MenuPagingDto>()); }
public static SendMessageData CreateSyncDataMessage(string body, string imageUrl, SurePortalModules module, Guid?objectId = null) { var message = new SendMessageData() { Id = Guid.NewGuid(), Action = ActionType.SyncData, Title = $"{ActionType.SyncData.ToString()}-{DateTime.Now.ToString("dd/MM/yyyy HH:mm")}", Body = body, ImageUrl = imageUrl, CustomData = new Dictionary <string, string>(), Module = module }; message.CustomData.Add("Module", module.ToString()); if (objectId.HasValue) { message.CustomData.Add("ObjectId", objectId.Value.ToString()); } return(message); }
public static SendMessageData CreateDisplayMessage(string title, string body, string imageUrl, SurePortalModules module, Guid?objectId = null) { var message = new SendMessageData() { Id = Guid.NewGuid(), Action = ActionType.Display, Title = title, Body = body, ImageUrl = imageUrl, CustomData = new Dictionary <string, string>(), Module = module }; message.CustomData.Add("Module", module.ToString()); if (objectId.HasValue) { message.CustomData.Add("ObjectId", objectId.Value.ToString()); } return(message); }
public async Task <MobileResponse <SendMessageResponse> > TestSyncDataFirebase(SurePortalModules module, string body, string imageUrl, Guid?objectId) { try { var firebaseService = new FirebaseServices(_userDeviceServices, _loggerServices); var message = SendMessageData.CreateSyncDataMessage(body, imageUrl, module, objectId); var result = await firebaseService.SendMessageAsync(message, new List <Guid>() { CurrentUser.Id }); return(MobileResponse <SendMessageResponse> .Create(MobileStatusCode.Success, null, result)); } catch (Exception ex) { _loggerServices.WriteError(ex.ToString()); return(MobileResponse <SendMessageResponse> .Create(MobileStatusCode.Error, ex.ToString(), null)); } }