private static string GetCSType(HField field) { string f1 = ""; if (field.Type == HFieldType.NVARCHAR2 || field.Type == HFieldType.CLOB) { f1 = "String "; } else if (field.Type == HFieldType.NUMBER) { //通过长度是否大于0,判断是整数还是小数 if (field.Length > 0) { f1 = "Integer "; } else { f1 = "Double "; } } else if (field.Type == HFieldType.DATE) { f1 = "Date "; } return(f1); }
/// <summary> /// 从文本中添加字段 /// </summary> /// <param name="cells"></param> private void AddFieldByText(string[] cells) { HField Entity = new HField(); Entity.CHName = cells[0]; Entity.ENName = cells[1]; string strType = cells[2]; strType = strType.ToUpper(); HFieldType type = HFieldType.NVARCHAR2; if (strType.Contains("NUMBER") || strType.Contains("COUNTER")) { type = HFieldType.NUMBER; } else if (strType.Contains("NVARCHAR2") || strType.Contains("TEXT") || strType.Contains("MEMO")) { type = HFieldType.NVARCHAR2; } else if (strType.Contains("DATE") || strType.Contains("DATETIME")) { type = HFieldType.DATE; } else if (strType.Contains("FLOAT")) { type = HFieldType.FLOAT; } else if (strType.Contains("INTEGER")) { type = HFieldType.INT; } else if (strType.Contains("CLOB")) { type = HFieldType.CLOB; } else if (strType.Contains("VARBINARY")) { type = HFieldType.BINARY; } Entity.Type = type; if (cells.Length >= 4) { string strLength = cells[3]; int length = 0; if (!string.IsNullOrEmpty(strLength) && int.TryParse(strLength, out length) == true) { Entity.Length = length; } } m_Datas.Add(Entity); }
private void btnOK_Click(object sender, EventArgs e) { if (Entity == null) Entity = new HField(); Entity.CHName = txtCHName.Text; Entity.ENName = txtENName.Text; Entity.Type = (HFieldType)Enum.Parse(typeof(HFieldType), cmbType.SelectedItem.ToString(), false); Entity.Length = (int)nudLength.Value; this.DialogResult = DialogResult.OK; Close(); }
private void 除ToolStripMenuItem_Click(object sender, EventArgs e) { if (lvwMain.SelectedItems.Count <= 0) { return; } HField field = lvwMain.SelectedItems[0].Tag as HField; m_Datas.Remove(field); RefreshList(); }
private void btnOK_Click(object sender, EventArgs e) { if (Entity == null) { Entity = new HField(); } Entity.CHName = txtCHName.Text; Entity.ENName = txtENName.Text; Entity.Type = (HFieldType)Enum.Parse(typeof(HFieldType), cmbType.SelectedItem.ToString(), false); Entity.Length = (int)nudLength.Value; this.DialogResult = DialogResult.OK; Close(); }
private void 修改ToolStripMenuItem_Click(object sender, EventArgs e) { if (lvwMain.SelectedItems.Count <= 0) { return; } HField field = lvwMain.SelectedItems[0].Tag as HField; FormHDetail form = new FormHDetail(DetailFormUseState.Edit); form.Entity = field; if (form.ShowDialog() == DialogResult.OK) { RefreshList(); } }
private void 移ToolStripMenuItem_Click(object sender, EventArgs e) { if (lvwMain.SelectedItems.Count <= 0) { return; } HField field = lvwMain.SelectedItems[0].Tag as HField; int idx = m_Datas.IndexOf(field); if (idx < m_Datas.Count - 1) { m_Datas.Remove(field); m_Datas.Insert(idx + 1, field); RefreshList(); } }
private static string GetCSType(HField field) { string f1 = ""; if (field.Type == HFieldType.NVARCHAR2 || field.Type == HFieldType.CLOB) { f1 = "String "; } else if (field.Type == HFieldType.NUMBER) { //通过长度是否大于0,判断是整数还是小数 if (field.Length > 0) { f1 = "Integer "; } else { f1 = "Double "; } } else if (field.Type == HFieldType.DATE) { f1 = "Date "; } return f1; }