Пример #1
0
        private void StartLottery()
        {
            if (employee == null || employee.Count == 0)
            {
                MessageBox.Show("Hệ thống không tìm thấy dữ liệu. Vui lòng nhập dữ liệu", "Lời nhắc");
                return;
            }

            if (!timer.Enabled)
            {
                if (employee.Count < amount)
                {
                    if (MessageBox.Show("Số lượng nhân viên tham gia dự thưởng ít. Tiếp tục...", "lời nhắn", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        this.amount = employee.Count;
                        RefreshSubtitle();
                    }
                    else
                    {
                        return;
                    }
                }


                BreakSquence(1);

                btnLottery.Text = "Dừng(Stop)";
                timer.Start();
            }
            else
            {
                timer.Stop();
                btnLottery.Text = "Bắt đầu(Start)";


                SavePrizewinners();


                RemovePrizewinners();

                string title = String.Format("Danh sách trúng thưởng: {0}", this.award);

                if (LotteryCompleted != null)
                {
                    LotteryCompleted();
                }

                RefreshLotteryBox("");

                FrmPrizewinnerPanel.Show(prizewinner, title);
            }
        }
        public static void Show(List <EmployeeInfo> prizewinners, string title, Point location)
        {
            if (prizewinners == null)
            {
                throw new ArgumentNullException("prizewinners", "Tham số không được để trống.");
            }

            //if (form == null) {
            form = new FrmPrizewinnerPanel();
            //}

            form.Prizewinners.Clear();
            form.Prizewinners.AddRange(prizewinners);
            form.Title         = title;
            form.StartPosition = FormStartPosition.Manual;
            form.Location      = location;
            //form.TopMost = true;
            //form.ShowDialog();
            form.Show();

            FrmMain.RefreshSign();
        }