Exemple #1
0
        private void mniInsertAsDG_Click(object sender, EventArgs e)
        {
            if (dgvDE.SelectedRows.Count == 0)
            {
                return;
            }

            frmRecord vFrmRecord = GetActiveRecord();

            if (vFrmRecord != null)
            {
                using (DeGroup vDeGroup = new DeGroup(vFrmRecord.EmrView.ActiveSectionTopLevelData()))
                {
                    vDeGroup[DeProp.Index] = dgvDE.SelectedRows[0].Cells[0].Value.ToString();
                    vDeGroup[DeProp.Name]  = dgvDE.SelectedRows[0].Cells[0].Value.ToString();

                    if (!vFrmRecord.EmrView.Focused)  // 先给焦点,便于处理光标处域
                    {
                        vFrmRecord.EmrView.Focus();
                    }

                    vFrmRecord.EmrView.InsertDeGroup(vDeGroup);
                }
            }
            else
            {
                MessageBox.Show("未发现打开的模板!");
            }
        }
Exemple #2
0
        private void DoDEInsertAsDeGroup(object sender, EventArgs e)
        {
            DeGroup vDeGroup = new DeGroup(FEmrEdit.TopLevelData());

            vDeGroup[DeProp.Index] = frmDataElement.GetDeIndex();
            vDeGroup[DeProp.Name]  = frmDataElement.GetDeName();
            FEmrEdit.InsertDeGroup(vDeGroup);
        }
Exemple #3
0
        /// <summary> 从当前数据组起始位置往前找相同数据组的内容Index域内容 </summary>
        /// <param name="AData">指定从哪个Data里获取</param>
        /// <param name="ADeGroupStartNo">指定从哪个位置开始往前找</param>
        /// <returns>相同数据组文本形式的内容</returns>
        public string GetDataForwardDeGroupText(HCViewData aData, int aDeGroupStartNo)
        {
            string Result = "";

            DeGroup vDeGroup = null;
            int     vBeginNo = -1;
            int     vEndNo   = -1;
            string  vDeIndex = (aData.Items[aDeGroupStartNo] as DeGroup)[DeProp.Index];

            for (int i = 0; i <= aDeGroupStartNo - 1; i++)  // 找起始
            {
                if (aData.Items[i] is DeGroup)
                {
                    vDeGroup = aData.Items[i] as DeGroup;
                    if (vDeGroup.MarkType == MarkType.cmtBeg)   // 是域起始
                    {
                        if (vDeGroup[DeProp.Index] == vDeIndex) // 是目标域起始
                        {
                            vBeginNo = i;
                            break;
                        }
                    }
                }
            }

            if (vBeginNo >= 0)  // 找结束
            {
                for (int i = vBeginNo + 1; i <= aDeGroupStartNo - 1; i++)
                {
                    if (aData.Items[i] is DeGroup)
                    {
                        vDeGroup = aData.Items[i] as DeGroup;
                        if (vDeGroup.MarkType == MarkType.cmtEnd)  // 是域结束
                        {
                            if (vDeGroup[DeProp.Index] == vDeIndex)
                            {
                                vEndNo = i;
                                break;
                            }
                        }
                    }
                }

                if (vEndNo > 0)
                {
                    Result = GetDataDeGroupText(aData, vBeginNo, vEndNo);
                }
            }

            return(Result);
        }
Exemple #4
0
        /// <summary> 插入一个数据组 </summary>
        public void InsertDeGroup(string aIndex, string aName)
        {
            if ((aIndex == "") || (aName == ""))
            {
                MessageBox.Show("要插入的数据组索引和名称不能为空!");
                return;
            }

            using (DeGroup vDeGroup = new DeGroup(FEmrView.ActiveSectionTopLevelData()))
            {
                vDeGroup[DeProp.Index] = aIndex;
                vDeGroup[DeProp.Name]  = aName;
                FEmrView.InsertDeGroup(vDeGroup);
            }
        }
