void render_DoubleClick(object sender, EventArgs e) { List <OrTplNItmDO> listCanSave = new List <OrTplNItmDO>(); string srvNames = ""; if (sender is IExtOrder) { if (!isActive((sender as IExtOrder).ExtAssist.OrderDto)) { showErrorInfoOnDoubleClick((sender as IExtOrder).ExtAssist.OrderDto.Name); return; } if ((sender as IExtOrder).ExtAssist.OrderDto.Ui_flag.Equals("1"))//套 { LisFirstOrdrRender render = (sender as LisFirstOrdrRender); if (sender is LisFirstOrdrRender)//检查检验一级 { foreach (var temp in (sender as LisFirstOrdrRender).SecondOrderCollections) { listCanSave.Add(temp.ItemDo); } } else if (sender is LisSecondOrder)//检查检查二级 { LisSecondOrder secondeOrder = sender as LisSecondOrder; foreach (var temp in secondeOrder.BrotherOrderCollecions) { listCanSave.Add(temp.ItemDo); } } } else if ((sender as IExtOrder).ExtAssist.OrderDto.Ui_flag.Equals("2"))//成组药 { OrderSingleRender ordersinglRender = (sender as OrderSingleRender); List <OrderSingleRender> brotherRenders = ordersinglRender.BrotherOrderCollecions; foreach (OrderSingleRender brotherSingle in brotherRenders) { if (this.isActive(brotherSingle.ItemDo)) { listCanSave.Add(brotherSingle.ItemDo); } else { srvNames += brotherSingle.ItemDo.Ortplnitm_srv_name + ","; } } } else if ((sender as IExtOrder).ExtAssist.OrderDto.Ui_flag.Equals("3"))//单一药品 { OrderSingleRender ordersinglRender = (sender as OrderSingleRender); if (this.isActive(ordersinglRender.ItemDo)) { listCanSave.Add(ordersinglRender.ItemDo); } else { srvNames += ordersinglRender.ItemDo.Ortplnitm_srv_name + ","; } } else if ((sender as IExtOrder).ExtAssist.OrderDto.Ui_flag.Equals("4"))//其他(检查检验非套) { LisFirstOrdrRender render = (sender as LisFirstOrdrRender); if (this.isActive(render.ItemDo)) { listCanSave.Add(render.ItemDo); } else { srvNames += render.ItemDo.Ortplnitm_srv_name + ","; } } else if ((sender as IExtOrder).ExtAssist.OrderDto.Ui_flag.Equals("5"))//草药 { ChineseMedicineOrder render = (sender as ChineseMedicineOrder); List <ChineseMedicineOrder> brotherRenders = render.BrotherOrderCollecions; foreach (ChineseMedicineOrder brotherSingle in brotherRenders) { if (this.isActive(brotherSingle.ItemDo)) { listCanSave.Add(brotherSingle.ItemDo); } else { srvNames += brotherSingle.ItemDo.Ortplnitm_srv_name + ","; } } } else if ((sender as IExtOrder).ExtAssist.OrderDto.Ui_flag.Equals("6"))//诊疗 { TreatmentOrder render = (sender as TreatmentOrder); if (this.isActive(render.ItemDo)) { listCanSave.Add(render.ItemDo); } else { srvNames += render.ItemDo.Ortplnitm_srv_name + ","; } } } if (listCanSave.Count == 0) { this.showErrorInfoOnDoubleClick(srvNames.Substring(0, srvNames.Length - 1)); return; } else { this.saveToDb(listCanSave); xapBaseControl.SetStatusMsg("保存成功!"); } }
private void modelItmChecked(object obj, TreeItemEventArgs e) { if (e.Node is IExtOrder) { var sender = e.Node; if ((sender as IExtOrder).ExtAssist.OrderDto.Ui_flag.Equals("1"))//套 { LisFirstOrdrRender render = (sender as LisFirstOrdrRender); if (sender is LisFirstOrdrRender)//检查检验一级 { bool nowChecked = (sender as LisFirstOrdrRender).Checked; if (nowChecked) { if (!this.selectTreeList.Contains(sender)) { this.selectTreeList.Add(sender as XAPTreeNodeRender); } } else { this.selectTreeList.Remove(sender as XAPTreeNodeRender); } if (!isCheckChild) { isCheckChild = true;; } foreach (var temp in (sender as LisFirstOrdrRender).SecondOrderCollections) { if (temp.ItemDo.Fg_active == null || (temp.ItemDo.Fg_active != null && (bool)temp.ItemDo.Fg_active)) { temp.IsCanel = true; temp.Checked = nowChecked; temp.IsCanel = false; if (nowChecked) { if (!selectList.Contains(temp.ItemDo)) { selectList.Add(temp.ItemDo); this.selectTreeList.Add(temp as XAPTreeNodeRender); } } else { selectList.Remove(temp.ItemDo); this.selectTreeList.Remove(temp as XAPTreeNodeRender); } } else { temp.IsCanel = true; temp.Checked = nowChecked; temp.IsCanel = false; } } } else if (sender is LisSecondOrder)//检查检查二级 { //render.ExtAssist.OrderDto LisSecondOrder secondeOrder = sender as LisSecondOrder; bool nowChecked = secondeOrder.Checked; bool flagResult = false; foreach (var temp in secondeOrder.BrotherOrderCollecions) { //temp.Checked if (nowChecked) { if (temp.ItemDo.Fg_active == null || (temp.ItemDo.Fg_active != null && (bool)temp.ItemDo.Fg_active)) { if (secondeOrder.ItemDo == temp.ItemDo || (temp.ItemDo.Fg_edit != null && !(bool)temp.ItemDo.Fg_edit)) { temp.IsCanel = true; temp.Checked = nowChecked; temp.IsCanel = false; if (!selectList.Contains(temp.ItemDo)) { selectList.Add(temp.ItemDo); this.selectTreeList.Add(temp as XAPTreeNodeRender); } } } } else { if (temp == secondeOrder) { if (selectList.Contains(temp.ItemDo)) { selectList.Remove(temp.ItemDo); this.selectTreeList.Remove(temp as XAPTreeNodeRender); } } } if (temp.IsChecked) { flagResult = true; } } if (secondeOrder.ParentRender != null) { secondeOrder.ParentRender.IsCanel = true; secondeOrder.ParentRender.IsCanelCheckedOperation = true; secondeOrder.ParentRender.IsChecked = flagResult; secondeOrder.ParentRender.IsCanelCheckedOperation = false; secondeOrder.ParentRender.IsCanel = false; if (flagResult) { if (!this.selectTreeList.Contains(secondeOrder.ParentRender)) { this.selectTreeList.Add(secondeOrder.ParentRender as XAPTreeNodeRender); } } else { this.selectTreeList.Remove(secondeOrder.ParentRender as XAPTreeNodeRender); } } } } else if ((sender as IExtOrder).ExtAssist.OrderDto.Ui_flag.Equals("2"))//成组药 { if (sender is OrderSingleRender) { OrderSingleRender ordersinglRender = (sender as OrderSingleRender); bool nowChecked = ordersinglRender.Checked; if (nowChecked) { List <OrderSingleRender> brotherList = ordersinglRender.BrotherOrderCollecions; foreach (OrderSingleRender brother in brotherList) { brother.Checked = true; if (brother.Checked) { if (!selectList.Contains(brother.ItemDo)) { selectList.Add(brother.ItemDo); this.selectTreeList.Add(brother as XAPTreeNodeRender); } } } if (!selectList.Contains(ordersinglRender.ItemDo)) { selectList.Add(ordersinglRender.ItemDo); this.selectTreeList.Add(ordersinglRender as XAPTreeNodeRender); } } else { selectList.Remove(ordersinglRender.ItemDo); this.selectTreeList.Add(ordersinglRender as XAPTreeNodeRender); } } else if (sender is OrderGroupFirstOrder) { if ((sender as OrderGroupFirstOrder).Checked) { if (!this.selectTreeList.Contains(sender)) { this.selectTreeList.Add(sender as XAPTreeNodeRender); } } else { this.selectTreeList.Remove(sender as XAPTreeNodeRender); } } } else if ((sender as IExtOrder).ExtAssist.OrderDto.Ui_flag.Equals("3"))//单一药品 { OrderSingleRender ordersinglRender = (sender as OrderSingleRender); bool nowChecked = ordersinglRender.Checked; if (nowChecked) { if (!selectList.Contains(ordersinglRender.ItemDo)) { selectList.Add(ordersinglRender.ItemDo); } } else { selectList.Remove(ordersinglRender.ItemDo); } } else if ((sender as IExtOrder).ExtAssist.OrderDto.Ui_flag.Equals("4"))//其他(检查检验非套) { LisFirstOrdrRender render = (sender as LisFirstOrdrRender); bool nowChecked = render.Checked; if (nowChecked) { if (!selectList.Contains(render.ItemDo)) { selectList.Add(render.ItemDo); } } else { selectList.Remove(render.ItemDo); } } else if ((sender as IExtOrder).ExtAssist.OrderDto.Ui_flag.Equals("5"))//草药 { if (sender is ChineseMedicineOrder) { ChineseMedicineOrder render = (sender as ChineseMedicineOrder); bool nowChecked = render.Checked; if (nowChecked) { List <ChineseMedicineOrder> brotherList = render.BrotherOrderCollecions; foreach (ChineseMedicineOrder brother in brotherList) { brother.Checked = true; if (brother.Checked) { if (!selectList.Contains(brother.ItemDo)) { selectList.Add(brother.ItemDo); } } } if (!selectList.Contains(render.ItemDo)) { selectList.Add(render.ItemDo); } } else { selectList.Remove(render.ItemDo); } } else if (sender is ChineseMedcineFirstOrder) { if ((sender as ChineseMedcineFirstOrder).Checked) { if (!this.selectTreeList.Contains(sender)) { this.selectTreeList.Add(sender as XAPTreeNodeRender); } } } else { this.selectTreeList.Remove(sender as XAPTreeNodeRender); } } else if ((sender as IExtOrder).ExtAssist.OrderDto.Ui_flag.Equals("6"))//诊疗 { TreatmentOrder render = (sender as TreatmentOrder); bool nowChecked = render.Checked; if (nowChecked) { if (!selectList.Contains(render.ItemDo)) { selectList.Add(render.ItemDo); } } else { selectList.Remove(render.ItemDo); } } } }