private void window_Loaded(object sender, RoutedEventArgs e)
        {
            StandardDeviceDesModel model = DBControler.UnityIns.GetSSDesTotalRecord(_ID);

            //无法读取数据,故而直接报错
            if (model == null)
            {
                BottomPart.Log("读取数据出现错误!", LogMessage.LevelEnum.Error);
                this.window.Close();
                return;
            }
            else
            {
                //设置信息
                EquCode_TB.Text = model.EquCode;
                EquType_TB.Text = model.EquType;
                Tem_TB.Text     = model.Tem.GetDisplayString();

                StartWork_Part.SetMessage(model.StartWork);
                IdlingWork_Part.SetMessage(model.IdlingWork);
                IdlingBreak_Part.SetMessage(model.IdlingBreak);
                ReviseBegin_Part.SetMessage(model.ReviseBegin);
                ReviseWork_Part.SetMessage(model.ReviseWork);
                ReviseEnd_Part.SetMessage(model.ReviseEnd);
                DemWork_Part.SetMessage(model.DemWork);
                AdjWork_Part.SetMessage(model.AdjWork);
                HighBreak_Part.SetMessage(model.HighBreak);
            }
        }
Exemplo n.º 2
0
        public HistoryDetailsWindow(int id)
        {
            InitializeComponent();

            DeviceId = id;
            HistoryModel model = DBControler.UnityIns.GetHistoryTotalRecord(id);


            if (model == null)
            {
                BottomPart.Log("读取历史记录失败", LogMessage.LevelEnum.Error);
                this.window.Close();
                return;
            }

            HModel = model;

            EquCodeTB.Text = model.EquCode;
            EquTypeTB.Text = model.EquType;
            TemTB.Text     = model.Tem.GetDisplayString();
            DateTB.Text    = model.HDate + "  " + model.HTime;

            HistorySP.Children.Add(new HistoryDetailsLine(model.StartWork, "启动工况"));
            HistorySP.Children.Add(new HistoryDetailsLine(model.IdlingWork, "怠速工况"));
            HistorySP.Children.Add(new HistoryDetailsLine(model.IdlingBreak, "怠速断油"));
            HistorySP.Children.Add(new HistoryDetailsLine(model.ReviseBegin, "校正起作用"));
            HistorySP.Children.Add(new HistoryDetailsLine(model.ReviseWork, "校正工况"));
            HistorySP.Children.Add(new HistoryDetailsLine(model.ReviseEnd, "校正结束"));
            HistorySP.Children.Add(new HistoryDetailsLine(model.DemWork, "标定工况"));
            HistorySP.Children.Add(new HistoryDetailsLine(model.AdjWork, "调速工况"));
            HistorySP.Children.Add(new HistoryDetailsLine(model.HighBreak, "高速断油"));

            if (model.IsPass)
            {
                IsPassTB.Text = "合格";
            }
            else
            {
                IsPassTB.Text = "不合格";
            }
        }
Exemplo n.º 3
0
        public void AddAHistoryLine(HistoryModel model)
        {
            HistorySP.Children.Insert(0, new HistoryShortLine(model, (which) =>
            {
                MessageDialog mDialog = new MessageDialog(String.Format("油泵型号 : {0}\n记录时间 : {1}\n是否确认删除该历史记录?", which.EquTypeTB.Text, which.TimeAndDateTB.Text), true);

                if (mDialog.ShowDialog().Value)
                {
                    //确认需要删除
                    if (DBControler.UnityIns.DeleteHistoryRecord(which.GetHId()))
                    {
                        //成功删除
                        HistorySP.Children.Remove(which);
                    }
                    else
                    {
                        BottomPart.Log("删除历史记录失败", LogMessage.LevelEnum.Error);
                    }
                }
            }));
        }
        private void ETXButton_Click()
        {
            DialogBox.SaveFileDialog dialog = new DialogBox.SaveFileDialog();
            string filePath;

            dialog.Title      = "选择导出文件保存路径";
            dialog.Filter     = "xml File(*.xml)|*.xml";
            dialog.DefaultExt = "xml";
            //如果用户没有添加则自动添加扩展
            dialog.AddExtension = true;

            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                //文件路径
                filePath = dialog.FileName;
                StandardDeviceDesModel        model = DBControler.UnityIns.GetSSDesTotalRecord(_ID);
                List <StandardDeviceDesModel> list  = new List <StandardDeviceDesModel>();
                list.Add(model);

                SDDAndXml.SaveToXml(filePath, list);
                BottomPart.Log("导出成功", LogMessage.LevelEnum.Important);
            }
        }
Exemplo n.º 5
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                new DBControler();
                BottomPart.Log("数据库检查完成", LogMessage.LevelEnum.Normal);
            }
            catch (Exception)
            {
                //数据库连接失败,直接返回
                BottomPart.Log("数据库连接失败", LogMessage.LevelEnum.Error);
                return;
            }

            //实例化传输方式,这里作为测试实例化的是TCP/IP传输方式,但是使用的都是ITRANS抽象类
            new TcpIpTrans();

            List <HistoryModel> history = DBControler.UnityIns.GetHistoryAllShortRecord();

            for (int counter = 0; counter < history.Count; counter++)
            {
                AddAHistoryLine(history[counter]);
            }
        }