Пример #1
0
        public static Models.ProgDec LoadById(int id)
        {
            try
            {
                using (ProgDecEntities dc = new ProgDecEntities())
                {
                    var progdec = (from pd in dc.tblProgDecs
                                   join s in dc.tblStudents on pd.StudentId equals s.Id
                                   join p in dc.tblPrograms on pd.ProgramId equals p.Id
                                   join dt in dc.tblDegreeTypes on p.DegreeTypeId equals dt.Id
                                   where pd.Id == id
                                   select new
                    {
                        ProgDecId = pd.Id,
                        ProgramId = p.Id,
                        StudentId = s.Id,
                        pd.ChangeDate,
                        ProgramName = p.Description,
                        s.FirstName,
                        s.LastName,
                        DegreeTypeName = dt.Description
                    }).FirstOrDefault();

                    if (progdec != null)
                    {
                        Models.ProgDec progDec = new Models.ProgDec
                        {
                            Id             = progdec.ProgDecId,
                            ProgramId      = progdec.ProgramId,
                            StudentId      = progdec.StudentId,
                            ProgramName    = progdec.ProgramName,
                            DegreeTypeName = progdec.DegreeTypeName,
                            StudentName    = progdec.LastName + ", " + progdec.FirstName,
                            ChangeDate     = progdec.ChangeDate
                        };

                        return(progDec);
                    }
                    else
                    {
                        throw new Exception("Row was not found");
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
 public static void Remove(ShoppingCart cart, Models.ProgDec progDec)
 {
     cart.Remove(progDec);
 }
Пример #3
0
 public static void Add(ShoppingCart cart, Models.ProgDec progDec)
 {
     cart.Add(progDec);
 }
Пример #4
0
 public void Remove(ProgDec progDec)
 {
     Items.Remove(progDec);
     TotalCost -= ITEM_COST;
 }
Пример #5
0
 public void Add(ProgDec progDec)
 {
     Items.Add(progDec);
     TotalCost += ITEM_COST; //Cost of each movie for DVDCentral
 }