宜昌华友原料库管理软件
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
3.8 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Xml;
namespace SiaSun.LMS.WPFClient.SYS
{
/// <summary>
/// INIT_TABLE_DATA.xaml 的交互逻辑
/// </summary>
public partial class INIT_TABLE_DATA : AvalonDock.DocumentContent
{
public INIT_TABLE_DATA()
{
InitializeComponent();
}
/// <summary>
/// 窗体加载
/// </summary>
private void DocumentContent_Loaded(object sender, RoutedEventArgs e)
{
//加载所有可初始化对象
this.LoadInitObjects();
}
//加载所有可初始化的对象
private void LoadInitObjects()
{
try
{
IList<Model.SYS_TABLE> listTable = null; //MainApp._I_SystemService.SYS_TABLE_GetList();
var query = from ls in listTable orderby ls.TABLE_NAME select ls;
foreach (Model.SYS_TABLE mSYS_TABLE in query)
{
TextBlock txtContent = new TextBlock();
txtContent.VerticalAlignment = System.Windows.VerticalAlignment.Center;
txtContent.Text = mSYS_TABLE.TABLE_NAME;
CheckBox chkBox = new CheckBox();
chkBox.Width = 200;
chkBox.FontSize = 18;
chkBox.Margin = new Thickness(10);
chkBox.Content = txtContent;
this.panelTableName.Children.Add(chkBox);
}
}
catch (Exception ex)
{
MainApp._MessageDialog.ShowException(ex);
}
}
/// <summary>
/// 点击按钮初始化
/// </summary>
private void Border_Click(object sender, RoutedEventArgs e)
{
Button btn = e.OriginalSource as Button;
if (btn != null)
{
switch (btn.Name)
{
case "btnOK":
this.StartExecute();
break;
}
}
}
/// <summary>
/// 开始执行初始化操作
/// </summary>
private void StartExecute()
{
if (MainApp._MessageDialog.ShowDialog("ConfirmExecute",null) == Sid.Windows.Controls.TaskDialogResult.Ok)
{
List<string> listTable = new List<string>();
foreach (CheckBox chkBox in this.panelTableName.Children)
{
if (chkBox.IsChecked == true)
{
listTable.Add((chkBox.Content as TextBlock).Text.ToString());
}
}
bool boolResult = true;
string strResult = string.Empty;
string[] arTable = listTable.ToArray();
try
{
MainApp._I_SystemService.SYS_Initialize(arTable, (this.chkInitCell.IsChecked == true));
}
catch (Exception ex)
{
boolResult = false;
strResult = ex.Message;
}
MainApp._MessageDialog.ShowResult(boolResult,strResult);
}
}
/// <summary>
/// 全选或反选
/// </summary>
private void chkAllCheck_Click(object sender, RoutedEventArgs e)
{
foreach (CheckBox chkBox in this.panelTableName.Children)
{
chkBox.IsChecked = !chkBox.IsChecked;
}
}
}
}