//将数据源与控件绑定起来 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; } } } }
//DO数据源发送变更时 void DataValueChanged(Object obj) { if (obj is NewOrderTemplateDTO)//检查检验成套一级节点 { NewOrderTemplateDTO tempDo = obj as NewOrderTemplateDTO; _serverNameLabel.ValueText = tempDo.Name + "[¥ " + (tempDo.Price == null?"0.00":tempDo.Price.ToString("0.00")) + "]";// +" (" + tempDo.Ortplnitm_mp_name + ")"; _xUnitTextBox.ValueText = tempDo.Quan_med.ToString(); _xUnitTextBox.UnitText = tempDo.Ortplnitm_unit_name; if (tempDo.Fg_active.HasValue) //检查,设置是否启用CheckBox,默认启用 { this.CheckBoxEnable = (bool)tempDo.Fg_active; if (!this.CheckBoxEnable) { _serverNameLabel.ReadOnly = true; _xUnitTextBox.Enabled = false; _serverStopRender.StopReason = tempDo.Description; _serverStopRender.Visible = true; } } } else if (obj is OrTplNItmDO)//检查检验非套的一级节点 { OrTplNItmDO tempDo = obj as OrTplNItmDO; _serverNameLabel.ValueText = tempDo.Ortplnitm_srv_name + "[¥ " + (tempDo.Price == null ? "0.00" : tempDo.Price.ToString("0.00")) + "]";// +" (" + tempDo.Ortplnitm_mp_name + ")"; _xUnitTextBox.ValueText = tempDo.Quan_med.ToString(); _xUnitTextBox.UnitText = tempDo.Ortplnitm_unit_name; if (tempDo.Fg_active.HasValue) //check for a value { this.CheckBoxEnable = (bool)tempDo.Fg_active; if (!this.CheckBoxEnable) { _serverNameLabel.ReadOnly = true; _xUnitTextBox.Enabled = false; _serverStopRender.StopReason = tempDo.Description; _serverStopRender.Visible = true; } } } this.IsFirstLoad = false; }
/// <summary> /// 缓存协定处方显示的模板明细 /// </summary> /// <param name="orderTemplate">模板对象</param> private void SetOrTplDodic(NewOrderTemplateDTO orderTemplate) { foreach (Object obj in orderTemplate.Itemlist) { if (obj is OrTplNItmDO) { OrTplNItmDO orTplNItm = obj as OrTplNItmDO; if (!OrTplDodic.ContainsKey(orTplNItm.Id_ortmplitm)) { // 如果模板明细中的煎法、用法、频次为空,使用NewOrderTemplateDTO对象中的对应属性,当模板初始加载,不选择煎法时,明细中煎法为空 orTplNItm.Id_boil = orderTemplate.Id_boil; orTplNItm.Id_route = orderTemplate.Id_route; orTplNItm.Id_freq = orderTemplate.Id_freq; OrTplDodic.Add(orTplNItm.Id_ortmplitm, orTplNItm); } } } }
private void ResetControl(bool isHerb, NewOrderTemplateDTO tnmpDto) { if (isHerb) { if (topControl != null && this.RenderControls.Contains(topControl)) { return; } topControl = new XBaseControl(); topControl.Size = new Size(this.Size.Width, 36); topControl.Location = new Point(1, 0); this.AddRender(topControl); usageRender = XLabelControlFactory.GetLabelComboBox(topControl, tnmpDto.getrouteList()); usageRender.ValueText = tnmpDto.Name_route; usageRender.Size = new System.Drawing.Size(236, 24); usageRender.TitleText = "用法:"; usageRender.Location = new Point(0, 6); usageRender.ValueTextChanged += new EventHandler(usageRender_ValueTextChanged); topControl.AddRender(usageRender); frequencyRender = XLabelControlFactory.GetLabelComboBox(topControl, tnmpDto.getFreqdefdo()); frequencyRender.TitleText = "频次:"; frequencyRender.ValueText = tnmpDto.Name_freq; frequencyRender.Size = new System.Drawing.Size(236, 24); frequencyRender.Location = new Point(usageRender.Bound.Right, 6); frequencyRender.ValueTextChanged += new EventHandler(frequencyRender_ValueTextChanged); topControl.AddRender(frequencyRender); decoctionRender = XLabelControlFactory.GetLabelComboBox(topControl, tnmpDto.getBoilList()); decoctionRender.TitleText = "煎法:"; decoctionRender.ValueText = tnmpDto.Name_boil; decoctionRender.Size = new System.Drawing.Size(236, 24); decoctionRender.Location = new Point(frequencyRender.Bound.Right, 6); decoctionRender.ValueTextChanged += new EventHandler(decoctionRender_ValueTextChanged); topControl.AddRender(decoctionRender); checkAllRender = new XCheckBox(); checkAllRender.Text = "全选"; checkAllRender.Location = new Point(decoctionRender.Bound.Right + 20, (36 - checkAllRender.Bound.Height) / 2); checkAllRender.ValueTextChanged += new EventHandler(checkAllRender_ValueTextChanged); topControl.AddRender(checkAllRender); this.ContainerControl.Size = new Size(this.Size.Width, this.Size.Height - 37); this.ContainerControl.Location = new Point(1, 37); this.Container.Size = new Size(this.Container.Width, this.ContainerControl.Height); if (this.Container.Width <= this.ContainerControl.Width) { this.Container.Size = new Size(this.ContainerControl.Width, this.ContainerControl.Height); } else { this.Container.Size = new Size(this.Container.Width, this.ContainerControl.Height); } } else { if (topControl != null && this.RenderControls.Contains(topControl)) { this.RemoveRender(topControl); this.ContainerControl.Size = new Size(this.Size.Width, this.Size.Height); this.ContainerControl.Location = new Point(1, 0); this.Container.Size = new Size(this.Container.Width, this.ContainerControl.Height); if (this.Container.Width <= this.ContainerControl.Width) { this.Container.Size = new Size(this.ContainerControl.Width, this.ContainerControl.Height); } else { this.Container.Size = new Size(this.Container.Width, this.ContainerControl.Height); } } } }