1001 lines
33 KiB
C#
1001 lines
33 KiB
C#
using HelperDB;
|
||
using Newtonsoft.Json;
|
||
using AIMSExtension;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Drawing;
|
||
using System.Linq;
|
||
using System.Windows.Forms;
|
||
using System.Xml.Serialization;
|
||
|
||
namespace DrawGraph
|
||
{
|
||
[Serializable, JsonObject(MemberSerialization.OptOut)]
|
||
/// <summary>
|
||
/// 模板管理工具的具体类,全局绑定在这个类里
|
||
/// </summary>
|
||
public class TemplateManage
|
||
{
|
||
public TemplateManage()
|
||
{
|
||
}
|
||
|
||
#region 属性
|
||
private List<AreaManageBase> manageList = new List<AreaManageBase>();
|
||
private string msgStr = "";
|
||
private string projectName = "";
|
||
private string direct = "";
|
||
private int id;
|
||
private object opeRecord = null;
|
||
PropertyObject operationRecordProObj = new PropertyObject();
|
||
private ZedGraphControl zedControl = null;
|
||
private int zjpyl = 0;
|
||
private int hzjpyl = 0;
|
||
private int dfzjpyl = 0;
|
||
private int locationY;
|
||
//private string hospitalName = "";
|
||
//private XmlUtil xmlOpe = new XmlUtil(System.Windows.Forms.Application.StartupPath + "\\AIMS.xml");
|
||
private TypesettingEnum typesetting = TypesettingEnum.Vertical;
|
||
private PageTypeEnum pageType = PageTypeEnum.A4;
|
||
|
||
public int LocationY
|
||
{
|
||
set
|
||
{
|
||
locationY = value;
|
||
if (zedControl != null) zedControl.Location = new Point(0, 0 - LocationY);//0);
|
||
}
|
||
get { return locationY; }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 管理器的列表
|
||
/// </summary>
|
||
public List<AreaManageBase> ManageList
|
||
{
|
||
get
|
||
{
|
||
return manageList;
|
||
}
|
||
}
|
||
[JsonIgnore]
|
||
[XmlIgnore]
|
||
public string MsgStr
|
||
{
|
||
get
|
||
{
|
||
return msgStr;
|
||
}
|
||
|
||
set
|
||
{
|
||
msgStr = value;
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 项目名称
|
||
/// </summary>
|
||
public string ProjectName
|
||
{
|
||
get
|
||
{
|
||
return projectName;
|
||
}
|
||
|
||
set
|
||
{
|
||
projectName = value;
|
||
Direct = value;
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 根据类.属性返回指定的绘图组件通知更新
|
||
/// </summary>
|
||
/// <param name="propertyName">类名加属性名</param>
|
||
/// <param name="newText">新文本</param>
|
||
/// <param name="newValue">新值</param>
|
||
/// <param name="isUpdate">是否更新数据库</param>
|
||
/// <param name="t">要更新的对象</param>
|
||
public int NotifyUpdate(string propertyName, string newText, string newValue, bool isUpdate = false, object t = null)
|
||
{
|
||
int i = 1;
|
||
|
||
if (isUpdate && t != null)
|
||
{
|
||
//为真时更新数据库
|
||
i = DBManage.SetOperationRecordValue(t, propertyName, newValue, newText);
|
||
}
|
||
if (isUpdate && i <= 0) return i;
|
||
|
||
foreach (AreaManageBase area in manageList)
|
||
{
|
||
if (area.PackManage != null)
|
||
{
|
||
//找到以类.属性结尾的对象
|
||
List<PackObjBase> packObjs = area.PackManage.ListPob.Where<PackObjBase>(s => s.PackTag.EndsWith(propertyName.Replace('.', '_'))).ToList<PackObjBase>();
|
||
foreach (PackObjBase pack in packObjs)
|
||
{
|
||
pack.PackText = newText;
|
||
pack.PackValue = newValue;
|
||
//pack.IsSelfFresh = false;
|
||
pack.Draw();
|
||
}
|
||
}
|
||
}
|
||
return i;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 设置对象的值
|
||
/// </summary>
|
||
/// <param name="t"></param>
|
||
/// <param name="propertyName"></param>
|
||
/// <param name="text"></param>
|
||
/// <param name="value"></param>
|
||
/// <param name="isUpdate"></param>
|
||
public void SetObjValue(object t, string propertyName, string text, string value, bool isUpdate = false)
|
||
{
|
||
//设置对象的值
|
||
object oldValue = EntityObjectChangeNotifier.SubObjSetValue(t, propertyName, value);
|
||
//是否更新数据库并通知组件重绘
|
||
NotifyUpdate(propertyName, text, value, isUpdate, t);
|
||
}
|
||
[JsonIgnore]
|
||
[XmlIgnore]
|
||
public int Id
|
||
{
|
||
get
|
||
{
|
||
return id;
|
||
}
|
||
set
|
||
{
|
||
id = value;
|
||
if (manageList.Count > 0)
|
||
{
|
||
foreach (AreaManageBase area in manageList)
|
||
{
|
||
area.Id = id;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
[JsonIgnore]
|
||
[XmlIgnore]
|
||
public string Direct
|
||
{
|
||
get
|
||
{
|
||
return direct;
|
||
}
|
||
set
|
||
{
|
||
string dir = projectName;
|
||
if (manageList.Count > 0)
|
||
{
|
||
foreach (AreaManageBase area in manageList)
|
||
{
|
||
area.Direct = dir;
|
||
}
|
||
}
|
||
direct = dir;
|
||
}
|
||
}
|
||
|
||
[JsonIgnore]
|
||
[XmlIgnore]
|
||
public object OpeRecord
|
||
{
|
||
get
|
||
{
|
||
return opeRecord;
|
||
}
|
||
set
|
||
{
|
||
opeRecord = value;
|
||
foreach (AreaManageBase area in manageList)
|
||
{
|
||
area.OpeRecord = opeRecord;
|
||
}
|
||
}
|
||
}
|
||
|
||
[JsonIgnore]
|
||
[XmlIgnore]
|
||
public ZedGraphControl ZedControl
|
||
{
|
||
get
|
||
{
|
||
return zedControl;
|
||
}
|
||
set
|
||
{
|
||
zedControl = value;
|
||
if (zedControl != null)
|
||
{
|
||
//把本界面的画板控件给所有子包控件传递。
|
||
foreach (AreaManageBase area in manageList)
|
||
{
|
||
area.SetZedControl(zedControl);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 组件的偏移量
|
||
/// </summary>
|
||
public int Zjpyl
|
||
{
|
||
get
|
||
{
|
||
return zjpyl;
|
||
}
|
||
|
||
set
|
||
{
|
||
foreach (AreaManageBase area in manageList)
|
||
{
|
||
List<PackObjBase> ableS = area.PackManage.ListPob.Where<PackObjBase>(s => s is AbleEditPackObj).ToList();
|
||
foreach (PackObjBase pack in ableS)
|
||
{
|
||
pack.Zjpyl = value;
|
||
}
|
||
}
|
||
zjpyl = value;
|
||
}
|
||
}
|
||
|
||
public int Hzjpyl
|
||
{
|
||
get
|
||
{
|
||
return hzjpyl;
|
||
}
|
||
|
||
set
|
||
{
|
||
foreach (AreaManageBase area in manageList)
|
||
{
|
||
List<PackObjBase> ableS = area.PackManage.ListPob.Where<PackObjBase>(s => s is AbleEditPackObj).ToList();
|
||
foreach (PackObjBase pack in ableS)
|
||
{
|
||
pack.Hzjpyl = value;
|
||
}
|
||
}
|
||
hzjpyl = value;
|
||
}
|
||
}
|
||
|
||
public int Dfzjpyl
|
||
{
|
||
get
|
||
{
|
||
return dfzjpyl;
|
||
}
|
||
|
||
set
|
||
{
|
||
//foreach (AreaManageBase area in manageList)
|
||
//{
|
||
// List<PackObjBase> ableS = area.PackManage.ListPob.Where<PackObjBase>(s => s is AbleEditPackObj).ToList();
|
||
// foreach (PackObjBase pack in ableS)
|
||
// {
|
||
// pack.DfHzjpyl = value;
|
||
// }
|
||
//}
|
||
dfzjpyl = value;
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 排版,默认竖着排
|
||
/// </summary>
|
||
public TypesettingEnum Typesetting
|
||
{
|
||
get
|
||
{
|
||
return typesetting;
|
||
}
|
||
|
||
set
|
||
{
|
||
typesetting = value;
|
||
}
|
||
}
|
||
|
||
public PageTypeEnum PageType
|
||
{
|
||
get
|
||
{
|
||
return pageType;
|
||
}
|
||
|
||
set
|
||
{
|
||
pageType = value;
|
||
}
|
||
}
|
||
#endregion 属性结束
|
||
|
||
#region 事件
|
||
/// <summary>
|
||
/// 鼠标点击画板
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
public void zedControl_MouseMoveEvent(ZedGraphControl sender, MouseEventArgs e)
|
||
{
|
||
foreach (AreaManageBase area in manageList)
|
||
{
|
||
area.MouseMove(sender, e);
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 点击画板
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
public void zedControl_MouseDownEvent(ZedGraphControl sender, MouseEventArgs e)
|
||
{
|
||
if (ZedControl == null) return;
|
||
|
||
double y = Convert.ToDouble(Convert.ToDouble(e.Y) / Convert.ToDouble(ZedControl.Height));
|
||
double x = Convert.ToDouble(Convert.ToDouble(e.X) / Convert.ToDouble(ZedControl.Width));
|
||
|
||
//foreach (AreaManageBase area in manageList)
|
||
//{
|
||
// if (e.Button == System.Windows.Forms.MouseButtons.Left)
|
||
// {
|
||
// #region 为可编辑组件触发响应事件
|
||
// List<PackObjBase> editPack = area.PackManage.ListPob.Where<PackObjBase>(s => s is AbleEditPackObj).ToList<PackObjBase>();
|
||
// foreach (PackObjBase pack in editPack)
|
||
// {
|
||
// AbleEditPackObj aEdit = pack as AbleEditPackObj;
|
||
// if (aEdit != null)
|
||
// {
|
||
// if ((x > aEdit.RealX && x < aEdit.RealEndX) && (y > aEdit.RealY && y < aEdit.RealEndY))
|
||
// {
|
||
// if (!aEdit.IsDoubleClick)
|
||
// {
|
||
// aEdit.onClick(e);
|
||
// break;
|
||
// }
|
||
// }
|
||
// }
|
||
// }
|
||
// #endregion
|
||
// }
|
||
// area.MouseDown(sender, e);
|
||
//}
|
||
foreach (AreaManageBase area in manageList)
|
||
{
|
||
area.MouseDown(sender, e);
|
||
}
|
||
}
|
||
public void zedControl_MouseUpEvent(ZedGraphControl sender, MouseEventArgs e)
|
||
{
|
||
foreach (AreaManageBase area in manageList)
|
||
{
|
||
area.MouseUp(sender, e);
|
||
}
|
||
}
|
||
public void zedControl_MouseDoubleClick(ZedGraphControl sender, MouseEventArgs e)
|
||
{
|
||
if (ZedControl == null) return;
|
||
|
||
double y = Convert.ToDouble(Convert.ToDouble(e.Y) / Convert.ToDouble(ZedControl.Height));
|
||
double x = Convert.ToDouble(Convert.ToDouble(e.X) / Convert.ToDouble(ZedControl.Width));
|
||
|
||
foreach (AreaManageBase area in manageList)
|
||
{
|
||
if (e.Button == System.Windows.Forms.MouseButtons.Left)
|
||
{
|
||
#region 为可编辑组件触发响应事件
|
||
List<PackObjBase> editPack = area.PackManage.ListPob.Where<PackObjBase>(s => s is AbleEditPackObj).ToList<PackObjBase>();
|
||
foreach (PackObjBase pack in editPack)
|
||
{
|
||
AbleEditPackObj aEdit = pack as AbleEditPackObj;
|
||
if (aEdit != null)
|
||
{
|
||
if ((x > aEdit.RealX && x < aEdit.RealEndX) && (y > aEdit.RealY && y < aEdit.RealEndY))
|
||
{
|
||
if (!aEdit.IsDoubleClick)
|
||
{
|
||
aEdit.onClick(e);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
}
|
||
area.MouseDoubleClick(sender, e);
|
||
}
|
||
}
|
||
public void zedControl_KeyUp(ZedGraphControl sender, KeyEventArgs e)
|
||
{
|
||
foreach (AreaManageBase area in manageList)
|
||
{
|
||
area.KeyUp(sender, e);
|
||
}
|
||
}
|
||
public void BindTempData()
|
||
{
|
||
foreach (AreaManageBase area in manageList)
|
||
{
|
||
area.BindTempData();
|
||
}
|
||
}
|
||
#endregion 事件结束
|
||
|
||
/// <summary>
|
||
/// 增加一个管理器
|
||
/// </summary>
|
||
/// <param name="manager">管理器</param>
|
||
/// <returns></returns>
|
||
public bool AddManage(AreaManageBase _manager)
|
||
{
|
||
bool reVal = false;
|
||
AreaManageBase manage = manageList.FirstOrDefault<AreaManageBase>(s => s.Name == _manager.Name || s.ClassName == _manager.ClassName);
|
||
if (manage == null)
|
||
{
|
||
manageList.Add(_manager);
|
||
reVal = true;
|
||
}
|
||
return reVal;
|
||
}
|
||
|
||
public int GetPageWidth()
|
||
{
|
||
int w = 900;
|
||
if (pageType == PageTypeEnum.A3)
|
||
{
|
||
w = 1280;
|
||
}
|
||
return w;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 重画区域
|
||
/// </summary>
|
||
public void DrawArea()
|
||
{
|
||
Clear();
|
||
for (int i = 0; i < ManageList.Count; i++)
|
||
{
|
||
AreaManageBase manageTemp = ManageList[i];
|
||
if (manageTemp != null)
|
||
{
|
||
if (i == 0)
|
||
{
|
||
manageTemp.Draw();
|
||
}
|
||
else
|
||
{
|
||
manageTemp.Draw(true);
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据标签查找指定的绘图组件
|
||
/// </summary>
|
||
/// <param name="tagName">标签名,使用类.属性就可以了</param>
|
||
/// <returns></returns>
|
||
public T GetPackObjectOTag<T>(string tagName) where T : PackObjBase
|
||
{
|
||
T pack = default;
|
||
for (int i = 0; i < ManageList.Count; i++)
|
||
{
|
||
AreaManageBase manageTemp = ManageList[i];
|
||
if (manageTemp != null)
|
||
{
|
||
pack = (T)manageTemp.GetPackObjectOTag(tagName);
|
||
if (pack != null) break;
|
||
}
|
||
}
|
||
return pack;
|
||
}
|
||
/// <summary>
|
||
/// 删除区域
|
||
/// </summary>
|
||
/// <param name="_manager"></param>
|
||
/// <returns></returns>
|
||
public bool DelManage(AreaManageBase _manager)
|
||
{
|
||
bool reVal = false;
|
||
if (_manager != null && manageList.Count > 0)
|
||
{
|
||
reVal = manageList.Remove(_manager);
|
||
}
|
||
return reVal;
|
||
}
|
||
/// <summary>
|
||
/// 保存
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public bool Save()
|
||
{
|
||
bool reVal = false;
|
||
try
|
||
{
|
||
if (ProjectName == "")
|
||
{
|
||
reVal = false;
|
||
MsgStr = "医院名称或项目名称不能为空";
|
||
return reVal;
|
||
}
|
||
string FilePath = Direct;
|
||
bool allAreaSaveOk = true;
|
||
if (manageList.Count > 0)
|
||
{
|
||
foreach (AreaManageBase area in manageList)
|
||
{
|
||
//区域保存值返回
|
||
bool areaSaveOk = area.Save();
|
||
if (!areaSaveOk)
|
||
{
|
||
allAreaSaveOk = false;
|
||
MsgStr = area.MsgStr;
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
//如果manageList为空则不允许保存模板管理器
|
||
allAreaSaveOk = false;
|
||
MsgStr = "没有具体的区域管理器不需要保存";
|
||
}
|
||
//如果所有区域都保存成功,才能保存模板管理器
|
||
if (allAreaSaveOk)
|
||
{
|
||
string jsonStr = JsonConvert.SerializeObject(this);
|
||
try
|
||
{
|
||
DBHelper.ExecNonQuery(" update [OperationRecordTemplate] set jsondate=N'" + jsonStr + "' where Id='" + Id + "' ");
|
||
msgStr = FilePath + "保存成功";
|
||
reVal = true;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
msgStr = ex.Message.ToString();
|
||
}
|
||
finally
|
||
{
|
||
}
|
||
}
|
||
}
|
||
catch (Exception exp)
|
||
{
|
||
reVal = false;
|
||
MsgStr = exp.Message;
|
||
|
||
}
|
||
return reVal;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 全局绑定之后在调用各自的区域管理器进行绑定
|
||
/// </summary>
|
||
public void Bind(string AreaManageName = null)
|
||
{
|
||
try
|
||
{
|
||
//各区域的数据绑定
|
||
foreach (AreaManageBase area in manageList)
|
||
{
|
||
if (AreaManageName != null && area.Name != AreaManageName && area.ClassName != AreaManageName) continue;
|
||
|
||
#region 绑定可编辑区域的点击事件
|
||
//绑定所有可编辑区域
|
||
List<PackObjBase> editPack = area.PackManage.ListPob.Where<PackObjBase>(s => s is AbleEditPackObj).ToList<PackObjBase>();
|
||
|
||
foreach (PackObjBase pack in editPack)
|
||
{
|
||
AbleEditPackObj aEdit = pack as AbleEditPackObj;
|
||
if (aEdit != null)
|
||
{
|
||
//aEdit.ClearControl();
|
||
aEdit.IsVisible = false;
|
||
aEdit.Click -= new AbleEditPackObj.ClickEventHandler(editAr_Click);
|
||
aEdit.Click += new AbleEditPackObj.ClickEventHandler(editAr_Click);
|
||
aEdit.SetControl();
|
||
//aEdit.IsVisible = DrawGraphModels.Util.EIsBool.False;;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
area.IsSelfFresh = false;
|
||
area.Bind();
|
||
area.IsSelfFresh = true;
|
||
}
|
||
if (zedControl != null)
|
||
zedControl.Refresh();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
public void ClearSelectCouve()
|
||
{
|
||
//各区域的数据绑定
|
||
foreach (AreaManageBase area in manageList)
|
||
{
|
||
area.clearSelectCouve_Click();
|
||
}
|
||
}
|
||
public void frmInstance_ConfigParam()
|
||
{
|
||
//各区域的数据绑定
|
||
foreach (AreaManageBase area in manageList)
|
||
{
|
||
area.frmInstance_ConfigParam();
|
||
}
|
||
}
|
||
public void initChart()
|
||
{
|
||
//各区域的数据绑定
|
||
foreach (AreaManageBase area in manageList)
|
||
{
|
||
area.initChart();
|
||
}
|
||
}
|
||
public bool Verification()
|
||
{
|
||
foreach (AreaManageBase area in manageList)
|
||
{
|
||
bool reVal = area.Verification();
|
||
if (!reVal)
|
||
{
|
||
//只要有一个区域的验证返回失败即失败
|
||
return reVal;
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
/// <summary>
|
||
/// 响应可编辑组件的单击事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
public void editAr_Click(object sender, EventArgs e)
|
||
{
|
||
foreach (AreaManageBase area in manageList)
|
||
{
|
||
area.editAr_Click(sender, e);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 加载所有区域里的组件
|
||
/// </summary>
|
||
public bool Load()
|
||
{
|
||
bool reVal = true;
|
||
if (manageList.Count > 0)
|
||
{
|
||
bool temp = true;
|
||
for (int i = 0; i < manageList.Count; i++)
|
||
{
|
||
AreaManageBase area = manageList[i];
|
||
//通过名称得到一个具体的区域实例
|
||
AreaManageBase areaSub = BoardFormUtil.AreaManageFactory(area.ClassName, area.OpeRecord, area.ZedControl, this, area.Name);
|
||
//父类的值传给子类
|
||
BoardUtil.MainToSub(area, areaSub);
|
||
manageList[i] = areaSub;
|
||
area = manageList[i];
|
||
//区域保存值返回
|
||
bool areaLoadOk = area.Load(Id);
|
||
if (!areaLoadOk)
|
||
{
|
||
MsgStr = area.Name + ":" + area.MsgStr;
|
||
temp = false;
|
||
}
|
||
|
||
#region 绑定可编辑区域的点击事件
|
||
//绑定所有可编辑区域
|
||
List<PackObjBase> editPack = area.PackManage.ListPob.Where<PackObjBase>(s => s is AbleEditPackObj).ToList<PackObjBase>();
|
||
|
||
foreach (PackObjBase pack in editPack)
|
||
{
|
||
AbleEditPackObj aEdit = pack as AbleEditPackObj;
|
||
if (aEdit != null)
|
||
{
|
||
//aEdit.IsVisible = false;
|
||
aEdit.Click -= new AbleEditPackObj.ClickEventHandler(editAr_Click);
|
||
aEdit.Click += new AbleEditPackObj.ClickEventHandler(editAr_Click);
|
||
aEdit.SetControl();
|
||
|
||
//aEdit.IsVisible = DrawGraphModels.Util.EIsBool.False;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
}
|
||
SetPYL();
|
||
|
||
if (!temp)
|
||
{
|
||
reVal = false;
|
||
}
|
||
}
|
||
return reVal;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取第一个板子的宽高
|
||
/// </summary>
|
||
public Point GetBorderPackWH()
|
||
{
|
||
Point point = new Point();
|
||
if (typesetting == TypesettingEnum.Vertical)
|
||
{
|
||
point.X = GetPageWidth();
|
||
point.Y = Convert.ToInt32(point.X * 1.414);
|
||
}
|
||
else
|
||
{
|
||
point.Y = GetPageWidth();
|
||
point.X = Convert.ToInt32(point.Y * 1.414);
|
||
}
|
||
|
||
//给所有子区域的板子设置成第一个版子的值
|
||
//if (manageList.Count > 0 && manageList[0].PackManage != null)
|
||
//{
|
||
// PackObjBase borderPack = manageList[0].PackManage.ListPob.FirstOrDefault<PackObjBase>(s => s is BorderPackObj);
|
||
// foreach (AreaManageBase areaT in manageList)
|
||
// {
|
||
// PackObjBase subBorder = areaT.PackManage.ListPob.FirstOrDefault<PackObjBase>(s => s is BorderPackObj);
|
||
// if (subBorder != null)
|
||
// {
|
||
// point.X = Convert.ToInt32(((BorderPackObj)borderPack).SetWidth);
|
||
// point.Y = Convert.ToInt32(((BorderPackObj)borderPack).SetHeight);
|
||
// }
|
||
// }
|
||
//}
|
||
return point;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 清空板上的内容
|
||
/// </summary>
|
||
public void Clear()
|
||
{
|
||
if (zedControl == null) return;
|
||
zedControl.MasterPane.GraphObjList.Clear();
|
||
zedControl.Controls.Clear();
|
||
zedControl.GraphPane.CurveList.Clear();
|
||
Chart chart = zedControl.GraphPane.Chart;
|
||
chart.Rect = new System.Drawing.RectangleF(0f, 0f, 0f, 0f); //设定中间的图像显示区域chart.Rect = {X = 120.0 Y = 304.5 Width = 576.0 Height = 375.55}
|
||
//清除原图像
|
||
if (zedControl.GraphPane.YAxisList.Count > 1)
|
||
{
|
||
//清空除Y轴以外的所有纵坐标轴
|
||
zedControl.GraphPane.YAxisList.RemoveRange(1, zedControl.GraphPane.YAxisList.Count - 1);
|
||
}
|
||
Refresh();
|
||
}
|
||
/// <summary>
|
||
/// 清空界面上的组件,在重新加载界面前做
|
||
/// </summary>
|
||
public void ControlClear()
|
||
{
|
||
foreach (AreaManageBase area in manageList)
|
||
{
|
||
#region 绑定可编辑区域的点击事件
|
||
//绑定所有可编辑区域
|
||
List<PackObjBase> editPack = area.PackManage.ListPob.Where<PackObjBase>(s => s is AbleEditPackObj).ToList<PackObjBase>();
|
||
|
||
foreach (PackObjBase pack in editPack)
|
||
{
|
||
AbleEditPackObj aEdit = pack as AbleEditPackObj;
|
||
if (aEdit != null)
|
||
{
|
||
aEdit.ClearControl();
|
||
//aEdit.IsVisible = DrawGraphModels.Util.EIsBool.False;
|
||
}
|
||
}
|
||
#endregion
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 绑定所有手术记录的值
|
||
/// </summary>
|
||
public void BindOperationRecordValueAll(Object obj)
|
||
{
|
||
//operationRecordProObj = new PropertyObject();
|
||
//operationRecordProObj.Key = "OperationRecord";
|
||
//operationRecordProObj.Description = "手术类";
|
||
foreach (AreaManageBase area in manageList)
|
||
{
|
||
area.IsSelfFresh = false;
|
||
}
|
||
List<PropertyObject> propertyList = BoardFormUtil.GetPropertyList(obj, this);
|
||
//operationRecordProObj.SubPropertyList = propertyList;
|
||
NotifyPackObj(propertyList);
|
||
|
||
foreach (AreaManageBase area in manageList)
|
||
{
|
||
area.IsSelfFresh = true;
|
||
}
|
||
|
||
Refresh();
|
||
}
|
||
|
||
private void Refresh()
|
||
{
|
||
if (zedControl != null)
|
||
{
|
||
zedControl.AxisChange();
|
||
zedControl.Refresh();
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 通知组件更新数据
|
||
/// </summary>
|
||
private void NotifyPackObj(List<PropertyObject> propertyList)
|
||
{
|
||
foreach (PropertyObject proTemp in propertyList)
|
||
{
|
||
NotifyUpdate(proTemp.ViewDesignTag(), proTemp.Text, proTemp.Value);
|
||
if (proTemp.SubPropertyList.Count > 0)
|
||
{
|
||
NotifyPackObj(proTemp.SubPropertyList);
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 通知区域绑定更新
|
||
/// </summary>
|
||
/// <param name="areaName">区域名称</param>
|
||
/// <returns>模板对象</returns>
|
||
public TemplateManage NotificationAreaBindingUpdate(string areaName)
|
||
{
|
||
AreaManageBase area = manageList.FirstOrDefault<AreaManageBase>(s => s.Name == areaName);
|
||
if (area != null)
|
||
{
|
||
area.Bind();
|
||
}
|
||
return this;
|
||
}
|
||
/// <summary>
|
||
/// 设置组件的偏移量
|
||
/// </summary>
|
||
/// <param name="isReturn0">强制返回到0时为真</param>
|
||
public void SetPYL(bool isReturn0 = false)
|
||
{
|
||
if (ZedControl == null)
|
||
{
|
||
Zjpyl = 0;
|
||
}
|
||
else
|
||
{
|
||
//如果是强制把流动条返回到头,就不需要取值了
|
||
if (isReturn0)
|
||
{
|
||
Zjpyl = 0;
|
||
}
|
||
else
|
||
{
|
||
Panel panel = ZedControl.Parent as Panel;
|
||
if (panel != null)
|
||
{
|
||
Zjpyl = panel.VerticalScroll.Value;
|
||
}
|
||
else
|
||
{
|
||
Zjpyl = 0;
|
||
}
|
||
}
|
||
}
|
||
//根据不同分辨率可能会有自己的配置偏移量,可以单独设置,在AIMS.xml里设置
|
||
int czpyl = 0;
|
||
int hzpyl = 0;
|
||
int dfzpyl = 0;
|
||
//try
|
||
//{
|
||
// czpyl = int.Parse(xmlOpe.GetNode("czpyl")[0].ToString());
|
||
// hzpyl = int.Parse(xmlOpe.GetNode("hzpyl")[0].ToString());
|
||
// //dfzpyl = int.Parse(xmlOpe.GetNode("dfzpyl")[0].ToString());
|
||
//}
|
||
//catch (Exception)
|
||
//{
|
||
//}
|
||
Zjpyl = Zjpyl + LocationY + czpyl;
|
||
Hzjpyl = hzpyl;
|
||
Dfzjpyl = dfzpyl;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 组件内容批量清空
|
||
/// </summary>
|
||
public void ClearEdit(bool isFlash = true)
|
||
{
|
||
if (ZedControl == null) return;
|
||
foreach (AreaManageBase manage in ManageList)
|
||
{
|
||
List<PackObjBase> ables = manage.PackManage.ListPob.Where<PackObjBase>(s => s is AbleEditPackObj).ToList<PackObjBase>();
|
||
foreach (PackObjBase pack in ables)
|
||
{
|
||
AbleEditPackObj ableEdit = pack as AbleEditPackObj;
|
||
if (ableEdit != null)
|
||
{
|
||
string dstr = ableEdit.DataSourceName.Replace("_", ".");
|
||
string value = "";
|
||
EntityObjectChangeNotifier.SubObjSetValue(manage.OpeRecord, dstr, value);
|
||
ableEdit.PackText = value;
|
||
ableEdit.PackValue = value;
|
||
if (ableEdit.ControlType == EControlType.CheckBox)
|
||
{
|
||
foreach (Control conl in ableEdit.CControl.Controls)
|
||
{
|
||
CheckBox chk = conl as CheckBox;
|
||
chk.Checked = false;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (isFlash)
|
||
{
|
||
DrawArea();
|
||
ZedControl.AxisChange();
|
||
ZedControl.Refresh();
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 绑定默认值
|
||
/// </summary>
|
||
public void BindDefaultValue()
|
||
{
|
||
foreach (AreaManageBase manage in ManageList)
|
||
{
|
||
List<PackObjBase> ables = manage.PackManage.ListPob.Where<PackObjBase>(s => s is AbleEditPackObj).ToList<PackObjBase>();
|
||
foreach (PackObjBase pack in ables)
|
||
{
|
||
AbleEditPackObj ableEdit = pack as AbleEditPackObj;
|
||
if (ableEdit != null && ableEdit.PackValue == "")
|
||
{
|
||
if (ableEdit.DefaultSelectValue.Trim() != "")
|
||
{
|
||
string[] defalutValues = new string[] { ableEdit.DefaultSelectValue };
|
||
if (ableEdit.DefaultSelectValue.Trim().Contains(","))
|
||
{
|
||
defalutValues = ableEdit.DefaultSelectValue.Split(',');
|
||
}
|
||
if (ableEdit.DefaultSelectValue.Trim().Contains(","))
|
||
{
|
||
defalutValues = ableEdit.DefaultSelectValue.Split(',');
|
||
}
|
||
//ableEdit.PackValue = ableEdit.DefaultSelectValue;
|
||
foreach (string str in defalutValues)
|
||
{
|
||
string dstr = ableEdit.DataSourceName.Replace("_", ".");
|
||
if (ableEdit.ControlType == EControlType.CheckBox || ableEdit.ControlType == EControlType.RadioButtonList)
|
||
{
|
||
SetObjValue(manage.OpeRecord, dstr, ableEdit.PackText, str);
|
||
}
|
||
else
|
||
{
|
||
SetObjValue(manage.OpeRecord, dstr, str, str);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
//排版的枚举
|
||
public enum TypesettingEnum { Horizontal, Vertical }
|
||
//纸张类型
|
||
public enum PageTypeEnum { A4, A3 }
|
||
|
||
}
|