示例#1
0
        void item_Click(object sender, EventArgs e)
        {
            MenuItem        item      = sender as MenuItem;
            clsEmrModule_VO objModule = item.Tag as clsEmrModule_VO;

            if (objModule != null)
            {
                m_mthSetEmrMenuItemClick(objModule);
            }
        }
示例#2
0
        /// <summary>
        /// 设置菜单单击事件
        /// </summary>
        /// <param name="p_objModule"></param>
        public void m_mthSetEmrMenuItemClick(clsEmrModule_VO p_objModule)
        {
            if (p_objModule != null && p_objModule.m_ObjFormInfo != null)
            {
                try
                {
                    string strPath = m_strGetValidPath(p_objModule.m_ObjFormInfo.m_StrDLLName);
                    if (string.IsNullOrEmpty(strPath))
                    {
                        throw new Exception("Invalid Dll Name");
                    }


                    Assembly objAsm = Assembly.LoadFrom(strPath);
                    if (objAsm == null)
                    {
                        throw new Exception("Load Assembly Error");
                    }

                    object obj = objAsm.CreateInstance(p_objModule.m_ObjFormInfo.m_StrOpraClassName, true);
                    if (obj == null)
                    {
                        throw new Exception("Create Instance Error");
                    }

                    Type objType = obj.GetType();

                    MethodInfo objMi;
                    string     strMethod = p_objModule.m_ObjFormInfo.m_StrOpraMethodName;
                    object[]   objParams = null;
                    int        intIndex  = strMethod.IndexOf("(");
                    if (intIndex != -1)//提取参数
                    {
                        string strParam = strMethod.Substring(intIndex + 1, strMethod.Length - intIndex - 2);
                        //objParams = new string[]{strParam};
                        objParams = strParam.Split(',');
                        strMethod = strMethod.Substring(0, intIndex);
                        objMi     = objType.GetMethod(strMethod);
                    }
                    else
                    {
                        objMi = objType.GetMethod(p_objModule.m_ObjFormInfo.m_StrOpraMethodName, new Type[0]);  //no param
                    }

                    if (objMi == null)
                    {
                        throw new Exception("Get Method Error");
                    }

                    //
                    if ((clsEMR_StaticObject.s_FrmMDI != null) && (obj is Form))
                    {
                        Form objForm = obj as Form;
                        if (objForm is com.digitalwave.GUI_Base.frmMDI_Child_Base)
                        {
                            if (m_blnCheckSameOrderForm((com.digitalwave.GUI_Base.frmMDI_Child_Base)objForm))
                            {
                                objForm = null;
                                return;
                            }
                        }

                        if (m_blnIsSaveBeforeNewForm())
                        {
                            return;
                        }

                        if (m_blnCheckSamePatientForm(objForm))
                        {
                            return;
                        }

                        if (m_blnCheckForFormOpen(objForm, false))
                        {
                            return;
                        }
                        if (p_objModule.m_ObjFormInfo.m_IntIsSubForm == 1)
                        {
                            objForm.MdiParent   = clsEMR_StaticObject.s_FrmMDI;
                            objForm.WindowState = FormWindowState.Maximized;
                        }
                        else
                        {
                            if (objForm.TopLevel)
                            {
                                objForm.Owner = clsEMR_StaticObject.s_FrmMDI;
                            }
                        }
                    }
                    if (obj != null && clsEMRLogin.LoginInfo != null)
                    {
                        if (obj is iLoginInfo)
                        {
                            ((iLoginInfo)obj).LoginInfo = clsEMRLogin.LoginInfo;
                        }
                    }
                    if (obj != null)
                    {
                        objMi.Invoke(obj, objParams);
                    }
                    if (obj is frmHRPBaseForm && MDIParent.s_ObjCurrentPatient != null)
                    {
                        ((frmHRPBaseForm)obj).m_mthSetPatient(MDIParent.s_ObjCurrentPatient);
                    }
                }
                catch (Exception ee)
                {
                    com.digitalwave.Utility.clsLogText objLog = new com.digitalwave.Utility.clsLogText();
                    objLog.LogDetailError(ee, false);
                }
            }
        }