public string Imp_Src_Step3_Save() { string hidImpFields = this.GetRequestVal("hidImpFields"); string[] fields = hidImpFields.TrimEnd(',').Split(','); MapData md = new MapData(); md.No = this.FK_MapData; md.RetrieveFromDBSources(); string msg = "导入字段信息:"; bool isLeft = true; float maxEnd = md.MaxEnd; //底部. for (int i = 0; i < fields.Length; i++) { string colname = fields[i]; MapAttr ma = new MapAttr(); ma.KeyOfEn = colname; ma.Name = this.GetRequestVal("TB_Desc_" + colname); ma.FK_MapData = this.FK_MapData; ma.MyDataType = int.Parse(this.GetRequestVal("DDL_DBType_" + colname)); ma.MaxLen = int.Parse(this.GetRequestVal("TB_Len_" + colname)); ma.UIBindKey = this.GetRequestVal("TB_BindKey_" + colname); ma.MyPK = this.FK_MapData + "_" + ma.KeyOfEn; ma.LGType = BP.En.FieldTypeS.Normal; if (ma.UIBindKey != "") { SysEnums se = new SysEnums(); se.Retrieve(SysEnumAttr.EnumKey, ma.UIBindKey); if (se.Count > 0) { ma.MyDataType = BP.DA.DataType.AppInt; ma.LGType = BP.En.FieldTypeS.Enum; ma.UIContralType = BP.En.UIContralType.DDL; } SFTable tb = new SFTable(); tb.No = ma.UIBindKey; if (tb.IsExits == true) { ma.MyDataType = BP.DA.DataType.AppString; ma.LGType = BP.En.FieldTypeS.FK; ma.UIContralType = BP.En.UIContralType.DDL; } } if (ma.MyDataType == BP.DA.DataType.AppBoolean) { ma.UIContralType = BP.En.UIContralType.CheckBok; } if (ma.IsExits) { continue; } ma.Insert(); msg += "\t\n字段:" + ma.KeyOfEn + "" + ma.Name + "加入成功."; FrmLab lab = null; if (isLeft == true) { maxEnd = maxEnd + 40; /* 是否是左边 */ lab = new FrmLab(); lab.MyPK = BP.DA.DBAccess.GenerGUID(); lab.FK_MapData = this.FK_MapData; lab.Text = ma.Name; lab.X = 40; lab.Y = maxEnd; lab.Insert(); ma.X = lab.X + 80; ma.Y = maxEnd; ma.Update(); } else { lab = new FrmLab(); lab.MyPK = BP.DA.DBAccess.GenerGUID(); lab.FK_MapData = this.FK_MapData; lab.Text = ma.Name; lab.X = 350; lab.Y = maxEnd; lab.Insert(); ma.X = lab.X + 80; ma.Y = maxEnd; ma.Update(); } isLeft = !isLeft; } //重新设置. md.ResetMaxMinXY(); return(msg); }
void btn_Save_Click(object sender, EventArgs e) { var ts = new List <Tuple <string, string, int, int, int, int> >(); var colname = string.Empty; Tuple <string, string, int, int, int, int> t = null; HiddenField hid = null; MapData md = new MapData(); md.No = this.FK_MapData; md.RetrieveFromDBSources(); string msg = "导入字段信息:"; bool isLeft = true; float maxEnd = md.MaxEnd; //底部. foreach (Control ctrl in Pub1.Controls) { if (ctrl.ID == null || !ctrl.ID.StartsWith("HID_Idx_")) { continue; } hid = ctrl as HiddenField; colname = hid.ID.Substring("HID_Idx_".Length); MapAttr ma = new MapAttr(); ma.KeyOfEn = colname; ma.Name = this.Pub1.GetTBByID("TB_Desc_" + colname).Text; ma.FK_MapData = this.FK_MapData; ma.MyDataType = this.Pub1.GetDDLByID("DDL_DBType_" + colname).SelectedItemIntVal; ma.MaxLen = int.Parse(this.Pub1.GetTBByID("TB_Len_" + colname).Text); //ma.LGType = (BP.En.FieldTypeS)this.Pub1.GetDDLByID("DDL_LogicType_" + colname).SelectedItemIntVal; ma.UIBindKey = this.Pub1.GetTBByID("TB_BindKey_" + colname).Text; ma.MyPK = this.FK_MapData + "_" + ma.KeyOfEn; ma.LGType = BP.En.FieldTypeS.Normal; if (ma.UIBindKey != "") { SysEnums se = new SysEnums(); se.Retrieve(SysEnumAttr.EnumKey, ma.UIBindKey); if (se.Count > 0) { ma.MyDataType = BP.DA.DataType.AppInt; ma.LGType = BP.En.FieldTypeS.Enum; ma.UIContralType = BP.En.UIContralType.DDL; } SFTable tb = new SFTable(); tb.No = ma.UIBindKey; if (tb.IsExits == true) { ma.MyDataType = BP.DA.DataType.AppString; ma.LGType = BP.En.FieldTypeS.FK; ma.UIContralType = BP.En.UIContralType.DDL; } } if (ma.MyDataType == BP.DA.DataType.AppBoolean) { ma.UIContralType = BP.En.UIContralType.CheckBok; } if (ma.IsExits) { continue; } ma.Insert(); msg += "\t\n字段:" + ma.KeyOfEn + "" + ma.Name + "加入成功."; FrmLab lab = null; if (isLeft == true) { maxEnd = maxEnd + 40; /* 是否是左边 */ lab = new FrmLab(); lab.MyPK = BP.DA.DBAccess.GenerGUID(); lab.FK_MapData = this.FK_MapData; lab.Text = ma.Name; lab.X = 40; lab.Y = maxEnd; lab.Insert(); ma.X = lab.X + 80; ma.Y = maxEnd; ma.Update(); } else { lab = new FrmLab(); lab.MyPK = BP.DA.DBAccess.GenerGUID(); lab.FK_MapData = this.FK_MapData; lab.Text = ma.Name; lab.X = 350; lab.Y = maxEnd; lab.Insert(); ma.X = lab.X + 80; ma.Y = maxEnd; ma.Update(); } isLeft = !isLeft; } //重新设置. md.ResetMaxMinXY(); BP.Sys.PubClass.WinClose("OK"); }
/// <summary> /// 设计自由表单 /// </summary> /// <returns></returns> public string DFreeFrm() { FrmLabs labs = new Sys.FrmLabs(this.No); if (labs.Count == 0) { //进行初始化控件位置及标签 MapData md = new MapData(); md.No = this.No; md.RetrieveFromDBSources(); float maxEnd = 200; bool isLeft = true; #region 字段顺序调整 MapAttrs mapAttrs = new Sys.MapAttrs(md.No); foreach (MapAttr attr in mapAttrs) { if (attr.UIVisible == false) { continue; } //生成lab. FrmLab lab = null; if (isLeft == true) { maxEnd = maxEnd + 40; /* 是否是左边 */ lab = new FrmLab(); lab.MyPK = BP.DA.DBAccess.GenerGUID(); lab.FK_MapData = attr.FK_MapData; lab.Text = attr.Name; lab.FontName = "Arial"; lab.X = 40; lab.Y = maxEnd; lab.Insert(); attr.X = lab.X + 80; attr.Y = maxEnd; attr.Update(); } else { lab = new FrmLab(); lab.MyPK = BP.DA.DBAccess.GenerGUID(); lab.FK_MapData = attr.FK_MapData; lab.Text = attr.Name; lab.FontName = "Arial"; lab.X = 350; lab.Y = maxEnd; lab.Insert(); attr.X = lab.X + 80; attr.Y = maxEnd; attr.Update(); } isLeft = !isLeft; } #endregion #region 明细表重置排序 MapDtls mapDtls = new Sys.MapDtls(this.No); foreach (MapDtl dtl in mapDtls) { maxEnd = maxEnd + 40; /* 是否是左边 */ FrmLab lab = new FrmLab(); lab.MyPK = BP.DA.DBAccess.GenerGUID(); lab.FK_MapData = dtl.FK_MapData; lab.Text = dtl.Name; lab.FontName = "Arial"; lab.X = 40; lab.Y = maxEnd; lab.Insert(); dtl.X = lab.X + 80; dtl.Y = maxEnd; dtl.Update(); maxEnd = maxEnd + dtl.H; } #endregion md.ResetMaxMinXY(); } string url = "../../Admin/CCFormDesigner/FormDesigner.htm?FK_MapData=" + this.No + "&FromDtl=1&UserNo=" + BP.Web.WebUser.No + "&SID=" + Web.WebUser.SID + "&AppCenterDBType=" + BP.DA.DBAccess.AppCenterDBType + "&CustomerNo=" + BP.Sys.SystemConfig.CustomerNo; return(url); }