private bool m_blnDelTemplate() { if (this.ctlPopupSelect.Value != null) { EntityElementTemplate vo = new EntityElementTemplate(); vo.status = 0; vo.serno = Function.Dec(this.ctlPopupSelect.Value.ToString()); ProxyEntityFactory proxy = new ProxyEntityFactory(); int intResult = proxy.Service.UpdateByPk(vo); proxy = null; if (intResult > 0) { DialogBox.Msg("删除成功"); return(true); } else { DialogBox.Msg("删除失败"); return(false); } } else { return(false); } }
private void clstElement_DrawItem(object sender, DevExpress.XtraEditors.ListBoxDrawItemEventArgs e) { BindingListView <EntityElementTemplate> source = clstElement.DataSource as BindingListView <EntityElementTemplate>; if (source != null) { EntityElementTemplate objElementTemplate = source.FirstOrDefault(t => t.serno.ToString() == e.Item.ToString()); if (objElementTemplate.linkSerno != null) { e.Appearance.ForeColor = Color.Blue; //e.Appearance.Font = new Font("宋体", 10.5f, FontStyle.Bold); } } }
private void AddElement() { BindingListView <EntityElementTemplate> source = clstElement.DataSource as BindingListView <EntityElementTemplate>; if (source != null) { BindingListView <EntityElementTemplate> tempSource = new BindingListView <EntityElementTemplate>(); EntityElementTemplate objNew = new EntityElementTemplate(); objNew.serno = -1; objNew.colcontent = " "; tempSource.Add(objNew); foreach (EntityElementTemplate objCurrent in source) { tempSource.Add(objCurrent); } clstElement.DataSource = tempSource; } biAdd.Enabled = false; biDel.Enabled = false; biMultiChoose.Enabled = false; biEdit.Enabled = false; txtNew = new DevExpress.XtraEditors.TextEdit(); txtNew.Name = "txtNew"; int intCount = clstElement.ItemCount; int intHeight = (intCount + 1) * clstElement.ItemHeight; txtNew.Location = new Point(0, 0); if (clstElement.Height <= intHeight) { txtNew.Width = clstElement.Width - 17; } else { txtNew.Width = clstElement.Width; } txtNew.Height = clstElement.ItemHeight; txtNew.KeyDown += new KeyEventHandler(txtNew_KeyDown); txtNew.Leave += new EventHandler(txtNew_Leave); clstElement.Controls.Add(txtNew); txtNew.BringToFront(); txtNew.Focus(); }
private void m_mthLoadData() { bool blnSingle = true; string strCaseCode = GlobalCase.caseInfo.CaseCode; if (!TemplateFlag && !string.IsNullOrEmpty(this.m_strCaseCode) && this.m_strCaseCode != GlobalCase.caseInfo.CaseCode) { blnSingle = false; strCaseCode = "'" + GlobalCase.caseInfo.CaseCode + "', '" + this.m_strCaseCode + "'"; } EntityElementTemplate vo = new EntityElementTemplate(); vo.status = 1; if (blnSingle) { vo.caseCode = strCaseCode; } else { vo.caseCode = "in (" + strCaseCode + ")"; } ProxyEntityFactory proxy = new ProxyEntityFactory(); DataTable dt = proxy.Service.Select(vo, new List <string> { EntityElementTemplate.Columns.caseCode, EntityElementTemplate.Columns.status }); proxy = null; if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { if (!this.m_hasElement.ContainsKey(dr[EntityElementTemplate.Columns.serno].ToString())) { this.m_hasElement.Add(dr[EntityElementTemplate.Columns.serno].ToString(), dr[EntityElementTemplate.Columns.caseCode].ToString()); } } } this.ctlPopupSelect.DataSource = dt; }
private void txtFilter_EditValueChanged(object sender, EventArgs e) { if (this.lstTemplateSource != null && this.lstTemplateSource.Count > 0) { if (this.clstElement.ItemCount <= 0) { return; } for (int i = 0; i < this.lstTemplateSource.Count; i++) { this.clstElement.SetItemChecked(i, false); } SetElementName(); string strVal = this.txtFilter.Text.Trim(); if (string.IsNullOrEmpty(strVal)) { return; } if (this.lstTemplateSource.Any(t => t.pyCode.Contains(strVal) || t.wbCode.Contains(strVal) || t.colcontent.Contains(strVal))) { EntityElementTemplate objEle = this.lstTemplateSource.First(t => t.pyCode.Contains(strVal) || t.wbCode.Contains(strVal) || t.colcontent.Contains(strVal)); if (objEle != null) { int intIdx = this.clstElement.FindItem(objEle); if (intIdx >= 0) { this.clstElement.SetSelected(intIdx, true); this.clstElement.SetItemChecked(intIdx, true); this.txtFilter.Focus(); SetElementName(); } } } } }
private void AddTemplate() { if (m_intFlags == 0)//新增 { EntityElementTemplate entity = new EntityElementTemplate(); entity.status = 1; entity.templateName = txtTemplateName.Text.Trim(); if (!m_blnCheckTemplateName(entity.templateName)) { DialogBox.Msg("模板名称已存在"); return; } entity.createrId = GlobalLogin.objLogin.EmpNo; entity.createDate = Common.Utils.Utils.ServerTime(); entity.pyCode = txtPYCode.Text.Trim(); entity.wbCode = txtWBCode.Text.Trim(); entity.caseCode = GlobalCase.caseInfo.CaseCode; entity.multiFlag = cbbMutiSel.SelectedIndex; ProxyEntityFactory proxy = new ProxyEntityFactory(); int intRet = proxy.Service.Insert(entity); proxy = null; if (intRet > 0) { if (DialogBox.Msg("成功增加了" + entity.templateName + "模板,是否继续增加该模板的元素?", MessageBoxIcon.Question) == DialogResult.Yes) { pnlAddElement.Visible = false; m_mthLoadData(); DataTable dtbSource = this.ctlPopupSelect.DataSource as DataTable; if (dtbSource != null) { DataRow[] drwArr = dtbSource.Select(EntityElementTemplate.Columns.templateName + " = '" + entity.templateName + "'"); if (drwArr != null && drwArr.Length > 0) { this.ctlPopupSelect.Value = drwArr[0][EntityElementTemplate.Columns.serno]; AddElement(); } } } else { pnlAddElement.Visible = false; m_mthLoadData(); } } } else//修改 { if (txtTemplateName.Tag != null) { string strSerno = txtTemplateName.Tag.ToString(); EntityElementTemplate vo = new EntityElementTemplate(); vo.templateName = txtTemplateName.Text.Trim(); vo.pyCode = txtPYCode.Text.Trim(); vo.wbCode = txtWBCode.Text.Trim(); vo.multiFlag = cbbMutiSel.SelectedIndex; vo.serno = Function.Dec(strSerno); ProxyEntityFactory proxy = new ProxyEntityFactory(); int intRet = proxy.Service.UpdateByPk(vo); proxy = null; if (intRet > 0) { DialogBox.Msg("成功修改了模板", MessageBoxIcon.Information); pnlAddElement.Visible = false; m_mthLoadData(); DataTable dtbSource = this.ctlPopupSelect.DataSource as DataTable; if (dtbSource != null) { DataRow[] drwArr = dtbSource.Select(EntityElementTemplate.Columns.serno + " = " + strSerno); if (drwArr != null && drwArr.Length > 0) { this.ctlPopupSelect.Value = drwArr[0][EntityElementTemplate.Columns.serno]; } } } } } }