private void BackButton_Click(object sender, EventArgs e)
        {
            AddViewDeleteF adf = new AddViewDeleteF();

            adf.Visible  = true;
            this.Visible = false;
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Hide();
            AddViewDeleteF avd = new AddViewDeleteF();

            avd.Show();
        }
        private void ConfirmButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Model.Text) || string.IsNullOrEmpty(BuyingPriceTextBox.Text) || string.IsNullOrEmpty(ChasisNo.Text) || string.IsNullOrEmpty(ManufactureYear.Text) || string.IsNullOrEmpty(Color.Text) || string.IsNullOrEmpty(Engine.Text))
            {
                MessageBox.Show("Insufficient Information \n Please Fill-up all information", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                try
                {
                    int check = Convert.ToInt32(BuyingPriceTextBox.Text);


                    try
                    {
                        var vehicleregister = new vehicle
                        {
                            model        = Model.Text.Trim(),
                            chasisNo     = ChasisNo.Text.Trim(),
                            brand        = modelCombobox.Text,
                            manufacturer = manufacturerCombobox.Text,
                            mYear        = ManufactureYear.Text.Trim(),
                            color        = Color.Text.Trim(),
                            engineNo     = Engine.Text.Trim(),
                            bprice       = Int32.Parse(BuyingPriceTextBox.Text.Trim()),
                            image        = CnvtimgToByte(imgpath),
                            //image= imgpath,
                            status = "Available"
                                     //id = Int32.Parse(id_tbox.Text.Trim())
                        };
                        _repousr1.Create(vehicleregister);

                        MessageBox.Show("Vehicle Successfully Added to the Database !!");
                        this.Visible = false;
                        AddViewDeleteF avd = new AddViewDeleteF();
                        avd.Visible = true;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                }
                catch (Exception h)
                {
                    MessageBox.Show("Please provide number Input for Amount !");
                }
            }
        }