Beispiel #1
0
        // 切换用户
        private void toolStripButton2_Click_1(object sender, EventArgs e)
        {
            UserLoginForm uf = new UserLoginForm();

            if (uf.ShowDialog() == DialogResult.OK)
            {
                DataSettings.Default.User = uf.User;
            }
        }
Beispiel #2
0
        private void tsmiLogOutItem_Click(object sender, EventArgs e)
        {
            var result = MessageBox.Show("คุณต้องการออกจากระบบใช้หรือไม่", "ออกจากระบบ", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (result == System.Windows.Forms.DialogResult.Yes)
            {
                Hide();
                User = null;
                var login = new UserLoginForm();
                if (login.ShowDialog() == System.Windows.Forms.DialogResult.Yes)
                {
                    tsmiManage.Visible = User.SuperUser;
                    Show();
                }
                else
                {
                    Close();
                }
            }
        }
Beispiel #3
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            var start = new StartForm();

            if (start.ShowDialog() == System.Windows.Forms.DialogResult.No)
            {
                this.Close();
            }


            // TODO: This line of code loads data into the 'farmManageDataSet.OrderInStatic' table. You can move, or remove it, as needed.
            this.orderInStaticTableAdapter.Fill(this.farmManageDataSet.OrderInStatic);
            // TODO: This line of code loads data into the 'farmManageDataSet.OrderOutStatic' table. You can move, or remove it, as needed.
            this.orderOutStaticTableAdapter.Fill(this.farmManageDataSet.OrderOutStatic);
            // TODO: This line of code loads data into the 'farmManageDataSet.CowStatic' table. You can move, or remove it, as needed.
            this.cowStaticTableAdapter.Fill(this.farmManageDataSet.CowStatic);



            colCowSex.ValueMember   = "Key";
            colCowSex.DisplayMember = "Value";
            colCowSex.DataSource    = TypeUtil.CowSex().ToList();


            var corralList = new SortedDictionary <Int32, String>();

            corralList.Add(-1, "ทั้งหมด");
            foreach (FarmManageDataSet.CorralRow row in corralTableAdapter.GetData())
            {
                corralList.Add(row.CorralID, row.Name);
            }
            cbxCorral.ValueMember   = "Key";
            cbxCorral.DisplayMember = "Value";
            cbxCorral.DataSource    = corralList.ToList();


            var geneList = new SortedDictionary <Int32, String>();

            geneList.Add(-1, "ทั้งหมด");
            foreach (FarmManageDataSet.GeneRow row in geneTableAdapter.GetData())
            {
                geneList.Add(row.GeneID, row.Name);
            }
            cbxGene.ValueMember   = "Key";
            cbxGene.DisplayMember = "Value";
            cbxGene.DataSource    = geneList.ToList();



            corralTableAdapter.Fill(farmManageDataSet.Corral);
            geneTableAdapter.Fill(farmManageDataSet.Gene);
            initSearch();

            var timer = new Timer();

            timer.Tick += new EventHandler(timer_Tick);
            timer.Start();



            var login = new UserLoginForm();

            if (login.ShowDialog() == System.Windows.Forms.DialogResult.Yes)
            {
                tsmiCurrentUser.Text   = String.Format("ลงชื่อเข้าใช้โดย {0} {1}", User.Firstname, User.Lastname);
                tsmiManage.Visible     = User.SuperUser;
                tsmiBackupItem.Visible = false;
                Show();
            }
            else
            {
                Close();
            }
        }