|
1 | 1 | using DotNetNuke.Framework; |
2 | 2 | using Connect.LanguagePackManager.Core.Models.Texts; |
| 3 | +using System.Data.SqlClient; |
| 4 | +using System; |
| 5 | +using DotNetNuke.Data; |
| 6 | +using DotNetNuke.Data.PetaPoco; |
3 | 7 |
|
4 | 8 | namespace Connect.LanguagePackManager.Core.Repositories |
5 | 9 | { |
6 | | - public partial class TextRepository : ServiceLocator<ITextRepository, TextRepository>, ITextRepository |
| 10 | + public partial class TextRepository : ServiceLocator<ITextRepository, TextRepository>, ITextRepository |
| 11 | + { |
| 12 | + public TextBase AddText(int packageVersionId, int resourceFileId, string key, string value) |
7 | 13 | { |
8 | | - public TextBase AddText(int packageVersionId, int resourceFileId, string key, string value) |
9 | | - { |
10 | | - var text = new TextBase() |
11 | | - { |
12 | | - PackageVersionId = packageVersionId, |
13 | | - ResourceFileId = resourceFileId, |
14 | | - TextKey = key, |
15 | | - OriginalValue = value |
16 | | - }; |
17 | | - return AddText(text); |
18 | | - } |
| 14 | + var text = new TextBase() |
| 15 | + { |
| 16 | + PackageVersionId = packageVersionId, |
| 17 | + ResourceFileId = resourceFileId, |
| 18 | + TextKey = key, |
| 19 | + OriginalValue = value |
| 20 | + }; |
| 21 | + return AddText(text); |
19 | 22 | } |
20 | | - public partial interface ITextRepository |
| 23 | + |
| 24 | + public void RefreshNrTexts() |
21 | 25 | { |
22 | | - TextBase AddText(int packageVersionId, int resourceFileId, string key, string value); |
| 26 | + // We have to bypass the regular DB Context as we need to be able to set the timeout. This SPROC can take minutes to complete. |
| 27 | + var dbInst = DataProvider.Instance(); |
| 28 | + PetaPocoHelper.ExecuteNonQuery( |
| 29 | + dbInst.ConnectionString, |
| 30 | + System.Data.CommandType.StoredProcedure, |
| 31 | + (int)TimeSpan.FromMinutes(30).TotalSeconds, |
| 32 | + dbInst.DatabaseOwner + dbInst.ObjectQualifier + "Connect_LPM_RefreshNrTexts"); |
23 | 33 | } |
| 34 | + } |
| 35 | + public partial interface ITextRepository |
| 36 | + { |
| 37 | + TextBase AddText(int packageVersionId, int resourceFileId, string key, string value); |
| 38 | + void RefreshNrTexts(); |
| 39 | + } |
24 | 40 | } |
25 | 41 |
|
0 commit comments