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

📄 form1.cs

📁 食堂管理提示系统。适用于各种环境下。能自动完成各种统计和计算工作。
💻 CS
📖 第 1 页 / 共 3 页
字号:
			this.button2.Name = "button2";
			this.button2.Size = new System.Drawing.Size(64, 23);
			this.button2.TabIndex = 11;
			this.button2.Text = "重新登录";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// submit
			// 
			this.submit.BackColor = System.Drawing.Color.DarkSeaGreen;
			this.submit.Location = new System.Drawing.Point(8, 168);
			this.submit.Name = "submit";
			this.submit.Size = new System.Drawing.Size(144, 23);
			this.submit.TabIndex = 13;
			this.submit.Text = "已选好,现在提交";
			this.submit.Click += new System.EventHandler(this.submit_Click);
			this.submit.EnabledChanged += new System.EventHandler(this.submit_EnabledChanged);
			// 
			// notifyIcon1
			// 
			this.notifyIcon1.ContextMenu = this.contextMenu1;
			this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
			this.notifyIcon1.Text = "消防支队食堂就餐提醒系统";
			this.notifyIcon1.Visible = true;
			this.notifyIcon1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.notifyIcon1_MouseDown);
			// 
			// contextMenu1
			// 
			this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																						 this.menuItem1,
																						 this.menuItem3,
																						 this.menuItem2});
			// 
			// menuItem1
			// 
			this.menuItem1.Index = 0;
			this.menuItem1.Text = "关于(&A)";
			this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
			// 
			// menuItem3
			// 
			this.menuItem3.Index = 1;
			this.menuItem3.Text = "-";
			// 
			// menuItem2
			// 
			this.menuItem2.Index = 2;
			this.menuItem2.Text = "退出(&E)";
			this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
			// 
			// timer1
			// 
			this.timer1.Enabled = true;
			this.timer1.Interval = 20000;
			this.timer1.SynchronizingObject = this;
			this.timer1.Elapsed += new System.Timers.ElapsedEventHandler(this.timer1_Elapsed);
			// 
			// label4
			// 
			this.label4.ForeColor = System.Drawing.Color.Red;
			this.label4.Location = new System.Drawing.Point(8, 192);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(320, 16);
			this.label4.TabIndex = 14;
			this.label4.Visible = false;
			// 
			// button3
			// 
			this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			this.button3.Location = new System.Drawing.Point(392, 168);
			this.button3.Name = "button3";
			this.button3.Size = new System.Drawing.Size(64, 23);
			this.button3.TabIndex = 15;
			this.button3.Text = "重启软件";
			this.button3.Click += new System.EventHandler(this.button3_Click_1);
			// 
			// imageList1
			// 
			this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
			this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
			this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(466, 215);
			this.Controls.Add(this.button3);
			this.Controls.Add(this.label4);
			this.Controls.Add(this.submit);
			this.Controls.Add(this.button2);
			this.Controls.Add(this.button1);
			this.Controls.Add(this.label3);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.i001);
			this.Controls.Add(this.i003);
			this.Controls.Add(this.i002);
			this.Controls.Add(this.tomorrowL);
			this.Controls.Add(this.todayL);
			this.Controls.Add(this.pictureBox1);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "Form1";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "消防支队食堂就餐提醒系统";
			this.Closing += new System.ComponentModel.CancelEventHandler(this.Form1_Closing);
			this.Closed += new System.EventHandler(this.Form1_Closed);
			this.VisibleChanged += new System.EventHandler(this.Form1_VisibleChanged);
			((System.ComponentModel.ISupportInitialize)(this.timer1)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>
		[STAThread]
		static void Main() 
		{
			if ( !IsExistProcess() ){
				
				//客户端
				Application.Run(new LoginApp());

				//管理员
				//Application.Run(new AdminLogin());

			}else {
				Application.Exit();
			}
		}

		/// <summary>
		/// 设置参数
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void button3_Click(object sender, System.EventArgs e) {
			
			SetWin sw = new SetWin();
			sw.ShowDialog();
		}

		/// <summary>
		/// 确定退出并重新登录
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void button2_Click(object sender, System.EventArgs e) {
			if(MessageBox.Show("确定退出并重新登录吗?","退出确认",MessageBoxButtons.OKCancel,MessageBoxIcon.Question) == DialogResult.OK){
				Public.configXml.Rows[0]["AutoLogin"] = "0";
				SRXML.SaveDataTableToXML(Public.configXml,Public.configFile);
				Process process             = new Process();
				process.StartInfo.FileName  = Application.StartupPath + "\\XFMAS.exe";
				process.Start();
				Application.Exit();
			}
		}

		/// <summary>
		/// 不能退出,退回到托盘
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e) {
			e.Cancel = !this.isExitApp;
			this.Visible = false;
		}

		/// <summary>
		/// 进入托盘
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void notifyIcon1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) {
			if(e.Clicks == 2){
				this.Visible = true;
			}
		}

		/// <summary>
		/// 载入已选
		/// </summary>
		private void LoadSelectedFormDB(){
			if(DBConn.DbIsAvailable()){

				this.ChangeNotIcon(true);

				try{

					this.i001.Checked = false;
					this.i002.Checked = false;
					this.i003.Checked = false;

					bool isAdminMod = false;

					DataTable selected = null;

					try{
						selected = DBConn.GetTodaySelected(Public.currentUserID);

						foreach(DataRow row in selected.Rows){
							if(row["itemClassID"].ToString() == "001"){
								this.i001.Checked = true;
							}else if(row["itemClassID"].ToString() == "002"){
								this.i002.Checked = true;
							}else if(row["itemClassID"].ToString() == "003"){
								this.i003.Checked = true;
							}

							if(row["adminMod"].ToString() == "1"){
								isAdminMod = true;
							}
						}
					}catch{}

					this.label4.Text = "";

					try{
						DateTime _nowTime = DBConn.GetServerTime();

						string _dodate = _nowTime.Year.ToString() + "-" + _nowTime.Month.ToString() + "-" + _nowTime.Day.ToString();

						if(isAdminMod){
							this.label4.Visible = true;
							string[] _gl = DBConn.GetLastEditLog(Public.currentUserID,_dodate);
							string _editLog = "";
							if(_gl != null) _editLog = " " + _gl[0].ToString() + " ";
							//
							this.label4.Text = "* 已被管理员"+ _editLog +"更改过 *";
						}else{
							if(selected != null && selected.Rows.Count == 0){
								if(!Public.todayIsAlert){
									if(Public.startTime < _nowTime && Public.endTime > _nowTime && !this.Visible){
									}else{
										isAdminMod = true;
									}
								}else{
									isAdminMod = true;
								}
							}

							if(isAdminMod){
								this.label4.Visible = true;
								string[] _gl = DBConn.GetLastEditLog(Public.currentUserID,_dodate);
								string _editLog = "";
								if(_gl != null) _editLog = " " + _gl[0].ToString() + " ";
								this.label4.Text = "* 没有选择或数据已被管理员"+ _editLog +"清空 *";
							}
						}

					}catch{}

				}catch(Exception ex){
					MessageBox.Show(ex.Message.ToString());
				}

				try{
					//检查是否正处于时间段中
					DateTime nowTime = DBConn.GetServerTime();

					if(Public.startTime < nowTime && Public.endTime > nowTime && (!Public.todayIsAlert || Public.alertingIsMod)){
						this.i002.Enabled   = true;
						this.i001.Enabled   = true;
						this.i003.Enabled   = true;
						this.submit.Enabled = true;
					}else{
						this.i002.Enabled   = false;
						this.i001.Enabled   = false;
						this.i003.Enabled   = false;
						this.submit.Enabled = false;
					}
				}catch{}

			}else{
				this.ChangeNotIcon(false);
			}

		}

		/// <summary>
		/// 保存选择的结果
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void submit_Click(object sender, System.EventArgs e) {

			if(!DBConn.DbIsAvailable()){
				MessageBox.Show("连系不到服务器,无法保存。\r\n\r\n请联系相关管理员确认服务器或网络是否存在问题!");
				return;
			}

			this.submit.Enabled = false;

			//先清除以选中的
			string delResult = DBConn.DeleteSelected("","",Public.currentUserID,"","");

			if(delResult != "OK"){
				MessageBox.Show(delResult);
				return;
			}

			DateTime nowTime = DBConn.GetServerTime();

			//保存第二天的早餐
			if(this.i001.Checked){
				string toTime_ = nowTime.AddDays(1).ToString();
				DateTime toTime = Convert.ToDateTime(toTime_);
				DBConn.SaveSelected("","001",Public.currentUserID,toTime.ToString(),Public.configXml.Rows[0]["LastUserIP"].ToString());
			}

			//保存晚餐
			if(this.i003.Checked)
				DBConn.SaveSelected("","003",Public.currentUserID,nowTime.ToString(),Public.configXml.Rows[0]["LastUserIP"].ToString());

⌨️ 快捷键说明

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