private string FormatBigRateItem( MessageRates rateType, int rateMultiplier, DateTime rateDate, string forumName, string forumDesc, bool forumInTop, int msgID, string msgSubj, bool msgIsRead, bool msgIsMarked, int?msgArticleID, int userID, UserClass userClass, string userDisplayName, bool even) { return(string.Format(_templateBigRateItem, FormatForum(forumName, forumDesc), FormatSubject( msgID, msgSubj, msgIsRead, msgIsMarked, msgArticleID, true), FormatRate(rateType, rateMultiplier, forumInTop), FormatAuthor( userID, userClass, userDisplayName, false), FormatDate(rateDate), even ? _selectorEven : _selectorUneven)); }
public void Add(int mid, MessageRates rate) { using (var db = _provider.CreateDBContext()) { if (rate == MessageRates.DeleteLocally) db .OutboxRates(r => r.MessageID == mid) .Delete(); else { var id = db .OutboxRates(r => r.RateType == rate && r.MessageID == mid) .Select(r => (int?)r.ID) .SingleOrDefault(); if (id == null) db .OutboxRates() .Value(_ => _.RateType, rate) .Value(_ => _.MessageID, mid) .Insert(); else db .OutboxRates(r => r.ID == id) .Set(_ => _.RateType, _ => rate) .Update(); } } Refresh(); }
private void CustomInitializeComponents(MessageRates rate) { _lblInfo.Text = SR.Forum.RateForm.AddRate; var styler = _provider.GetRequiredService <IStyleImageManager>(); switch (rate) { case MessageRates.Plus1: _pbxRateImage.Image = styler.GetImage( "MessageViewer\\RatePlus1", StyleImageType.Small); break; case MessageRates.Agree: _pbxRateImage.Image = styler.GetImage( "MessageViewer\\RateAgree", StyleImageType.Small); break; case MessageRates.DisAgree: _pbxRateImage.Image = styler.GetImage( "MessageViewer\\RateDisagree", StyleImageType.Small); break; case MessageRates.Rate1: _pbxRateImage.Image = styler.GetImage( "MessageViewer\\Rate1", StyleImageType.Small); break; case MessageRates.Rate2: _pbxRateImage.Image = styler.GetImage( "MessageViewer\\Rate2", StyleImageType.Small); break; case MessageRates.Rate3: _pbxRateImage.Image = styler.GetImage( "MessageViewer\\Rate3", StyleImageType.Small); break; case MessageRates.Smile: _pbxRateImage.Image = styler.GetImage( "MessageViewer\\RateSmile", StyleImageType.Small); break; case MessageRates.DeleteRate: _pbxRateImage.Image = styler.GetImage( "MessageViewer\\RateX", StyleImageType.Small); _lblInfo.Text = SR.Forum.RateForm.DeleteRate; break; case MessageRates.DeleteLocally: _lblInfo.Text = SR.Forum.RateForm.DeleteRateLocally; break; } }
/// <summary> /// Возвращает путь к иконке с оценкой. /// </summary> /// <param name="provider"></param> /// <param name="rate">Оценка.</param> /// <returns>Путь к иконке с оценкой.</returns> public static string GetRateImagePath( IServiceProvider provider, MessageRates rate) { switch (rate) { case MessageRates.Rate1: case MessageRates.Rate2: case MessageRates.Rate3: return(GetImageUri(provider, @"MessageViewer\" + rate, StyleImageType.Small)); } return(GetImageUri(provider, @"MessageViewer\Rate" + rate, StyleImageType.Small) ?? string.Empty); }
public RateMark( RateMarkCollection parent, int id, MessageRates rateType, string userNick, string subject, string forumName) { _parent = parent; _id = id; _rateType = rateType; _userNick = userNick; _subject = subject; _forumName = forumName; }
public RateMark( RateMarkCollection parent, int id, MessageRates rateType, string userNick, string subject, string forumName) { _parent = parent; _id = id; _rateType = rateType; _userNick = userNick; _subject = subject; _forumName = forumName; }
private string FormatRateItemWithDate( MessageRates rateType, int multiplier, bool forumInTop, int userId, UserClass userClass, string userDisplayName, DateTime rateDate, bool even) { return(string.Format(_templateRateItemWithDate, FormatRate(rateType, multiplier, forumInTop), FormatAuthor(userId, userClass, userDisplayName, false), FormatDate(rateDate), even ? _selectorEven : _selectorUneven)); }
private void CustomInitializeComponents(MessageRates rate) { _lblInfo.Text = SR.Forum.RateForm.AddRate; var styler = _provider.GetRequiredService<IStyleImageManager>(); switch (rate) { case MessageRates.Plus1: _pbxRateImage.Image = styler.GetImage( "MessageViewer\\RatePlus1", StyleImageType.Small); break; case MessageRates.Agree: _pbxRateImage.Image = styler.GetImage( "MessageViewer\\RateAgree", StyleImageType.Small); break; case MessageRates.DisAgree: _pbxRateImage.Image = styler.GetImage( "MessageViewer\\RateDisagree", StyleImageType.Small); break; case MessageRates.Rate1: _pbxRateImage.Image = styler.GetImage( "MessageViewer\\Rate1", StyleImageType.Small); break; case MessageRates.Rate2: _pbxRateImage.Image = styler.GetImage( "MessageViewer\\Rate2", StyleImageType.Small); break; case MessageRates.Rate3: _pbxRateImage.Image = styler.GetImage( "MessageViewer\\Rate3", StyleImageType.Small); break; case MessageRates.Smile: _pbxRateImage.Image = styler.GetImage( "MessageViewer\\RateSmile", StyleImageType.Small); break; case MessageRates.DeleteRate: _pbxRateImage.Image = styler.GetImage( "MessageViewer\\RateX", StyleImageType.Small); _lblInfo.Text = SR.Forum.RateForm.DeleteRate; break; case MessageRates.DeleteLocally: _lblInfo.Text = SR.Forum.RateForm.DeleteRateLocally; break; } }
public void ExecuteRateMessage(ICommandContext context, int[] messageIds, MessageRates rate) { using (var rateForm = new RateForm(context, rate)) if (rateForm.ShowDialog( context .GetRequiredService <IUIShell>() .GetMainWindowParent()) == DialogResult.Yes) { ForumCommandHelper .GetMessageIds(context, messageIds) .ForEach( msgId => context .GetRequiredService <IOutboxManager>() .RateMarks .Add(msgId, rate)); } }
public void Add(int mid, MessageRates rate) { using (var db = _provider.CreateDBContext()) { if (rate == MessageRates.DeleteLocally) { db .OutboxRates(r => r.MessageID == mid) .Delete(); } else { var id = db .OutboxRates(r => r.RateType == rate && r.MessageID == mid) .Select(r => (int?)r.ID) .SingleOrDefault(); if (id == null) { db .OutboxRates() .Value(_ => _.RateType, rate) .Value(_ => _.MessageID, mid) .Insert(); } else { db .OutboxRates(r => r.ID == id) .Set(_ => _.RateType, _ => rate) .Update(); } } } Refresh(); }
private string FormatRate( MessageRates rateType, int multiplier, bool forumInTop) { // Считается, что оценка обязательно есть, и она корректна var rt = string.Empty; if ((int)rateType > 0) { rt = (multiplier * (int)rateType).ToString(); if (forumInTop) // учёт специфичных форумов { rt = string.Format(@"<b>{0}</b>", rt); } rt += @" x "; } // 0 - rate text, 1 - path to rate icon return(string.Format(_templateRatePart, rt, JanusFormatMessage.GetRateImagePath(_serviceProvider, rateType))); }
public string GetRateImagePath(MessageRates rate) { return JanusFormatMessage.GetRateImagePath(_serviceProvider, rate); }
/// <summary> /// Возвращает путь к иконке с оценкой. /// </summary> /// <param name="provider"></param> /// <param name="rate">Оценка.</param> /// <returns>Путь к иконке с оценкой.</returns> public static string GetRateImagePath( IServiceProvider provider, MessageRates rate) { switch (rate) { case MessageRates.Rate1: case MessageRates.Rate2: case MessageRates.Rate3: return GetImageUri(provider, @"MessageViewer\" + rate, StyleImageType.Small); } return GetImageUri(provider, @"MessageViewer\Rate" + rate, StyleImageType.Small) ?? string.Empty; }
public RatesWindow(MessageRates rates) { InitializeComponent(); DataContext = rates; }
public RateForm(IServiceProvider provider, MessageRates rate) { _provider = provider; InitializeComponent(); CustomInitializeComponents(rate); }
public RateForm(IServiceProvider provider, MessageRates rate) { _provider = provider; InitializeComponent(); CustomInitializeComponents(rate); }
public void ExecuteRateMessage(ICommandContext context, int[] messageIds, MessageRates rate) { using (var rateForm = new RateForm(context, rate)) if (rateForm.ShowDialog( context .GetRequiredService<IUIShell>() .GetMainWindowParent()) == DialogResult.Yes) foreach (var msgId in ForumCommandHelper.GetMessageIds(context, messageIds)) context .GetRequiredService<IOutboxManager>() .RateMarks .Add(msgId, rate); }
public string GetRateImagePath(MessageRates rate) { return(JanusFormatMessage.GetRateImagePath(_serviceProvider, rate)); }
private string FormatRateItemWithDate( MessageRates rateType, int multiplier, bool forumInTop, int userId, UserClass userClass, string userDisplayName, DateTime rateDate, bool even) { return string.Format(_templateRateItemWithDate, FormatRate(rateType, multiplier, forumInTop), FormatAuthor(userId, userClass, userDisplayName, false), FormatDate(rateDate), even ? _selectorEven : _selectorUneven); }
private string FormatRate( MessageRates rateType, int multiplier, bool forumInTop) { // Считается, что оценка обязательно есть, и она корректна var rt = string.Empty; if ((int)rateType > 0) { rt = (multiplier * (int)rateType).ToString(); if (forumInTop) // учёт специфичных форумов rt = string.Format(@"<b>{0}</b>", rt); rt += @" x "; } // 0 - rate text, 1 - path to rate icon return string.Format(_templateRatePart, rt, JanusFormatMessage.GetRateImagePath(_serviceProvider, rateType)); }
private string FormatBigRateItem( MessageRates rateType, int rateMultiplier, DateTime rateDate, string forumName, string forumDesc, bool forumInTop, int msgID, string msgSubj, bool msgIsRead, bool msgIsMarked, int? msgArticleID, int userID, UserClass userClass, string userDisplayName, bool even) { return string.Format(_templateBigRateItem, FormatForum(forumName, forumDesc), FormatSubject( msgID, msgSubj, msgIsRead, msgIsMarked, msgArticleID, true), FormatRate(rateType, rateMultiplier, forumInTop), FormatAuthor( userID, userClass, userDisplayName, false), FormatDate(rateDate), even ? _selectorEven : _selectorUneven); }