protected override void OnXapFormControl_ModelFilled(object sender, EventArgs e) { base.OnXapFormControl_ModelFilled(sender, e); this.ResetColumnsInfo(this.GetGridControl()); if (GetViewModel() == null) { return; } GetGridControl().DataTable.DataSource = GetViewModel().GetTableDataSource(); OnRefreshData(); SetIndicatorControl(); var dtAge = new DateTime(CommonExtentions.NowTime(this).Subtract(DateTime.Parse(this.GetViewModel().GetEnt4BannerDTO().Dt_birth)).Ticks); var nAge = dtAge.Year; try { int[] ages = CalcAgeArray.getAgeArray(DateTime.Parse(this.GetViewModel().GetEnt4BannerDTO().Dt_birth)); if (ages != null) { nAge = ages[0]; } } catch //(Exception exc) { this.SetStatusMsg("年龄使用默认值"); } var pregnat_num = AssXapFormUtils.GetUserRender(this.GetXapFormControl(), "preblood.pregnat_num") as XLabelBaseUserRender; if (null != pregnat_num && this.allowEdit) { // 1,男性; 2, 女 pregnat_num.NullFlag = this.GetViewModel().GetEnt4BannerDTO().Sd_sex == "1" || (nAge < 18 && this.GetViewModel().GetEnt4BannerDTO().Sd_sex == "2"); pregnat_num.Enabled = !(this.GetViewModel().GetEnt4BannerDTO().Sd_sex == "1"); } var parturition_cnt = AssXapFormUtils.GetUserRender(this.GetXapFormControl(), "preblood.parturition_cnt") as XLabelBaseUserRender; if (null != parturition_cnt && this.allowEdit) { parturition_cnt.NullFlag = this.GetViewModel().GetEnt4BannerDTO().Sd_sex == "1" || (nAge < 18 && this.GetViewModel().GetEnt4BannerDTO().Sd_sex == "2"); parturition_cnt.Enabled = !(this.GetViewModel().GetEnt4BannerDTO().Sd_sex == "1"); } var ur = AssXapFormUtils.GetUserRender(this.GetXapFormControl(), "preblood.no_db"); ur.Enabled = checkbox.Checked; (ur as XLabelBaseUserRender).NullFlag = !ur.Enabled; if (!ur.Enabled) { (this.GetViewModel().GetEmsUIDTO() as EmsUIDTO).Emsapbt.No_db = null; } AdjustLayout(); this.SetFocus(); }
void xapFormControl_DataChanged(object sender, xap.rui.control.forms.model.DataChangedEventArgs e) { if (string.IsNullOrEmpty(e.PropName)) { return; } if (e.PropName.Equals("Id_agent")) { //代办人的信息是否必填 setIsNullFlag(); } OrSrvAgentInfoDO orSrvAgent = e.Data as OrSrvAgentInfoDO; if (e.PropName == "Age_agent") { if (orSrvAgent.Age_agent < 0 || orSrvAgent.Age_agent > 200) { this.ShowAlert("年龄输入在0-200岁之间!"); return; } } else if (e.PropName.Equals("Idno_agent")) { DateTime birth; try { birth = IDUtil.GetBirthdayByIdentityCardId(orSrvAgent.Idno_agent, true); } catch (Exception) { return; } if (birth != null) { int[] ages = CalcAgeArray.getAgeArray(birth); if (ages != null) { orSrvAgent.Age_agent = ages[0]; } } var idsex = 0; Int32.TryParse(IDUtil.GetCardIdInfo(orSrvAgent.Idno_agent)[3], out idsex); orSrvAgent.Sd_sextp_agent = idsex.ToString(); orSrvAgent.Id_sextp_agent = idsex.ToString().Equals(PiDictCodeConst.SD_SEX_MALE) ? PiDictCodeConst.ID_SEX_MALE : PiDictCodeConst.ID_SEX_FEMALE; orSrvAgent.Name_sextp_agent = idsex.ToString().Equals(PiDictCodeConst.SD_SEX_MALE) ? PiDictCodeConst.NAME_SEX_MALE : PiDictCodeConst.NAME_SEX_FEMALE; } else if (e.PropName.Equals("Id_idtp_pat")) { if (!string.IsNullOrEmpty(orSrvAgent.Id_idtp_pat) && patInfoCache.Keys.Contains(orSrvAgent.Id_idtp_pat)) { orSrvAgent.Idno_pat = this.patInfoCache[orSrvAgent.Id_idtp_pat]; } else { orSrvAgent.Idno_pat = ""; } } }