private bool pf_input_valid() { if (pdDate.SelectedDate == null || pdDate.Text == string.Empty) { Valid_Ani va1 = new Valid_Ani(); Ani_pdDate.BeginAnimation(SolidColorBrush.ColorProperty, va1.color_Ani); return(false); } if (pdUnit.Text == null || pdUnit.Text == string.Empty) { Valid_Ani va2 = new Valid_Ani(); Ani_pdUnit.BeginAnimation(SolidColorBrush.ColorProperty, va2.color_Ani); return(false); } if (planDate.SelectedDate == null || planDate.Text == string.Empty) { Valid_Ani va3 = new Valid_Ani(); Ani_planDate.BeginAnimation(SolidColorBrush.ColorProperty, va3.color_Ani); return(false); } if (PlanFix.Text == null || PlanFix.Text == string.Empty) { Valid_Ani va4 = new Valid_Ani(); Ani_planFix.BeginAnimation(SolidColorBrush.ColorProperty, va4.color_Ani); return(false); } return(true); } //验证函数
private void Record_Click(object sender, RoutedEventArgs e) //录入处理 按键事件 { if (Rec_info.站名 == "" || Rec_info.站名 == null) { Valid_Ani va = new Valid_Ani(); Ani_zn.BeginAnimation(SolidColorBrush.ColorProperty, va.color_Ani); Re_zn.GotFocus += Ani_Valid_gotFoc; return; } if (Rec_info.设备名称 == null || Rec_info.设备名称 == string.Empty) { Valid_Ani vd = new Valid_Ani(); Ani_eqName.BeginAnimation(SolidColorBrush.ColorProperty, vd.color_Ani); Re_eq.GotFocus += Ani_Valid_gotFoc; return; } if (Rec_info.存在问题 == null || Rec_info.存在问题 == string.Empty) { Valid_Ani vc = new Valid_Ani(); Ani_eqFault.BeginAnimation(SolidColorBrush.ColorProperty, vc.color_Ani); Re_eqfault.GotFocus += Ani_Valid_gotFoc; return; } if (Rec_info.发现时间 == null) { Valid_Ani vb = new Valid_Ani(); dptx.Background.BeginAnimation(SolidColorBrush.ColorProperty, vb.color_Ani); dptx.GotFocus += PART_TextBox_GotFocus; return; } if (eq_name_count > 0 && Rec_info.销记 == false) //更新 { wt_update(); } else { wt_insert_new(); } //GridUpdate("wt"); AllWT = myFuc.LoadWts(); mainGrid.ItemsSource = AllWT; init_zhname.ItemsSource = (from g in AllWT select g.站名).Distinct(); init_unit.ItemsSource = (from f in AllWT select f.受理单位).Distinct(); Re_zn.ItemsSource = (from g in AllWT select g.站名).Distinct(); //插入或更新后, 全局记录器 重置! g_wt_info_rec.Re_reset(Rec_info.站名); Rec_info = g_wt_info_rec.getWtRec(); Re_rows.DataContext = null; Re_rows.DataContext = Rec_info; edit_tips.Content = "存在问题"; edit_tips.Foreground = new SolidColorBrush(Colors.Black); }
private void Button_Click(object sender, RoutedEventArgs e) { if (x2.Text == null || x2.Text == string.Empty) { Valid_Ani va = new Valid_Ani(); Ani_x2.BeginAnimation(SolidColorBrush.ColorProperty, va.color_Ani); return; } if (x3.Text == null || x2.Text == string.Empty) { Valid_Ani vb = new Valid_Ani(); Ani_x3.BeginAnimation(SolidColorBrush.ColorProperty, vb.color_Ani); return; } if (x4.SelectedDate == null || x4.Text == string.Empty) { Valid_Ani vc = new Valid_Ani(); Ani_x4.BeginAnimation(SolidColorBrush.ColorProperty, vc.color_Ani); return; } using (jhbEntities ctx = new jhbEntities()) { var wt = (from g in ctx.WTs where g.站名 == _zn && g.问题编号 == _wtid select g).Single(); ctx.Entry(wt).Entity.销记时间 = x4.SelectedDate.Value.Date; ctx.Entry(wt).Entity.完成情况 = x1.Text; ctx.Entry(wt).Entity.整治情况 = x2.Text; ctx.Entry(wt).Entity.整治负责人 = x3.Text; ctx.Entry(wt).Entity.lastEdit = myFuc.getNowDateHashcode(); ctx.Entry(wt).Entity.销记 = true; ctx.Entry(wt).Entity.OpTrack = "X"; g_var.g_xj_flag = true; //窗口返回... g_var.g_chg_wt = ctx.Entry(wt).Entity; var pf = from g in ctx.PFs where g.站名 == _zn && g.问题编号 == _wtid select g; foreach (var pfitem in pf) { ctx.Entry(pfitem).Entity.ver1 = x4.SelectedDate.Value.Date.ToString("M月d日"); //销记时间 ctx.Entry(pfitem).Entity.ver2 = x1.Text; //完成情况 ctx.Entry(pfitem).Entity.ver3 = x2.Text; //整治情况 ctx.Entry(pfitem).Entity.var4 = x3.Text; //负责人 } ctx.SaveChanges(); } this.Close(); }