Example #1
0
 private void refreshTableInitData()
 {
     if (!File.Exists(data_file_path))
     {
         return;
     }
     data_profile = DBInitDataProfile.fromXMLFile(data_file_path);
     foreach (DBInitData data in data_profile.data_list)
     {
         int row = dgvData.Rows.Add();
         loadDataForRow(row, data);
     }
 }
Example #2
0
 private void cbTables_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     data_profile = null;
     if (cbTables.SelectedIndex >= 0)
     {
         table = parent.tables[cbTables.SelectedIndex];
     }
     else
     {
         table = null;
     }
     data_file_path = "";
     if (table != null)
     {
         data_file_path = root_path + table.table_name + file_ext;
     }
     loadCurrentInitialData();
 }
Example #3
0
        private void btnAdd_Click(object sender, System.EventArgs e)
        {
            if (table == null)
            {
                ExMessageBox.Show(this, "请选择一个数据表再进行操作!");
                return;
            }
            if (data_profile == null)
            {
                data_profile            = DBInitDataProfile.fromXMLFile(data_file_path);
                data_profile.table_name = table.table_name;
            }
            DBInitData data = new DBInitData(table);

            data_profile.data_list.Add(data);
            data_profile.toXmlFile(root_path);
            int row = dgvData.Rows.Add();

            loadDataForRow(row, data);
        }
Example #4
0
 private void btnClear_Click(object sender, System.EventArgs e)
 {
     if (table == null)
     {
         ExMessageBox.Show(this, "请选择一个数据表再进行操作!");
         return;
     }
     if (data_profile == null)
     {
         return;
     }
     if (ExMessageBox.Show(this, "将要清空当前数据表所有初始数据, 确认继续吗?清空后, 数据描述文件也将被删除.", "清空数据项", ExMessageBoxIcon.Warning, ExMessageBoxButton.YesNo) == DialogResult.No)
     {
         return;
     }
     try
     {
         File.Delete(data_file_path);
     }
     catch (Exception ex) { ExMessageBox.Show(this, "删除文件失败, 错误信息:" + ex.Message, "删除失败", ExMessageBoxIcon.Error); }
     data_profile = null;
     dgvData.Rows.Clear();
 }