Пример #1
0
        public List <BookingsViewModel> GetListofBookings()
        {
            var _entities = new PegasusEntities();

            //  _entities.Configuration.ProxyCreationEnabled = false;

            List <Booking>           bookings       = new List <Booking>();
            List <BookingsViewModel> bookingdetails = new List <BookingsViewModel>();
            var context = new ApplicationUser.ApplicationDbContext();

            try
            {
                bookings = (from c in _entities.Bookings select c).ToList();

                bookingdetails = (from b in bookings
                                  let firstOrDefault = context.Users.FirstOrDefault(x => x.Id == b.b_createdbyUser)
                                                       where firstOrDefault != null
                                                       join s in _entities.ServiceTypes on b.typeofservice equals s.serviceId
                                                       select new BookingsViewModel
                {
                    trn_Id = b.trn_Id,
                    c_Id = b.c_Id,
                    noofperson = b.noofperson,
                    occasion = b.occasion,
                    packagename = b.Package.p_descripton,
                    packageType = b.Package.p_type.Trim(),
                    amoutperPax = Convert.ToDecimal(b.Package.p_amountPax),
                    venue = b.venue,
                    typeofservice = b.typeofservice,
                    startdate = b.startdate,
                    enddate = b.enddate,
                    transdate = b.transdate,
                    serve_status = b.serve_stat,
                    serviceType = s.servicetypedetails,
                    eventcolor = b.eventcolor,
                    pId = Convert.ToInt32(b.p_id),
                    fullname = Utilities.getfullname(b.Customer.lastname, b.Customer.firstname, b.Customer.middle),
                    b_createdbyUser = b.b_createdbyUser,
                    b_createdbyUserName = firstOrDefault.UserName,
                    refernce = b.reference,
                    apply_extendedAmount = (bool)b.apply_extendedAmount,
                    b_updatedDate = Convert.ToDateTime(b.b_updatedDate),
                    iscancelled = Convert.ToBoolean(b.is_cancelled),
                    booktypecode = !string.Equals(b.booktype, null, StringComparison.Ordinal) ?b.booktype:"",
                    no_of_lackingMenus = BookMenusViewModel.GetTotalLackingMenus(Convert.ToInt32(b.p_id), b.trn_Id)
                }).ToList();
                //}).Where(x=>x.serve_status==false).OrderBy(d => d.startdate).ToList();
            }
            catch (EntityCommandExecutionException eceex)
            {
                if (eceex.InnerException != null)
                {
                    throw eceex.InnerException;
                }
                throw;
            }


            return(bookingdetails.ToList());
        }
Пример #2
0
        public ActionResult GetProfileInformation(string userId)
        {
            var context = new ApplicationUser.ApplicationDbContext();

            var userprofile = context.Users.FirstOrDefault(u => u.Id == userId);

            UserProfileViewModel userProfile = new UserProfileViewModel();

            //ViewBag.userRoles = string.Join(",", UserManager.GetRoles(userId));
            if (userprofile != null)
            {
                userProfile = new UserProfileViewModel()
                {
                    uId      = userprofile.Id,
                    username = userprofile.UserName,
                    emailAdd = userprofile.Email,
                    fullname = Utilities.getfullname_nonreverse(userprofile.Lastname, userprofile.Firstname, userprofile.Middle),
                    roles    = string.Join(",", UserManager.GetRoles(userId))
                };
            }



            return(View(userProfile));
        }
Пример #3
0
        public IEnumerable <UserinRoleViewModel> GetUsersinRole()
        {
            var context = new ApplicationUser.ApplicationDbContext();

            var listofuser = (from user in context.Users
                              select new
            {
                userId = user.Id,
                username = user.UserName,
                email = user.Email,
                Rolenames = (from userRole in user.Roles
                             join role in context.Roles on userRole.RoleId
                             equals role.Id
                             select role).ToList()
            }).ToList().Select(p => new UserinRoleViewModel()
            {
                userId   = p.userId,
                username = p.username,
                email    = p.email,
                userRole = p.Rolenames
            }).ToList();


            return(listofuser.ToList());
        }
Пример #4
0
        public IEnumerable <UsersViewModel> listofUsers()
        {
            //List<UsersViewModel> listofuser=new List<UsersViewModel>();

            var context = new ApplicationUser.ApplicationDbContext();


            var listofuser = (from user in context.Users select new
            {
                userId = user.Id,
                username = user.UserName,
                email = user.Email,
                Rolenames = (from userRole in user.Roles
                             join role in context.Roles on userRole.RoleId
                             equals role.Id
                             select role.Name).ToList()
            }).ToList().Select(p => new UsersViewModel()
            {
                userId               = p.userId,
                username             = p.username,
                email                = p.email,
                roles                = string.Join(",", p.Rolenames),
                has_superadminRights = p.Rolenames.Contains("superadmin")
            }).ToList();



            return(listofuser);
        }
Пример #5
0
        public IEnumerable <CollectionReportViewModel> GetAllCollection()
        {
            List <CollectionReportViewModel> list = new List <CollectionReportViewModel>();

            var appuser = new ApplicationUser.ApplicationDbContext();

            try
            {
                var bookinglist = (from b in dbEntities.Bookings select b).ToList();

                list = (from item in bookinglist
                        join p in dbEntities.Payments on item.trn_Id equals p.trn_Id
                        join pp in dbEntities.Packages on item.p_id equals pp.p_id
                        join c in dbEntities.Customers on item.c_Id equals c.c_Id
                        select new CollectionReportViewModel()
                {
                    transId = p.payNo,
                    payDate = Convert.ToDateTime(p.dateofPayment),
                    customer = Utilities.getfullname_nonreverse(c.lastname, c.firstname, c.middle),
                    occassion = item.occasion,
                    venue = item.venue,
                    eventDate = Convert.ToDateTime(item.startdate),
                    reference = p.particular,
                    paymeans = p.pay_means,
                    checkdetails = p.checkNo,
                    notes = p.notes,
                    noofPax = Convert.ToInt32(item.noofperson),
                    AmountperPax = Convert.ToDecimal(pp.p_amountPax),
                    PayAmt = Convert.ToDecimal(p.amtPay),
                    recievedBy = p.p_createdbyUser != null?(from user in appuser.Users where user.Id == p.p_createdbyUser select user).Select(t => t.UserName).FirstOrDefault().ToString():null
                }).OrderBy(t => t.transId).ToList();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }


            return(list);
        }
Пример #6
0
 public FilmlerController()
 {
     _context = new ApplicationUser.ApplicationDbContext();
 }
Пример #7
0
 public KiralarController()
 {
     _context = new ApplicationUser.ApplicationDbContext();
 }
Пример #8
0
 public MusterilerController()
 {
     _context = new ApplicationUser.ApplicationDbContext();
 }
Пример #9
0
        private ApplicationUser.ApplicationDbContext _context;      // We need a DbContext to access the database. Initialize it in the constructor.

        public MusterilerController()
        {
            _context = new ApplicationUser.ApplicationDbContext(); // dbContext is a disposable (tek kullanımlık) object.
        }
Пример #10
0
 public CustomersController()
 {
     _context = new ApplicationUser.ApplicationDbContext();
 }
Пример #11
0
 public MoviesController()
 {
     _context = new ApplicationUser.ApplicationDbContext();
 }