/// <summary> /// 设置发布信息 先执行更新操作 再执行插入操作 /// </summary> /// <param name="notice">发布信息实体</param> /// <returns>成功返回1 失败返回-1</returns> public int SetNotice(Neusoft.HISFC.Models.Base.Notice notice) { int parm = this.UpdateNotice(notice); if (parm == -1) { return(parm); } if (parm == 0) { return(this.InsertNotice(notice)); } return(parm); }
/// <summary> /// 保存发布信息 /// </summary> /// <returns>成功返回1 失败返回-1</returns> public int SaveNotice(string noticeTitle) { if (this.ValidSave() == -1) { return(-1); } if (this.notice == null) { this.notice = new Neusoft.HISFC.Models.Base.Notice(); } //不使用Rtf属性 保存后的字符串长度过大 //如使用Rtf属性 需更改业务层参数赋值方式 不使用string.format 直接使用execnoquery(sql,parms..) this.notice.NoticeInfo = this.rtbNotice.Text; if (this.ckDeptAll.Checked) { this.notice.Dept.ID = "AAAA"; } else { this.notice.Dept.ID = this.cmbDept.Tag.ToString(); } if (this.ckGroupAll.Checked) { this.notice.Group.ID = "AAAA"; } else { this.notice.Group.ID = this.cmbSysGroup.Tag.ToString(); } this.notice.NoticeDept.ID = this.cmbNoticeDept.Tag.ToString(); this.notice.NoticeDept.Name = this.cmbNoticeDept.Text; this.notice.NoticeDate = Neusoft.FrameWork.Function.NConvert.ToDateTime(this.dtNoticeDate.Text); this.notice.NoticeTitle = noticeTitle; if (noticeManager.SetNotice(this.notice) != 1) { MessageBox.Show("保存发布信息失败" + noticeManager.Err); return(-1); } MessageBox.Show("保存成功"); return(1); }
/// <summary> /// 加载显示发布信息 /// </summary> /// <param name="notice">发布信息实体</param> protected void ShowNotice(Neusoft.HISFC.Models.Base.Notice notice) { if (notice == null) { return; } if (notice.ID == "") { this.Clear(); } //不使用Rtf属性 保存后的字符串长度过大 this.rtbNotice.Text = notice.NoticeInfo; if (notice.Dept.ID == "AAAA") //接收科室 { this.ckDeptAll.Checked = true; this.cmbDept.Tag = null; this.cmbDept.Text = ""; } else { if (notice.Dept.ID != "") { this.cmbDept.Tag = notice.Dept.ID; } } if (notice.Group.ID == "AAAA") //接收功能组 { this.ckGroupAll.Checked = true; this.cmbSysGroup.Tag = null; this.cmbSysGroup.Text = ""; } else { if (notice.Group.ID != "") { this.cmbSysGroup.Tag = notice.Group.ID; } } this.cmbNoticeDept.Tag = notice.NoticeDept.ID; //发布科室 if (notice.NoticeDate != DateTime.MinValue) { this.dtNoticeDate.Value = notice.NoticeDate; //发布日期 } }
/// <summary> /// 执行Sql语句 获得Notice实体数组 /// </summary> /// <param name="sql">所执行Sql语句</param> /// <returns>成功返回ArrayList 失败返回null</returns> protected ArrayList myNoticeQuery(string sql) { ArrayList al = new ArrayList(); if (this.ExecQuery(sql) == -1) { return(null); } try { Neusoft.HISFC.Models.Base.Notice notice; while (this.Reader.Read()) { notice = new Neusoft.HISFC.Models.Base.Notice(); notice.ID = this.Reader[0].ToString(); //0 流水号 notice.Dept.ID = this.Reader[1].ToString(); //1 科室编码 notice.Group.ID = this.Reader[2].ToString(); //2 功能组编码 notice.NoticeInfo = this.Reader[3].ToString(); //3 发布信息 notice.NoticeDate = Neusoft.FrameWork.Function.NConvert.ToDateTime(this.Reader[4].ToString()); //4 发布日期 notice.NoticeDept.ID = this.Reader[5].ToString(); //5 发布科室 notice.ExtFlag = this.Reader[6].ToString(); //6 扩展标志 notice.OperEnvironment.OperTime = Neusoft.FrameWork.Function.NConvert.ToDateTime(this.Reader[7].ToString()); //7 操作日期 notice.OperEnvironment.ID = this.Reader[8].ToString(); //8 操作人 notice.NoticeTitle = this.Reader[9].ToString(); //9 发布信息标题 al.Add(notice); } } catch (Exception ex) { this.Err = "获取已发布信息发生错误" + ex.Message; this.WriteErr(); return(null); } finally { this.Reader.Close(); } return(al); }
private void btnQuery_Click(object sender, EventArgs e) { this.GetNotice(); using (Manager.Notice.frmNoticeManager frm = new frmNoticeManager()) { frm.OnlyShow = true; Neusoft.HISFC.Models.Base.Notice info = new Neusoft.HISFC.Models.Base.Notice(); info.NoticeTitle = "aaaaa"; info.NoticeDate = this.noticeManager.GetDateTimeFromSysDateTime(); info.NoticeInfo = "阿飞毒素幅度所附斯多夫撒阿发送毒发斯多夫缩短发送多幅撒"; ArrayList al = new ArrayList(); al.Add(info); al.Add("11"); frm.ShowData(al); if (frm.NoticeInfo.Count > 0) { frm.ShowDialog(); } } }
/// <summary> /// 返回insert 或 update 参数数组 /// </summary> /// <param name="notice">notice实体</param> /// <returns>成功返回string数组</returns> protected string[] myNoticeParm(Neusoft.HISFC.Models.Base.Notice notice) { if (notice == null) { return(null); } string[] strParm = { notice.ID, //0 流水号 notice.Dept.ID, //1 科室编码 notice.Group.ID, //2 功能组编码 notice.NoticeInfo, //3 发布信息 notice.NoticeDate.ToString(), //4 发布日期 notice.NoticeDept.ID, //5 发布科室 notice.ExtFlag, //6 扩展标志 notice.OperEnvironment.OperTime.ToString(), //7 操作日期 notice.OperEnvironment.ID, //8 操作员 notice.NoticeTitle //9 发布信息标题 }; return(strParm); }
/// <summary> /// 更新发布信息 /// </summary> /// <param name="notice">发布信息实体</param> /// <returns>成功更新返回1 失败返回-1</returns> protected int UpdateNotice(Neusoft.HISFC.Models.Base.Notice notice) { string sql = ""; if (this.Sql.GetSql("Manager.Notice.Update", ref sql) == -1) { return(-1); } try { string[] strParm = this.myNoticeParm(notice); sql = string.Format(sql, strParm); } catch (Exception ex) { this.Err = "格式化Update Sql语句出错" + ex.Message; this.WriteErr(); return(-1); } return(this.ExecNoQuery(sql)); }
/// <summary> /// 根据科室编码、组编码、及附加显示信息 /// </summary> /// <param name="deptCode"></param> /// <param name="groupCode"></param> /// <param name="baseNotice"></param> protected void GetNotice(string deptCode, string groupCode, string baseNotice) { DateTime dt1 = Neusoft.FrameWork.Function.NConvert.ToDateTime(this.dateTimePicker1.Text); DateTime dt2 = Neusoft.FrameWork.Function.NConvert.ToDateTime(this.dateTimePicker2.Text); if (!this.panelTop.Visible) { dt1 = new DateTime(2005, 10, 1); } ArrayList al = this.noticeManager.GetNotice(deptCode, groupCode, dt1, dt2); if (al == null) { MessageBox.Show("获取发布信息出错" + noticeManager.Err); return; } if (baseNotice != null && baseNotice != "") { Neusoft.HISFC.Models.Base.Notice temp = new Neusoft.HISFC.Models.Base.Notice(); temp.Dept.ID = deptCode; temp.Group.ID = groupCode; temp.NoticeInfo = baseNotice; temp.NoticeDate = noticeManager.GetDateTimeFromSysDateTime(); temp.NoticeDept.ID = ""; temp.NoticeTitle = "系统提示"; al.Insert(0, temp); } if (al.Count > 0) { string strErr = ""; ArrayList alValues = Neusoft.FrameWork.WinForms.Classes.Function.GetDefaultValue("NoticeSetting", out strErr); if (alValues == null) { MessageBox.Show(strErr); } bool isCheck = false; DateTime dtEnd; if (alValues.Count > 0) { isCheck = Neusoft.FrameWork.Function.NConvert.ToBoolean(alValues[0]); dtEnd = Neusoft.FrameWork.Function.NConvert.ToDateTime(alValues[1]); this.ckShowEveryDay.Checked = isCheck; if (isCheck) { this.NoticeInfo = al; } else { ArrayList alTemp = new ArrayList(); foreach (Neusoft.HISFC.Models.Base.Notice info in al) { if (info.NoticeDate >= dtEnd) { alTemp.Add(info); } } this.NoticeInfo = alTemp; } } else { this.ckShowEveryDay.Checked = false; this.NoticeInfo = al; } this.iReadBottom = 0; this.iReadTop = this.noticeInfo.Count - 1; this.readIndex = this.noticeInfo.Count; } this.SetNewNoticeLabel(); }
/// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmNoticeManager)); Neusoft.HISFC.Models.Base.Notice notice1 = new Neusoft.HISFC.Models.Base.Notice(); Neusoft.FrameWork.Models.NeuObject neuObject1 = new Neusoft.FrameWork.Models.NeuObject(); Neusoft.FrameWork.Models.NeuObject neuObject2 = new Neusoft.FrameWork.Models.NeuObject(); Neusoft.FrameWork.Models.NeuObject neuObject3 = new Neusoft.FrameWork.Models.NeuObject(); Neusoft.HISFC.Models.Base.OperEnvironment operEnvironment1 = new Neusoft.HISFC.Models.Base.OperEnvironment(); Neusoft.FrameWork.Models.NeuObject neuObject4 = new Neusoft.FrameWork.Models.NeuObject(); Neusoft.HISFC.Models.Base.Operator _operator1 = new Neusoft.HISFC.Models.Base.Operator(); this.toolBar1 = new System.Windows.Forms.ToolBar(); this.tbbDate = new System.Windows.Forms.ToolBarButton(); this.tbQuery = new System.Windows.Forms.ToolBarButton(); this.toolBarButton1 = new System.Windows.Forms.ToolBarButton(); this.tbAdd = new System.Windows.Forms.ToolBarButton(); this.tbDel = new System.Windows.Forms.ToolBarButton(); this.tbSave = new System.Windows.Forms.ToolBarButton(); this.tbPrint = new System.Windows.Forms.ToolBarButton(); this.toolBarButton2 = new System.Windows.Forms.ToolBarButton(); this.tbExit = new System.Windows.Forms.ToolBarButton(); this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.treeView1 = new System.Windows.Forms.TreeView(); this.imageList2 = new System.Windows.Forms.ImageList(this.components); this.splitter1 = new System.Windows.Forms.Splitter(); this.ucNotice1 = new Manager.Notice.ucNotice(); this.SuspendLayout(); // // statusBar1 // this.statusBar1.Location = new System.Drawing.Point(0, 368); this.statusBar1.Size = new System.Drawing.Size(634, 24); // // toolBar1 // this.toolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat; this.toolBar1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { this.tbbDate, this.tbQuery, this.toolBarButton1, this.tbAdd, this.tbDel, this.tbSave, this.tbPrint, this.toolBarButton2, this.tbExit }); this.toolBar1.DropDownArrows = true; this.toolBar1.ImageList = this.imageList1; this.toolBar1.Location = new System.Drawing.Point(0, 0); this.toolBar1.Name = "toolBar1"; this.toolBar1.ShowToolTips = true; this.toolBar1.Size = new System.Drawing.Size(634, 45); this.toolBar1.TabIndex = 1; // // tbbDate // this.tbbDate.ImageIndex = 2; this.tbbDate.Name = "tbbDate"; this.tbbDate.Text = "时间"; // // tbQuery // this.tbQuery.ImageIndex = 0; this.tbQuery.Name = "tbQuery"; this.tbQuery.Text = "查询"; // // toolBarButton1 // this.toolBarButton1.Name = "toolBarButton1"; this.toolBarButton1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; // // tbAdd // this.tbAdd.ImageIndex = 5; this.tbAdd.Name = "tbAdd"; this.tbAdd.Text = "增加"; // // tbDel // this.tbDel.ImageIndex = 3; this.tbDel.Name = "tbDel"; this.tbDel.Text = "删除"; // // tbSave // this.tbSave.ImageIndex = 7; this.tbSave.Name = "tbSave"; this.tbSave.Text = "保存"; // // tbPrint // this.tbPrint.ImageIndex = 6; this.tbPrint.Name = "tbPrint"; this.tbPrint.Text = "打印"; // // toolBarButton2 // this.toolBarButton2.Name = "toolBarButton2"; this.toolBarButton2.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; // // tbExit // this.tbExit.ImageIndex = 4; this.tbExit.Name = "tbExit"; this.tbExit.Text = "退出"; // // imageList1 // this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); this.imageList1.TransparentColor = System.Drawing.Color.Transparent; this.imageList1.Images.SetKeyName(0, ""); this.imageList1.Images.SetKeyName(1, ""); this.imageList1.Images.SetKeyName(2, ""); this.imageList1.Images.SetKeyName(3, ""); this.imageList1.Images.SetKeyName(4, ""); this.imageList1.Images.SetKeyName(5, ""); this.imageList1.Images.SetKeyName(6, ""); this.imageList1.Images.SetKeyName(7, ""); // // treeView1 // this.treeView1.Dock = System.Windows.Forms.DockStyle.Left; this.treeView1.ImageIndex = 0; this.treeView1.ImageList = this.imageList2; this.treeView1.Location = new System.Drawing.Point(0, 45); this.treeView1.Name = "treeView1"; this.treeView1.SelectedImageIndex = 0; this.treeView1.Size = new System.Drawing.Size(156, 323); this.treeView1.TabIndex = 2; // // imageList2 // this.imageList2.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList2.ImageStream"))); this.imageList2.TransparentColor = System.Drawing.Color.Transparent; this.imageList2.Images.SetKeyName(0, ""); this.imageList2.Images.SetKeyName(1, ""); this.imageList2.Images.SetKeyName(2, ""); // // splitter1 // this.splitter1.Location = new System.Drawing.Point(156, 45); this.splitter1.Name = "splitter1"; this.splitter1.Size = new System.Drawing.Size(3, 323); this.splitter1.TabIndex = 3; this.splitter1.TabStop = false; // // ucNotice1 // this.ucNotice1.BackColor = System.Drawing.SystemColors.Control; this.ucNotice1.Dock = System.Windows.Forms.DockStyle.Fill; this.ucNotice1.Location = new System.Drawing.Point(159, 45); this.ucNotice1.Name = "ucNotice1"; neuObject1.ID = "AAAA"; neuObject1.Memo = ""; neuObject1.Name = ""; notice1.Dept = neuObject1; notice1.ExtFlag = ""; neuObject2.ID = "AAAA"; neuObject2.Memo = ""; neuObject2.Name = ""; notice1.Group = neuObject2; notice1.ID = ""; notice1.Memo = ""; notice1.Name = ""; notice1.NoticeDate = new System.DateTime(((long)(0))); neuObject3.ID = ""; neuObject3.Memo = ""; neuObject3.Name = ""; notice1.NoticeDept = neuObject3; notice1.NoticeInfo = ""; notice1.NoticeTitle = ""; neuObject4.ID = ""; neuObject4.Memo = ""; neuObject4.Name = ""; operEnvironment1.Dept = neuObject4; operEnvironment1.ID = ""; operEnvironment1.Memo = ""; operEnvironment1.Name = ""; _operator1.ID = ""; _operator1.Memo = ""; _operator1.Name = ""; //operEnvironment1.Oper = _operator1; operEnvironment1.OperTime = new System.DateTime(((long)(0))); notice1.OperEnvironment = operEnvironment1; this.ucNotice1.Notice = notice1; this.ucNotice1.Size = new System.Drawing.Size(475, 323); this.ucNotice1.TabIndex = 4; // // frmNoticeManager // this.ClientSize = new System.Drawing.Size(634, 392); this.Controls.Add(this.ucNotice1); this.Controls.Add(this.splitter1); this.Controls.Add(this.treeView1); this.Controls.Add(this.toolBar1); this.KeyPreview = true; this.Name = "frmNoticeManager"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "信息发布"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.Controls.SetChildIndex(this.toolBar1, 0); this.Controls.SetChildIndex(this.statusBar1, 0); this.Controls.SetChildIndex(this.treeView1, 0); this.Controls.SetChildIndex(this.splitter1, 0); this.Controls.SetChildIndex(this.ucNotice1, 0); this.ResumeLayout(false); this.PerformLayout(); }
/// <summary> /// 加载列表显示 /// </summary> /// <param name="alAddInfo">附加显示信息</param> protected void ShowList(ArrayList alAddInfo) { ArrayList al = new ArrayList(); if (this.onlyShow) { al = noticeManager.GetNotice(var.Dept.ID, var.CurrentGroup.ID, this.myBeginTime, this.myEndTime); } else { al = noticeManager.GetNotice("AAAA", this.myBeginTime, this.myEndTime); } if (al == null) { MessageBox.Show("获取本月内已发布信息列表出错" + noticeManager.Err); return; } this.treeView1.Nodes.Clear(); TreeNode root = new TreeNode("发布信息列表"); root.SelectedImageIndex = 0; root.ImageIndex = 0; root.Tag = null; ArrayList alTemp = new ArrayList(); // this.treeView1.Nodes.Add(root); TreeNode node; DateTime tempReadDate = DateTime.MinValue; Neusoft.HISFC.Models.Base.Notice info = new Neusoft.HISFC.Models.Base.Notice(); for (int i = 0; i < al.Count; i++) { info = al[i] as Neusoft.HISFC.Models.Base.Notice; node = new TreeNode(); node.Text = info.NoticeTitle; node.ImageIndex = 1; node.SelectedImageIndex = 2; node.Tag = info; if (this.onlyShow && this.noticeMode == "0") //显示模式为只显示新信息 { if (info.NoticeDate <= this.readDate) { continue; } tempReadDate = info.NoticeDate; } // root.Nodes.Add(node); this.treeView1.Nodes.Add(node); alTemp.Add(info); } if (this.onlyShow && this.noticeMode == "0") //显示模式为只显示新信息 { this.readDate = tempReadDate; } if (alAddInfo != null && alAddInfo.Count > 0) { Neusoft.HISFC.Models.Base.Notice tempInfo; for (int j = 0; j < alAddInfo.Count; j++) { tempInfo = alAddInfo[j] as Neusoft.HISFC.Models.Base.Notice; if (tempInfo != null) { alTemp.Add(tempInfo); node = new TreeNode(); node.Text = tempInfo.NoticeTitle; node.ImageIndex = 1; node.SelectedImageIndex = 2; node.Tag = tempInfo; // root.Nodes.Add(node); this.treeView1.Nodes.Add(node); } } } this.noticeInfo = alTemp; this.treeView1.ExpandAll(); if (this.treeView1.Nodes.Count > 0) { this.treeView1.SelectedNode = this.treeView1.Nodes[0]; } }