Beispiel #1
0
        protected void LeaseBtn_Click(object sender, EventArgs e)
        {
            List <Slip> sls = new List <Slip>();
            //Slip sl = new Slip();
            Lease l = new Lease();

            using (SlipDataContext dbContent = new SlipDataContext())
            {
                var selectedSlips = from ls in dbContent.Leases
                                    join c in dbContent.Customers on ls.CustomerID equals c.ID
                                    join s in dbContent.Slips on ls.SlipID equals s.ID
                                    join d in dbContent.Docks on s.DockID equals d.ID
                                    select new
                {
                    s.ID,
                    s.Width,
                    s.Length,
                    d.Name,
                    c.LastName
                };
                LeaseStatusGridView.DataSource = selectedSlips;
                LeaseStatusGridView.DataBind();
                LeaseStatusLabel.Visible    = true;
                LeaseStatusGridView.Visible = true;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            List <Slip> sls = new List <Slip>();

            //Slip sl = new Slip();
            //Lease l = new Lease();
            using (SlipDataContext dbContent = new SlipDataContext())
            {
                var selectedSlips = from sl in dbContent.Slips
                                    join d in dbContent.Docks
                                    on sl.DockID equals d.ID
                                    join ls in dbContent.Leases
                                    on sl.ID equals ls.SlipID


                                    //join s in dbContent.Slips on ls.SlipID equals s.ID
                                    //join d in dbContent.Docks on s.DockID equals d.ID
                                    into empLeases
                                    from cu in empLeases.DefaultIfEmpty()
                                    select new

                {
                    sl.ID,
                    sl.Width,
                    sl.Length,
                    d.Name,
                    Slip_Status = cu == null?"Available":("Occupy")
                };
                availableSlipsGridView.DataSource = selectedSlips;
                availableSlipsGridView.DataBind();
            }
        }
Beispiel #3
0
        private Slip GetSelectedSlip()
        {
            Slip        s      = new Slip();
            GridViewRow gr     = SlipGridView.SelectedRow;
            int         slipID = Convert.ToInt32(gr.Cells[1].Text);

            using (SlipDataContext dbContext = new SlipDataContext())
            {
                s = (from p in dbContext.Slips
                     where p.ID == slipID
                     select p).Single();
            }
            return(s);
        }