Skip to content

Commit

Permalink
Переработано форматиование номера версии.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChernenkoAV committed Sep 20, 2024
1 parent 0438481 commit c346829
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 26 deletions.
15 changes: 4 additions & 11 deletions src/Arcas.BL/SettingClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,6 @@ private TFSDBList(List<TfsDbLink> lfd)
public class VerDB
{
public long VersionBD { get; set; }
public DateTime DateVersion { get; set; } = DateTime.Now;
public override string ToString() =>
$"{VersionBD.ToString().PadLeft(6, '0')} {DateVersion:yyyy-MM-dd}";

public static implicit operator String(VerDB ver)
{
if (ver == null)
return null;

return ver.ToString();
}
}

public class TfsDbLink
Expand Down Expand Up @@ -94,6 +83,10 @@ public class UpdateDbSetting
/// </summary>
public String ScriptPartAfterBodyWithTran { get; set; }

/// <summary>
/// Формат версии
/// </summary>
public string FormatVersion { get; set; }
/// <summary>
/// Скрипт измемения значения версии БД
/// </summary>
Expand Down
12 changes: 6 additions & 6 deletions src/Arcas.BL/TfsDBSaveBL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public String SaveScript(

sendStat("Обработка файла версионности");

var verFileName = "_lastVer.xml";
var verFileName = "lastVer.json";
var pathVerFile = Path.Combine(tfsbl.Tempdir, verFileName);

if (tfsbl.GetLastFile(verFileName) == 0)
Expand All @@ -210,10 +210,9 @@ public String SaveScript(
if (!tfsbl.CheckOut(pathVerFile))
return "Извлечение файла текущей версии неуспешно. Повторите позже";

var curVerDB = pathVerFile.XMLDeserializeFromFile<VerDB>() ?? new VerDB();

curVerDB.VersionBD += 1;
curVerDB.DateVersion = new DateTimeOffset(DateTime.Now).DateTime;
var cvo = pathVerFile.JsonDeserealizeFromFile<VerDB>();
cvo.VersionBD += 1;
var curVerDB = String.Format(upsets.FormatVersion, cvo.VersionBD, DateTime.Now);

var scts = new List<string>();

Expand Down Expand Up @@ -268,7 +267,8 @@ public String SaveScript(
var fileNameNewVer = Path.Combine(tfsbl.Tempdir, curVerDB + ".sql");

File.WriteAllText(fileNameNewVer, sb.ToString());
curVerDB.XMLSerialize(pathVerFile);
File.WriteAllText(pathVerFile, cvo.JsonSerialize());

tfsbl.AddFile(fileNameNewVer);

sendStat("Кладем в шельву в TFS");
Expand Down
39 changes: 31 additions & 8 deletions src/Arcas.UI/Dialogs/CreateSettingUpdater.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/Arcas.UI/Dialogs/CreateSettingUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ private UpdateDbSetting dbSettingGet(DbTypeItem dbItem) =>
ScriptPartBeforeBodyWithTran = tbPartBeforescript.Text.GetNullIfIsNullOrWhiteSpace(),
ScriptPartAfterBodyWithTran = tbPartAfterScript.Text.GetNullIfIsNullOrWhiteSpace(),
ScriptUpdateVer = tbScriptUpdateVer.Text.GetNullIfIsNullOrWhiteSpace(),
FormatVersion = tbFormatVersion.Text.GetNullIfIsNullOrWhiteSpace(),
FormatBinary = new FormatBinaryData()
{
Prefix = tbFormatBinPrefix.Text,
Expand Down Expand Up @@ -134,6 +135,7 @@ private void dbSettingLoad(UpdateDbSetting upsets)
tbPartBeforescript.Text = upsets.ScriptPartBeforeBodyWithTran;
tbPartAfterScript.Text = upsets.ScriptPartAfterBodyWithTran;
tbScriptUpdateVer.Text = upsets.ScriptUpdateVer;
tbFormatVersion.Text = upsets.FormatVersion;

var formatBin = upsets.FormatBinary ?? new FormatBinaryData();
tbFormatBinPrefix.Text = formatBin.Prefix;
Expand Down Expand Up @@ -314,6 +316,14 @@ private void btPathFoldertoFileSet_Click(object sender, EventArgs e)
tbSetFileServerFolder_Validating(null, null);
}

private void tbNumberTask_Validating(object sender, System.ComponentModel.CancelEventArgs e)
{
if (tbNumberTask.Text.IsNullOrWhiteSpace())
errorTracker.SetError(tbNumberTask, "Не указан номер таски для чекина настроек");
else
errorTracker.SetError(tbNumberTask, null);
}

private void cmbDbConectionType_SelectedIndexChanged(object sender, EventArgs e)
{
if (cmbDbConectionType.SelectedIndex < 0)
Expand Down
2 changes: 1 addition & 1 deletion src/Arcas/Arcas.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<Prefer32Bit>false</Prefer32Bit>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ApplicationVersion>0.0.5</ApplicationVersion>
<ApplicationVersion>0.0.6</ApplicationVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down

0 comments on commit c346829

Please sign in to comment.