Ejemplo n.º 1
0
        private void btn_save_Click(object sender, RoutedEventArgs e)
        {
            string trcode = tb_code.Text;
            string trname = tb_name.Text;

            if (truckId == 0)
            {
                TruckInfo trInfo = new TruckInfo()
                {
                    Createtime = DateTime.Now,
                    Isvalid    = 1,
                    Updatetime = DateTime.Now
                };
                trInfo.Truckcode = trcode;
                trInfo.Truckname = trname;
                x_tService.Insert(trInfo);
            }
            else
            {
                x_tService.Update(() => new TruckInfo()
                {
                    Truckcode = trcode, Truckname = trname
                }, a => a.Id == truckId);
            }
            tb_code.Text = "";
            tb_name.Text = "";
            MsgBox.Show("保存成功");
            if (win_trIndex != null && win_trIndex.IsVisible)
            {
                win_trIndex.InitData();
            }
        }