示例#1
0
        public MTDRecapBiz(List <int> dealerIDs, DateTime startDate, DateTime endDate, int dealerID, string vehicleType)
        {
            context          = new FowlerDORContext();
            this.Dealerships = context.DealerShips.Where(d => dealerIDs.Contains(d.DealerID)).ToList();
            this.StartDate   = startDate;
            this.EndDate     = endDate;
            this.DealerIDs   = dealerIDs;
            this.dealerID    = dealerID;
            this.vehicleType = vehicleType;
            GetDealerships(dealerID);
            if (vehicleType != "")
            {
                GetVehicleTypes();
            }
            else
            {
                GetVehicleTypes(vehicleType);
            }

            GetDealStatuses();
            GetVehicleKinds();
            GetBusinessSources();
            GetSalesCategories();
            GetFinanceManagers();
            GetSalesManagers();
            GetSalesPeople();

            this.ReportFilters = new List <MTDFilterObj>();

            // MasterFilters = null;
            //OIFilters = null;
        }
示例#2
0
        public AddDealViewModel(int userID, int dealerID) : base(userID)
        {
            context = new FowlerDORContext();

            //this.Dealerships = context.DealerShips.Where(d => (d.DisableDate == null || d.DisableDate > DateTime.Now) && DealerIDs.Contains(d.DealerID)).ToList();
            //this.BusinessSources = context.BUSINESSSOURCEs.Where(b=>b.DisableDate == null).ToList();
            //this.FinanceTypes = context.FinanceTypes.ToList();
            //this.VehicleTypes = context.VehicleTypes.ToList();
            //this.DealStatuses = context.DealStatus.ToList();
            //this.VehicleKinds = context.Vehicles.Where(v => v.DisableDate == null).ToList();
            //this.SalesCategories = context.SalesCategories.ToList();
            //this.GradeCredits = context.GradeCredits.ToList();

            PreLoadLists();

            if (dealerID == 0)
            {
                dealerID = this.Dealerships.Select(d => d.DealerID).First();
            }

            this.Deal = new DealRecord();
            SetDefaultDates();

            this.Makes           = context.Makes.Where(m => (m.DisableDate == null || m.DisableDate > DateTime.Now) && m.Dealer == dealerID).ToList();
            this.VehicleModels   = context.Models.Where(m => (m.DisableDate == null || m.DisableDate > DateTime.Now) && _makeIDs.Contains(m.MakeId)).ToList();
            this.SalesPeople     = context.SalesPersons.Where(s => (s.DisableDate == null || s.DisableDate > DateTime.Now) && s.Dealer == dealerID).ToList();
            this.SalesManagers   = context.SalesManagers.Where(m => (m.DisableDate == null || m.DisableDate > DateTime.Now) && m.Dealer == dealerID).ToList();
            this.FinanceManagers = context.FinanceManagers.Where(fm => (fm.DisableDate == null || fm.DisableDate > DateTime.Now) && fm.Dealer == dealerID).ToList();
            this.LienHolders     = context.DORLienHolders.Where(l => (l.DisableDate == null || l.DisableDate > DateTime.Now) && l.Dealer == dealerID).ToList();
        }
示例#3
0
 public SalesRecapBiz(DateTime startDate, DateTime endDate)
 {
     context        = new FowlerDORContext();
     this.StartDate = startDate;
     this.EndDate   = endDate;
     mFIs           = GetMasterFIs();
     mUnwinds       = GetUnwinds();
 }
示例#4
0
        public void PreLoadLists()
        {
            context = new FowlerDORContext();

            this.Dealerships     = context.DealerShips.Where(d => (d.DisableDate == null || d.DisableDate > DateTime.Now) && DealerIDs.Contains(d.DealerID)).ToList();
            this.BusinessSources = context.BUSINESSSOURCEs.Where(b => b.DisableDate == null).ToList();
            this.FinanceTypes    = context.FinanceTypes.ToList();
            this.VehicleTypes    = context.VehicleTypes.ToList();
            this.DealStatuses    = context.DealStatus.ToList();
            this.VehicleKinds    = context.Vehicles.Where(v => v.DisableDate == null).ToList();
            this.SalesCategories = context.SalesCategories.ToList();
            this.GradeCredits    = context.GradeCredits.ToList();
        }
示例#5
0
        public async Task <ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            FowlerDORContext context = new FowlerDORContext();

            // This doesn't count login failures towards account lockout
            // To enable password failures to trigger account lockout, change to shouldLockout: true

            //var user = context.Users.Where(u => u.Email == model.Email && u.Password.Equals(model.Password)).FirstOrDefault();
            //    if (user == null)
            //{
            //    ModelState.AddModelError("", "Invalid login attempt.");
            //    return View(model);
            //}

            //return RedirectToLocal(returnUrl);
            //        return View(model);

            var test = SignInManager.UserManager.CheckPassword(UserManager.FindByEmail("*****@*****.**"), model.Password);

            var result = await SignInManager.PasswordSignInAsync(model.Email.Substring(0, model.Email.IndexOf("@")), model.Password, model.RememberMe, shouldLockout : false);

            switch (result)
            {
            case SignInStatus.Success:
                return(RedirectToLocal(returnUrl));

            case SignInStatus.LockedOut:
                return(View("Lockout"));

            case SignInStatus.RequiresVerification:
                return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe }));

            case SignInStatus.Failure:
            default:
                ModelState.AddModelError("", "Invalid login attempt.");
                return(View());
            }
        }
