public static string Messages(MessageFor messageTextFor, string currentItemName = "") { string messageText = ""; switch (messageTextFor) { case MessageFor.SucssesInsert: messageText = "Succsses Insert"; break; case MessageFor.SucssesUpdate: messageText = "Succsses Update"; break; case MessageFor.SucssesDelete: messageText = "Succsses Delete"; break; case MessageFor.ItemExistInDatabase: messageText = "" + currentItemName + " alreday exist.Please enter new " + currentItemName + " Name"; break; case MessageFor.TransactionCancel: messageText = "Transaction cancelled"; break; } return(messageText); }
public virtual void Hide(MessageFor hideMessageFor) { if (hideMessageFor == MessageFor.Addresser) { _hideForAddresser = true; } if (hideMessageFor == MessageFor.Addressee) { _hideForAddressee = true; } }
public GlobalMessage(string text, MessageType type, MessageFor msgFor, string registerer, List <string> forUsers) { ForUsers = new List <string>(); if (forUsers != null) { ForUsers = forUsers; } MessageId = Guid.NewGuid().ToString(); Text = text; Type = type; For = msgFor; Registrater = registerer; }
public static IQueryable<Message> CanShow(this IQueryable<Message> source, MessageFor hideMessageFor) { if (hideMessageFor == MessageFor.Addresser) { return source.Where(m => !m.HideForAddresser); } else if (hideMessageFor == MessageFor.Addressee) { return source.Where(m => !m.HideForAddressee); } else { throw new ArgumentException("unknown filter for hidding messages."); } }
public static IQueryable<Message> Get(this IQueryable<Message> source, int? addresserId, int? addresseeId, int? projectId, MessageFor hideMessageFor) { return source .From(addresserId) .To(addresseeId) .Project(projectId) .CanShow(hideMessageFor); }
private IList<User> getRawCommunicators(int? userId, MessageFor direction) { var result = _querySource.CanShow(direction); if (direction == MessageFor.Addresser) { return result .From(userId) .Select(m => m.Addressee) .Distinct().ToList(); } else { return result .To(userId) .Select(m => m.Addresser) .Distinct().ToList(); } }
private IList<UserModel> getCommunicators(int? userId, MessageFor direction) { IList<UserModel> models = new List<UserModel>(); IList<User> users = getRawCommunicators(userId, direction); models.FilledBy(users); return models; }
private IList<_LiteralLinkedModel> getProjects(int? userId, MessageFor direction) { IList<_LiteralLinkedModel> models = new List<_LiteralLinkedModel>(); var messages = _querySource.CanShow(direction); ; if (direction == MessageFor.Addresser) { messages = messages.From(userId); } else if (direction == MessageFor.Addressee) { messages = messages.To(userId); } var projects = messages .Select(m => m.Project) .Distinct() .ToList(); models.FilledBy(projects); return models; }