Esempio n. 1
0
        private Boolean Validation()
        {
            String Com, Dt;

            Com = MonthYear.Value.Date.ToString();
            Dt  = DateTime.Today.ToString();


            if ((AmounttextBox.Text == "" || AmounttextBox.Text == "0") && (PertextBox.Text == "" || PertextBox.Text == "0"))
            {
                MessageBox.Show("Amount Or Percentage Is Required", "Please Enter Amount Or Percentage", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                return(true);
            }
            if (ReasontextBox.Text == "")
            {
                ReasontextBox.BackColor = Color.DodgerBlue;
                MessageBox.Show("Reason Is Required", "Please Enter Reason", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                ReasontextBox.Focus();
                return(true);
            }

            if (Com == Dt)
            {
                DialogResult Result = MessageBox.Show("Do You Want To Enter To Day's Date ? ", "Yes Or No", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (Result == DialogResult.No)
                {
                    MonthYear.Focus();
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            Dt = DateTime.Now;



            if (DaystextBox.Text == "")
            {
                DaystextBox.BackColor = Color.DodgerBlue;
                MessageBox.Show("Days Are Required", "Please Enter Days", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                DaystextBox.Focus();
                return;
            }

            if (int.Parse(DaystextBox.Text) > 30)
            {
                DaystextBox.BackColor = Color.DodgerBlue;
                MessageBox.Show("Days Should Be Less Then 31", "Please Enter Days", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                DaystextBox.Focus();
                return;
            }


            if (HollydaysTb.Text == "")
            {
                HollydaysTb.BackColor = Color.DodgerBlue;
                MessageBox.Show("Hollyday Reason Is Required", "Please Enter Reason", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                HollydaysTb.Focus();
                return;
            }

            if (MonthYear.Value == Dt)
            {
                DialogResult Result = MessageBox.Show("Do You Want To Enter To Day's Date ? ", "Yes Or No", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (Result == DialogResult.No)
                {
                    MonthYear.Focus();
                    return;
                }
            }

            if (CheckPayment())
            {
                //  MessageBox.Show("Selected");
                return;
            }
            //   MessageBox.Show("Inserted");

            AddRecord();
        }
Esempio n. 3
0
        private Boolean Validation()
        {
            String Com, Dt;

            Com = MonthYear.Value.Date.ToString();
            Dt  = DateTime.Today.ToString();


            if (AmounttextBox.Text == "" || AmounttextBox.Text == "0")
            {
                AmounttextBox.BackColor = Color.DodgerBlue;
                MessageBox.Show("Amount Is Required", "Please Enter Amount", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                AmounttextBox.Focus();
                return(true);
            }
            if (ReasonCB.Text == "")
            {
                ReasonCB.BackColor = Color.DodgerBlue;
                MessageBox.Show("Reason Is Required", "Please Enter Reason", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                ReasonCB.Focus();
                return(true);
            }
            if (AttendanceAllowancetb.SelectedIndex == -1)
            {
                AttendanceAllowancetb.BackColor = Color.DodgerBlue;
                MessageBox.Show("Attendance Allowance Is Required", "Please Select Yes Or No", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                AttendanceAllowancetb.Focus();
                return(true);
            }

            if (Com == Dt)
            {
                DialogResult Result = MessageBox.Show("Do You Want To Enter To Day's Date ? ", "Yes Or No", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (Result == DialogResult.No)
                {
                    MonthYear.Focus();
                    return(true);
                }
            }

            return(false);
        }