/// <summary> /// DeleteQnTopic /// </summary> /// <param name="fieldId"></param> /// <returns></returns> public int DeleteQnTopic(string fieldId) { int affectRows = 0; SqlHelper svc = null; try { svc = new SqlHelper(EnumBiz.onlineDB); List <DacParm> lstParm = new List <DacParm>(); EntityDicQnSetting vo = new EntityDicQnSetting(); vo.fieldId = fieldId; vo.parentFieldId = fieldId; lstParm.Add(svc.GetDelParm(vo, EntityDicQnSetting.Columns.fieldId)); lstParm.Add(svc.GetDelParm(vo, EntityDicQnSetting.Columns.parentFieldId)); EntityDicQnDetail vo2 = new EntityDicQnDetail(); vo2.fieldId = fieldId; lstParm.Add(svc.GetDelParm(vo2, EntityDicQnDetail.Columns.fieldId)); affectRows = svc.Commit(lstParm); } catch (Exception e) { ExceptionLog.OutPutException(e); affectRows = -1; } finally { svc = null; } return(affectRows); }
public List <EntityDicQnSetting> GetQnSettings() { List <EntityDicQnSetting> data = new List <EntityDicQnSetting>(); EntityDicQnSetting vo = null; foreach (Control ctr in plBack.Controls) { if (ctr is DevExpress.XtraEditors.CheckEdit) { if (!string.IsNullOrEmpty(((DevExpress.XtraEditors.CheckEdit)ctr).Properties.AccessibleName) && ((DevExpress.XtraEditors.CheckEdit)ctr).Checked) { vo = new EntityDicQnSetting(); vo.fieldId = ((DevExpress.XtraEditors.CheckEdit)ctr).Properties.AccessibleName; vo.qnClassId = 1; vo.typeId = "2"; vo.fieldName = ctr.Text; vo.parentFieldId = vo.fieldId.Substring(0, 4); vo.status = 1; vo.sortNo = Function.Int(vo.fieldId.Replace('F', ' ').Trim()); data.Add(vo); } if (!string.IsNullOrEmpty(((DevExpress.XtraEditors.CheckEdit)ctr).Properties.AccessibleName) && !((DevExpress.XtraEditors.CheckEdit)ctr).Checked) { vo = new EntityDicQnSetting(); vo.fieldId = ((DevExpress.XtraEditors.CheckEdit)ctr).Properties.AccessibleName; vo.qnClassId = 1; vo.typeId = "2"; vo.fieldName = ctr.Text; vo.parentFieldId = vo.fieldId.Substring(0, 4); vo.status = 0; vo.sortNo = Function.Int(vo.fieldId.Replace('F', ' ').Trim()); data.Add(vo); } } } foreach (Control ctr in plBack.Controls) { if (ctr is DevExpress.XtraEditors.LabelControl) { if (data.Any(r => r.parentFieldId == ctr.Name && r.status == 1)) { vo = new EntityDicQnSetting(); vo.fieldId = ctr.Name; vo.qnClassId = 1; vo.typeId = "2"; vo.fieldName = ctr.Text; vo.parentFieldId = ""; vo.status = 1; vo.sortNo = Function.Int(vo.fieldId.Replace('F', ' ').Trim()); data.Add(vo); } } } return(data); }
/// <summary> /// AddQuestCtrl /// </summary> void AddQuestCtrl(EntityQnRecord qnRecord) { try { if (qnRecord != null) { if (!string.IsNullOrEmpty(qnRecord.xmlData)) { XmlDocument document = new XmlDocument(); document.LoadXml(qnRecord.xmlData); XmlNodeList list = document["FormData"].ChildNodes; xmlData = list[9].OuterXml; dicData = Function.ReadXML(xmlData); } } using (ProxyHms proxy = new ProxyHms()) { lstCtrlLocation = proxy.Service.GetQnCtrlLocation(lstQuest[8], qnRecord.qnId); lstTopic = new List <EntityDicQnSetting>(); lstItems = new List <EntityDicQnSetting>(); proxy.Service.GetQnCustom(1, out lstTopic, out lstItems); } int locationX = 0; int locationY = 0; if (lstCtrlLocation != null && lstCtrlLocation.Count > 0) { foreach (var clVo in lstCtrlLocation) { if (clVo.name.Contains("FM")) { DevExpress.XtraReports.UI.XRLabel lblTopic = new DevExpress.XtraReports.UI.XRLabel(); lblTopic.Name = clVo.name; lblTopic.Text = clVo.text; if (clVo.name == "FM0902" || clVo.name == "FM0903") { lblTopic.Font = new System.Drawing.Font("宋体", 9.5F); lblTopic.ForeColor = System.Drawing.Color.Red; lblTopic.WidthF = clVo.width + 10; } else { lblTopic.Font = new System.Drawing.Font("宋体", 9.75F, System.Drawing.FontStyle.Bold); } locationX = clVo.locationX; locationY = clVo.locationY; lblTopic.WidthF = clVo.width; lblTopic.Location = new System.Drawing.Point(locationX, locationY); this.Detail.Controls.Add(lblTopic); } } } List <EntityDicQnSetting> lstChildSettings = new List <EntityDicQnSetting>(); if (lstTopic != null && lstTopic.Count > 0) { for (int i = 0; i < lstTopic.Count; i++) { EntityDicQnSetting item = lstTopic[i]; if (item.questName == lstQuest[8]) { if (string.IsNullOrEmpty(item.parentFieldId)) { DevExpress.XtraReports.UI.XRLabel lblTopic = new DevExpress.XtraReports.UI.XRLabel(); lblTopic.Name = item.fieldId; lblTopic.Text = item.fieldName; lblTopic.Font = new System.Drawing.Font("宋体", 9.5F); EntityCtrlLocation ctrLocat = lstCtrlLocation.Find(r => r.name == item.fieldId); locationX = ctrLocat.locationX; locationY = ctrLocat.locationY; lblTopic.WidthF = ctrLocat.width; //lblTopic.HeightF = ctrLocat.height; lblTopic.Location = new System.Drawing.Point(locationX, locationY); this.Detail.Controls.Add(lblTopic); lstChildSettings = lstTopic.FindAll(r => r.parentFieldId == item.fieldId); if (lstChildSettings.Count > 0) { foreach (var childVo in lstChildSettings) { if (childVo.typeId != "3") { DevExpress.XtraReports.UI.XRCheckBox chkAns = new DevExpress.XtraReports.UI.XRCheckBox(); string strEndWith = childVo.fieldId.Substring(4, 2); chkAns.Text = childVo.fieldName; chkAns.Font = new System.Drawing.Font("宋体", 9.5F); chkAns.Name = childVo.fieldId; EntityCtrlLocation ctrLocatChild = lstCtrlLocation.Find(r => r.name == childVo.fieldId); locationX = ctrLocatChild.locationX; locationY = ctrLocatChild.locationY; chkAns.Width = ctrLocatChild.width; //chkAns.Height = ctrLocatChild.height; chkAns.Location = new System.Drawing.Point(locationX, locationY); if (dicData.ContainsKey(childVo.fieldId)) { string value = dicData[childVo.fieldId]; chkAns.Checked = value == "0" ? false : true; } this.Detail.Controls.Add(chkAns); } else { DevExpress.XtraReports.UI.XRLabel txtAns = new DevExpress.XtraReports.UI.XRLabel(); string strEndWith = childVo.fieldId.Substring(4, 2); txtAns.Text = childVo.fieldName; txtAns.Font = new System.Drawing.Font("宋体", 9.5F); txtAns.Name = childVo.fieldId; EntityCtrlLocation ctrLocatChild = lstCtrlLocation.Find(r => r.name == childVo.fieldId); locationX = ctrLocatChild.locationX; locationY = ctrLocatChild.locationY; txtAns.Width = ctrLocatChild.width; //txtAns.Height = ctrLocatChild.height; txtAns.Location = new System.Drawing.Point(locationX, locationY); if (dicData.ContainsKey(childVo.fieldId)) { string value = dicData[childVo.fieldId]; txtAns.Text = value; } this.Detail.Controls.Add(txtAns); } } } } } } } } catch (Exception ex) { ExceptionLog.OutPutException(ex); } finally { } }
/// <summary> /// InitComponent /// </summary> public void InitComponent(decimal QnId) { try { this.SuspendLayout(); List <EntityDicQnSetting> lstTopic = null; List <EntityDicQnSetting> lstItems = null; using (ProxyHms svc = new ProxyHms()) { svc.Service.GetQnCustom(QnId, out lstTopic, out lstItems); } int intY = 50; if (lstTopic != null && lstTopic.Count > 0) { if (this.QnVo != null) { DevExpress.XtraEditors.LabelControl lblTitle = new DevExpress.XtraEditors.LabelControl(); lblTitle.Text = this.QnVo.qnName; lblTitle.Font = new System.Drawing.Font("宋体", 18F, FontStyle.Bold); lblTitle.Location = new Point(450, intY); this.plContent.Controls.Add(lblTitle); intY += 60; } EntityDicQnSetting item = null; EntityDicQnSetting item2 = null; for (int i = 0; i < lstTopic.Count; i++) { item = lstTopic[i]; DevExpress.XtraEditors.LabelControl lblTopic = new DevExpress.XtraEditors.LabelControl(); lblTopic.Name = item.fieldId; lblTopic.Text = Convert.ToString(i + 1) + "、" + item.fieldName; lblTopic.Font = new System.Drawing.Font("宋体", 9.5F); lblTopic.Location = new Point(80, intY); this.plContent.Controls.Add(lblTopic); List <EntityDicQnSetting> lstCtrls = lstItems.FindAll(t => t.parentFieldId == item.fieldId); if (lstCtrls != null && lstCtrls.Count > 0) { intY += 40; int tmpX = 0; int tmpY = intY; for (int j = 0; j < lstCtrls.Count; j++) { tmpY = intY + 40 * (j / 6); tmpX = 100 + (j % 6) * 150; item2 = lstCtrls[j]; DevExpress.XtraEditors.CheckEdit chkAns = new DevExpress.XtraEditors.CheckEdit(); chkAns.Name = item2.fieldId; chkAns.Text = item2.fieldName; chkAns.Font = new System.Drawing.Font("宋体", 9.5F); chkAns.Location = new Point(tmpX, tmpY); chkAns.CheckedChanged += new EventHandler(iChk_CheckedChanged); if (!string.IsNullOrEmpty(item2.parentFieldId) && item2.isMultipe == 0) { chkAns.Properties.AccessibleName = item2.parentFieldId; lstCheck.Add(chkAns); } this.plContent.Controls.Add(chkAns); } intY = tmpY; intY += 60; } else { if (item.typeId == "3") { intY += 30; DevExpress.XtraEditors.TextEdit txtAns = new DevExpress.XtraEditors.TextEdit(); txtAns.Location = new Point(100, intY); txtAns.Width = 600; txtAns.Font = new System.Drawing.Font("宋体", 9.5F); txtAns.ForeColor = Color.Blue; this.plContent.Controls.Add(txtAns); } else { intY += 60; } } } } this.Height = intY + 100; } catch (Exception ex) { DialogBox.Msg(ex.Message); } finally { this.ResumeLayout(); } }
/// <summary> /// InitComponent /// </summary> public void InitComponent() { this.SuspendLayout(); lstCheck.Clear(); using (ProxyHms proxy = new ProxyHms()) { lstCtrlLocation = proxy.Service.GetQnCtrlLocation(lstQuest[idx], qnId); } using (ProxyHms proxy = new ProxyHms()) { lstTopic = new List <EntityDicQnSetting>(); lstItems = new List <EntityDicQnSetting>(); proxy.Service.GetQnCustom(qnId, out lstTopic, out lstItems); } int locationX = 0; int locationY = 0; #region quest01 if (idx == 0) { if (lstCtrlLocation != null && lstCtrlLocation.Count > 0) { foreach (var clVo in lstCtrlLocation) { if (clVo.name.Contains("FT")) { DevExpress.XtraEditors.LabelControl lblTopic = new DevExpress.XtraEditors.LabelControl(); lblTopic.Name = clVo.name; lblTopic.Text = clVo.text; lblTopic.Font = new System.Drawing.Font("宋体", 9.5F); locationX = clVo.locationX; locationY = clVo.locationY; lblTopic.Location = new System.Drawing.Point(locationX, locationY); this.plUserCtrl.Controls.Add(lblTopic); } if (clVo.name.Contains("FM")) { DevExpress.XtraEditors.LabelControl lblTopic = new DevExpress.XtraEditors.LabelControl(); lblTopic.Name = clVo.name; lblTopic.Text = clVo.text; lblTopic.Font = new System.Drawing.Font("宋体", 9.75F, System.Drawing.FontStyle.Bold); locationX = clVo.locationX; locationY = clVo.locationY; lblTopic.Location = new System.Drawing.Point(locationX, locationY); this.plUserCtrl.Controls.Add(lblTopic); } } } int parentCount = 0; List <EntityDicQnSetting> lstChildSettings = new List <EntityDicQnSetting>(); if (lstTopic != null && lstTopic.Count > 0) { List <EntityCtrlLocation> lstCtrlLocation2 = lstCtrlLocation.FindAll(r => r.type == 1 && !(r.name.Contains("FM") || r.name.Contains("FT"))); for (int i = 0; i < lstTopic.Count; i++) { EntityDicQnSetting item = lstTopic[i]; #region quest01 if (item.questName == "quest01") { if (string.IsNullOrEmpty(item.parentFieldId)) { DevExpress.XtraEditors.LabelControl lblTopic = new DevExpress.XtraEditors.LabelControl(); lblTopic.Name = item.fieldId; lblTopic.Text = lstTopic.Find(r => r.fieldId == item.fieldId).fieldName; lblTopic.Font = new System.Drawing.Font("宋体", 9.5F); EntityCtrlLocation ctrLocat = lstCtrlLocation2[parentCount]; locationX = ctrLocat.locationX; locationY = ctrLocat.locationY; lblTopic.Location = new System.Drawing.Point(locationX, locationY); this.plUserCtrl.Controls.Add(lblTopic); lstChildSettings = lstTopic.FindAll(r => r.parentFieldId == item.fieldId); if (lstChildSettings.Count > 0) { foreach (var childVo in lstChildSettings) { DevExpress.XtraEditors.CheckEdit chkAns = new DevExpress.XtraEditors.CheckEdit(); string strEndWith = childVo.fieldId.Substring(4, 2); chkAns.Text = ""; chkAns.Font = new System.Drawing.Font("宋体", 9.5F); chkAns.Name = childVo.fieldId; chkAns.Properties.AccessibleName = childVo.fieldId; EntityCtrlLocation ctrLocatChild = lstCtrlLocation.Find(r => r.name.Contains(ctrLocat.name) && r.type == 2 && r.name.EndsWith(strEndWith)); locationX = ctrLocatChild.locationX; locationY = ctrLocatChild.locationY; chkAns.Width = ctrLocatChild.width; chkAns.Height = ctrLocatChild.height; chkAns.Location = new System.Drawing.Point(locationX, locationY); this.plUserCtrl.Controls.Add(chkAns); } parentCount++; } } } #endregion } } this.plUserCtrl.Height = 680; this.plContent.Height = (this.plUserCtrl.Height + 200); } #endregion #region quest02 if (idx == 1) { int F35Count = 0; int F35Row = (lstTopic.FindAll(r => r.fieldId.Contains("F035")).Count) / 6; int F35Y = 0; List <EntityDicQnSetting> lstChildSettings = new List <EntityDicQnSetting>(); if (lstTopic != null && lstTopic.Count > 0) { for (int i = 0; i < lstTopic.Count; i++) { EntityDicQnSetting item = lstTopic[i]; if (item.questName == lstQuest[idx]) { if (item.fieldId.Contains("F035")) { DevExpress.XtraEditors.CheckEdit chkAns = new DevExpress.XtraEditors.CheckEdit(); chkAns.Text = item.fieldName; chkAns.Font = new System.Drawing.Font("宋体", 9.5F); chkAns.Name = item.fieldId; chkAns.Properties.AccessibleName = item.fieldId; EntityCtrlLocation ctrLocat = lstCtrlLocation.FindAll(r => r.name.Contains("F035"))[F35Count]; locationX = ctrLocat.locationX; locationY = ctrLocat.locationY; F35Y += locationY; chkAns.Width = ctrLocat.width; chkAns.Height = ctrLocat.height; chkAns.Location = new System.Drawing.Point(locationX, locationY); this.plUserCtrl.Controls.Add(chkAns); F35Count++; } } } for (int i2 = 0; i2 < lstTopic.Count; i2++) { EntityDicQnSetting itemVo = lstTopic[i2]; if (itemVo.questName == lstQuest[idx]) { if (string.IsNullOrEmpty(itemVo.parentFieldId) && !itemVo.fieldId.Contains("F035")) { DevExpress.XtraEditors.LabelControl lblTopic = new DevExpress.XtraEditors.LabelControl(); lblTopic.Name = itemVo.fieldId; lblTopic.Text = itemVo.fieldName; lblTopic.Font = new System.Drawing.Font("宋体", 9.5F); EntityCtrlLocation ctrLocat = lstCtrlLocation.Find(r => r.name == itemVo.fieldId); locationX = ctrLocat.locationX; locationY = ctrLocat.locationY - F35Y + 80; lblTopic.Location = new System.Drawing.Point(locationX, locationY); this.plUserCtrl.Controls.Add(lblTopic); lstChildSettings = lstTopic.FindAll(r => r.parentFieldId == itemVo.fieldId); if (lstChildSettings.Count > 0) { foreach (var childVo in lstChildSettings) { DevExpress.XtraEditors.CheckEdit chkAns = new DevExpress.XtraEditors.CheckEdit(); string strEndWith = childVo.fieldId.Substring(4, 2); chkAns.Text = childVo.fieldName; chkAns.Font = new System.Drawing.Font("宋体", 9.5F); chkAns.Name = childVo.fieldId; chkAns.Properties.AccessibleName = childVo.fieldId; EntityCtrlLocation ctrLocatChild = lstCtrlLocation.Find(r => r.name == childVo.fieldId); locationX = ctrLocatChild.locationX; locationY = ctrLocatChild.locationY - F35Y + 80; chkAns.Width = ctrLocatChild.width; chkAns.Height = ctrLocatChild.height; chkAns.Location = new System.Drawing.Point(locationX, locationY); this.plUserCtrl.Controls.Add(chkAns); } } } } } } if (lstCtrlLocation != null && lstCtrlLocation.Count > 0) { foreach (var clVo in lstCtrlLocation) { DevExpress.XtraEditors.LabelControl lblTopic = new DevExpress.XtraEditors.LabelControl(); lblTopic.Name = clVo.name; lblTopic.Text = clVo.text; lblTopic.Font = new System.Drawing.Font("宋体", 9.75F, System.Drawing.FontStyle.Bold); locationX = clVo.locationX; if (clVo.name == "FM0201") { locationY = clVo.locationY; } else if (clVo.name.Contains("FM")) { locationY = clVo.locationY - F35Y + 80; } else { continue; } lblTopic.Location = new System.Drawing.Point(locationX, locationY); this.plUserCtrl.Controls.Add(lblTopic); } } this.plUserCtrl.Height = 1000; this.plContent.Height = (this.plUserCtrl.Height + 200); } #endregion #region quest03 quest04 quest05 quest06 quest07 quest08 quest09 quest10 if (idx == 2 || idx == 3 || idx == 4 || idx == 5 || idx == 6 || idx == 7 || idx == 8 || idx == 9) { if (lstCtrlLocation != null && lstCtrlLocation.Count > 0) { foreach (var clVo in lstCtrlLocation) { if (clVo.name.Contains("FM")) { DevExpress.XtraEditors.LabelControl lblTopic = new DevExpress.XtraEditors.LabelControl(); lblTopic.Name = clVo.name; lblTopic.Text = clVo.text; if (clVo.name == "FM0902" || clVo.name == "FM0903") { lblTopic.Font = new System.Drawing.Font("宋体", 9.5F); lblTopic.ForeColor = System.Drawing.Color.Red; } else { lblTopic.Font = new System.Drawing.Font("宋体", 9.75F, System.Drawing.FontStyle.Bold); } locationX = clVo.locationX; locationY = clVo.locationY; lblTopic.Location = new System.Drawing.Point(locationX, locationY); this.plUserCtrl.Controls.Add(lblTopic); } } } List <EntityDicQnSetting> lstChildSettings = new List <EntityDicQnSetting>(); if (lstTopic != null && lstTopic.Count > 0) { for (int i = 0; i < lstTopic.Count; i++) { EntityDicQnSetting item = lstTopic[i]; if (item.questName == lstQuest[idx]) { if (string.IsNullOrEmpty(item.parentFieldId)) { DevExpress.XtraEditors.LabelControl lblTopic = new DevExpress.XtraEditors.LabelControl(); lblTopic.Name = item.fieldId; lblTopic.Text = item.fieldName; lblTopic.Font = new System.Drawing.Font("宋体", 9.5F); EntityCtrlLocation ctrLocat = lstCtrlLocation.Find(r => r.name == item.fieldId); locationX = ctrLocat.locationX; locationY = ctrLocat.locationY; lblTopic.Location = new System.Drawing.Point(locationX, locationY); this.plUserCtrl.Controls.Add(lblTopic); lstChildSettings = lstTopic.FindAll(r => r.parentFieldId == item.fieldId); if (lstChildSettings.Count > 0) { foreach (var childVo in lstChildSettings) { if (childVo.typeId != "3") { DevExpress.XtraEditors.CheckEdit chkAns = new DevExpress.XtraEditors.CheckEdit(); string strEndWith = childVo.fieldId.Substring(4, 2); chkAns.Text = childVo.fieldName; chkAns.Font = new System.Drawing.Font("宋体", 9.5F); chkAns.Name = childVo.fieldId; chkAns.Properties.AccessibleName = childVo.fieldId; EntityCtrlLocation ctrLocatChild = lstCtrlLocation.Find(r => r.name == childVo.fieldId); locationX = ctrLocatChild.locationX; locationY = ctrLocatChild.locationY; chkAns.Width = ctrLocatChild.width; chkAns.Height = ctrLocatChild.height; chkAns.Location = new System.Drawing.Point(locationX, locationY); chkAns.CheckedChanged += new EventHandler(iChk_CheckedChanged); if (!string.IsNullOrEmpty(childVo.parentFieldId) && item.typeId == "1") { chkAns.Properties.AccessibleName = childVo.parentFieldId; lstCheck.Add(chkAns); } this.plUserCtrl.Controls.Add(chkAns); } else { DevExpress.XtraEditors.TextEdit txtAns = new DevExpress.XtraEditors.TextEdit(); string strEndWith = childVo.fieldId.Substring(4, 2); txtAns.Text = childVo.fieldName; txtAns.Font = new System.Drawing.Font("宋体", 9.5F); txtAns.Name = childVo.fieldId; txtAns.Properties.AccessibleName = childVo.fieldId; EntityCtrlLocation ctrLocatChild = lstCtrlLocation.Find(r => r.name == childVo.fieldId); locationX = ctrLocatChild.locationX; locationY = ctrLocatChild.locationY; txtAns.Width = ctrLocatChild.width; txtAns.Height = ctrLocatChild.height; txtAns.Location = new System.Drawing.Point(locationX, locationY); this.plUserCtrl.Controls.Add(txtAns); } } } } } } } this.plUserCtrl.Height = 2000; this.plContent.Height = (this.plUserCtrl.Height + 200); } #endregion this.ResumeLayout(); }
/// <summary> /// AddQuestCtrl /// </summary> void AddQuestCtrl(EntityQnRecord qnRecord) { try { if (qnRecord != null) { if (!string.IsNullOrEmpty(qnRecord.xmlData)) { XmlDocument document = new XmlDocument(); document.LoadXml(qnRecord.xmlData); XmlNodeList list = document["FormData"].ChildNodes; xmlData = list[1].OuterXml; dicData = Function.ReadXML(xmlData); } } using (Biz202 biz = new Biz202()) { lstCtrlLocation = biz.GetQnCtrlLocation(lstQuest[1]); } using (Biz209 biz = new Biz209()) { lstTopic = new List <EntityDicQnSetting>(); lstItems = new List <EntityDicQnSetting>(); biz.GetQnCustom(1, out lstTopic, out lstItems); } int locationX = 0; int locationY = 0; int F35Count = 0; int F35Row = (lstTopic.FindAll(r => r.fieldId.Contains("F035")).Count) / 6; int F35Y = 0; List <EntityDicQnSetting> lstChildSettings = new List <EntityDicQnSetting>(); if (lstTopic != null && lstTopic.Count > 0) { for (int i = 0; i < lstTopic.Count; i++) { EntityDicQnSetting item = lstTopic[i]; if (item.questName == lstQuest[1]) { if (item.fieldId.Contains("F035")) { DevExpress.XtraReports.UI.XRCheckBox chkAns = new DevExpress.XtraReports.UI.XRCheckBox(); chkAns.Text = item.fieldName; chkAns.Font = new System.Drawing.Font("宋体", 9.5F); chkAns.Name = item.fieldId; EntityCtrlLocation ctrLocat = lstCtrlLocation.FindAll(r => r.name.Contains("F035"))[F35Count]; locationX = ctrLocat.locationX; locationY = ctrLocat.locationY; F35Y += locationY; chkAns.Width = ctrLocat.width; chkAns.Height = ctrLocat.height; chkAns.Location = new System.Drawing.Point(locationX, locationY); if (dicData.ContainsKey(item.fieldId)) { string value = dicData[item.fieldId]; chkAns.Checked = value == "0" ? false : true; } this.Detail.Controls.Add(chkAns); F35Count++; } } } F35Y -= 80; for (int i2 = 0; i2 < lstTopic.Count; i2++) { EntityDicQnSetting itemVo = lstTopic[i2]; if (itemVo.questName == lstQuest[1]) { if (string.IsNullOrEmpty(itemVo.parentFieldId) && !itemVo.fieldId.Contains("F035")) { DevExpress.XtraReports.UI.XRLabel lblTopic = new DevExpress.XtraReports.UI.XRLabel(); lblTopic.Name = itemVo.fieldId; lblTopic.Text = itemVo.fieldName; lblTopic.Font = new System.Drawing.Font("宋体", 9.5F); EntityCtrlLocation ctrLocat = lstCtrlLocation.Find(r => r.name == itemVo.fieldId); locationX = ctrLocat.locationX; locationY = ctrLocat.locationY - F35Y; lblTopic.Location = new System.Drawing.Point(locationX, locationY); this.Detail.Controls.Add(lblTopic); lstChildSettings = lstTopic.FindAll(r => r.parentFieldId == itemVo.fieldId); if (lstChildSettings.Count > 0) { foreach (var childVo in lstChildSettings) { DevExpress.XtraReports.UI.XRCheckBox chkAns = new DevExpress.XtraReports.UI.XRCheckBox(); string strEndWith = childVo.fieldId.Substring(4, 2); chkAns.Text = childVo.fieldName; chkAns.Font = new System.Drawing.Font("宋体", 9.5F); chkAns.Name = childVo.fieldId; EntityCtrlLocation ctrLocatChild = lstCtrlLocation.Find(r => r.name == childVo.fieldId); locationX = ctrLocatChild.locationX; locationY = ctrLocatChild.locationY - F35Y; chkAns.Width = ctrLocatChild.width; chkAns.Height = ctrLocatChild.height; chkAns.Location = new System.Drawing.Point(locationX, locationY); if (dicData.ContainsKey(childVo.fieldId)) { string value = dicData[childVo.fieldId]; chkAns.Checked = value == "0" ? false : true; } this.Detail.Controls.Add(chkAns); } } } } } } if (lstCtrlLocation != null && lstCtrlLocation.Count > 0) { foreach (var clVo in lstCtrlLocation) { DevExpress.XtraReports.UI.XRLabel lblTopic = new DevExpress.XtraReports.UI.XRLabel(); lblTopic.Name = clVo.name; lblTopic.Text = clVo.text; lblTopic.Font = new System.Drawing.Font("宋体", 9.75F, System.Drawing.FontStyle.Bold); locationX = clVo.locationX; if (clVo.name == "FM0201") { locationY = clVo.locationY; } else if (clVo.name.Contains("FM")) { locationY = clVo.locationY - F35Y; } else { continue; } lblTopic.Location = new System.Drawing.Point(locationX, locationY); this.Detail.Controls.Add(lblTopic); } } } catch (Exception ex) { ExceptionLog.OutPutException(ex); } finally { } }
/// <summary> /// Save /// </summary> void Save() { EntityDicQnMain vo = new EntityDicQnMain(); vo.qnName = this.txtQnName.Text.Trim(); vo.qnDesc = this.txtQnDesc.Text.Trim(); vo.status = this.cboStatus.SelectedIndex; vo.classId = 2; // 自定义问卷 vo.creatorId = GlobalLogin.objLogin.EmpNo; vo.creatDate = DateTime.Now; if (this.QnVo != null && this.QnVo.qnId > 0) { vo.qnId = this.QnVo.qnId; } // 明细缓 this.gridView.CloseEditor(); lstDicQnSetting = new List <EntityDicQnSetting>(); List <EntityQnSetting> data = this.gridControl.DataSource as List <EntityQnSetting>; List <EntityDicQnDetail> lstDet = new List <EntityDicQnDetail>(); foreach (EntityQnSetting item in data) { if (item.isCheck == 1) { lstDet.Add(new EntityDicQnDetail() { fieldId = item.fieldId, qnId = item.qnId }); EntityDicQnSummary qnSummaryVo = lstQnSummary.Find(r => r.fieldId == item.fieldId); if (qnSummaryVo != null) { EntityDicQnSetting setVo = new EntityDicQnSetting(); setVo = Function.MapperToModel(setVo, qnSummaryVo); setVo.qnId = item.qnId; lstDicQnSetting.Add(setVo); } List <EntityDicQnSummary> lstSub = lstQnSummary.FindAll(r => r.parentFieldId == item.fieldId); if (lstSub != null) { foreach (var summaryVo in lstSub) { EntityDicQnSetting setVo = new EntityDicQnSetting(); setVo = Function.MapperToModel(setVo, summaryVo); setVo.qnId = item.qnId; lstDicQnSetting.Add(setVo); } } } } decimal qnId = 0; using (ProxyHms proxy = new ProxyHms()) { if (proxy.Service.SaveQNnormal(vo, lstDet, out qnId, null, lstDicQnSetting) > 0) { if (this.QnVo == null) { this.QnVo = new EntityDicQnMain() { qnId = qnId }; } this.IsRequireRefresh = true; DialogBox.Msg("保存问卷成功!"); } else { DialogBox.Msg("保存问卷失败。"); } } }
/// <summary> /// InitComponent /// </summary> public void InitComponent() { try { List <EntityDicQnSetting> lstTopic = null; List <EntityDicQnSetting> lstItems = null; dteQuestDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); this.glueClient.Properties.ValueMember = "clientNo"; this.glueClient.Properties.DisplayMember = "clientName"; this.glueClient.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; this.glueClient.Properties.View.BestFitColumns(); this.glueClient.Properties.ShowFooter = false; this.glueClient.Properties.View.OptionsView.ShowAutoFilterRow = true; this.glueClient.Properties.AutoComplete = false; this.glueClient.Properties.ImmediatePopup = true; this.glueClient.Properties.PopupFilterMode = DevExpress.XtraEditors.PopupFilterMode.Contains; this.glueClient.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard; using (ProxyHms svc = new ProxyHms()) { if (qnVo != null) { svc.Service.GetQnCustom(qnVo.qnId, out lstTopic, out lstItems); } else { svc.Service.GetQnCustom(qnRecordVo.qnId, out lstTopic, out lstItems); } } int intY = 10; if (lstTopic != null && lstTopic.Count > 0) { if (this.qnVo != null) { lblTitle.Text = this.qnVo.qnName; } else { lblTitle.Text = this.qnRecordVo.qnName; this.glueClient.Enabled = false; this.txtSearch.Enabled = false; } EntityDicQnSetting item = null; EntityDicQnSetting item2 = null; for (int i = 0; i < lstTopic.Count; i++) { item = lstTopic[i]; DevExpress.XtraEditors.LabelControl lblTopic = new DevExpress.XtraEditors.LabelControl(); lblTopic.Name = item.fieldId; lblTopic.Text = Convert.ToString(i + 1) + "、" + item.fieldName; lblTopic.Font = new System.Drawing.Font("宋体", 9.5F); lblTopic.Location = new Point(80, intY); this.plUserCtrl.Controls.Add(lblTopic); List <EntityDicQnSetting> lstCtrls = lstItems.FindAll(t => t.parentFieldId == item.fieldId); if (lstCtrls != null && lstCtrls.Count > 0) { intY += 40; int tmpX = 0; int tmpY = intY; for (int j = 0; j < lstCtrls.Count; j++) { tmpY = intY + 40 * (j / 5); tmpX = 100 + (j % 5) * 150; item2 = lstCtrls[j]; if (item2.typeId == "3") { DevExpress.XtraEditors.TextEdit txtAns = new DevExpress.XtraEditors.TextEdit(); txtAns.Properties.AccessibleName = item2.fieldId; txtAns.Location = new Point(100, intY); txtAns.Width = 600; txtAns.Font = new System.Drawing.Font("宋体", 9.5F); txtAns.ForeColor = Color.Blue; this.plUserCtrl.Controls.Add(txtAns); } else { DevExpress.XtraEditors.CheckEdit chkAns = new DevExpress.XtraEditors.CheckEdit(); chkAns.Name = item2.fieldId; chkAns.Text = item2.fieldName; chkAns.Font = new System.Drawing.Font("宋体", 9.5F); chkAns.Width = item2.fieldName.Length + 85; chkAns.Location = new Point(tmpX, tmpY); chkAns.CheckedChanged += new EventHandler(iChk_CheckedChanged); if (!string.IsNullOrEmpty(item2.parentFieldId) && item.typeId == "1") { chkAns.Properties.AccessibleName = item2.parentFieldId; lstCheck.Add(chkAns); } this.plUserCtrl.Controls.Add(chkAns); } } intY = tmpY; intY += 60; } else { if (item.typeId == "3") { intY += 30; DevExpress.XtraEditors.TextEdit txtAns = new DevExpress.XtraEditors.TextEdit(); txtAns.Properties.AccessibleName = item2.fieldId; txtAns.Location = new Point(100, intY); txtAns.Width = 600; txtAns.Font = new System.Drawing.Font("宋体", 9.5F); txtAns.ForeColor = Color.Blue; this.plUserCtrl.Controls.Add(txtAns); } else { intY += 60; } } } } plUserCtrl.Height = intY + 100; plContent.Height = intY + 200; this.Height = intY + 230; if (qnRecordVo != null) { SetData(qnRecordVo.xmlData); } } catch (Exception ex) { DialogBox.Msg(ex.Message); } finally { } }
/// <summary> /// InitComponent /// </summary> public void InitComponent(EntityQnRecord qnRecordVo) { try { List <EntityDicQnSetting> lstTopic = null; List <EntityDicQnSetting> lstItems = null; using (ProxyHms svc = new ProxyHms()) { svc.Service.GetQnCustom(qnRecordVo.qnId, out lstTopic, out lstItems); } int intY = 10; Dictionary <string, string> dicData = Function.ReadXmlNodes(qnRecordVo.xmlData, "FormData"); this.Sex.Text = dicData["Sex"]; this.ClientName.Text = dicData["ClientName"]; this.ClientNo.Text = dicData["clientNo"]; this.QuestionDate.Text = dicData["QuestionDate"]; this.Birthday.Text = dicData["Birthday"]; if (lstTopic != null && lstTopic.Count > 0) { qnName.Text = qnRecordVo.qnName; EntityDicQnSetting item = null; EntityDicQnSetting item2 = null; for (int i = 0; i < lstTopic.Count; i++) { item = lstTopic[i]; DevExpress.XtraReports.UI.XRLabel lblTopic = new DevExpress.XtraReports.UI.XRLabel(); lblTopic.Name = item.fieldId; lblTopic.Text = Convert.ToString(i + 1) + "、" + item.fieldName; lblTopic.WidthF = lblTopic.Text.Length + 120; lblTopic.Font = new System.Drawing.Font("宋体", 9.5F); lblTopic.Location = new Point(44, intY); this.Detail.Controls.Add(lblTopic); List <EntityDicQnSetting> lstCtrls = lstItems.FindAll(t => t.parentFieldId == item.fieldId); if (lstCtrls != null && lstCtrls.Count > 0) { intY += 40; int tmpX = 0; int tmpY = intY; for (int j = 0; j < lstCtrls.Count; j++) { tmpY = intY + 30 * (j / 5); tmpX = 44 + (j % 5) * 130; item2 = lstCtrls[j]; if (item2.typeId == "3") { DevExpress.XtraReports.UI.XRLabel lblAns = new XRLabel(); lblAns.Location = new Point(44, intY); lblAns.Font = new System.Drawing.Font("宋体", 9.5F); if (dicData.ContainsKey(item2.fieldId)) { lblAns.Text = dicData[item2.fieldId]; } lblAns.Width = lblAns.Text.Length + 120; this.Detail.Controls.Add(lblAns); } else { DevExpress.XtraReports.UI.XRCheckBox chkAns = new XRCheckBox(); chkAns.Name = item2.fieldId; chkAns.Text = item2.fieldName; chkAns.Font = new System.Drawing.Font("宋体", 9.5F); chkAns.Width = item2.fieldName.Length + 85; if (dicData.ContainsKey(item2.fieldId)) { chkAns.Checked = dicData[item2.fieldId] == "1" ? true : false; } chkAns.Location = new Point(tmpX, tmpY); this.Detail.Controls.Add(chkAns); } } intY = tmpY; intY += 60; } else { if (item.typeId == "3") { intY += 30; DevExpress.XtraReports.UI.XRLabel lblAns = new XRLabel(); lblAns.Location = new Point(44, intY); lblAns.Font = new System.Drawing.Font("宋体", 9.5F); if (dicData.ContainsKey(item2.fieldId)) { lblAns.Text = dicData[item2.fieldId]; } lblAns.Width = lblAns.Text.Length + 120; this.Detail.Controls.Add(lblAns); } else { intY += 60; } } } } } catch (Exception ex) { DialogBox.Msg(ex.Message); } finally { } }
/// <summary> /// AddQuestCtrl /// </summary> void AddQuestCtrl(EntityQnRecord qnRecord) { try { if (qnRecord != null) { if (!string.IsNullOrEmpty(qnRecord.xmlData)) { XmlDocument document = new XmlDocument(); document.LoadXml(qnRecord.xmlData); XmlNodeList list = document["FormData"].ChildNodes; xmlData = list[1].OuterXml; dicData = Function.ReadXML(xmlData); } } using (ProxyHms proxy = new ProxyHms()) { lstCtrlLocation = proxy.Service.GetQnCtrlLocation(lstQuest[0], qnRecord.qnId); } using (ProxyHms proxy = new ProxyHms()) { lstTopic = new List <EntityDicQnSetting>(); lstItems = new List <EntityDicQnSetting>(); proxy.Service.GetQnCustom(1, out lstTopic, out lstItems); } int locationX = 0; int locationY = 0; if (lstCtrlLocation != null && lstCtrlLocation.Count > 0) { foreach (var clVo in lstCtrlLocation) { if (clVo.name.Contains("FT")) { DevExpress.XtraReports.UI.XRLabel lblTopic = new DevExpress.XtraReports.UI.XRLabel(); lblTopic.Name = clVo.name; lblTopic.Text = clVo.text; lblTopic.Font = new System.Drawing.Font("宋体", 9.5F); locationX = clVo.locationX; locationY = clVo.locationY; lblTopic.LocationFloat = new DevExpress.Utils.PointFloat(locationX, locationY); this.Detail.Controls.Add(lblTopic); } if (clVo.name.Contains("FM")) { DevExpress.XtraReports.UI.XRLabel lblTopic = new DevExpress.XtraReports.UI.XRLabel(); lblTopic.Name = clVo.name; lblTopic.Text = clVo.text; lblTopic.Font = new System.Drawing.Font("宋体", 9.75F, System.Drawing.FontStyle.Bold); locationX = clVo.locationX; locationY = clVo.locationY; lblTopic.LocationFloat = new DevExpress.Utils.PointFloat(locationX, locationY); this.Detail.Controls.Add(lblTopic); } } } int parentCount = 0; List <EntityDicQnSetting> lstChildSettings = new List <EntityDicQnSetting>(); if (lstTopic != null && lstTopic.Count > 0) { for (int i = 0; i < lstTopic.Count; i++) { EntityDicQnSetting item = lstTopic[i]; if (item.questName == lstQuest[0]) { if (string.IsNullOrEmpty(item.parentFieldId)) { DevExpress.XtraReports.UI.XRLabel lblTopic = new DevExpress.XtraReports.UI.XRLabel(); lblTopic.Name = item.fieldId; lblTopic.Text = lstTopic.Find(r => r.fieldId == item.fieldId).fieldName; lblTopic.Font = new System.Drawing.Font("宋体", 9.5F); EntityCtrlLocation ctrLocat = lstCtrlLocation.FindAll(r => r.type == 1)[parentCount]; locationX = ctrLocat.locationX; locationY = ctrLocat.locationY; lblTopic.LocationFloat = new DevExpress.Utils.PointFloat(locationX, locationY); this.Detail.Controls.Add(lblTopic); lstChildSettings = lstTopic.FindAll(r => r.parentFieldId == item.fieldId); if (lstChildSettings.Count > 0) { foreach (var childVo in lstChildSettings) { DevExpress.XtraReports.UI.XRCheckBox chkAns = new DevExpress.XtraReports.UI.XRCheckBox(); string strEndWith = childVo.fieldId.Substring(4, 2); chkAns.Text = ""; chkAns.Font = new System.Drawing.Font("宋体", 9.5F); chkAns.Name = childVo.fieldId; EntityCtrlLocation ctrLocatChild = lstCtrlLocation.Find(r => r.name.Contains(ctrLocat.name) && r.type == 2 && r.name.EndsWith(strEndWith)); locationX = ctrLocatChild.locationX; locationY = ctrLocatChild.locationY; chkAns.Dpi = 100F; chkAns.LocationFloat = new DevExpress.Utils.PointFloat(locationX, locationY); chkAns.SizeF = new System.Drawing.SizeF(15.625F, 23F); if (dicData.ContainsKey(childVo.fieldId)) { string value = dicData[childVo.fieldId]; chkAns.Checked = value == "0" ? false : true; } this.Detail.Controls.Add(chkAns); } } parentCount++; } } } } } catch (Exception ex) { ExceptionLog.OutPutException(ex); } finally { } }