MyfrmStation.cs 1.71 KB
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MyClassLib;
namespace MyControlLib
{
    public partial class MyfrmMessage : Form 
    {
        public MyfrmMessage()
        {
            InitializeComponent();
        }
        private string stationcode = "";
        private string strProduct = "";
        public Timer tm;
        public int SpInterval = 4000;
        public MyfrmMessage(string stationCode,int product,Point p1)
        {
            InitializeComponent();
            stationcode = stationCode;
            strProduct = product.ToString();
            StationInit();
            tm = new Timer();
            tm.Tick += new EventHandler(tm_Tick);
            tm.Interval = SpInterval;
            tm.Start();
            //this.Location =p1;
            //textBox7.Text = string.Format("X:{0}+Y:{1}", this.Location.X, this.Location.Y);
        }

        void tm_Tick(object sender, EventArgs e)
        {
            this.Close();
        }

        private void StationInit()
        {
            DataSet ds = CSqlHelper.ExecuteDataset(string.Format("select * from T_StationInfo where stationCode='{0}'",stationcode));
            if (ds.Tables[0].Rows.Count >= 1)
            {
                textBox1.Text = stationcode;
                textBox2.Text = ds.Tables[0].Rows[0]["stationName"].ToString();
                textBox4.Text = strProduct;
                textBox8.Text = ds.Tables[0].Rows[0]["lineName"].ToString();
            }
        }

        private void MyfrmMessage_Leave(object sender, EventArgs e)
        {
            this.Close();
        }


    }
}