Exemple #5
0
 public bool InsertDeGroup(DeGroup aDeGroup)
 {
     return(this.InsertDomain(aDeGroup));
 }
        public void TraverseItem(HCCustomData aData, int aItemNo, int aTag, ref bool aStop)
        {
            if ((aData is HCHeaderData) || (aData is HCFooterData))
            {
                return;
            }

            if (aData.Items[aItemNo] is DeGroup)  // 数据组
            {
                DeGroup vDeGroup = aData.Items[aItemNo] as DeGroup;
                if (vDeGroup.MarkType == MarkType.cmtBeg)
                {
                    XmlElement vXmlNode = FXmlDoc.CreateElement("DeGroup");
                    if (FDeGroupNodes.Count > 0)
                    {
                        FDeGroupNodes[FDeGroupNodes.Count - 1].AppendChild(vXmlNode);
                    }
                    else
                    {
                        FXmlDoc.DocumentElement.AppendChild(vXmlNode);
                    }

                    vXmlNode.SetAttribute("Index", vDeGroup[DeProp.Index]);

                    DataRow[] vRows = FDETable.Select("DeID=" + vDeGroup[DeProp.Index]);
                    if (vRows.Length == 1)
                    {
                        vXmlNode.SetAttribute("Code", vRows[0]["decode"].ToString());
                        vXmlNode.SetAttribute("Name", vRows[0]["dename"].ToString());
                    }

                    FDeGroupNodes.Add(vXmlNode);
                }
                else
                {
                    if (FDeGroupNodes.Count > 0)
                    {
                        FDeGroupNodes.RemoveAt(FDeGroupNodes.Count - 1);
                    }
                }
            }
            else
            if (aData.Items[aItemNo].StyleNo > HCStyle.Null)    // 文本类
            {
                if ((aData.Items[aItemNo] as DeItem).IsElement) // 是数据元
                {
                    DeItem vDeItem = aData.Items[aItemNo] as DeItem;
                    if (vDeItem[DeProp.Index] != "")
                    {
                        XmlElement vXmlNode = FXmlDoc.CreateElement("DeItem");
                        if (FDeGroupNodes.Count > 0)
                        {
                            FDeGroupNodes[FDeGroupNodes.Count - 1].AppendChild(vXmlNode);
                        }
                        else
                        {
                            FXmlDoc.DocumentElement.AppendChild(vXmlNode);
                        }

                        vXmlNode.InnerText = vDeItem.Text;
                        vXmlNode.SetAttribute("Index", vDeItem[DeProp.Index]);

                        DataRow[] vRows = FDETable.Select("DeID=" + vDeItem[DeProp.Index]);
                        if (vRows.Length == 1)
                        {
                            vXmlNode.SetAttribute("Code", vRows[0]["decode"].ToString());
                            vXmlNode.SetAttribute("Name", vRows[0]["dename"].ToString());
                        }
                    }
                }
                else
                if (!FOnlyDeItem)
                {
                    XmlElement vXmlNode = FXmlDoc.CreateElement("Text");
                    if (FDeGroupNodes.Count > 0)
                    {
                        FDeGroupNodes[FDeGroupNodes.Count - 1].AppendChild(vXmlNode);
                    }
                    else
                    {
                        FXmlDoc.DocumentElement.AppendChild(vXmlNode);
                    }

                    vXmlNode.InnerText = aData.Items[aItemNo].Text;
                }
            }
            else  // 非文本类
            {
                if (aData.Items[aItemNo] is EmrYueJingItem)
                {
                    XmlElement vXmlNode = FXmlDoc.CreateElement("DeItem");
                    if (FDeGroupNodes.Count > 0)
                    {
                        FDeGroupNodes[FDeGroupNodes.Count - 1].AppendChild(vXmlNode);
                    }
                    else
                    {
                        FXmlDoc.DocumentElement.AppendChild(vXmlNode);
                    }

                    (aData.Items[aItemNo] as EmrYueJingItem).ToXmlEmr(vXmlNode as XmlElement);
                }
                else
                if (aData.Items[aItemNo] is EmrToothItem)
                {
                    XmlElement vXmlNode = FXmlDoc.CreateElement("DeItem");
                    if (FDeGroupNodes.Count > 0)
                    {
                        FDeGroupNodes[FDeGroupNodes.Count - 1].AppendChild(vXmlNode);
                    }
                    else
                    {
                        FXmlDoc.DocumentElement.AppendChild(vXmlNode);
                    }

                    (aData.Items[aItemNo] as EmrToothItem).ToXmlEmr(vXmlNode as XmlElement);
                }
                else
                if (aData.Items[aItemNo] is EmrFangJiaoItem)
                {
                    XmlElement vXmlNode = FXmlDoc.CreateElement("DeItem");
                    if (FDeGroupNodes.Count > 0)
                    {
                        FDeGroupNodes[FDeGroupNodes.Count - 1].AppendChild(vXmlNode);
                    }
                    else
                    {
                        FXmlDoc.DocumentElement.AppendChild(vXmlNode);
                    }

                    (aData.Items[aItemNo] as EmrFangJiaoItem).ToXmlEmr(vXmlNode as XmlElement);
                }
            }
        }
