Пример #1
0
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            customerSearch m1 = new customerSearch();

            m1.Show();
            this.Hide();
        }
Пример #2
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            if (txt_name.Text != "")
            {
                if (txt_adrs.Text != "")
                {
                    if (txt_tel.Text != "" && txt_tel.Text.Length == 10 && Regex.Match(txt_tel.Text, @"^\d{10}$").Success)
                    {
                        Customer customer = new Customer();
                        customer.Cus_nic     = txt_nic.Text;
                        customer.Cus_tel     = Convert.ToInt32(txt_tel.Text);
                        customer.Cus_name    = txt_name.Text;
                        customer.Cus_address = txt_adrs.Text;

                        int addReturn = customer.addCustomer();


                        if (addReturn == 0)
                        {
                            MessageBox.Show("Duplicate NIC", "Warning");
                        }
                        else
                        {
                            MessageBox.Show("Customer details added Succesfully", "Registered");
                            c1 = new customerSearch();
                            c1.Show();
                            this.Hide();
                        }
                    }
                    else
                    {
                        txt_tel.Text      = "Invalid phone number";
                        txt_tel.ForeColor = System.Drawing.Color.Red;
                    }
                }
                else
                {
                    txt_adrs.Text      = "Please enter your address";
                    txt_adrs.ForeColor = System.Drawing.Color.Red;
                }
            }
            else
            {
                txt_name.Text      = "Please enter your name";
                txt_name.ForeColor = System.Drawing.Color.Red;
            }
        }
Пример #3
0
 private void rect_Cust_Click(object sender, EventArgs e)
 {
     c1 = new customerSearch();
     this.Hide();
     c1.Show();
 }
Пример #4
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            if (txt_movieName.Text != "")
            {
                if (cmb_genre.SelectedIndex != -1)
                {
                    if (txt_price.Text != "")
                    {
                        if (Convert.ToDouble(txt_price.Text) > 0)
                        {
                            if (txt_noCopies.Text != "")
                            {
                                if (Convert.ToDouble(txt_noCopies.Text) > 0)
                                {
                                    Movie movie = new Movie();
                                    movie.Movie_Name   = txt_movieName.Text;
                                    movie.Genre        = cmb_genre.SelectedItem.ToString();
                                    movie.Price        = Convert.ToDouble(txt_price.Text);
                                    movie.No_Of_Copies = Convert.ToInt32(txt_noCopies.Text);

                                    int addReturn = movie.addMovie();


                                    if (addReturn != 0)
                                    {
                                        MessageBox.Show("Movie details added Succesfully", "Registered");
                                    }
                                    else
                                    {
                                        MessageBox.Show("Error", "Error");
                                        c1 = new customerSearch();
                                        c1.Show();
                                        this.Hide();
                                    }
                                }
                            }
                        }


                        else
                        {
                            txt_noCopies.Text      = "Invalid no of copies";
                            txt_noCopies.ForeColor = System.Drawing.Color.Red;
                        }
                    }

                    else
                    {
                        txt_price.Text      = "Invalid Price";
                        txt_price.ForeColor = System.Drawing.Color.Red;
                    }
                }
                else
                {
                    MessageBox.Show("Please select movie genre");
                }
            }
            else
            {
                txt_movieName.Text      = "Please enter movie name";
                txt_movieName.ForeColor = System.Drawing.Color.Red;
            }
        }