示例#6
0
        public UpdateDealViewModel(int userID, int dorID) : base(userID)
        {
            context = new FowlerDORContext();
            this.BusinessSources = context.BUSINESSSOURCEs.ToList();
            this.FinanceTypes    = context.FinanceTypes.ToList();

            this.VehicleTypes    = context.VehicleTypes.ToList();
            this.DealStatuses    = context.DealStatus.ToList();
            this.VehicleKinds    = context.Vehicles.Where(v => v.DisableDate == null).ToList();
            this.SalesCategories = context.SalesCategories.ToList();
            this.GradeCredits    = context.GradeCredits.ToList();


            DealBiz biz = new DealBiz();

            this.Deal = biz.GetDealRecord(dorID);
            //Deal.GetType().GetProperty("DealerId").CustomAttributes.Add();
            this.Makes             = context.Makes.Where(m => (m.DisableDate == null || m.DisableDate > Deal.salesdate) && m.Dealer == Deal.Dealerid).ToList();
            this.VehicleModels     = context.Models.Where(m => (m.DisableDate == null || m.DisableDate > Deal.salesdate) && _makeIDs.Contains(m.MakeId)).ToList();
            this.Trades            = biz.GetTrades(Deal);
            this.SalespeopleOnDeal = biz.GetSalespersons(Deal);
            this.SalesManagers     = context.SalesManagers.Where(m => (m.DisableDate == null || m.DisableDate > Deal.salesdate) && m.Dealer == Deal.Dealerid).ToList();
            this.SalesPeople       = context.SalesPersons.Where(p => (p.DisableDate == null || p.DisableDate > Deal.salesdate) && p.Dealer == Deal.Dealerid).ToList();
            this.FinanceManagers   = context.FinanceManagers.Where(fm => (fm.DisableDate == null || fm.DisableDate > Deal.salesdate) && fm.Dealer == Deal.Dealerid).ToList();
            this.LienHolders       = context.DORLienHolders.Where(l => (l.DisableDate == null || l.DisableDate > Deal.salesdate) && l.Dealer == Deal.Dealerid).ToList();

            this.SaleDate         = Convert.ToDateTime(this.Deal.salesdate);
            this.DeliveryDate     = Convert.ToDateTime(this.Deal.delvdate);
            this.DateToAccounting = Convert.ToDateTime(this.Deal.datetoacct);
            this.BookedDate       = Convert.ToDateTime(this.Deal.bookeddate);
            this.DateToTag        = Convert.ToDateTime(this.Deal.datetotag);
            this.DateToBank       = Convert.ToDateTime(this.Deal.datetobank);
            this.DatePaid         = Convert.ToDateTime(this.Deal.datepaid);

            this.IsCurrentMonth = (Deal.salesdate.Month == DateTime.Now.Month ? true : false);
            this.CanUpdate      = CanUserUpdate();
            this.IsAdmin        = (IsSiteAdmin || CurrentUser.AccessLevels.Exists(a => a.DealerId == Deal.Dealerid && a.Role.IsAdmin));
            //this.CanUpdate = (isCurrentMonth || IsAdmin? true : false);
        }
示例#7
0
 public MTDRecapBiz(List <int> dealerIDs, DateTime startDate, DateTime endDate, int dealerID, List <MTDFilterObj> filters)
 {
     context            = new FowlerDORContext();
     this.Dealerships   = context.DealerShips.Where(d => dealerIDs.Contains(d.DealerID)).ToList();
     this.StartDate     = startDate;
     this.EndDate       = endDate;
     this.ReportFilters = filters;
     this.DealerIDs     = dealerIDs;
     //this.VehicleType = type;
     //this.Master_Filters = filters;
     //this.OI_Filters = filters;
     GetDealerships(dealerID);
     GetVehicleTypes();
     GetDealStatuses();
     GetVehicleKinds();
     GetBusinessSources();
     GetSalesCategories();
     GetFinanceManagers();
     GetSalesManagers();
     GetSalesPeople();
     //AddMasterFilters();
     // AddOIFilters();
 }
示例#8
0
        public AdminAddUserViewModel(int userID) : base(userID)
        {
            context     = new FowlerDORContext();
            Dealerships = context.DealerShips.Where(d => (d.DisableDate == null || d.DisableDate > DateTime.Now) && DealerIDs.Contains(d.DealerID)).ToList();
            Roles       = context.Roles.Where(r => r.Id != "1").Select(r => r).ToList();

            Roles.Add(new Role {
                Id = "0", Name = "No Access"
            });

            UserRoleObjects = new List <UserRoleObj>();

            foreach (var dealer in Dealerships)
            {
                UserRoleObjects.Add(new UserRoleObj
                {
                    IsActive   = false,
                    DealerID   = dealer.DealerID,
                    DealerName = dealer.DealerName,
                    RoleID     = "0"
                });
            }
        }
示例#9
0
 public DORUserBiz(int UserID)
 {
     context       = new FowlerDORContext();
     this.UserInfo = context.Users.Where(u => u.ID == UserID).FirstOrDefault();
 }
示例#10
0
 public DealBiz()
 {
     this.context = new FowlerDORContext();
     ListOfDeals  = context.MasterFIs.ToList();
 }