Skip to content

Commit

Permalink
优化删除
Browse files Browse the repository at this point in the history
  • Loading branch information
li-zheng-hao committed Nov 17, 2023
1 parent b6e84cd commit 24fb423
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
10 changes: 10 additions & 0 deletions LightDeployApp/Windows/AddEnvironment.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,18 @@
<TextBox Name="AuthKey" Width="200"></TextBox>
</StackPanel>
<Button Click="ButtonBase_OnClick">新增</Button>

</StackPanel>
</GroupBox>
<GroupBox Header="删除" Margin="5" >
<StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<Label Width="100">删除编号</Label>
<TextBox Name="Id" Width="200"></TextBox>
</StackPanel>
<Button Click="ButtonBase_OnClick2">删除(只需要填写环境名)</Button>
</StackPanel>

</GroupBox>
<GroupBox Header="修改" Margin="5">
<StackPanel>
Expand Down
18 changes: 13 additions & 5 deletions LightDeployApp/Windows/AddEnvironment.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,19 @@ private void ButtonBase_OnClick(object sender, RoutedEventArgs e)

private void ButtonBase_OnClick2(object sender, RoutedEventArgs e)
{
var num=DBHelper.GetClient().Deleteable<TEnvironment>()
.Where(it => it.Name == EnvironmentName.Text)
.ExecuteCommand();
MessageBox.Show($"删除{num}条数据");
AppContext.RefreshData();
if (int.TryParse(Id.Text,out var id))
{
var num=DBHelper.GetClient().Deleteable<TEnvironment>()
.Where(it => it.Id == id)
.ExecuteCommand();
MessageBox.Show($"删除{num}条数据");
AppContext.RefreshData();
}
else
{
MessageBox.Show("请输入编号数字");
}

}

private void SaveClick(object sender, RoutedEventArgs e)
Expand Down

0 comments on commit 24fb423

Please sign in to comment.