You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.1 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Microsoft.Extensions.DependencyInjection;
using SlnMesnac.Repository;
using SlnMesnac.Repository.service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* 版权所有 (c) 2024 WenJY 保留所有权利。
* CLR版本4.0.30319.42000
* 机器名称T14-GEN3-7895
* 命名空间SlnMesnac.WPF.ViewModel
* 唯一标识b5cb5a41-5885-475f-b182-9ea83f983978
*
* 创建者WenJY
* 电子邮箱:
* 创建时间2024-11-08 15:57:46
* 版本V1.0.0
* 描述:
*
*--------------------------------------------------------------------
* 修改人:
* 时间:
* 修改说明:
*
* 版本V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace SlnMesnac.WPF.ViewModel
{
public partial class CabinetUpdateViewModel : ObservableObject
{
private readonly Ibase_cabinet_infoServices _ibase_cabinet_infoServices;
public Action CloseAction { get; set; }
public CabinetUpdateViewModel(base_cabinet_info cabinet_Info)
{
CabinetInfo = cabinet_Info;
_ibase_cabinet_infoServices = App.ServiceProvider.GetService<Ibase_cabinet_infoServices>();
}
public base_cabinet_info _cabinetInfo = null;
public base_cabinet_info CabinetInfo
{
get => _cabinetInfo;
set => SetProperty(ref _cabinetInfo, value);
}
[RelayCommand]
private void SaveCabinetInfo()
{
if (_cabinetInfo != null)
{
if (_ibase_cabinet_infoServices.Update(_cabinetInfo))
{
MessageBox.Show($"电柜信息保存成功");
CloseAction?.Invoke();
}
else
{
MessageBox.Show($"电柜信息保存失败");
}
}
}
}
}