Exemple #7
0
        private void DoEmrEditMouseUp(object sender, MouseEventArgs e)
        {
            string vInfo = "";

            HCCustomItem vActiveItem = FEmrEdit.Data.GetTopLevelItem();

            if (vActiveItem != null)
            {
                if (FEmrEdit.Data.ActiveDomain.BeginNo >= 0)
                {
                    DeGroup vDeGroup = FEmrEdit.Data.Items[FEmrEdit.Data.ActiveDomain.BeginNo] as DeGroup;

                    vInfo = vDeGroup[DeProp.Name];
                }

                if (vActiveItem is DeItem)
                {
                    DeItem vDeItem = vActiveItem as DeItem;
                    if (vDeItem.StyleEx != StyleExtra.cseNone)
                    {
                        vInfo += "-" + vDeItem.GetHint();
                    }
                    else
                    if (vDeItem.Active &&
                        (vDeItem[DeProp.Index] != "") &&
                        (!vDeItem.IsSelectComplate) &&
                        (!vDeItem.IsSelectPart) &&
                        (Environment.TickCount - FMouseDownTick < 500)
                        )
                    {
                        vInfo = vInfo + "元素(" + vDeItem[DeProp.Index] + ")";

                        if (FEmrEdit.Data.ReadOnly)
                        {
                            //tssDeInfo.Text = "";
                            return;
                        }

                        POINT            vPt             = FEmrEdit.Data.GetActiveDrawItemCoord(); // 得到相对EmrEdit的坐标
                        HCCustomDrawItem vActiveDrawItem = FEmrEdit.Data.GetTopLevelDrawItem();
                        RECT             vDrawItemRect   = vActiveDrawItem.Rect;
                        vDrawItemRect = HC.View.HC.Bounds(vPt.X, vPt.Y, vDrawItemRect.Width, vDrawItemRect.Height);

                        if (HC.View.HC.PtInRect(vDrawItemRect, new POINT(e.X, e.Y)))
                        {
                            vPt.Y = vPt.Y + vActiveDrawItem.Height;

                            Point vPoint = new Point(vPt.X, vPt.Y);
                            vPoint = FEmrEdit.PointToScreen(vPoint);

                            //HC.Win32.User.ClientToScreen(FEmrEdit.Handle, ref vPt);
                            vPt.X = vPoint.X;
                            vPt.Y = vPoint.Y;
                            PopupForm().PopupDeItem(vDeItem, vPt);
                        }
                    }
                }
                else
                if (vActiveItem is DeEdit)
                {
                }
                else
                if (vActiveItem is DeCombobox)
                {
                }
                else
                if (vActiveItem is DeDateTimePicker)
                {
                }
            }

            //tssDeInfo.Text = vInfo;
        }
Exemple #8
0
        protected void DoMouseUp(object sender, MouseEventArgs e)
        {
            string vInfo = "";

            if (FEmrView.ActiveSection.ActiveData.ReadOnly)
            {
                tssDeInfo.Text = "";
                return;
            }

            HCCustomItem vActiveItem = FEmrView.GetTopLevelItem();

            if (vActiveItem != null)
            {
                if (FEmrView.ActiveSection.ActiveData.ActiveDomain.BeginNo >= 0)
                {
                    DeGroup vDeGroup = FEmrView.ActiveSection.ActiveData.Items[
                        FEmrView.ActiveSection.ActiveData.ActiveDomain.BeginNo] as DeGroup;

                    vInfo = vDeGroup[DeProp.Name];
                }

                if (vActiveItem is DeItem)
                {
                    DeItem vDeItem = vActiveItem as DeItem;
                    if (vDeItem.Active &&
                        (vDeItem[DeProp.Index] != "") &&
                        (!vDeItem.IsSelectComplate) &&
                        (!vDeItem.IsSelectPart) &&
                        (Environment.TickCount - FMouseDownTick < 500)
                        )
                    {
                        vInfo = vInfo + "元素(" + vDeItem[DeProp.Index] + ")";

                        if (FEmrView.ActiveSection.ActiveData.ReadOnly)
                        {
                            tssDeInfo.Text = "";
                            return;
                        }

                        POINT            vPt             = FEmrView.GetActiveDrawItemClientCoord();
                        HCCustomDrawItem vActiveDrawItem = FEmrView.GetTopLevelDrawItem();
                        RECT             vDrawItemRect   = vActiveDrawItem.Rect;
                        vDrawItemRect = HC.View.HC.Bounds(vPt.X, vPt.Y, vDrawItemRect.Width, vDrawItemRect.Height);

                        if (HC.View.HC.PtInRect(vDrawItemRect, new POINT(e.X, e.Y)))
                        {
                            vPt.Y = vPt.Y + FEmrView.ZoomIn(vActiveDrawItem.Height());
                            vPt.Offset(FEmrView.Left, FEmrView.Top);
                            HC.Win32.User.ClientToScreen(FEmrView.Handle, ref vPt);

                            PopupForm().PopupDeItem(vDeItem, vPt);
                        }
                    }
                }
                else
                if (vActiveItem is DeEdit)
                {
                }
                else
                if (vActiveItem is DeCombobox)
                {
                }
                else
                if (vActiveItem is DeDateTimePicker)
                {
                }
            }

            tssDeInfo.Text = vInfo;
        }