示例#1
0
        private void setTextbox()
        {
            ro = db.tbl_Routes.FirstOrDefault(x => x.id_route == int.Parse(tbIdroute.Text));
            if (ro != null)
            {
                tbIdroute.Text = ro.id_route.ToString();

                var depart = (from d in db.tbl_Places where d.id_place == ro.departure_place select d).First();
                tbAirportdeparture.Text = depart.name_place;
                departid = depart.id_place;


                var arriv = (from d in db.tbl_Places where d.id_place == ro.arrival_place select d).First();
                tbAirportarrival.Text = arriv.name_place;
                arrivid = arriv.id_place;

                btnAdd.Text = "UPDATE";
            }

            else
            {
                va.clear("tbIdroute", 0);
                btnAdd.Text = "ADD";
            }
        }
示例#2
0
        private void setTextbox()
        {
            if (!String.IsNullOrEmpty(tbIdplace.Text))
            {
                pl = db.tbl_Places.FirstOrDefault(x => x.id_place == int.Parse(tbIdplace.Text));
                if (pl != null)
                {
                    tbIdplace.Text   = pl.id_place.ToString();
                    tbNameplace.Text = pl.name_place;
                    btnAdd.Text      = "UPDATE";
                }

                else
                {
                    btnAdd.Text = "ADD";
                    va.clear("tbIdplace", 0);
                }
            }
        }
示例#3
0
        private void setTextbox()
        {
            if (!String.IsNullOrEmpty(tbIdclass.Text))
            {
                cl = db.tbl_Classes.FirstOrDefault(x => x.id_class == int.Parse(tbIdclass.Text));
                if (cl != null)
                {
                    tbIdclass.Text    = cl.id_class.ToString();
                    tbNameclass.Text  = cl.name_class;
                    tbPriceclass.Text = cl.price_class.ToString();
                    btnAdd.Text       = "UPDATE";
                }

                else
                {
                    va.clear("tbIdclass", 0);
                    btnAdd.Text = "ADD";
                }
            }
        }
示例#4
0
        private void setTextbox()
        {
            if (!String.IsNullOrEmpty(tbIdconsumption.Text))
            {
                cons = db.tbl_Consumptions.FirstOrDefault(x => x.id_consumption == int.Parse(tbIdconsumption.Text));
                if (cons != null)
                {
                    tbIdconsumption.Text    = cons.id_consumption.ToString();
                    tbNameconsumption.Text  = cons.name_consumption;
                    tbPriceconsumption.Text = cons.price_consumption.ToString();
                    btnAdd.Text             = "UPDATE";
                }

                else
                {
                    va.clear("tbIdconsumption", 0);
                    btnAdd.Text = "ADD";
                }
            }
        }
示例#5
0
        private void setTextbox()
        {
            if (!String.IsNullOrEmpty(tbIdcustomer.Text))
            {
                cust = db.tbl_Customers.FirstOrDefault(x => x.id_customer == int.Parse(tbIdcustomer.Text));
                if (cust != null)
                {
                    tbNamecustomer.Text        = cust.name_customer;
                    rtbAddresscustomer.Text    = cust.address_customer;
                    tbEmailcustomer.Text       = cust.email_customer;
                    tbPhonenumbercustomer.Text = cust.phonenumber_customer;
                    btnAdd.Text = "UPDATE";
                }

                else
                {
                    va.clear("tbIdcustomer", 0);
                    btnAdd.Text = "ADD";
                }
            }
        }
示例#6
0
        private void setTextbox()
        {
            if (!String.IsNullOrEmpty(tbAirplane.Text))
            {
                pl = db.tbl_Planes.FirstOrDefault(x => x.id_plane == int.Parse(tbAirplane.Text));
                if (pl != null)
                {
                    tbNameplane.Text    = pl.name_plane;
                    nupdSeatplane.Value = pl.seat_plane;
                    cl = db.tbl_Classes.FirstOrDefault(x => x.id_class == pl.id_class);
                    tbClassname.Text = cl.name_class;
                    idclass          = (int)pl.id_class;
                    btnAdd.Text      = "UPDATE";
                }

                else
                {
                    va.clear("tbAirplane", 100);
                    btnAdd.Text = "ADD";
                }
            }
        }
示例#7
0
        private void setTextbox()
        {
            int i   = 0;
            var set = (from b in db.tbl_Schedules
                       join r in db.tbl_Places
                       on b.departure_origin equals r.id_place

                       join d in db.tbl_Places
                       on b.arrival_origin equals d.id_place

                       join p in db.tbl_Planes
                       on b.id_plane equals p.id_plane

                       where b.id_schedule == tbIdschedule.Text
                       select new
            {
                b.id_schedule,
                p.id_plane,
                p.name_plane,
                IDDepart = r.id_place,
                DepartureOrigin = r.name_place,
                IDArriv = d.id_place,
                ArrivalOrigin = d.name_place,
                b.total_seat,
                b.date,
                ArrivalDate = b.arrival_date,
                b.price
            }).FirstOrDefault();

            var det = (from y in db.tbl_Schedules
                       join g in db.tbl_ScheduleDetails
                       on y.id_schedule equals g.id_schedule

                       join t in db.tbl_Routes
                       on g.id_route equals t.id_route

                       join p in db.tbl_Places
                       on t.departure_place equals p.id_place

                       join u in db.tbl_Places
                       on t.arrival_place equals u.id_place
                       where y.id_schedule == set.id_schedule
                       select new
            {
                Transit = t.id_route,
                TransiName = p.name_place + " - " + u.name_place
            });

            if (set != null)
            {
                tbIdschedule.Text      = set.id_schedule;
                tbIdplane.Text         = set.id_plane.ToString();
                tbNameplane.Text       = set.name_plane;
                tbDepartureorigin.Text = set.IDDepart.ToString();
                tbDeparturename.Text   = set.DepartureOrigin;
                tbArrivalorigin.Text   = set.IDArriv.ToString();
                tbArrivalname.Text     = set.ArrivalOrigin;
                dtpDeparturedate.Value = set.date;
                tbPrice.Text           = set.price.ToString();
                foreach (var tr in det)
                {
                    us[i].textBox1.Text = tr.Transit.ToString();
                    us[i].textBox2.Text = tr.TransiName.ToString();
                    i++;
                }

                btnAdd.Text = "UPDATE";
            }

            else
            {
                va.clear("tbIdschedule", 100);
                btnAdd.Text = "ADD";


                //for (int g = 0; g < 3; i++)
                //{
                //    us[g].textBox1.Text = "";
                //    us[g].textBox2.Text = "";
                //}
            }
        }