public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var settings = DependencyService.Get <IAppSettings>(); var Controller = EnumExtensionMethods.GetEnumDescription(UserRole.Controller); var Admin = EnumExtensionMethods.GetEnumDescription(UserRole.Admin); var SiteAdmin = EnumExtensionMethods.GetEnumDescription(UserRole.SiteAdmin); ComplaintModel complaint = (ComplaintModel)value; if (complaint.ComplainStatus == (int)ComplaintStatusEnum.Pending || complaint.ComplainStatus == (int)ComplaintStatusEnum.Rejected) { if ((settings.UserRole.Equals(Controller) || settings.UserRole.Equals(Admin) || settings.UserRole.Equals(SiteAdmin)) && complaint.CreatedBy.Equals(settings.UserId)) { return(true); } else { if (!settings.UserRole.Equals(Controller) || settings.UserRole.Equals(Admin) || settings.UserRole.Equals(SiteAdmin)) { return(true); } return(false); } } else { return(false); } }
public static IEnumerable <EnumResponseModel> GetEnums <T>() { return((Enum.GetValues(typeof(T)).Cast <T>().Select( enu => new EnumResponseModel() { Name = enu.ToString(), Id = enu.To <int>(), Description = EnumExtensionMethods.GetEnumDescription <T>(enu.To <int>()) })).ToList()); }
public bool IsSiteAdmin() { var Admin = EnumExtensionMethods.GetEnumDescription(UserRole.SiteAdmin); if (_settings.UserRole.Equals(Admin)) { return(true); } else { return(false); } }
public bool IsController() { var Controller = EnumExtensionMethods.GetEnumDescription(UserRole.Controller); var Volunteer = EnumExtensionMethods.GetEnumDescription(UserRole.Volunteer); var Admin = EnumExtensionMethods.GetEnumDescription(UserRole.Admin); var SiteAdmin = EnumExtensionMethods.GetEnumDescription(UserRole.SiteAdmin); if (_settings.UserRole.Equals(Controller) || _settings.UserRole.Equals(Admin) || _settings.UserRole.Equals(SiteAdmin)) { return(true); } else { return(false); } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var settings = DependencyService.Get <IAppSettings>(); var Controller = EnumExtensionMethods.GetEnumDescription(UserRole.Controller); var Admin = EnumExtensionMethods.GetEnumDescription(UserRole.Admin); var SiteAdmin = EnumExtensionMethods.GetEnumDescription(UserRole.SiteAdmin); ComplaintModel status = (ComplaintModel)value; if ((settings.UserRole.Equals(Controller) || settings.UserRole.Equals(Admin) || settings.UserRole.Equals(SiteAdmin)) && status.ComplainStatus != (int)ComplaintStatusEnum.Registered && status.IsEmailSend == false) { return(true); } else { return(false); } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var settings = DependencyService.Get <IAppSettings>(); var Controller = EnumExtensionMethods.GetEnumDescription(UserRole.Controller); var Volunteer = EnumExtensionMethods.GetEnumDescription(UserRole.Volunteer); var Admin = EnumExtensionMethods.GetEnumDescription(UserRole.Admin); switch ((int)value) { case (int)ComplaintStatusEnum.Registered: { return(false); } case (int)ComplaintStatusEnum.Rejected: { return(true); } case (int)ComplaintStatusEnum.Verified: { if (settings.UserRole.Equals(Controller) || settings.UserRole.Equals(Admin)) { return(false); } return("Register"); } case (int)ComplaintStatusEnum.Pending: default: { return(true); } } }
public async Task SetComplaintOverviewData() { try { List <LowsModel> listLows = new List <LowsModel>(); listLows = await _complaintService.GetAllLows(_settings.UserId, _settings.UserCityId); RejectTextArea = ComplaintModelObj.CommentForRejection; Complaint = _complaintService.GetNonComplaint(); IsBusy = true; ComplaintModelObj = await _complaintService.GetNonComplaintModel(); var Controller = EnumExtensionMethods.GetEnumDescription(UserRole.Controller); var Admin = EnumExtensionMethods.GetEnumDescription(UserRole.Admin); if (ComplaintModelObj != null) { if (!string.IsNullOrEmpty(ComplaintModelObj.LowsId)) { List <int> SplitLows = new List <int>(); SplitLows = ComplaintModelObj.LowsId.Split(',')?.Select(Int32.Parse).ToList(); int i = 1; foreach (var item in listLows) { if (SplitLows.AnyExtended()) { if (SplitLows.Contains(item.ExternalId)) { item.LowsTitile = item.LowsTitile; item.NumberText = Convert.ToString(i); LowsList.Add(item); i++; } } } } ComplaintImagesDTOs = new ObservableCollection <ComplaintImagesDTO>(); if (!string.IsNullOrEmpty(ComplaintModelObj.Files)) { List <string> SplitFilePaths = new List <string>(); SplitFilePaths = ComplaintModelObj.Files.Split(',')?.ToList(); if (SplitFilePaths.AnyExtended()) { foreach (var item in SplitFilePaths) { ComplaintImagesDTOs.Add(new ComplaintImagesDTO() { ComplaintId = 0, FileType = "Image", FileImage = item }); } CheckHashFile(); } } } } catch (Exception ex) { } }