Ejemplo n.º 1
0
        /// <summary>
        /// 显示消息
        /// </summary>
        public void Show(MessageStruct message)
        {
            try
            {
                //调用LIS的DLL
                string dllName      = "ts_lis_mzzyQuery.dll";
                string strNameSpace = "ts_lis_mzzyQuery";
                string className    = "Frm_Query";
                string fullPath     = path + "\\" + dllName;
                if (System.IO.File.Exists(fullPath))
                {
                    Assembly assembly = Assembly.LoadFile(fullPath);

                    object objInstance = assembly.CreateInstance(strNameSpace + "." + "InstanceForm");
                    objInstance.GetType().GetProperty("CurrentUser").SetValue(objInstance, currentUser, null);
                    objInstance.GetType().GetProperty("CurrentDept").SetValue(objInstance, currentDept, null);
                    objInstance.GetType().GetProperty("Database").SetValue(objInstance, TrasenFrame.Forms.FrmMdiMain.Database, null);       //传框架连接

                    object[] args    = new object[] { currentUser.EmployeeId, currentDept.DeptId, "报告查询" };
                    object   objForm = assembly.CreateInstance(strNameSpace + "." + className, true, BindingFlags.CreateInstance, null, args, null, null);

                    if (objForm != null)
                    {
                        Type   type          = objForm.GetType();
                        string funcationName = "GetRepNoInfo";
                        args = new object[] { message.KeyFieldValue, message.Reg_No };//-jianqg  2012-6-26 修改 增加参数Reg_No
                        object obj = type.InvokeMember(funcationName, BindingFlags.InvokeMethod, null, objForm, args);

                        //需要先执行GetRepNoInfo,再显示数据,--jianqg  2012-6-26 修改
                        type.InvokeMember("ShowDialog", BindingFlags.InvokeMethod, null, objForm, null);


                        //设置查看状态
                        string sql = "update LS_AS_READREPORT set flag=1, look_dr='" + currentUser.Name + "' where id=" + message.MsgId.ToString();
                        database.DoCommand(sql);
                    }
                }
            }
            catch (Exception err)
            {
                //Console.WriteLine( err.Message );
                throw err;
            }
        }
Ejemplo n.º 2
0
        void lstMessage_DoubleClick(object sender, EventArgs e)
        {
            ListView lvw = (ListView)sender;

            if (lvw.SelectedItems.Count == 1)
            {
                if (lvw.SelectedItems[0].Tag != null)
                {
                    MessageStruct message = (MessageStruct)lvw.SelectedItems[0].Tag;
                    try
                    {
                        reader.Show(message);
                        message.IsRead = true;
                        lvw.SelectedItems[0].SubItems[2].Text = "已阅";
                        lvw.SelectedItems[0].ForeColor        = Color.Red;
                    }
                    catch (Exception err)
                    {
                        MessageBox.Show(err.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }