Esempio n. 1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtUsername.Text == null)
            {
                MessageBox.Show(SportRegistrationSystem.lblInvalidLogin);
            }
            else
            {
                if (txtPassword.Text == null)
                {
                    MessageBox.Show(SportRegistrationSystem.lblInvalidPassword);
                }
                else
                {
                    List <StaffClass> loginStatus = StaffBll.Login(txtUsername.Text, txtPassword.Text);

                    if (loginStatus.Count() == 1)
                    {
                        MainMenuForm form = new MainMenuForm(loginStatus);
                        form.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show(SportRegistrationSystem.lblLoginFailed);
                    }
                }
            }
        }
Esempio n. 2
0
 private void btnRegister_Click(object sender, EventArgs e)
 {
     if (txtUsername.Text == "")
     {
         MessageBox.Show(SportRegistrationSystem.lblInvalidUsername);
     }
     else
     {
         if (txtPassword.Text == "" || lblPassword.Text.Length < 8)
         {
             MessageBox.Show(SportRegistrationSystem.lblInvalidPassword);
         }
         else
         {
             if (txtFullName.Text == "")
             {
                 MessageBox.Show(SportRegistrationSystem.lblInvalidFullName);
             }
             else
             {
                 bool registrationStatus = StaffBll.RegisterStaff(txtUsername.Text, txtPassword.Text, txtFullName.Text, (int)System.Enum.Parse(typeof(PermissionEnum), cbPermission.SelectedValue.ToString()));
                 MessageBox.Show(registrationStatus
                     ? SportRegistrationSystem.lblRegisterSuccess
                     : SportRegistrationSystem.lblRegisterFailed);
                 if (registrationStatus)
                 {
                     LoginForm form = new LoginForm();
                     form.Show();
                     this.Close();
                 }
             }
         }
     }
 }
        private void CreateReceipt(object sender, PrintPageEventArgs e)
        {
            Graphics graphic = e.Graphics;
            Font     font    = new Font("Times New Roman", 15);

            int startX = 10;
            int startY = 10;
            int offset = 40;

            string companyName   = "BB Gymnastic Centre\n";
            string slogan        = "Be Better";
            string studentName   = "Student Name : \t" + cbStudentName.SelectedItem + "\n";
            string paidAmount    = "Paid Amount : \t" + txtPayableAmt.Text + "\n";
            string paidMonth     = "Paid for Month : \t" + dtpDate.Value.ToString("MMMM") + " " + dtpDate.Value.Year + "\n";
            string remarks       = "Remarks : \t" + txtRemark.Text + "\n";
            string StaffID       = "This receipt was issued by " + StaffBll.StaffLookup(StaffId) + "\n";
            string currentDate   = "This receipt was printed on " + DateTime.Now + "\n";
            string quote         = QuoteBLL.GetRandomQuote() + "\n";
            string contact1      = "SH Chong - 0162773629";
            string contact2      = "SF Soo - 0133057605";
            string webPage       = "WebPage : www.bbgimn.com";
            string receiptNumber = (PaymentBLL.GetReceiptNumber() + 1).ToString();


            graphic.DrawString(companyName, new Font("Times New Roman", 24), new SolidBrush(Color.Green), startX, startY);
            graphic.DrawString(receiptNumber, new Font("Times New Roman", 24), new SolidBrush(Color.Black), companyName.Length + 425, startY);
            graphic.DrawString(slogan, new Font("Times New Roman", 22), new SolidBrush(Color.Black), startX, startY + offset);
            offset += FontHeight + 5;
            graphic.DrawString("-------------------------------------------------------------------------\n\n", font, new SolidBrush(Color.Black), startX, startY + offset);
            offset += FontHeight + 5;
            graphic.DrawString(studentName, font, new SolidBrush(Color.Black), startX, startY + offset);
            offset += FontHeight + 8;
            graphic.DrawString(paidAmount, font, new SolidBrush(Color.Black), startX, startY + offset);
            offset += FontHeight + 8;
            graphic.DrawString(paidMonth, font, new SolidBrush(Color.Black), startX, startY + offset);
            offset += FontHeight + 8;
            graphic.DrawString(remarks, font, new SolidBrush(Color.Black), startX, startY + offset);
            offset += FontHeight + 20;

            graphic.DrawString(StaffID, font, new SolidBrush(Color.Black), startX, startY + offset);
            offset += FontHeight + 8;
            graphic.DrawString(currentDate, font, new SolidBrush(Color.Black), startX, startY + offset);
            offset += FontHeight + 5;
            graphic.DrawString("-------------------------------------------------------------------------", font, new SolidBrush(Color.Black), startX, startY + offset);
            offset += FontHeight + 5;
            graphic.DrawString(quote, font, new SolidBrush(Color.Black), startX, startY + offset);
            offset += FontHeight + 5;
            graphic.DrawString("-------------------------------------------------------------------------", font, new SolidBrush(Color.Black), startX, startY + offset);
            offset += FontHeight + 8;
            graphic.DrawString(contact1, font, new SolidBrush(Color.Black), startX, startY + offset);
            offset += FontHeight + 8;
            graphic.DrawString(contact2, font, new SolidBrush(Color.Black), startX, startY + offset);
            offset += FontHeight + 8;
            graphic.DrawString(webPage, font, new SolidBrush(Color.Black), startX, startY + offset);
        }