private void config_Add() { ConfigItem first = txt_TextFirst.Value; ConfigItem last = txt_TextLast.Value; if (first == null || last == null || string.IsNullOrEmpty(first.Text) || string.IsNullOrEmpty(last.Text)) { MessageBox.Show("Please input text first and last config."); return; } IndexDynamic id = db.FindItemFirstByContainFieldValue(new CNSPLIT() { SITE = Domain, TEXT_FIRST = first.Text, TEXT_LAST = last.Text }, "SITE,TEXT_FIRST,TEXT_LAST"); if (id.Index == -1 || id.Item == null) { object o = new CNSPLIT() { SITE = Domain, TEXT_FIRST = first.Text, TEXT_LAST = last.Text, SKIP_LINE_BOTTOM = (byte)last.SkipLine, SKIP_LINE_TOP = (byte)first.SkipLine, }; object add = db.AddItem(o); if (add != null && add.GetType().Name != typeof(EditStatus).Name) { CNSPLIT val = add.Convert <CNSPLIT>(); list_TextFirst.Items.Insert(0, new ComboboxItem() { Value = val.ID, Text = first.SkipLine.ToString() + " | " + first.Text }); list_TextLast.Items.Insert(0, new ComboboxItem() { Value = val.ID, Text = last.SkipLine.ToString() + " | " + last.Text }); txt_TextFirst.Reset(); txt_TextLast.Reset(); } else { MessageBox.Show("Add object fail"); } } else { MessageBox.Show("Config exist"); } }