⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gonggaowindow.cs

📁 快速地把各种源文件的Unicode码转换为汉字或相反
💻 CS
📖 第 1 页 / 共 2 页
字号:
		private void LoadFclist()
		{
			DataTable table1 = new DataTable();
			table1 = this.Db.DBList("Select Id,FcName From GroupTable Order By NumSet");
			DataTable table2 = table1.Clone();
			table2.Rows.Add(table2.NewRow());
			table2.Rows[0]["FcName"] = "所有部门";
			table2.Rows[0]["Id"] = "999999";
			table1.ImportRow(table2.Rows[0]);
			this.FcListST.DataSource = table1;
			this.FcListST.DisplayMember = "FcName";
			this.FcListST.ValueMember = "Id";
			this.FcListST.SelectedValue = "999999";
		}

		private void LoadGgFile()
		{
			this.OpenMBST.InitialDirectory = @"c:\";
			this.OpenMBST.Filter = "所有支持的格式|*.rtf;*.txt;*.htm;*.html|RTF格式|*.rtf|文本格式(*.txt)|*.txt|htm格式|*.htm;*.html|*.*|*.*";
			if (this.OpenMBST.ShowDialog() == DialogResult.OK)
			{
				try
				{
					string text1;
					RichTextBox box1 = new RichTextBox();
					if ((text1 = this.OpenMBST.FileName.ToLower().Substring(this.OpenMBST.FileName.Length - 3, 3)) == null)
					{
						goto Label_00F2;
					}
					text1 = string.IsInterned(text1);
					if (text1 != "rtf")
					{
						if (text1 == "txt")
						{
							goto Label_00B6;
						}
						if (text1 == "htm")
						{
							goto Label_00CA;
						}
						if (text1 == "tml")
						{
							goto Label_00DE;
						}
						goto Label_00F2;
					}
					box1.LoadFile(this.OpenMBST.FileName, RichTextBoxStreamType.RichText);
					goto Label_0108;
				Label_00B6:
					box1.LoadFile(this.OpenMBST.FileName, RichTextBoxStreamType.PlainText);
					goto Label_0108;
				Label_00CA:
					box1.LoadFile(this.OpenMBST.FileName, RichTextBoxStreamType.PlainText);
					goto Label_0108;
				Label_00DE:
					box1.LoadFile(this.OpenMBST.FileName, RichTextBoxStreamType.PlainText);
					goto Label_0108;
				Label_00F2:
					MessageBox.Show("系统不支持此文件格式!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
				Label_0108:
					this.NrSt.SelectedRtf = box1.Rtf;
				}
				catch
				{
					MessageBox.Show("读取文件出错!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
				}
			}
		}

		private void LoadGGInfo()
		{
			int num1 = this.MT.FcTemp;
			this.ggDt = this.Db.DBList(string.Concat(new object[] { "Select * From GongGao Where ToGroup='", this.MT.GroupIdTemp, "' or ToGroup='A公告' or ToGroup='B公告To-", num1.ToString(), "' Order By FbDate DESC" }));
			this.GGListSt.DisplayMember = "Title";
			this.GGListSt.ValueMember = "Id";
			this.GGListSt.DataSource = this.ggDt;
		}

		private void LodGp()
		{
			try
			{
				DataTable table1 = new DataTable();
				table1 = this.Db.DBList("Select GroupId,GroupName From WorkGroup Where ByFcId=" + this.FcListST.SelectedValue + " Order By NumSet");
				DataTable table2 = table1.Clone();
				table2.Rows.Add(table2.NewRow());
				table2.Rows[0]["GroupName"] = "所有部门";
				table2.Rows[0]["GroupId"] = "888888";
				table1.ImportRow(table2.Rows[0]);
				this.GroupIdST.DataSource = table1;
				this.GroupIdST.DisplayMember = "GroupName";
				this.GroupIdST.ValueMember = "GroupId";
				this.GroupIdST.SelectedValue = "888888";
			}
			catch
			{
			}
		}

		private void menuItem1_Click(object sender, EventArgs e)
		{
			if (this.FcListST.Visible)
			{
				this.NrSt.SelectionAlignment = HorizontalAlignment.Left;
			}
		}

		private void menuItem2_Click(object sender, EventArgs e)
		{
			if (this.FcListST.Visible)
			{
				this.NrSt.SelectionAlignment = HorizontalAlignment.Center;
			}
		}

		private void menuItem3_Click(object sender, EventArgs e)
		{
			if (this.FcListST.Visible)
			{
				this.NrSt.SelectionAlignment = HorizontalAlignment.Right;
			}
		}

		private void newdoc()
		{
			this.UsIdSt.Text = this.MT.UsId;
			this.label2.Visible = true;
			this.FcListST.Visible = true;
			this.GroupIdST.Visible = true;
			this.GGListSt.Enabled = false;
			this.DateSt.Enabled = false;
			this.TitleSt.ReadOnly = false;
			this.TitleSt.Text = "请在此输入您的公告标题";
			this.NrSt.ReadOnly = false;
			this.NrSt.Text = "请在此输入您的公告内容";
		}

		private void NrSt_LinkClicked(object sender, LinkClickedEventArgs e)
		{
			Process.Start(e.LinkText);
		}

		private void OpenWithOffice()
		{
			string text1 = string.Concat(new string[] { System.Windows.Forms.Application.StartupPath, @"\Temp\~temp_", this.MT.UsId, this.GGListSt.SelectedValue.ToString(), ".rtf" });
			ApplicationClass class1 = null;
			Document document1 = null;
			class1 = new ApplicationClass();
			object obj1 = text1;
			object obj2 = false;
			object obj3 = 0;
			object obj4 = true;
			object obj5 = true;
			object obj6 = Missing.Value;
			document1 = class1.Documents.Open(ref obj1, ref obj6, ref obj4, ref obj6, ref obj6, ref obj6, ref obj6, ref obj6, ref obj6, ref obj6, ref obj6, ref obj5);
			try
			{
				class1.Application.CommandBars.AdaptiveMenus = true;
				class1.ActiveWindow.DisplayRightRuler = true;
				class1.ActiveWindow.DisplayScreenTips = true;
				class1.ActiveWindow.DisplayVerticalRuler = true;
				class1.ActiveWindow.DisplayRightRuler = true;
				class1.ActiveWindow.ActivePane.DisplayRulers = true;
				class1.ActiveWindow.ActivePane.View.Type = WdViewType.wdPrintView;
			}
			catch
			{
			}
			int num1 = class1.ActiveWindow.Application.CommandBars.Count;
			for (int num2 = 0; num2 < num1; num2++)
			{
				try
				{
					class1.ActiveWindow.Application.CommandBars[num2].Enabled = true;
				}
				catch
				{
				}
			}
			class1.Visible = true;
			class1.Activate();
		}

		private void OutToPrint()
		{
			try
			{
				RichTextBox box1 = new RichTextBox();
				box1.SelectedRtf = this.NrSt.Rtf;
				box1.SaveFile(string.Concat(new string[] { System.Windows.Forms.Application.StartupPath, @"\Temp\~temp_", this.MT.UsId, this.GGListSt.SelectedValue.ToString(), ".rtf" }));
				Thread thread1 = new Thread(new ThreadStart(this.OpenWithOffice));
				thread1.IsBackground = true;
				thread1.Start();
			}
			catch
			{
				MessageBox.Show("很报谦。由于不明原因,文件导出失败。可能是您的OFFICE版本高于\n系统支持版本,或您没有安装OFFICE系统。");
			}
		}

		private void SaveTalkInfo()
		{
			this.SaveST.InitialDirectory = @"C:\";
			if (this.SaveST.ShowDialog() == DialogResult.OK)
			{
				this.NrSt.SaveFile(this.SaveST.FileName);
			}
		}

		private void savetouslook()
		{
			if (this.GGListSt.Items.Count > 0)
			{
				DataTable table1 = this.MT.UsLookDt.Clone();
				DataRow[] rowArray1 = this.MT.UsLookDt.Copy().Select("LookId=" + this.GGListSt.SelectedValue.ToString() + " And LookType='公告'");
				if (rowArray1.Length == 0)
				{
					table1.Rows.Add(table1.NewRow());
					table1.Rows[0]["LookId"] = (int) this.GGListSt.SelectedValue;
					table1.Rows[0]["UsId"] = this.MT.UsId;
					table1.Rows[0]["LookType"] = "公告";
					this.MT.UsLookDt.ImportRow(table1.Rows[0]);
					this.Db.InsDb(table1.Rows[0], "UsLookYN", "Id");
				}
			}
		}

		private void SendGongGao()
		{
			string text2;
			DataTable table1 = this.ggDt.Clone();
			table1.Rows.Add(table1.NewRow());
			table1.Rows[0]["Title"] = this.TitleSt.Text;
			table1.Rows[0]["Nr"] = this.NrSt.Rtf;
			table1.Rows[0]["FbDate"] = DateTime.Now;
			table1.Rows[0]["UsId"] = this.MT.UsId;
			if (this.FcListST.SelectedValue.ToString() == "999999")
			{
				table1.Rows[0]["ToGroup"] = "A公告";
			}
			else if (this.GroupIdST.SelectedValue.ToString() == "888888")
			{
				table1.Rows[0]["ToGroup"] = "B公告To-" + this.FcListST.SelectedValue.ToString();
			}
			else
			{
				table1.Rows[0]["ToGroup"] = this.GroupIdST.SelectedValue;
			}
			string text1 = this.Db.InsDb(table1.Rows[0], "GongGao", "Id");
			if ((text2 = text1) != null)
			{
				text2 = string.IsInterned(text2);
				if (text2 != "0")
				{
					if (text2 == "1")
					{
						MessageBox.Show("公告发送失败!", "PoinTO短讯系统");
					}
					else if (text2 == "2")
					{
						MessageBox.Show("公告发送失败!", "PoinTO短讯系统");
					}
				}
				else
				{
					MessageBox.Show("公告发送成功!", "PoinTO短讯系统");
				}
			}
		}

		private void toolBar1_ButtonClick(object sender, ToolBarButtonClickEventArgs e)
		{
			switch (e.Button.Text)
			{
				case "新建":
				{
					this.newdoc();
					return;
				}
				case "另存":
				{
					this.SaveTalkInfo();
					return;
				}
				case "导入":
				{
					if (!this.FcListST.Visible)
					{
						MessageBox.Show("请您先新建公告。", "PoinTO短讯系统");
						break;
					}
					this.LoadGgFile();
					break;
				}
				case "图片":
				{
					if (!this.FcListST.Visible)
					{
						MessageBox.Show("请您先新建公告。", "PoinTO短讯系统");
						goto Label_019A;
					}
					this.InsertImage();
					goto Label_019A;
				}
				case "发布":
				{
					if (!this.FcListST.Visible)
					{
						MessageBox.Show("请您先新建公告,再做发送。", "PoinTO短讯系统");
						return;
					}
					if (MessageBox.Show("公告发出后将无法做修改。您确定要发布您所编写的公告吗?", "PoinTO短讯系统", MessageBoxButtons.YesNo) == DialogResult.Yes)
					{
						this.SendGongGao();
					}
					return;
				}
				case "字体":
				{
					if (!this.FcListST.Visible)
					{
						MessageBox.Show("请您先新建公告。", "PoinTO短讯系统");
						return;
					}
					this.Fontst();
					return;
				}
				case "颜色":
				{
					if (!this.FcListST.Visible)
					{
						MessageBox.Show("请您先新建公告。", "PoinTO短讯系统");
						return;
					}
					this.colorstt();
					return;
				}
				case "关闭":
				{
					base.Close();
					return;
				}
				case "对齐":
				{
					return;
				}
				case "打印":
				{
					this.OutToPrint();
					return;
				}
				default:
				{
					return;
				}
			}
			this.NrSt.Focus();
			return;
			Label_019A:
				this.NrSt.Focus();
		}

		private void UsTypeSet()
		{
			string text1;
			if ((text1 = this.MT.UsType) != null)
			{
				text1 = string.IsInterned(text1);
				if ((((text1 != "A") && (text1 != "B")) && (text1 != "C")) && (text1 == "D"))
				{
					this.toolBarButton2.Enabled = false;
					this.toolBarButton5.Enabled = false;
					this.toolBarButton6.Enabled = false;
					this.toolBarButton7.Enabled = false;
					this.toolBarButton9.Enabled = false;
					this.toolBarButton10.Enabled = false;
					this.toolBarButton13.Enabled = false;
				}
			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -