//addtours
 public bool AddTour(AddToursTable entity)
 {
     if (entity != null)
     {
         dbcontext3.AddToursTables.Add(entity);
         dbcontext3.SaveChanges();
         return(true);
     }
     else
     {
         return(false);
     }
 }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            int           a, b;
            AddToursTable addplus = new AddToursTable();
            int           result  = 0;

            for (int i = 0; i < metroGrid2.RowCount; i++)
            {
                a = Convert.ToInt32(metroGrid2.Rows[i].Cells[2].Value);
                b = Convert.ToInt32(metroGrid2.Rows[i].Cells[4].Value);
                //sumunit += unit;

                txtplus.Text = Convert.ToString(a + b);
            }
        }
Exemple #3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            AddTourLogic  confirmTour      = new AddTourLogic();
            AddToursTable objaddtourstable = new AddToursTable();

            if (!string.IsNullOrEmpty(txtAddTours.Text) &&
                !string.IsNullOrEmpty(metroComboBox1.Text) &&
                !string.IsNullOrEmpty(txtHotelprice.Text) &&
                !string.IsNullOrEmpty(metroComboBox2.Text) &&
                !string.IsNullOrEmpty(metroComboBox3.Text) &&
                !string.IsNullOrEmpty(txtTransportcost.Text))
            {
                var addtours      = txtAddTours.Text.Trim();
                var addhotel      = metroComboBox1.Text.Trim();
                var hotelprice    = txtHotelprice.Text.Trim();
                var location      = metroComboBox2.Text.Trim();
                var destination   = metroComboBox3.Text.Trim();
                var transportcost = txtTransportcost.Text.Trim();

                objaddtourstable.AddTour          = addtours;
                objaddtourstable.AddHotel         = addhotel;
                objaddtourstable.AddHotelCost     = hotelprice;
                objaddtourstable.AddLocation      = location;
                objaddtourstable.AddDestination   = destination;
                objaddtourstable.Selecttransport  = CmbTransport.Text;
                objaddtourstable.AddTransportCost = transportcost;

                confirmTour.AddTour(objaddtourstable);



                MetroMessageBox.Show(this, "Saved");
            }
            else
            {
                MetroMessageBox.Show(this, "You Need To FillUp All Field");
            }
        }