机台信息管理页面修改
This commit is contained in:
commit
710672bfc0
3 files changed
+135
-18
No files matched your search
@@ -1,5 +1,8 @@
|
||||
using System;
|
||||
using Microsoft.VisualBasic;
|
||||
using SunlightAggregationManager.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection.PortableExecutable;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
@@ -9,6 +12,8 @@ using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using System.Xml.Linq;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace SunlightAggregationManager.UserWindow
|
||||
{
|
||||
@@ -17,29 +22,75 @@ namespace SunlightAggregationManager.UserWindow
|
||||
/// </summary>
|
||||
public partial class MachineSet : Window
|
||||
{
|
||||
private string _id = "";
|
||||
public MachineSet()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Button_Preservation(object sender, RoutedEventArgs e)
|
||||
{
|
||||
{
|
||||
Dictionary<string, object> _new = new Dictionary<string, object>();//缓存函数
|
||||
_new.Add("Name", _Name.Text);
|
||||
_new.Add("Machine", _Machine.Text);
|
||||
_new.Add("Model", GROUP.Text);
|
||||
_new.Add("IP", _IP.Text);
|
||||
_new.Add("MachineUser", _MachineUser.Text);
|
||||
_new.Add("MachinePassword", _MachinePassword.Text);
|
||||
_new.Add("Information", _inf.Text);
|
||||
_new.Add("State", 0);
|
||||
|
||||
var rowdata = MainWindowViewModel.Selet_Memory(MainWindowViewModel._machines, "ID", "ID='" + _id + "'");
|
||||
if (rowdata != null)
|
||||
{
|
||||
MainWindowViewModel.Updata_Memory(MainWindowViewModel._machines, "ID='" + _id + "'", _new);
|
||||
}
|
||||
else
|
||||
{
|
||||
MainWindowViewModel.Insert_Memory(MainWindowViewModel._machines, _new);// 执行插入
|
||||
}
|
||||
DataGridm.ItemsSource = MainWindowViewModel._machines.DefaultView;
|
||||
_Name.Text = null;
|
||||
_Machine.Text = null;
|
||||
_id = "";
|
||||
}
|
||||
|
||||
private void Button_Delete(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
MainWindowViewModel.Delete_Memory(MainWindowViewModel._machines, "ID='" + _id + "'");
|
||||
}
|
||||
catch (Exception) { }
|
||||
finally
|
||||
{
|
||||
DataGridm.ItemsSource = MainWindowViewModel._machines.DefaultView;
|
||||
_Name.Text = null;
|
||||
_Machine.Text = null;
|
||||
_id = "";
|
||||
}
|
||||
}
|
||||
|
||||
private void DataGridm_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
|
||||
int rownum = DataGridm.SelectedIndex;//获取鼠标选中行并定义变量
|
||||
if (rownum != -1)//判断鼠标定位是否有效
|
||||
{
|
||||
/*定位选中行及指定列单元格文本信息*/
|
||||
_id = (DataGridm.Columns[0].GetCellContent(DataGridm.Items[rownum]) as TextBlock)!.Text.Trim();//定位第列
|
||||
_Name.Text = (DataGridm.Columns[1].GetCellContent(DataGridm.Items[rownum]) as TextBlock)!.Text.Trim();//定位第列
|
||||
_Machine.Text = (DataGridm.Columns[2].GetCellContent(DataGridm.Items[rownum]) as TextBlock)!.Text.Trim();//定位第列
|
||||
GROUP.Text = (DataGridm.Columns[4].GetCellContent(DataGridm.Items[rownum]) as TextBlock)!.Text.Trim();
|
||||
_IP.Text = (DataGridm.Columns[5].GetCellContent(DataGridm.Items[rownum]) as TextBlock)!.Text.Trim();
|
||||
_MachineUser.Text = (DataGridm.Columns[6].GetCellContent(DataGridm.Items[rownum]) as TextBlock)!.Text.Trim();
|
||||
_MachinePassword.Text = (DataGridm.Columns[7].GetCellContent(DataGridm.Items[rownum]) as TextBlock)!.Text.Trim();
|
||||
_inf.Text = (DataGridm.Columns[8].GetCellContent(DataGridm.Items[rownum]) as TextBlock)!.Text.Trim();
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
DataGridm.ItemsSource = MainWindowViewModel._machines.DefaultView;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user