示例#1
0
        private void Save()
        {
            List <Hashtable> list = new List <Hashtable>();

            for (int i = 0; i < dataGridView1.RowCount; i++)
            {
                if (GetValue(dataGridView1, i, 0).Trim() == "")
                {
                    MessageBox.Show("有属性名称没有设定,请重新设定属性名称。");
                    return;
                }
                Hashtable data = new Hashtable();
                data.Add("fieldname", GetValue(dataGridView1, i, 0));
                data.Add("oldfieldname", GetValue(dataGridView1, i, "oldname"));
                data.Add("fieldtype", (comboBox1.SelectedIndex + 1).ToString());
                data.Add("datatype", GetValue(dataGridView1, i, 1));
                data.Add("allowunselect", GetValue(dataGridView1, i, 2) == "允许" ? "1" : "0");
                data.Add("allowinput", GetValue(dataGridView1, i, 3) == "允许" ? "1" : "0");
                data.Add("allowvisible", GetValue(dataGridView1, i, 6) == "允许" ? "1" : "0");
                data.Add("inputlist", GetValue(dataGridView1, i, 4));
                list.Add(data);
            }
            MapDBClass.InsertPropertyDefine(list, (comboBox1.SelectedIndex + 1).ToString(), comboBox1.SelectedItem.ToString());

            for (int i = 0; i < dataGridView1.RowCount; i++)
            {
                dataGridView1.Rows[i].Cells["isnewrow"].Value = "0";
                dataGridView1.Rows[i].Cells["oldname"].Value  = dataGridView1.Rows[i].Cells["fieldname"].Value;
            }
        }