/// <summary> /// 获取市政路灯扩展信息 /// </summary> public object GetInfo(string where = "", object objModel = null, int flag = 0) { //路灯信息 RoadLampMDL = (new BLL.T_Project_RoadLamp_BLL().QueryRoadLamp_ByProjID(where)); //工程信息 objModel = Reflections.Control_Reflection(typeof(T_Projects), objModel, this.Controls, "txt_ld_", flag) as T_Projects; if (RoadLampMDL == null) { RoadLampMDL = new T_Project_RoadLamp(); } Reflections.Control_Reflection(typeof(T_Project_RoadLamp), RoadLampMDL, this.Controls, "txt_ld_", flag); return(objModel); }
public object GetInfo(string where = "", object objModel = null, int flag = 0) { if (cboStru.Items.Count == 0) { IList <MDL.T_Dict> ds2 = new ERM.BLL.T_Dict_BLL().FindByKeyWord("stru"); cboStru.DisplayMember = "displayname"; cboStru.ValueMember = "valuename"; cboStru.DataSource = ds2; } projectMDL = (new BLL.T_Projects_BLL()).Find(where); if (projectMDL == null) { projectMDL = new T_Projects(); } return(Reflections.Control_Reflection(typeof(T_Projects), projectMDL, this.Controls, "txt|cbo|dtp", flag)); }
/// <summary> /// 获取市政桥梁扩展信息 /// </summary> public object GetInfo(string where = "", object objModel = null, int flag = 0) { if (this.cbo_ql_stuructType.Items.Count == 0) { IList <MDL.T_Dict> ds2 = new ERM.BLL.T_Dict_BLL().FindByKeyWord("stru_brige"); this.cbo_ql_stuructType.DisplayMember = "displayname"; cbo_ql_stuructType.ValueMember = "valuename"; cbo_ql_stuructType.DataSource = ds2; } //桥梁信息 brigeMDL = (new BLL.T_Project_Brige_BLL().QueryBrige_ByProjID(where)); //工程信息 objModel = Reflections.Control_Reflection(typeof(T_Projects), objModel, this.Controls, "txt_ql_", flag) as T_Projects; if (brigeMDL == null) { brigeMDL = new T_Project_Brige(); } Reflections.Control_Reflection(typeof(T_Project_Brige), brigeMDL, this.Controls, "txt_ql_|cbo_ql_", flag); return(objModel); }
//private void SetControl(ControlCollection controls) //{ // for (int i = 0; i < controls.Count; i++) // { // if (controls[i].Name.ToLower().Contains("label")) // { // controls[i].ForeColor = Color.Black; // } // else // { // SetControl(controls[i].Controls); // } // } //} /// <summary> /// 获取市政交通工程扩展信息 /// 新增和更新操作获取数据的共用方法, /// Flag参数区分是控件赋值还是控件取值 /// </summary> public object GetInfo(string where, object objModel, int flag = 0) { //if (this.cbo_jt_jcxs.Items.Count == 0) //{ // IList<MDL.T_Dict> ds2 = new ERM.BLL.T_Dict_BLL().FindByKeyWord("sz_jcxs"); // cbo_jt_jcxs.DisplayMember = "displayname"; // cbo_jt_jcxs.ValueMember = "valuename"; // cbo_jt_jcxs.DataSource = ds2; //} //if (this.cbo_jt_mcxs.Items.Count == 0) //{ // IList<MDL.T_Dict> ds2 = new ERM.BLL.T_Dict_BLL().FindByKeyWord("sz_mcxs"); // cbo_jt_mcxs.DisplayMember = "displayname"; // cbo_jt_mcxs.ValueMember = "valuename"; // cbo_jt_mcxs.DataSource = ds2; //} trafficMDL = new T_Traffic_BLL().QueryTraffic_ByProjID(where); //如果为空,表示新增,创建一个用来接收控件数据的对象 if (trafficMDL == null) { trafficMDL = new T_Traffic(); if (ConfigurationManager.AppSettings["lockItem"].ToString() == "1") { //this.ContextMenuStrip = this.contextMenuStrip1; } } #region 获取或设置信息 //获取交通扩展主工程信息 trafficMDL = Reflections.Control_Reflection(typeof(T_Traffic), trafficMDL, this.Controls, "txt_jt_|cbo_jt_", flag) as T_Traffic; //主工程信息 objModel = Reflections.Control_Reflection(typeof(T_Projects), objModel, this.Controls, "txt_jt_", flag) as T_Projects; //获取交通工程附属扩展明细 detailList = new T_Traffic_Detail_BLL().QueryTraffic_ByProjID(trafficMDL.ID == null ? "" : trafficMDL.ID); //获取交通明细的类型字典 ERM.BLL.T_Dict_BLL dicData = new ERM.BLL.T_Dict_BLL(); list = dicData.FindByKeyWord("TrafficType"); //动态初始化管道信息控件 InitControl(((detailList.Count - 10) / 3) - 1); //如果为空则增加空对象集合,用来接收填写的控件数据,以备更新时使用 if (detailList.Count == 0) { for (int j = 0; j < list.Count; j++) { detailList.Add(new T_Traffic_Detail()); detailList[j].ID = Guid.NewGuid().ToString(); } } #endregion #region 动态添加管道项 //动态添加键值,应对自动增加的管道项 //if (list.Count - 4 < this.panel1.Controls.Count) //{ // for (int m = 0; m < (this.panel1.Controls.Count - 3) / 3; m++) // { // list.Add(new T_Dict() { ValueName = "gsg" + (m + 2), DisplayName = "给水管(" + (m + 2) + ")", KeyWord = "TrafficType", ID = list.Count + 1 }); // list.Add(new T_Dict() { ValueName = "ysg" + (m + 2), DisplayName = "雨水管(" + (m + 2) + ")", KeyWord = "TrafficType", ID = list.Count + 1 }); // list.Add(new T_Dict() { ValueName = "wsg" + (m + 2), DisplayName = "污水管(" + (m + 2) + ")", KeyWord = "TrafficType", ID = list.Count + 1 }); // } //} //为新增加的管道项添加空对象接收数据 if (list.Count > detailList.Count) { int length = list.Count - detailList.Count; for (int i = 0; i < length; i++) { detailList.Add(new T_Traffic_Detail()); detailList[detailList.Count - 1].ID = Guid.NewGuid().ToString(); } } #endregion for (var item = 0; item < list.Count; item++) { //循环获取或设置明细 detailList[item] = Reflections.Control_Reflection(typeof(T_Traffic_Detail), detailList[item], this.Controls, "txt_jt_" + list[item].ValueName + "_", flag) as T_Traffic_Detail; detailList[item].Types = list[item].ValueName; } //返回工程对象 return(objModel); }