public void DoUp() { this.DoOrderUp(MapAttrAttr.GroupID, this.GroupID.ToString(), MapAttrAttr.UIVisible, "1", MapAttrAttr.Idx); MapAttr attr = new MapAttr(); attr.MyPK = this.FK_MapData + "_Title"; if (attr.RetrieveFromDBSources() == 1) { attr.Idx = -1; attr.Update(); } }
public static void SaveMapAttr(string fk_mapdata, string fieldID, string shape, JsonData control, JsonData properties, string pks) { MapAttr attr = new MapAttr(); attr.FK_MapData = fk_mapdata; attr.KeyOfEn = fieldID; attr.MyPK = fk_mapdata + "_" + fieldID; attr.RetrieveFromDBSources(); //if (attr.KeyOfEn == "BiaoTi") //{ // int i = 11; //} //执行一次查询,以防止其他的属性更新错误. //if (pks.Contains("@" + attr.KeyOfEn + "@") == true) // attr.RetrieveFromDBSources(); switch (shape) { case "TextBoxStr": //文本类型. case "TextBoxSFTable": attr.LGType = En.FieldTypeS.Normal; attr.UIContralType = En.UIContralType.TB; break; case "TextBoxInt": //数值 attr.LGType = En.FieldTypeS.Normal; attr.MyDataType = DataType.AppInt; attr.UIContralType = En.UIContralType.TB; break; case "TextBoxBoolean": attr.MyDataType = DataType.AppBoolean; attr.UIContralType = En.UIContralType.CheckBok; attr.LGType = En.FieldTypeS.Normal; break; case "TextBoxFloat": attr.LGType = En.FieldTypeS.Normal; attr.UIContralType = En.UIContralType.TB; break; case "TextBoxMoney": attr.MyDataType = DataType.AppMoney; attr.LGType = En.FieldTypeS.Normal; attr.UIContralType = En.UIContralType.TB; break; case "TextBoxDate": attr.MyDataType = DataType.AppDate; attr.LGType = En.FieldTypeS.Normal; attr.UIContralType = En.UIContralType.TB; break; case "TextBoxDateTime": attr.MyDataType = DataType.AppDateTime; attr.LGType = En.FieldTypeS.Normal; attr.UIContralType = En.UIContralType.TB; break; case "DropDownListEnum": //枚举类型. attr.MyDataType = BP.DA.DataType.AppInt; attr.LGType = En.FieldTypeS.Enum; attr.UIContralType = En.UIContralType.DDL; break; case "DropDownListTable": //外键类型. attr.MyDataType = BP.DA.DataType.AppString; if (pks.Contains("@" + attr.KeyOfEn + "@") == false) { attr.LGType = En.FieldTypeS.FK; } attr.UIContralType = En.UIContralType.DDL; attr.MaxLen = 100; attr.MinLen = 0; break; default: break; } //坐标 JsonData style = control["style"]; JsonData vector = style["gradientBounds"]; attr.X = float.Parse(vector[0].ToJson()); attr.Y = float.Parse(vector[1].ToJson()); for (int iProperty = 0; iProperty < properties.Count; iProperty++) { JsonData property = properties[iProperty]; //获得一个属性. if (property == null || !property.Keys.Contains("property") || property["property"] == null || property["property"].ToString() == "group") { continue; } string val = null; if (property["PropertyValue"] != null) { val = property["PropertyValue"].ToString(); } string propertyName = property["property"].ToString(); switch (propertyName) { case "Name": if (attr.Name == "") { attr.Name = val; } break; case "MinLen": case "MaxLen": case "DefVal": attr.SetValByKey(propertyName, val); break; case "UIIsEnable": case "UIVisible": attr.SetValByKey(propertyName, val); break; case "FieldText": if (attr.Name == "") { attr.Name = val; } break; case "UIIsInput": if (val == "true") { attr.UIIsInput = true; } else { attr.UIIsInput = false; } break; case "UIBindKey": attr.UIBindKey = val; break; default: break; } } //Textbox 高、宽. decimal minX = decimal.Parse(vector[0].ToJson()); decimal minY = decimal.Parse(vector[1].ToJson()); decimal maxX = decimal.Parse(vector[2].ToJson()); decimal maxY = decimal.Parse(vector[3].ToJson()); decimal imgWidth = maxX - minX; decimal imgHeight = maxY - minY; attr.UIWidth = float.Parse(imgWidth.ToString("0.00")); attr.UIHeight = float.Parse(imgHeight.ToString("0.00")); // attr.ColSpan if (pks.Contains("@" + attr.KeyOfEn + "@") == true) { attr.Update(); } else { attr.Insert(); } }