698 lines
		
	
	
		
			36 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			698 lines
		
	
	
		
			36 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using AIMSExtension;
 | ||
| using DevComponents.DotNetBar;
 | ||
| using System;
 | ||
| using System.Collections.Generic;
 | ||
| using System.Drawing;
 | ||
| using System.Linq;
 | ||
| using System.Windows.Forms;
 | ||
| 
 | ||
| namespace DrawGraph
 | ||
| {
 | ||
|     /// <summary>
 | ||
|     /// 麻醉前访视单
 | ||
|     /// </summary>
 | ||
|     public class InstrumentDataManage : AreaManageBase
 | ||
|     {
 | ||
| 
 | ||
|         private OperationRecord myOpeRecord = null;
 | ||
|         public TextPackObj txtObj;
 | ||
|         public TablePackObj tablePackObj;
 | ||
|         public TablePackObj tablePackObj1;
 | ||
|         public TablePackObj tablePackObj2;
 | ||
|         public TablePackObj tablePackObj3;
 | ||
|         public float chaY;
 | ||
|         public float fontsize;
 | ||
| 
 | ||
|         public InstrumentDataManage() { }
 | ||
|         public InstrumentDataManage(object _operationRecor, DrawGraph.ZedGraphControl _zedControl, TemplateManage _template, string _name) : base(_operationRecor, _zedControl, _template, _name)
 | ||
|         { }
 | ||
| 
 | ||
|         public void init()
 | ||
|         {
 | ||
|             txtObj = template.GetPackObjectOTag<TextPackObj>("InstrumentDataManage_TextPackObj_44");
 | ||
|             tablePackObj = template.GetPackObjectOTag<TablePackObj>("InstrumentDataManage_TablePackObj_39");
 | ||
|             tablePackObj1 = template.GetPackObjectOTag<TablePackObj>("InstrumentDataManage_TablePackObj_41");
 | ||
|             tablePackObj2 = template.GetPackObjectOTag<TablePackObj>("InstrumentDataManage_TablePackObj_42");
 | ||
|             tablePackObj3 = template.GetPackObjectOTag<TablePackObj>("InstrumentDataManage_TablePackObj_43");
 | ||
|             if (tablePackObj != null)
 | ||
|             {
 | ||
|                 chaY = (tablePackObj.EndY - tablePackObj.Y) / tablePackObj.Rows;
 | ||
|                 fontsize = txtObj.FontSize;
 | ||
|             }
 | ||
|             myOpeRecord = OpeRecord as OperationRecord;
 | ||
|         }
 | ||
|         #region 重写的事件
 | ||
|         /// <summary>
 | ||
|         /// 鼠标点击画板
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         public override void MouseDown(ZedGraphControl sender, MouseEventArgs e)
 | ||
|         {
 | ||
|         }
 | ||
|         public override void MouseMove(ZedGraphControl sender, MouseEventArgs e)
 | ||
|         {
 | ||
|         }
 | ||
|         public override void MouseUp(ZedGraphControl sender, MouseEventArgs e)
 | ||
|         {
 | ||
|         }
 | ||
|         public override void MouseDoubleClick(ZedGraphControl sender, MouseEventArgs e)
 | ||
|         {
 | ||
|         }
 | ||
|         public override void KeyUp(ZedGraphControl sender, KeyEventArgs e)
 | ||
|         {
 | ||
|         }
 | ||
| 
 | ||
|         private void SetApplianceMethod(List<ApplianceRecord> ApplianceRecordList)
 | ||
|         {
 | ||
|             if (tablePackObj == null) return;
 | ||
|             if (myOpeRecord != null && myOpeRecord.Id != null)
 | ||
|             { 
 | ||
|                 //if (myOpeRecord.InstrumentList.InstrumentNurse != null && myOpeRecord.InstrumentList.InstrumentNurse != "")
 | ||
|                 //{
 | ||
|                 //    template.SetObjValue(myOpeRecord, "OperationRecord.InstrumentList.InstrumentNurse", myOpeRecord.InstrumentList.InstrumentNurse, myOpeRecord.InstrumentList.InstrumentNurse);
 | ||
|                 //}
 | ||
|                 //if (myOpeRecord.InstrumentList.TourNurse != null && myOpeRecord.InstrumentList.TourNurse != "")
 | ||
|                 //{
 | ||
|                 //    template.SetObjValue(myOpeRecord, "OperationRecord.InstrumentList.TourNurse", myOpeRecord.InstrumentList.TourNurse, myOpeRecord.InstrumentList.TourNurse);
 | ||
|                 //}
 | ||
|                 if (myOpeRecord.InstrumentList.Remark != null)
 | ||
|                 {
 | ||
|                     template.SetObjValue(myOpeRecord, "OperationRecord.InstrumentList.Remark", myOpeRecord.InstrumentList.Remark, myOpeRecord.InstrumentList.Remark);
 | ||
|                 }
 | ||
|             }
 | ||
|             int Columns = int.Parse(tablePackObj1.Columns.ToString());
 | ||
|             double span = tablePackObj.RealX - 0.005;
 | ||
|             double span2 = tablePackObj.RealX * 0.3;
 | ||
|             for (int i = 0; i < tablePackObj.Rows * 3 + 1; i++)
 | ||
|             {
 | ||
|                 DelAddObj("ApplianceRecordList" + i);
 | ||
|                 DelAddObj("ApplianceRecordListOpeFront" + i);
 | ||
|                 DelAddObj("ApplianceRecordListOpeDoing" + i);
 | ||
|                 DelAddObj("ApplianceRecordListCloseFront" + i);
 | ||
|                 DelAddObj("ApplianceRecordListCloseLast" + i);
 | ||
|                 DelAddObj("ApplianceRecordListSkinCloseLast" + i);
 | ||
|             }
 | ||
|             for (int index = 0; index < tablePackObj.Rows; index++)
 | ||
|             {
 | ||
|                 //if (ApplianceRecordList.Count > 0 && index < ApplianceRecordList.Count)
 | ||
|                 //{
 | ||
|                 double y = tablePackObj.RealY + chaY * index;
 | ||
|                 if (index < ApplianceRecordList.Count)
 | ||
|                     ZUtil.DrawText(ApplianceRecordList[index].ApplianceName, tablePackObj.X + tablePackObj.RealX, y, ZedControl, "ApplianceRecordList" + index, Color.Black, fontsize, false);
 | ||
|                 else
 | ||
|                     ZUtil.DrawLine(tablePackObj.X + tablePackObj.RealX, y + chaY,   tablePackObj1.X + span,  y, ZedControl, "ApplianceRecordList" + index, Color.Black);
 | ||
| 
 | ||
| 
 | ||
|                 if (index < ApplianceRecordList.Count && ApplianceRecordList[index].OpeFront != null && ApplianceRecordList[index].OpeFront != "" && ApplianceRecordList[index].OpeFront != @"/")
 | ||
|                     ZUtil.DrawText(ApplianceRecordList[index].OpeFront, tablePackObj1.X + tablePackObj.RealX + span2, y, ZedControl, "ApplianceRecordListOpeFront" + index, Color.Black, fontsize, false);
 | ||
|                 else
 | ||
|                     ZUtil.DrawLine(tablePackObj1.X + span, y + chaY, (tablePackObj1.EndX - tablePackObj1.X) / Columns * 1 + tablePackObj1.X + span, y, ZedControl, "ApplianceRecordListOpeFront" + index, Color.Black);
 | ||
|                 if (index < ApplianceRecordList.Count && ApplianceRecordList[index].OpeDoing != null && ApplianceRecordList[index].OpeDoing != "" && ApplianceRecordList[index].OpeDoing != @"/")
 | ||
|                     ZUtil.DrawText(ApplianceRecordList[index].OpeDoing, (tablePackObj1.EndX - tablePackObj1.X) / Columns * 1 + tablePackObj1.X + tablePackObj.RealX + span2, y, ZedControl, "ApplianceRecordListOpeDoing" + index, Color.Black, fontsize, false);
 | ||
|                 else
 | ||
|                     ZUtil.DrawLine((tablePackObj1.EndX - tablePackObj1.X) / Columns * 1 + tablePackObj1.X + span, y + chaY, (tablePackObj1.EndX - tablePackObj1.X) / Columns * 2 + tablePackObj1.X + span, y, ZedControl, "ApplianceRecordListOpeDoing" + index, Color.Black);
 | ||
|                 if (index < ApplianceRecordList.Count && ApplianceRecordList[index].CloseFront != null && ApplianceRecordList[index].CloseFront != "" && ApplianceRecordList[index].CloseFront != @"/")
 | ||
|                     ZUtil.DrawText(ApplianceRecordList[index].CloseFront, (tablePackObj1.EndX - tablePackObj1.X) / Columns * 2 + tablePackObj1.X + tablePackObj.RealX + span2, y, ZedControl, "ApplianceRecordListCloseFront" + index, Color.Black, fontsize, false);
 | ||
|                 else
 | ||
|                     ZUtil.DrawLine((tablePackObj1.EndX - tablePackObj1.X) / Columns * 2 + tablePackObj1.X + span, y + chaY, (tablePackObj1.EndX - tablePackObj1.X) / Columns * 3 + tablePackObj1.X + span, y, ZedControl, "ApplianceRecordListCloseFront" + index, Color.Black);
 | ||
|                 if (index < ApplianceRecordList.Count && ApplianceRecordList[index].CloseLast != null && ApplianceRecordList[index].CloseLast != "" && ApplianceRecordList[index].CloseLast != @"/")
 | ||
|                     ZUtil.DrawText(ApplianceRecordList[index].CloseLast, (tablePackObj1.EndX - tablePackObj1.X) / Columns * 3 + tablePackObj1.X + tablePackObj.RealX + span2, y, ZedControl, "ApplianceRecordListCloseLast" + index, Color.Black, fontsize, false);
 | ||
|                 else
 | ||
|                     ZUtil.DrawLine((tablePackObj1.EndX - tablePackObj1.X) / Columns * 3 + tablePackObj1.X + span, y + chaY, (tablePackObj1.EndX - tablePackObj1.X) / Columns * 4 + tablePackObj1.X + span, y, ZedControl, "ApplianceRecordListCloseLast" + index, Color.Black);
 | ||
|                 if (Columns == 5)
 | ||
|                     if (index < ApplianceRecordList.Count && ApplianceRecordList[index].SkinCloseLast != null && ApplianceRecordList[index].SkinCloseLast != "" && ApplianceRecordList[index].SkinCloseLast != @"/")
 | ||
|                         ZUtil.DrawText(ApplianceRecordList[index].SkinCloseLast, (tablePackObj1.EndX - tablePackObj1.X) / Columns * 4 + tablePackObj1.X + tablePackObj.RealX + span2, y, ZedControl, "ApplianceRecordListSkinCloseLast" + index, Color.Black, fontsize, false);
 | ||
|                     else
 | ||
|                         ZUtil.DrawLine((tablePackObj1.EndX - tablePackObj1.X) / Columns * 4 + tablePackObj1.X + span, y + chaY, (tablePackObj1.EndX - tablePackObj1.X) / Columns * 5 + tablePackObj1.X + span, y, ZedControl, "ApplianceRecordListSkinCloseLast" + index, Color.Black);
 | ||
| 
 | ||
|                 continue;
 | ||
|                 //}
 | ||
|             }
 | ||
|             for (int index = (int)tablePackObj.Rows; index < tablePackObj.Rows * 2; index++)
 | ||
|             {
 | ||
|                 //if (ApplianceRecordList.Count > 0 && index < ApplianceRecordList.Count)
 | ||
|                 //{
 | ||
|                 double y = tablePackObj.RealY + (chaY * (index - tablePackObj.Rows));
 | ||
|                 if (index < ApplianceRecordList.Count)
 | ||
|                     ZUtil.DrawText(ApplianceRecordList[index].ApplianceName, (tablePackObj.EndX - tablePackObj.X) / 2 + tablePackObj.X + tablePackObj.RealX, y, ZedControl, "ApplianceRecordList" + index, Color.Black, fontsize, false);
 | ||
|                 else
 | ||
|                     ZUtil.DrawLine((tablePackObj.EndX - tablePackObj.X) / 2 + tablePackObj.X + tablePackObj.RealX, y + chaY, tablePackObj2.X + span, y, ZedControl, "ApplianceRecordList" + index, Color.Black);
 | ||
| 
 | ||
| 
 | ||
|                 if (index < ApplianceRecordList.Count && ApplianceRecordList[index].OpeFront != null && ApplianceRecordList[index].OpeFront != "" && ApplianceRecordList[index].OpeFront != @"/")
 | ||
|                     ZUtil.DrawText(ApplianceRecordList[index].OpeFront, tablePackObj2.X + tablePackObj.RealX + span2, y, ZedControl, "ApplianceRecordListOpeFront" + index, Color.Black, fontsize, false);
 | ||
|                 else
 | ||
|                     ZUtil.DrawLine(tablePackObj2.X + span, y + chaY, (tablePackObj2.EndX - tablePackObj2.X) / Columns * 1 + tablePackObj2.X + span, y, ZedControl, "ApplianceRecordListOpeFront" + index, Color.Black);
 | ||
|                 if (index < ApplianceRecordList.Count && ApplianceRecordList[index].OpeDoing != null && ApplianceRecordList[index].OpeDoing != "" && ApplianceRecordList[index].OpeDoing != @"/")
 | ||
|                     ZUtil.DrawText(ApplianceRecordList[index].OpeDoing, (tablePackObj2.EndX - tablePackObj2.X) / Columns * 1 + tablePackObj2.X + tablePackObj.RealX + span2, y, ZedControl, "ApplianceRecordListOpeDoing" + index, Color.Black, fontsize, false);
 | ||
|                 else
 | ||
|                     ZUtil.DrawLine((tablePackObj2.EndX - tablePackObj2.X) / Columns * 1 + tablePackObj2.X + span, y + chaY, (tablePackObj2.EndX - tablePackObj2.X) / Columns * 2 + tablePackObj2.X + span, y, ZedControl, "ApplianceRecordListOpeDoing" + index, Color.Black);
 | ||
|                 if (index < ApplianceRecordList.Count && ApplianceRecordList[index].CloseFront != null && ApplianceRecordList[index].CloseFront != "" && ApplianceRecordList[index].CloseFront != @"/")
 | ||
|                     ZUtil.DrawText(ApplianceRecordList[index].CloseFront, (tablePackObj2.EndX - tablePackObj2.X) / Columns * 2 + tablePackObj2.X + tablePackObj.RealX + span2, y, ZedControl, "ApplianceRecordListCloseFront" + index, Color.Black, fontsize, false);
 | ||
|                 else
 | ||
|                     ZUtil.DrawLine((tablePackObj2.EndX - tablePackObj2.X) / Columns * 2 + tablePackObj2.X + span, y + chaY, (tablePackObj2.EndX - tablePackObj2.X) / Columns * 3 + tablePackObj2.X + span, y, ZedControl, "ApplianceRecordListCloseFront" + index, Color.Black);
 | ||
|                 if (index < ApplianceRecordList.Count && ApplianceRecordList[index].CloseLast != null && ApplianceRecordList[index].CloseLast != "" && ApplianceRecordList[index].CloseLast != @"/")
 | ||
|                     ZUtil.DrawText(ApplianceRecordList[index].CloseLast, (tablePackObj2.EndX - tablePackObj2.X) / Columns * 3 + tablePackObj2.X + tablePackObj.RealX + span2, y, ZedControl, "ApplianceRecordListCloseLast" + index, Color.Black, fontsize, false);
 | ||
|                 else
 | ||
|                     ZUtil.DrawLine((tablePackObj2.EndX - tablePackObj2.X) / Columns * 3 + tablePackObj2.X + span, y + chaY, (tablePackObj2.EndX - tablePackObj2.X) / Columns * 4 + tablePackObj2.X + span, y, ZedControl, "ApplianceRecordListCloseLast" + index, Color.Black);
 | ||
|                 if (Columns == 5)
 | ||
|                     if (index < ApplianceRecordList.Count && ApplianceRecordList[index].SkinCloseLast != null && ApplianceRecordList[index].SkinCloseLast != "" && ApplianceRecordList[index].SkinCloseLast != @"/")
 | ||
|                         ZUtil.DrawText(ApplianceRecordList[index].SkinCloseLast, (tablePackObj2.EndX - tablePackObj2.X) / Columns * 4 + tablePackObj2.X + tablePackObj.RealX + span2, y, ZedControl, "ApplianceRecordListSkinCloseLast" + index, Color.Black, fontsize, false);
 | ||
|                     else
 | ||
|                         ZUtil.DrawLine((tablePackObj2.EndX - tablePackObj2.X) / Columns * 4 + tablePackObj2.X + span, y + chaY, (tablePackObj2.EndX - tablePackObj2.X) / Columns * 5 + tablePackObj2.X + span, y, ZedControl, "ApplianceRecordListSkinCloseLast" + index, Color.Black);
 | ||
| 
 | ||
|                 continue;
 | ||
|                 //}
 | ||
|             }
 | ||
|             //if (tablePackObj3 != null)
 | ||
|             //{
 | ||
|             //    for (int index = (int)tablePackObj.Rows * 2 - 2; index < tablePackObj.Rows * 3 - 3; index++)
 | ||
|             //    {
 | ||
|             //        if (ApplianceRecordList.Count > 0 && index < ApplianceRecordList.Count)
 | ||
|             //        {
 | ||
|             //            double y = tablePackObj.RealY + (chaY * (index + 2 - tablePackObj.Rows * 2));
 | ||
|             //            ZUtil.DrawText(ApplianceRecordList[index].ApplianceName, (tablePackObj.EndX - tablePackObj.X) / 3 * 2 + tablePackObj.X + tablePackObj.RealX, y, ZedControl, "ApplianceRecordList" + index, Color.Black, fontsize, false);
 | ||
| 
 | ||
|             //            if (ApplianceRecordList[index].OpeFront != null && ApplianceRecordList[index].OpeFront != ""&& ApplianceRecordList[index].OpeFront != @"/")
 | ||
|             //                ZUtil.DrawText(ApplianceRecordList[index].OpeFront, tablePackObj3.X + tablePackObj.RealX, y, ZedControl, "ApplianceRecordListOpeFront" + index, Color.Black, fontsize, false);
 | ||
|             //            if (ApplianceRecordList[index].OpeDoing != null && ApplianceRecordList[index].OpeDoing != ""&& ApplianceRecordList[index].OpeDoing != @"/")
 | ||
|             //                ZUtil.DrawText(ApplianceRecordList[index].OpeDoing, (tablePackObj3.EndX - tablePackObj3.X) / Columns * 1 + tablePackObj3.X + tablePackObj.RealX, y, ZedControl, "ApplianceRecordListOpeDoing" + index, Color.Black, fontsize, false);
 | ||
|             //            if (ApplianceRecordList[index].CloseFront != null && ApplianceRecordList[index].CloseFront != ""&& ApplianceRecordList[index].CloseFront != @"/")
 | ||
|             //                ZUtil.DrawText(ApplianceRecordList[index].CloseFront, (tablePackObj3.EndX - tablePackObj3.X) / Columns * 2 + tablePackObj3.X + tablePackObj.RealX, y, ZedControl, "ApplianceRecordListCloseFront" + index, Color.Black, fontsize, false);
 | ||
|             //            if (ApplianceRecordList[index].CloseLast != null && ApplianceRecordList[index].CloseLast != "" && ApplianceRecordList[index].CloseLast != @"/")
 | ||
|             //                ZUtil.DrawText(ApplianceRecordList[index].CloseLast, (tablePackObj3.EndX - tablePackObj3.X) / Columns * 3 + tablePackObj3.X + tablePackObj.RealX, y, ZedControl, "ApplianceRecordListCloseLast" + index, Color.Black, fontsize, false);
 | ||
|             //            if (Columns == 5)
 | ||
|             //                if (ApplianceRecordList[index].SkinCloseLast != null && ApplianceRecordList[index].SkinCloseLast != "" && ApplianceRecordList[index].SkinCloseLast != @"/")
 | ||
|             //                    ZUtil.DrawText(ApplianceRecordList[index].SkinCloseLast, (tablePackObj3.EndX - tablePackObj3.X) / Columns * 4 + tablePackObj3.X + tablePackObj.RealX, y, ZedControl, "ApplianceRecordListSkinCloseLast" + index, Color.Black, fontsize, false);
 | ||
| 
 | ||
|             //            continue;
 | ||
|             //        }
 | ||
|             //    }
 | ||
|             //}
 | ||
|         }
 | ||
| 
 | ||
|         public override void editAr_Click(object sender, EventArgs e)
 | ||
|         {
 | ||
|             //传过来的数据是不是可编辑的
 | ||
|             AbleEditPackObj editPack = sender as AbleEditPackObj;
 | ||
|             if (editPack == null) return;
 | ||
|             //找到这个组件
 | ||
|             AbleEditPackObj aEdit1 = PackManage.ListPob.FirstOrDefault<PackObjBase>(s => s is AbleEditPackObj && s.PackTag == editPack.PackTag) as AbleEditPackObj;
 | ||
|             if (aEdit1 == null) return;
 | ||
| 
 | ||
|             txt_DoubleClick(aEdit1.CControl, null);
 | ||
|         }
 | ||
| 
 | ||
|         public SelectWorkerValue aSyncSelectDict = null;
 | ||
|         public override void Bind()
 | ||
|         {
 | ||
|             base.Bind();
 | ||
|             init();
 | ||
|             aSyncSelectDict = SelectWorkerValue.CreateInstance();
 | ||
|             List<PackObjBase> ables = PackManage.ListPob.Where<PackObjBase>(s => s is AbleEditPackObj).ToList<PackObjBase>();
 | ||
|             foreach (PackObjBase pack in ables)
 | ||
|             {
 | ||
|                 AbleEditPackObj ableEdit = pack as AbleEditPackObj;
 | ||
| 
 | ||
|                 if (ableEdit != null)
 | ||
|                 {
 | ||
|                     ableEdit.IsVisible = true;
 | ||
|                     if (ableEdit.ControlType == EControlType.DateTimePicker)
 | ||
|                     {
 | ||
|                         ableEdit.CControl.Leave -= new EventHandler(txt_Leave);
 | ||
|                         ableEdit.CControl.Leave += new EventHandler(txt_Leave);
 | ||
|                     }
 | ||
|                     else if (ableEdit.ControlType == EControlType.Directory)
 | ||
|                     {
 | ||
|                         ableEdit.CControl.DoubleClick -= new EventHandler(txt_DoubleClick);
 | ||
|                         ableEdit.CControl.DoubleClick += new EventHandler(txt_DoubleClick);
 | ||
|                         ableEdit.CControl.TextChanged -= new EventHandler(txt_Leave);
 | ||
|                         ableEdit.CControl.TextChanged += new EventHandler(txt_Leave);
 | ||
|                     }
 | ||
|                     else if (ableEdit.ControlType == EControlType.CheckBox)
 | ||
|                     {
 | ||
|                         Panel pan = ableEdit.CControl as Panel;
 | ||
|                         if (pan != null)
 | ||
|                         {
 | ||
|                             foreach (Control conl in pan.Controls)
 | ||
|                             {
 | ||
|                                 CheckBox chBox = conl as CheckBox;
 | ||
|                                 if (chBox != null)
 | ||
|                                 {
 | ||
|                                     chBox.CheckedChanged -= new EventHandler(txt_Leave);
 | ||
|                                     chBox.CheckedChanged += new EventHandler(txt_Leave);
 | ||
|                                 }
 | ||
|                             }
 | ||
|                         }
 | ||
|                     }
 | ||
|                     else if (ableEdit.ControlType == EControlType.RadioButtonList)
 | ||
|                     {
 | ||
|                         Panel pan = ableEdit.CControl as Panel;
 | ||
|                         if (pan != null)
 | ||
|                         {
 | ||
|                             foreach (Control conl in pan.Controls)
 | ||
|                             {
 | ||
|                                 CheckBox chBox = conl as CheckBox;
 | ||
|                                 if (chBox != null)
 | ||
|                                 {
 | ||
|                                     chBox.CheckedChanged -= new EventHandler(txt_Leave);
 | ||
|                                     chBox.CheckedChanged += new EventHandler(txt_Leave);
 | ||
|                                     //chBox.Click -= new EventHandler(radio_click);
 | ||
|                                     //chBox.Click += new EventHandler(radio_click);
 | ||
|                                 }
 | ||
|                             }
 | ||
|                         }
 | ||
|                     }
 | ||
|                     else
 | ||
|                     {
 | ||
|                         if (ableEdit.ControlType == EControlType.TextBox)
 | ||
|                         {
 | ||
|                             ableEdit.CControl.KeyDown -= new KeyEventHandler(text_keyDown);
 | ||
|                             ableEdit.CControl.KeyDown += new KeyEventHandler(text_keyDown);
 | ||
|                             ableEdit.CControl.GotFocus -= new EventHandler(txt_Focus);
 | ||
|                             ableEdit.CControl.GotFocus += new EventHandler(txt_Focus);
 | ||
|                         }
 | ||
|                         ableEdit.CControl.Leave -= new EventHandler(txt_Leave);
 | ||
|                         ableEdit.CControl.Leave += new EventHandler(txt_Leave);
 | ||
|                     }
 | ||
|                     SetAbleEditView(ableEdit);
 | ||
|                 }
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         private void txt_Focus(object sender, EventArgs e)
 | ||
|         {
 | ||
|             TextBox control = (TextBox)sender;
 | ||
|             if (control == null) return;
 | ||
|             AbleEditPackObj ableEdit = control.Tag as AbleEditPackObj;
 | ||
|             if (ableEdit == null) return;
 | ||
|             if (control.Focused == true && (ableEdit.PackValue == ableEdit.DefaultValue || ableEdit.PackValue == ""))
 | ||
|                 control.Clear();
 | ||
|         }
 | ||
|         private void text_keyDown(object sender, KeyEventArgs e)
 | ||
|         {
 | ||
|             if (e.Modifiers.CompareTo(Keys.Control) == 0 && e.KeyCode == Keys.V)
 | ||
|             {
 | ||
|                 string val = Clipboard.GetText();
 | ||
|                 val = val.Replace("\r", "").Replace("\n", "");
 | ||
|                 Clipboard.SetText(val);
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 在画完表单后,显示多选单选的默认项
 | ||
|         /// </summary>
 | ||
|         public override void FollowUpMethod()
 | ||
|         {
 | ||
|             base.FollowUpMethod();
 | ||
|             //在这里画积分
 | ||
|             BindTempData();
 | ||
|             List<PackObjBase> ables = PackManage.ListPob.Where<PackObjBase>(s => s is AbleEditPackObj).ToList<PackObjBase>();
 | ||
|             foreach (PackObjBase pack in ables)
 | ||
|             {
 | ||
|                 AbleEditPackObj ableEdit = pack as AbleEditPackObj;
 | ||
|                 SetAbleEditView(ableEdit);
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         public override void BindTempData()
 | ||
|         {
 | ||
|             if (myOpeRecord != null && myOpeRecord.Id != null)
 | ||
|             {
 | ||
|                 if (myOpeRecord.InstrumentList != null && tablePackObj != null)
 | ||
|                 {
 | ||
|                     SetApplianceMethod(myOpeRecord.InstrumentList.ApplianceRecordList);
 | ||
|                 }
 | ||
|                 if (myOpeRecord.InstrumentList.InstrumentNurse != null && myOpeRecord.InstrumentList.InstrumentNurse != "")
 | ||
|                 {
 | ||
|                     template.SetObjValue(myOpeRecord, "OperationRecord.InstrumentList.InstrumentNurse", myOpeRecord.InstrumentList.InstrumentNurse, myOpeRecord.InstrumentList.InstrumentNurse);
 | ||
|                 }
 | ||
|                 if (myOpeRecord.InstrumentList.TourNurse != null && myOpeRecord.InstrumentList.TourNurse != "")
 | ||
|                 {
 | ||
|                     template.SetObjValue(myOpeRecord, "OperationRecord.InstrumentList.TourNurse", myOpeRecord.InstrumentList.TourNurse, myOpeRecord.InstrumentList.TourNurse);
 | ||
|                 }
 | ||
|                 if (myOpeRecord.InstrumentList.Remark != null)
 | ||
|                 {
 | ||
|                     template.SetObjValue(myOpeRecord, "OperationRecord.InstrumentList.Remark", myOpeRecord.InstrumentList.Remark, myOpeRecord.InstrumentList.Remark);
 | ||
|                 }
 | ||
|             }
 | ||
|             List<PackObjBase> ables = PackManage.ListPob.Where<PackObjBase>(s => s is AbleEditPackObj).ToList<PackObjBase>();
 | ||
|             foreach (PackObjBase pack in ables)
 | ||
|             {
 | ||
|                 pack.Draw();
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 公共验证方法
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public override bool Verification()
 | ||
|         {
 | ||
|             List<PackObjBase> editPack = PackManage.ListPob.Where<PackObjBase>(s => s is AbleEditPackObj).ToList<PackObjBase>();
 | ||
|             foreach (PackObjBase pack in editPack)
 | ||
|             {
 | ||
|                 AbleEditPackObj ablePack = pack as AbleEditPackObj;
 | ||
|                 if (ablePack != null)
 | ||
|                 {
 | ||
|                     if (ablePack.ValidType == EValidType.IsRequired)
 | ||
|                     {
 | ||
|                         if (ablePack.PackValue.Trim() == "")
 | ||
|                         {
 | ||
|                             MessageBox.Show(pack.Descript + "不能为空");
 | ||
|                             return false;
 | ||
|                         }
 | ||
|                     };
 | ||
|                     if (ablePack.PackValue != "" && ablePack.ValidType == EValidType.IsNumber)
 | ||
|                     {
 | ||
|                         try
 | ||
|                         {
 | ||
|                             int.Parse(ablePack.PackValue);
 | ||
|                         }
 | ||
|                         catch (Exception  )
 | ||
|                         {
 | ||
|                             MessageBox.Show(pack.Descript + "不能为空且必须是数值型");
 | ||
|                             return false;
 | ||
|                         }
 | ||
|                     };
 | ||
|                     if (ablePack.TextLength != 0)
 | ||
|                     {
 | ||
|                         if (ablePack.PackValue.Length >= ablePack.TextLength)
 | ||
|                         {
 | ||
|                             MessageBox.Show(ablePack.Descript + "长度不能超过" + ablePack.TextLength + "字");
 | ||
|                         }
 | ||
|                     }
 | ||
|                 }
 | ||
|             }
 | ||
|             return true;
 | ||
|         }
 | ||
| 
 | ||
|         #endregion 重写的事件结束
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 设置可编辑组件的显示样式
 | ||
|         /// </summary>
 | ||
|         /// <param name="ableEdit"></param>
 | ||
|         private void SetAbleEditView(AbleEditPackObj ableEdit)
 | ||
|         {
 | ||
|             string span = "";
 | ||
|             double spanSum = Math.Round((float)(ableEdit.OneUnitCount / 18));
 | ||
|             for (int i = 0; i < spanSum; i++)
 | ||
|             {
 | ||
|                 if (ableEdit.IsHorizontal == ELineType.Horizontal)
 | ||
|                 {
 | ||
|                     span += " ";
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
| 
 | ||
|                     span += "\n";
 | ||
|                 }
 | ||
|             }
 | ||
|             string text = "", value = "";
 | ||
|             if (ableEdit != null && ableEdit.CControl != null)
 | ||
|             {
 | ||
|                 switch (ableEdit.ControlType)
 | ||
|                 {
 | ||
|                     case EControlType.RadioButtonList:
 | ||
|                         foreach (Control conl in ableEdit.CControl.Controls)
 | ||
|                         {
 | ||
|                             string spanT = span.Clone().ToString();
 | ||
|                             if (ableEdit.DfArrangement == EIsBool.True)
 | ||
|                             {
 | ||
|                                 if (spanT.Length - conl.Text.Length >= conl.Text.Length)
 | ||
|                                 {
 | ||
|                                     spanT = spanT.Remove(spanT.Length - conl.Text.Length, conl.Text.Length);
 | ||
|                                 }
 | ||
|                             }
 | ||
|                             CheckBox radio = conl as CheckBox;
 | ||
|                             if (radio.Checked)
 | ||
|                             {
 | ||
|                                 text += "☑" + conl.Text + spanT;
 | ||
|                                 value = conl.Text;
 | ||
|                             }
 | ||
|                             else
 | ||
|                             {
 | ||
|                                 text += "□" + conl.Text + spanT;
 | ||
|                             }
 | ||
|                         }
 | ||
|                         break;
 | ||
|                     case EControlType.CheckBox:
 | ||
|                         foreach (Control conl in ableEdit.CControl.Controls)
 | ||
|                         {
 | ||
|                             string spanT = span.Clone().ToString();
 | ||
|                             if (ableEdit.DfArrangement == EIsBool.True)
 | ||
|                             {
 | ||
|                                 if (spanT.Length - conl.Text.Length >= conl.Text.Length)
 | ||
|                                 {
 | ||
|                                     spanT = spanT.Remove(spanT.Length - conl.Text.Length, conl.Text.Length);
 | ||
|                                 }
 | ||
|                             }
 | ||
|                             CheckBox radio = conl as CheckBox;
 | ||
|                             if (radio.Checked)
 | ||
|                             {
 | ||
|                                 text += "☑" + conl.Text + spanT;
 | ||
|                                 value += conl.Text + ",";
 | ||
|                             }
 | ||
|                             else
 | ||
|                             {
 | ||
|                                 text += "□" + conl.Text + spanT;
 | ||
|                             }
 | ||
|                         }
 | ||
|                         value = value.TrimEnd(',');
 | ||
|                         break;
 | ||
|                     case EControlType.Directory:
 | ||
|                         if (ableEdit.ControlTitleText.Contains("模板"))
 | ||
|                         {
 | ||
|                             text = ableEdit.CControl.Text;
 | ||
|                             value = ableEdit.CControl.Text;
 | ||
|                         }
 | ||
|                         else
 | ||
|                         {
 | ||
|                             value = ableEdit.PackValue;
 | ||
|                             text = DBManage.GetDictionaryValuesById(ableEdit.PackValue, ableEdit.ControlTitleText);
 | ||
|                         }
 | ||
|                         break;
 | ||
|                     default:
 | ||
|                         text = ableEdit.CControl.Text;
 | ||
|                         value = ableEdit.CControl.Text;
 | ||
|                         break;
 | ||
|                 }
 | ||
| 
 | ||
|                 //设置属性的值
 | ||
|                 template.SetObjValue(OpeRecord, ableEdit.ClassDataSourceName, text, value, false);
 | ||
|                 //如果有逻辑区域,则区域进行更新。
 | ||
|                 //template.NotificationAreaBindingUpdate(template.ProjectName + "逻辑");
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         private void txt_DoubleClick(object sender, EventArgs e)
 | ||
|         {
 | ||
|             Control control = (Control)sender;
 | ||
|             if (control == null) return;
 | ||
|             AbleEditPackObj ableEdit = control.Tag as AbleEditPackObj;
 | ||
|             if (ableEdit == null) return;
 | ||
|             string DataSourceName = ableEdit.ClassDataSourceName;
 | ||
|             try
 | ||
|             {
 | ||
|                 string text = "", value = "";
 | ||
|                 switch (ableEdit.ControlType)
 | ||
|                 {
 | ||
|                     case EControlType.DateTimePicker:
 | ||
|                         text = DateTime.Now.ToString();
 | ||
|                         value = DateTime.Now.ToString();
 | ||
|                         control.Text = text;
 | ||
|                         break;
 | ||
|                     default:
 | ||
|                         text = ableEdit.CControl.Text;
 | ||
|                         value = ableEdit.CControl.Text;
 | ||
|                         break;
 | ||
|                 }
 | ||
|                 switch (ableEdit.ClassDataSourceName)
 | ||
|                 {
 | ||
|                     case "OperationRecord.InstrumentList.InstrumentNurse":
 | ||
|                         Worker_Click(ableEdit, e, 3);
 | ||
|                         break;
 | ||
|                     case "OperationRecord.InstrumentList.TourNurse":
 | ||
|                         Worker_Click(ableEdit, e, 3);
 | ||
|                         break;
 | ||
|                         //default:
 | ||
|                         //    //在此处写日志
 | ||
|                         //    aEdit1.IsVisible = !aEdit1.IsVisible;
 | ||
|                         //    MessageBox.Show("没找到-" + aEdit1.ClassDataSourceName + "-属性的事件");
 | ||
|                         //    break;
 | ||
|                 }
 | ||
|             }
 | ||
|             catch (Exception ex)
 | ||
|             {
 | ||
|                 PublicMethod.WriteLog(ex);
 | ||
|             }
 | ||
|             finally
 | ||
|             {
 | ||
|                 template.ZedControl.Refresh();
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         //private void radio_click(object sender, EventArgs e)
 | ||
|         //{
 | ||
|         //    CheckBox control = (CheckBox)sender;
 | ||
|         //    if (control == null) return;
 | ||
| 
 | ||
|         //    if (!valChang)
 | ||
|         //    {
 | ||
|         //        control.Checked = false;
 | ||
|         //    }
 | ||
| 
 | ||
|         //    valChang = false;
 | ||
| 
 | ||
|         //}
 | ||
| 
 | ||
|         private void Worker_Click(AbleEditPackObj sender, EventArgs e, int _workersType)
 | ||
|         {
 | ||
|             AbleEditPackObj ableEdit = sender;
 | ||
|             if (ableEdit == null) return;
 | ||
| 
 | ||
|             ableEdit.CControl.TextChanged -= new EventHandler(CControl_TextChanged);
 | ||
|             ableEdit.CControl.TextChanged += new EventHandler(CControl_TextChanged);
 | ||
|             ableEdit.CControl.MouseDown -= new MouseEventHandler(CControl_MouseDown);
 | ||
|             ableEdit.CControl.MouseDown += new MouseEventHandler(CControl_MouseDown);
 | ||
|             ableEdit.CControl.KeyUp -= new KeyEventHandler(CControl_KeyUp);
 | ||
|             ableEdit.CControl.KeyUp += new KeyEventHandler(CControl_KeyUp);
 | ||
| 
 | ||
|             if (myOpeRecord != null)
 | ||
|             {
 | ||
|                 Control conl = sender.CControl;
 | ||
|                 if (conl is TextBox)
 | ||
|                 {
 | ||
|                     ((TextBox)conl).BorderStyle = BorderStyle.Fixed3D;
 | ||
|                     ((TextBox)conl).Focus();
 | ||
|                     if (sender.PackValue != null && sender.PackValue.Trim() != "")
 | ||
|                     {
 | ||
|                         if (((TextBox)conl).Text.LastIndexOf(',') != sender.PackText.Length)
 | ||
|                             ((TextBox)conl).Text = ((TextBox)conl).Text + ",";
 | ||
|                         ((TextBox)conl).Select(((TextBox)conl).Text.Length, 1);
 | ||
|                     }
 | ||
|                 }
 | ||
| 
 | ||
|                 aSyncSelectDict.Show(template, OpeRecord, sender, _workersType.ToString(), false);
 | ||
| 
 | ||
|                 SetAbleEditView(ableEdit);
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         private void CControl_TextChanged(object sender, EventArgs e)
 | ||
|         {
 | ||
|             if (myOpeRecord != null)
 | ||
|             {
 | ||
|                 Control conl = sender as Control;
 | ||
| 
 | ||
|                 aSyncSelectDict.ShowSel(conl, OpeRecord);
 | ||
|             }
 | ||
|         }
 | ||
|         private void CControl_KeyUp(object sender, KeyEventArgs e)
 | ||
|         {
 | ||
|             if (myOpeRecord != null)
 | ||
|             {
 | ||
|                 Control conl = sender as Control;
 | ||
|                 if (conl.Text != SelectWorkerValue.Value)
 | ||
|                     if (e.KeyCode == Keys.Delete || e.KeyCode == Keys.Back)
 | ||
|                     {
 | ||
|                         aSyncSelectDict.DelSel(conl, OpeRecord);
 | ||
|                     }
 | ||
|             }
 | ||
|         }
 | ||
|         private void CControl_MouseDown(object sender, MouseEventArgs e)
 | ||
|         {
 | ||
|             if (myOpeRecord != null)
 | ||
|             {
 | ||
|                 TextBox conl = sender as TextBox;
 | ||
|                 string leftStr = conl.Text.Substring(0, conl.SelectionStart);
 | ||
|                 string rightStr = conl.Text.Substring(conl.SelectionStart, conl.Text.Length - conl.SelectionStart);
 | ||
|                 int startIndex = 0;
 | ||
|                 int endLength = conl.Text.Length;
 | ||
| 
 | ||
|                 if (leftStr.Contains(","))
 | ||
|                 {
 | ||
|                     int beginindex = leftStr.LastIndexOf(',');
 | ||
|                     startIndex = beginindex + 1;
 | ||
|                     if (rightStr.Contains(","))
 | ||
|                     {
 | ||
|                         endLength = rightStr.IndexOf(",") + (leftStr.Length - beginindex);
 | ||
|                     }
 | ||
|                     //else
 | ||
|                     //{
 | ||
|                     //    endLength = conl.Text.Length - startIndex;
 | ||
|                     //}
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     if (rightStr.Contains(","))
 | ||
|                     {
 | ||
|                         endLength = rightStr.IndexOf(",") + leftStr.Length + 1;
 | ||
|                     }
 | ||
|                 }
 | ||
|                 conl.Select(startIndex, endLength);
 | ||
| 
 | ||
|             }
 | ||
|         }
 | ||
|         private void txt_Leave(object sender, EventArgs e)
 | ||
|         {
 | ||
|             Control control = (Control)sender;
 | ||
|             if (control == null) return;
 | ||
|             AbleEditPackObj ableEdit = control.Tag as AbleEditPackObj;
 | ||
|             if (ableEdit == null) return;
 | ||
|             //拿到数据源(格式:OperationRecord.PatientRef.Bed)
 | ||
|             //bool updateOk = true;
 | ||
|             try
 | ||
|             {
 | ||
|                 SetAbleEditView(ableEdit);
 | ||
|                 if (ableEdit.ControlType == EControlType.RadioButtonList)
 | ||
|                 {
 | ||
|                     if ((sender as CheckBox).Checked == true)
 | ||
|                     {
 | ||
|                         foreach (CheckBox chk in (sender as CheckBox).Parent.Controls)
 | ||
|                         {
 | ||
|                             if (chk != sender)
 | ||
|                             {
 | ||
|                                 chk.Checked = false;
 | ||
|                             }
 | ||
|                         }
 | ||
|                     }
 | ||
|                 }
 | ||
|             }
 | ||
|             catch (Exception ex )
 | ||
|             {
 | ||
|                 PublicMethod.WriteLog(ex); 
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         //设置打印模式,组件不显示
 | ||
|         public override void setPrint(bool isVisible)
 | ||
|         {
 | ||
|             //预览状态时所可编辑组件的组件隐藏
 | ||
|             List<PackObjBase> ables = PackManage.ListPob.Where<PackObjBase>(s => s is AbleEditPackObj).ToList<PackObjBase>();
 | ||
|             foreach (PackObjBase pack1 in ables)
 | ||
|             {
 | ||
|                 AbleEditPackObj ableEdit = pack1 as AbleEditPackObj;
 | ||
| 
 | ||
|                 if (ableEdit != null)
 | ||
|                 {
 | ||
|                     ableEdit.IsVisible = isVisible;
 | ||
|                     if (isVisible == true)
 | ||
|                         ableEdit.IsViewBoard = EIsBool.True;
 | ||
|                     else
 | ||
|                         ableEdit.IsViewBoard = EIsBool.False;
 | ||
|                 }
 | ||
|             }
 | ||
|         }
 | ||
|         public void DelAddObj(string tagName)
 | ||
|         {
 | ||
|             GraphObj text = (GraphObj)ZedControl.MasterPane.GraphObjList[tagName];
 | ||
|             if (text != null)
 | ||
|                 ZedControl.MasterPane.GraphObjList.Remove(text);
 | ||
|         }
 | ||
| 
 | ||
|     }
 | ||
| }
 |