public void AlterField(int fieldId) { DataTable uitype = new DataTable(); uitype.Columns.Add("id"); uitype.Columns.Add("name"); uitype.Rows.Add(0, "hidden"); uitype.Rows.Add(1, "Text"); //uitype.Rows.Add(2, "DateTime"); //uitype.Rows.Add(3, "Int"); //uitype.Rows.Add(4, "Double"); uitype.Rows.Add(5, "combobox"); uitype.Rows.Add(6, "checkbox"); ((IfrmEditField)frmeditField).loadUitype(uitype); List <BaseGeneralDataUnit> unitList = NewObject <BaseGeneralDataUnit>().getlist <BaseGeneralDataUnit>(); ((IfrmEditField)frmeditField).loadUnitType(unitList); BaseGeneralField field = NewObject <BaseGeneralField>().getmodel(fieldId) as BaseGeneralField; frmeditField.currField = field; ((Form)frmeditField).Text = "修改字段"; ((Form)frmeditField).ShowDialog(); }
public void SaveField() { BaseGeneralField field = frmeditField.currField; field.save(); LoadFieldList(1, field.TitleId); }
//[AOP(typeof(AopTransaction))] public void InitFields(int titleId) { BaseGeneralTitle title = NewObject <BaseGeneralTitle>().getmodel(titleId) as BaseGeneralTitle; DataTable dt = NewDao <GeneralDao>().GetDbFields(title.TableName); List <BaseGeneralField> fields = new List <BaseGeneralField>(); try { //先删除原来数据 NewDao <GeneralDao>().DeleteField(titleId); //循环添加字段 for (int i = 0; i < dt.Rows.Count; i++) { BaseGeneralField field = NewObject <BaseGeneralField>(); field.FieldId = 0; field.TitleId = titleId; field.Name = dt.Rows[i]["remarks"] == DBNull.Value ? dt.Rows[i]["colname"].ToString() : dt.Rows[i]["remarks"].ToString(); field.ColName = dt.Rows[i]["colname"].ToString(); field.ColLength = Convert.ToInt32(dt.Rows[i]["length"]); field.DataType = dt.Rows[i]["typename"].ToString(); field.UiType = 0; field.DynamicSQL = ""; field.DataUnitId = "-1"; field.IsMust = dt.Rows[i]["nulls"].ToString() == "Y" ? 0 : 1; field.MatchRegular = ""; field.SortOrder = i; field.IsKey = dt.Rows[i]["_identity"].ToString() == "Y" ? 1 : 0; field.save(); } } catch (Exception e) { throw e; } }