//更新数据源到当前控件 void UpdateDatasourceToRender() { if (String.IsNullOrEmpty(this.TreatStyle) || (this.TreatStyle.Equals("1")))//诊疗模式为1或者空(默认) { _treatNameCheckBox.Text = this._itemDo.Ortplnitm_srv_name; _orderLabel.ValueText = OrdStrUtil.OrdStrMosaic(this._itemDo.Price == null ? null : this._itemDo.Price.ToString(), this._itemDo.Name_hp); if (_itemDo.Fg_active.HasValue) //检查,设置是否启用CheckBox,默认启用 { this._treatNameCheckBox.Checked = (bool)_itemDo.Fg_active; } _userNum.Text = this._itemDo.Quan_med.ToString(); _userNum.UnitText = this._itemDo.Ortplnitm_unit_name; _userNum.ValueTextChanged += _userNum_ValueTextChanged; _excuteProject.ValueText = this._itemDo.Ortplnitm_mp_name; } else if (this.TreatStyle.Equals("0")) { _treatNameCheckBox.Text = this._itemDo.Ortplnitm_srv_name + OrdStrUtil.OrdStrMosaic(this._itemDo.Price == null ? null : this._itemDo.Price.ToString(), this._itemDo.Name_hp); //_orderLabel.ValueText = OrdStrUtil.OrdStrMosaic(this._itemDo.Price == null ? null : this._itemDo.Price.ToString(), this._itemDo.Name_hp); if (_itemDo.Fg_active.HasValue) //检查,设置是否启用CheckBox,默认启用 { this._treatNameCheckBox.Checked = (bool)_itemDo.Fg_active; } _userNum.Text = this._itemDo.Quan_med.ToString(); _userNum.UnitText = this._itemDo.Ortplnitm_unit_name; _userNum.ValueTextChanged += _userNum_ValueTextChanged; if (this.templatRstDTo != null) { _freqXComboBox.DataSource = this.templatRstDTo.getFreqdefdo(); } _freqXComboBox.ValueText = this.OrderDTo.Name_freq; _freqXComboBox.ValueTextChanged += _freqXComboBox_ValueTextChanged; _userDays.Text = this._itemDo.Days_or.ToString(); _userDays.UnitText = "天"; _userDays.ValueTextChanged += _userDays_ValueTextChanged; } if (_itemDo.Fg_active.HasValue) { _treatNameCheckBox.Enabled = (bool)_itemDo.Fg_active; _userNum.Enabled = (bool)_itemDo.Fg_active; _freqXComboBox.Enabled = (bool)_itemDo.Fg_active; _userDays.Enabled = (bool)_itemDo.Fg_active; } if (_treatNameCheckBox.Enabled) { if (_itemDo.Fg_checked.HasValue) { _treatNameCheckBox.Checked = (bool)_itemDo.Fg_checked; } } }
//将数据源与控件绑定起来 void UpdateDatasourceToRender(Object obj) { if (obj is NewOrderTemplateDTO)//检查检验成套一级节点 { NewOrderTemplateDTO tempDo = obj as NewOrderTemplateDTO; tempDo.PropertyChanged += tempDo_PropertyChanged; // _checkBox.Text = tempDo.Name + OrdStrUtil.OrdStrMosaic(tempDo.Price == null ? null : tempDo.Price.ToString(), tempDo.Name_hp) + " " + tempDo.Ortplnitm_mp_name + ""; //将服务名称-(单价,分类)-科室进行拆分 _checkBox.Text = tempDo.Name; _orderLabel.ValueText = OrdStrUtil.OrdStrMosaic(tempDo.Price == null ? null : tempDo.Price.ToString(), tempDo.Name_hp); _departmentLabel.ValueText = tempDo.Ortplnitm_mp_name; if (tempDo.Fg_active.HasValue) //检查,设置是否启用CheckBox,默认启用 { this._checkBox.Enabled = (bool)tempDo.Fg_active; } if (this._checkBox.Enabled) { if (tempDo.Fg_checked.HasValue) { _checkBox.Checked = (bool)tempDo.Fg_checked; } } } else if (obj is OrTplNItmDO)//检查检验非套的一级节点 { OrTplNItmDO tempDo = obj as OrTplNItmDO; tempDo.PropertyChanged += tempDo_PropertyChanged; //将服务名称-(单价,分类)-科室进行拆分 _checkBox.Text = tempDo.Ortplnitm_srv_name; _orderLabel.ValueText = OrdStrUtil.OrdStrMosaic(tempDo.Price == null ? null : tempDo.Price.ToString(), tempDo.Name_hp); _departmentLabel.ValueText = tempDo.Ortplnitm_mp_name; // _checkBox.Text = tempDo.Ortplnitm_srv_name + OrdStrUtil.OrdStrMosaic(tempDo.Price == null ? null : tempDo.Price.ToString(), tempDo.Name_hp) + " " + tempDo.Ortplnitm_mp_name + ""; if (tempDo.Fg_active.HasValue) //check for a value { this._checkBox.Enabled = (bool)tempDo.Fg_active; } if (this._checkBox.Enabled) { if (tempDo.Fg_checked.HasValue) { _checkBox.Checked = (bool)tempDo.Fg_checked; } } } }