Beispiel #1
0
        private void complaintadding_Click(object sender, EventArgs e)
        {
            Validation_Class v = new Validation_Class();

            if (pID.Text == "" || Tid.Text == "" || !v.Is_Empty(complaintdiscpribtion.Text))
            {
                MessageBox.Show("all values are required ");
            }
            else if (v.IsPositiveNumber(Tid.Text) && v.PhoneNumber(pID.Text))
            {
                DataTable passengerid = controllerObj.Get_Passenger_id(pID.Text);
                if (passengerid == null)
                {
                    MessageBox.Show("No passenger with this Phone number exists ");
                }
                else if (Convert.ToInt32(controllerObj.CheckTripID(Tid.Text)) == 0)
                {
                    MessageBox.Show("No trip with this ID exists ");
                }
                else if (Convert.ToInt32(controllerObj.PassengerinTrip(passengerid.Rows[0][0].ToString(), Tid.Text)) == 0)
                {
                    MessageBox.Show("This passenger is not in this Bus trip ");
                }
                else
                {
                    DataTable dt1      = controllerObj.DriverOfWeeklTrip(Tid.Text);
                    string    driverid = dt1.Rows[0][0].ToString();
                    int       res      = controllerObj.AddComplaint(Tid.Text, passengerid.Rows[0][0].ToString(), complaintdiscpribtion.Text, driverid);
                    if (res == 1)
                    {
                        MessageBox.Show("Complaint's added successfully !");
                    }
                }
            }
        }
Beispiel #2
0
        private void confirmAddPromo_Click(object sender, EventArgs e)
        {
            Validation_Class v = new Validation_Class();

            if (v.Is_Empty(PC_name.Text) && v.IsPositiveNumber(WT_id.Text))
            {
                if (Convert.ToInt32(controllerObj.CheckPromoCodeName(PC_name.Text)) == 1)
                {
                    MessageBox.Show("This name is already taken");
                }
                else if (Convert.ToInt32(controllerObj.CheckWTID(WT_id.Text)) == 0)
                {
                    MessageBox.Show("Weekly trip  ID is invalid !");
                }
                else
                {
                    controllerObj.AddPromoCode(PC_name.Text, discount.Value.ToString(), LoggedinEmployee);
                    controllerObj.AddPromoToWT(PC_name.Text, WT_id.Text);
                    MessageBox.Show("Promo Code is added Successfully");
                }
            }
        }