/// <summary> /// Edit /// </summary> public override void Edit() { if (this.gridView.SelectedRowsCount > 0) { EntityDicQnMain mainVo = this.gridView.GetRow(this.gridView.GetSelectedRows()[0]) as EntityDicQnMain; if (mainVo.classId == 1) { frmPopup2090101 frm = new frmPopup2090101(mainVo); frm.ShowDialog(); if (frm.IsRequireRefresh) { this.RefreshData(); this.ScrollRow(frm.QnVo.qnId); } } else if (mainVo.classId == 2) { frmPopup2090102 frm = new frmPopup2090102(mainVo); frm.ShowDialog(); if (frm.IsRequireRefresh) { this.RefreshData(); this.ScrollRow(frm.QnVo.qnId); } } } else { DialogBox.Msg("请选择要编辑的记录."); } }
/// <summary> /// 保存 /// </summary> /// <param name="vo"></param> /// <param name="lstDet"></param> /// <param name="qnId"></param> /// <returns></returns> public int SaveQNnormal(EntityDicQnMain vo, List <EntityDicQnDetail> lstDet, out decimal qnId, List <EntityDicQnCtlLocation> lstLaction = null, List <EntityDicQnSetting> lstSettings = null) { using (Biz209 biz = new Biz209()) { return(biz.SaveQNnormal(vo, lstDet, out qnId, lstLaction, lstSettings)); } }
public EntityDicQnMain GetRowObject() { EntityDicQnMain vo = null; if (this.cardView.FocusedRowHandle >= 0) { vo = this.cardView.GetRow(this.cardView.FocusedRowHandle) as EntityDicQnMain; } return(vo); }
private void btnOk_Click(object sender, EventArgs e) { if (this.gridView.RowCount > 0) { dicQn = this.gridView.GetRow(this.gridView.FocusedRowHandle) as EntityDicQnMain; if (dicQn != null) { this.isSelect = true; this.Close(); } } }
/// <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 = 1; // 普通问卷 vo.creatorId = GlobalLogin.objLogin.EmpNo; vo.creatDate = DateTime.Now; if (this.QnVo != null && this.QnVo.qnId > 0) { vo.qnId = this.QnVo.qnId; } // 明细缓 List <EntityDicQnDetail> lstDet = new List <EntityDicQnDetail>(); List <EntityDicQnCtlLocation> lstLocation = new List <EntityDicQnCtlLocation>(); List <EntityDicQnSetting> lstSettings = new List <EntityDicQnSetting>(); foreach (KeyValuePair <int, IQuest> kvp in dicQuestCtrl) { lstDet.AddRange(kvp.Value.GetQnCtrls()); lstLocation.Add(kvp.Value.GetQnCtrlsLocation()); lstSettings.AddRange(kvp.Value.GetQnSettings()); } decimal qnId = 0; using (ProxyHms proxy = new ProxyHms()) { if (proxy.Service.SaveQNnormal(vo, lstDet, out qnId, lstLocation, lstSettings) > 0) { if (this.QnVo == null) { this.QnVo = new EntityDicQnMain() { qnId = qnId }; } this.IsRequireRefresh = true; DialogBox.Msg("保存问卷成功!"); } else { DialogBox.Msg("保存问卷失败。"); } } }
/// <summary> /// 获取自定义表单 /// </summary> /// <param name="parms"></param> /// <returns></returns> public List <EntityDicQnMain> GetQnMain(List <EntityParm> parms) { List <EntityDicQnMain> data = null; SqlHelper svc = new SqlHelper(EnumBiz.onlineDB); string Sql = string.Empty; Sql = @"select a.qnid,a.qnName,a.classId,a.qnDesc from dicQnMain a where a.qnid > -1 "; string sub = string.Empty; if (parms != null) { foreach (EntityParm pa in parms) { string key = pa.key; switch (key) { case "class": sub += " and a.classId = '" + pa.value + "'"; break; default: break; } } } Sql += sub; DataTable dt = svc.GetDataTable(Sql); if (dt != null && dt.Rows.Count > 0) { data = new List <EntityDicQnMain>(); EntityDicQnMain vo = null; foreach (DataRow dr in dt.Rows) { vo = new EntityDicQnMain(); vo = Function.Row2Model <EntityDicQnMain>(dr); data.Add(vo); } } return(data); }
/// <summary> /// 保存 /// </summary> /// <param name="vo"></param> /// <param name="lstDet"></param> /// <param name="qnId"></param> /// <returns></returns> public int SaveQNnormal(EntityDicQnMain vo, List <EntityDicQnDetail> lstDet, out decimal qnId, List <EntityDicQnCtlLocation> lstLaction = null, List <EntityDicQnSetting> lstSettings = null) { int affectRows = 0; qnId = 0; string Sql = string.Empty; SqlHelper svc = null; try { svc = new SqlHelper(EnumBiz.onlineDB); if (vo.qnId <= 0) { Sql = @"select max(t.qnId) as maxId from dicQnMain t"; DataTable dt = svc.GetDataTable(Sql); if (dt != null && dt.Rows.Count > 0) { if (dt.Rows[0]["maxId"] != DBNull.Value) { vo.qnId = Convert.ToDecimal(dt.Rows[0]["maxId"]) + 1; } } if (vo.qnId <= 0) { vo.qnId = 1; } } if (lstDet != null) { foreach (EntityDicQnDetail item in lstDet) { item.qnId = vo.qnId; } } if (lstLaction != null) { foreach (EntityDicQnCtlLocation item in lstLaction) { item.qnId = vo.qnId; } } if (lstSettings != null) { foreach (EntityDicQnSetting item in lstSettings) { item.qnId = vo.qnId; } } List <DacParm> lstParm = new List <DacParm>(); List <DacParm> lstParam2 = new List <DacParm>(); lstParm.Add(svc.GetDelParmByPk(vo)); lstParm.Add(svc.GetInsertParm(vo)); if (lstDet != null && lstDet.Count > 0) { lstParam2.Add(svc.GetDelParm(lstDet[0], EntityDicQnDetail.Columns.qnId)); lstParam2.Add(svc.GetInsertParm(lstDet.ToArray())); } if (lstLaction != null && lstLaction.Count > 0) { lstParm.Add(svc.GetDelParmByPk(lstLaction.ToArray())); lstParm.Add(svc.GetInsertParm(lstLaction.ToArray())); } if (lstSettings != null && lstSettings.Count > 0) { lstParm.Add(svc.GetDelParm(lstSettings[0], EntityDicQnSetting.Columns.qnId)); lstParm.Add(svc.GetInsertParm(lstSettings.FindAll(r => r.status == 1).ToArray())); } if (lstParam2.Count > 0) { affectRows = svc.Commit(lstParam2); } if (lstParm.Count > 0) { affectRows = svc.Commit(lstParm); } qnId = vo.qnId; } catch (Exception e) { ExceptionLog.OutPutException(e); affectRows = -1; qnId = -1; } finally { svc = null; } return(affectRows); }
private void frmPopup2090103_Load(object sender, EventArgs e) { this.customQN.QnVo = this.QnVo; this.customQN.InitComponent(this.QnVo.qnId); }
/// <summary> /// ctor /// </summary> /// <param name="_qnVo"></param> public frmPopup2090103(EntityDicQnMain _qnVo) { InitializeComponent(); this.Height = Screen.PrimaryScreen.WorkingArea.Height; this.QnVo = _qnVo; }
/// <summary> /// ctor /// </summary> /// <param name="_qnVo"></param> public frmPopup2090101(EntityDicQnMain _qnVo) { InitializeComponent(); this.QnVo = _qnVo; }
/// <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("保存问卷失败。"); } } }
public frmPopup2020702(EntityDicQnMain _qnVo) { InitializeComponent(); qnVo = _qnVo; }