Ejemplo n.º 1
0
        void savecheckset()
        {
            List <systemcheckset> ls = new List <systemcheckset>();

            try {
                systemcheckset s = new systemcheckset();
                s.throwvalue = Convert.ToDecimal(this.tb_throw.Text.Trim());
                // s.boundaryvalue = Convert.ToDecimal(this.tb_jmax .Text .Trim  ());
                s.count       = Convert.ToInt32(this.tb_jcount.Text.Trim());
                s.arry        = Convert.ToInt32(this.tb_jarry.Text.Trim());
                s.ishavejuser = (this.rb_true.IsChecked == null || this.rb_true.IsChecked == false) ? false : true;
                s.noticeshow  = (this.rb_show.IsChecked == null || this.rb_show.IsChecked == false) ? false : true;
                s.noticetime  = Convert.ToInt32(this.tb_hour.Text.Trim()).ToString("D2") + ":" + Convert.ToInt32(this.tb_min.Text.Trim()).ToString("D2") + ":" + Convert.ToInt32(this.tb_second.Text.Trim()).ToString("D2");
                s.noticedays  = this.tb_day.Text.Trim();
                ls.Add(s);
                if (SerializeXML <systemcheckset> .exit())
                {
                    SerializeXML <systemcheckset> .del();
                }
                SerializeXML <systemcheckset> .SaveList(ls);

                MessageAlert.Alert("设置成功!");
            }

            catch (Exception ex) { MessageAlert.Error("出错!" + ex); }
        }
Ejemplo n.º 2
0
 void savetester()
 {
     if (SerializeXML <TorqueTestModel> .exit())
     {
         SerializeXML <TorqueTestModel> .del();
     }
     SerializeXML <TorqueTestModel> .SaveList(ttmlist);
 }
        void saveErrorRang(errorrangset et)
        {
            errorrangset er = new errorrangset();

            er = et;
            try
            {
                er.speciesID    = this.cb_species.SelectedValue.ToString();
                er.speciesname  = (this.cb_species.SelectedItem as wrenchspecies).speciesName;
                er.rangmax      = Convert.ToDecimal(this.tb_max.Text.Trim());
                er.rangmin      = Convert.ToDecimal(this.tb_min.Text.Trim());
                er.errorrangMax = Convert.ToDecimal(this.tb_errormax.Text.Trim());
                er.errorrangMin = Convert.ToDecimal(this.tb_errormin.Text.Trim());
                er.errorrang    = _errorrangset.errorrangMin.ToString() + "~" + _errorrangset.errorrangMax.ToString();
                er.rangvalue    = this.tb_min.Text.Trim() + "~" + this.tb_max.Text.Trim();
            }
            catch
            {
                MessageAlert.Error("请填写正确的数值!"); return;
            }
            if (!string.IsNullOrEmpty(er.guid))
            {
                if (errorset.FindIndex(p => p.guid == er.guid) >= 0)
                {
                    errorset.RemoveAt(errorset.FindIndex(p => p.guid == er.guid));
                }
            }
            else
            {
                er.guid = Guid.NewGuid().ToString();
            }

            List <errorrangset> esl = errorset.FindAll(p => p.speciesname == er.speciesname);

            foreach (errorrangset e in esl)
            {
                if ((e.rangmin < er.rangmax && er.rangmax <= e.rangmax) || (e.rangmin <= er.rangmin && er.rangmin < e.rangmax))
                {
                    MessageAlert.Alert("设置数值范围重合!");
                    return;
                }
                if ((er.rangmax >= e.rangmax) && (er.rangmin <= e.rangmin))
                {
                    MessageAlert.Alert("设置数值范围重合!");
                    return;
                }
            }

            errorset.Add(er);
            if (SerializeXML <errorrangset> .exit())
            {
                SerializeXML <errorrangset> .del();
            }
            SerializeXML <errorrangset> .SaveList(errorset);

            getErrorRanng();
            Clear();
        }
        private void del_Click(object sender, RoutedEventArgs e)
        {
            if (this.dg_set.SelectedIndex < 0)
            {
                return;
            }

            errorrangset er = this.dg_set.SelectedItem as errorrangset;

            errorset.RemoveAt(errorset.FindIndex(p => p.guid == er.guid));
            if (SerializeXML <errorrangset> .exit())
            {
                SerializeXML <errorrangset> .del();
            }
            SerializeXML <errorrangset> .SaveList(errorset);

            getErrorRanng();
        }