public async Task <IViewComponentResult> InvokeAsync(int id)
        {
            var reservations = RestaurantsManager.GetManageReservations(id);

            List <ResCustomerModelView> viewReservations = new List <ResCustomerModelView>();

            foreach (ReservationEntry resAux in reservations)
            {
                if (resAux.ReservationStatus == "on Hold")
                {
                    var customer        = CustomersManager.GetCustomerByCustomerId(resAux.CustomerId);
                    var viewReservation = new ResCustomerModelView
                    {
                        RestaurantID       = (int)resAux.RestaurantId,
                        CustomerId         = (int)resAux.CustomerId,
                        CustomerName       = $"{customer.User.FirstName} {customer.User.LastName}",
                        Restaurant         = resAux.Restaurant.RestaurantName,
                        ReservationEntryId = resAux.ReservationId,
                        PartySize          = resAux.PartySize,
                        ReservationStatus  = resAux.ReservationStatus,
                        EntryOrigin        = resAux.EntryOrigin,
                        ReservationDate    = resAux.ReservationDateTime
                    };
                    viewReservations.Add(viewReservation);
                }
            }
            return(View(viewReservations));
        }
Example #2
0
        public IActionResult ReservationManage()
        {
            LogRestaurant();
            ClaimsPrincipal             cp               = this.User;
            var                         claims           = cp.Claims.ToList();
            var                         restId           = Convert.ToInt32(claims.SingleOrDefault(p => p.Type == "RestaurantID").Value);
            var                         reservations     = RestaurantsManager.GetManageReservations(restId);
            List <ResCustomerModelView> viewReservations = new List <ResCustomerModelView>();

            foreach (ReservationEntry resAux in reservations)
            {
                if (resAux.ReservationStatus != "on Hold")
                {
                    var customer        = CustomersManager.GetCustomerByCustomerId(resAux.CustomerId);
                    var viewReservation = new ResCustomerModelView
                    {
                        RestaurantID       = (int)resAux.RestaurantId,
                        CustomerId         = (int)resAux.CustomerId,
                        CustomerName       = $"{customer.User.FirstName} {customer.User.LastName}",
                        Restaurant         = resAux.Restaurant.RestaurantName,
                        ReservationEntryId = resAux.ReservationId,
                        PartySize          = resAux.PartySize,
                        ReservationStatus  = resAux.ReservationStatus,
                        EntryOrigin        = resAux.EntryOrigin,
                        ReservationDate    = resAux.ReservationDateTime
                    };
                    viewReservations.Add(viewReservation);
                }
            }
            ViewBag.RestaurantID = restId;
            return(View(viewReservations));
        }
Example #3
0
        // get customer from custID, then set parameter of available list data source.
        protected void uxLeaseSource_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
        {
            int custID;

            if (Request.Cookies["CustomerID"] != null)
            {
                custID = Convert.ToInt32(Request.Cookies["CustomerID"].Value);
            }
            else if (Session["customerID"] != null)
            {
                // Get customer ID from session.
                custID = (int)Session["customerID"];
            }
            else // display message if cookies are disabled and session custID doesn't exist.
            {
                uxMessage.Text = "Please sign in again to display leased slips.";
                return;
            }

            // find customer from ID.
            Customer cust = CustomersManager.Find(custID);

            if (cust != null) // if customer exists, set input parameter as ID
            {
                e.InputParameters["custID"] = cust.ID;
            }
            else // if customer somehow doesn't exist (how did they get past authentication?)
            {
                uxMessage.Text = "No leased slips present for this account. Lease your slip above.";
            }
        }
Example #4
0
        //Edit Reservation
        public IActionResult ReservationEdit(int id)
        {
            LogRestaurant();
            if (TempData["ErrorMessage"] != null)
            {
                ViewBag.ErrorMessage = TempData["ErrorMessage"];
            }
            if (TempData["Message"] != null)
            {
                ViewBag.Message = TempData["Message"];
            }

            var    reservation     = RestaurantsManager.GetReservationById(id);
            var    userId          = CustomersManager.GetUserIdByCustomerId(reservation.CustomerId);
            var    customerUser    = UsersManager.GetUserByUserId(userId);
            string fullName        = $"{customerUser.FirstName} {customerUser.LastName}";
            var    viewreservation = new ResCustomerModelView
            {
                CustomerName       = fullName,
                EntryOrigin        = reservation.EntryOrigin,
                PartySize          = reservation.PartySize,
                ReservationStatus  = reservation.ReservationStatus,
                ReservationDate    = reservation.ReservationDateTime,
                ReservationEntryId = reservation.ReservationId,
                RestaurantID       = reservation.RestaurantId
            };

            ViewBag.ReservationStatus = GetReservationStatus();
            return(View(viewreservation));
        }
        public async Task <IViewComponentResult> InvokeAsync(int id)
        {
            bool checkin;
            var  reservations = RestaurantsManager.GetCheckinTodayReservationsByRestaurantID(id);
            List <ResCustomerModelView> viewReservations = new List <ResCustomerModelView>();

            foreach (ReservationEntry resAux in reservations)
            {
                var customer = CustomersManager.GetCustomerByCustomerId(resAux.CustomerId);
                if (resAux.CheckinDateTime == null)
                {
                    checkin = false;
                }
                else
                {
                    checkin = true;
                }
                var viewReservation = new ResCustomerModelView
                {
                    RestaurantID       = (int)resAux.RestaurantId,
                    CustomerId         = (int)resAux.CustomerId,
                    CustomerName       = $"{customer.User.FirstName} {customer.User.LastName}",
                    Restaurant         = resAux.Restaurant.RestaurantName,
                    ReservationEntryId = resAux.ReservationId,
                    PartySize          = resAux.PartySize,
                    ReservationStatus  = resAux.ReservationStatus,
                    EntryOrigin        = resAux.EntryOrigin,
                    ReservationDate    = resAux.ReservationDateTime,
                    Checkin            = checkin
                };
                viewReservations.Add(viewReservation);
            }
            return(View(viewReservations));
        }
Example #6
0
        protected void uxSubmit_Click(object sender, EventArgs e)
        {
            if (IsUpdate)
            {
                if (Session["StudentID"] != null)
                {
                    var id   = Convert.ToInt32(Session["StudentID"]);
                    var cust = CustomersManager.Find(id);
                    cust.FirstName = uxFirstName.Text;
                    cust.LastName  = uxLastName.Text;
                    cust.City      = uxCity.Text;
                    cust.Phone     = uxPhone.Text;

                    CustomersManager.Update(cust);
                    FormsAuthentication.SignOut();
                    Session.Clear();
                    Response.Redirect("/Login");
                }
            }
            else
            {
                var cust = new Customer
                {
                    FirstName = uxFirstName.Text,
                    LastName  = uxLastName.Text,
                    City      = uxCity.Text,
                    Phone     = uxPhone.Text
                };
                CustomersManager.Add(cust);
                Response.Redirect("/Login");
            }
        }
        public void CustomerManager_GetCustomersByRegion_InProcessorCacheTest()
        {
            var cache           = new InProcessorCache.Cache <IEnumerable <Customer> >();
            var customerManager = new CustomersManager(cache);

            long executionTimeWithoutCaching = 0;
            long executionTimeWithCaching    = 0;

            var region = "RJ";

            _stopwatch.Start();

            var inProcessorCacheResult1 = customerManager.GetCustomersByRegion(region);

            _stopwatch.Stop();

            executionTimeWithoutCaching = _stopwatch.ElapsedMilliseconds;

            _stopwatch.Restart();

            var inProcessorCacheResult2 = customerManager.GetCustomersByRegion(region);

            _stopwatch.Stop();

            executionTimeWithCaching = _stopwatch.ElapsedMilliseconds;

            Assert.IsTrue(executionTimeWithoutCaching > executionTimeWithCaching);
        }
Example #8
0
        protected void uxAuthenticate_Click(object sender, EventArgs e)
        {
            var customer = CustomersManager.Authenticate(uxFirstname.Text, uxLastName.Text);

            if (customer == null)
            {
                uxMessage.Text   = "Customer not present";
                uxFirstname.Text = string.Empty;
                uxLastName.Text  = string.Empty;
                uxFirstname.Focus();
                return;
            }

            // Add customer ID to session
            Session.Add("CustomerID", customer.ID);

            // instatiate cookie and add customer ID to cookie
            HttpCookie cookieCustID = new HttpCookie("CustomerID");

            cookieCustID.Value   = Convert.ToString(customer.ID);
            cookieCustID.Expires = DateTime.Now.AddMonths(1); // cookie expires after 1 month
            Response.Cookies.Add(cookieCustID);

            FormsAuthentication.RedirectFromLoginPage(customer.FullName, false);
        }
Example #9
0
        //Customer's Reservations
        public IActionResult ReservationsShow()
        {
            LogRestaurant();
            if (TempData["ErrorMessage"] != null)
            {
                ViewBag.ErrorMessage = TempData["ErrorMessage"];
            }
            if (TempData["Message"] != null)
            {
                ViewBag.Message = TempData["Message"];
            }
            ClaimsPrincipal cp               = this.User;
            var             claims           = cp.Claims.ToList();
            var             custId           = Convert.ToInt32(claims.SingleOrDefault(p => p.Type == "CustomerID").Value);
            var             reservations     = CustomersManager.GetReservations(custId);
            var             viewReservations = reservations.Select(r => new ResCustomerModelView
            {
                RestaurantID       = (int)r.RestaurantId,
                CustomerId         = (int)r.CustomerId,
                Restaurant         = r.Restaurant.RestaurantName,
                ReservationEntryId = r.ReservationId,
                PartySize          = r.PartySize,
                ReservationStatus  = r.ReservationStatus,
                EntryOrigin        = r.EntryOrigin,
                ReservationDate    = r.ReservationDateTime,
                Message            = r.CustomerMessage
            }).ToList();

            return(View(viewReservations));
        }
Example #10
0
        public ActionResult ManageSubscriptions(ManageSubscriptionsVM model)
        {
            if (!ModelState.IsValid)
            {
                model.Sites = SitesManager.GetSites();
                return(View(model));
            }
            int memberId = 0;

            Int32.TryParse(model.MemberId, out memberId);
            int siteId = 0;

            Int32.TryParse(model.SiteId, out siteId);
            int lastFourDigit = -1;

            lastFourDigit = !string.IsNullOrEmpty(model.LastFourDigit) && int.TryParse(model.LastFourDigit, out lastFourDigit) ? int.Parse(model.LastFourDigit) : -1;

            if (memberId != 0 || model.Email != null || model.Phone != null || model.Name != null || (lastFourDigit >= 0 && lastFourDigit <= 9999))
            {
                string lastFourDigitCreditCard = GenerateLastFourDigitCreditCard(lastFourDigit);

                List <CustomerDT> data = CustomersManager.GetCustomers(siteId, memberId, model.Email, model.Phone, model.Name, lastFourDigitCreditCard);
                ViewBag.Data = data;
            }

            model.Sites = SitesManager.GetSites();
            return(View(model));
        }
Example #11
0
        //
        // GET: /Customers/
        public ActionResult Index()
        {
            ViewBag.CustomersCount = CustomersManager.GetCustomersCount().ToString();
            ViewBag.SitesName      = SitesManager.GetSites().GroupBy(x => x.Name).Select(x => x.Key);

            return(View());
        }
Example #12
0
        public IActionResult HostManage()
        {
            LogRestaurant();
            ClaimsPrincipal cp       = this.User;
            var             claims   = cp.Claims.ToList();
            var             restId   = Convert.ToInt32(claims.SingleOrDefault(p => p.Type == "RestaurantID").Value);
            var             waitlist = RestaurantsManager.GetWaitlistByRestaurantID(restId);
            List <WaitCustomerModelView> viewWaitlist = new List <WaitCustomerModelView>();

            foreach (WaitlistEntry waitAux in waitlist)
            {
                var customer          = CustomersManager.GetCustomerByCustomerId(waitAux.CustomerId);
                var viewWaitlistEntry = new WaitCustomerModelView
                {
                    RestaurantID     = (int)waitAux.RestaurantId,
                    CustomerId       = (int)waitAux.CustomerId,
                    CustomerName     = $"{customer.User.FirstName} {customer.User.LastName}",
                    Restaurant       = waitAux.Restaurant.RestaurantName,
                    WaitlistEntryId  = waitAux.WaitlistEntryId,
                    PartySizew       = waitAux.PartySize,
                    WaitlistStatus   = waitAux.WaitlistStatus,
                    EntryOriginw     = waitAux.EntryOrigin,
                    WaitlistPosition = Convert.ToString(RestaurantsManager.GetWaitlistPosition(restId, waitAux.WaitlistEntryId))
                };
                viewWaitlist.Add(viewWaitlistEntry);
            }
            var orderViewWaitlist = viewWaitlist.OrderBy(w => w.WaitlistPosition);

            ViewBag.RestaurantID = restId;
            return(View(orderViewWaitlist));
        }
Example #13
0
        private static void CustomerAdd()
        {
            CustomersManager customerManager = new CustomersManager(new EfCustomerDal());

            customerManager.Add(new Customer {
                CompanyName = "SoganSoft1", CustomerName = "Yilmaz1"
            });
        }
Example #14
0
        /**/
        public ActionResult Access()
        {
            AccessVM model = new AccessVM();

            return(View(model));
        }

        [HttpPost]

        public ActionResult Access(AccessVM model)
        {
            model.response = CustomersManager.NewActivateMember(SitesManager.GetSite(13), CustomersManager.GetCustomer(2239433), "OPEN");
            //////responseFromServer;
            /////SHA1 sha1 = SHA1Managed.Create();

            ////ASCIIEncoding encoding = new ASCIIEncoding();
            ////byte[] stream = null;
            ////StringBuilder sb = new StringBuilder();
            ////stream = sha1.ComputeHash(encoding.GetBytes("WEj5g-101036-2239433"));
            ////for (int i = 0; i < stream.Length; i++)
            ////    sb.AppendFormat("{0:x2}", stream[i]);
            ////string cvt = sb.ToString();


            ////System.Diagnostics.Process.Start("https://foodvalueshop.enjoymydeals.com/home?CVT=" + cvt);

            return(View(model));
        }

        /**/

        public string CancelDebtorsCustomers()
        {
            //ViewBag.CustomersCount = CustomersManager.GetDebtorsCount().ToString();
            //ViewBag.SitesName = SitesManager.GetSites().GroupBy(x => x.Name).Select(x => x.Key);

            //return DateTime.Now.ToLongDateString();
            return(CustomersManager.CancelDebtorsCustomers().ToString());
        }
Example #15
0
 private static void GetAllCustomerList(CustomersManager customersManager)
 {
     Console.WriteLine("Müşterilerin Listesi: \nId\tKullanıcı Id\tCustomer Name");
     foreach (var customer in customersManager.GetAll().Data)
     {
         Console.WriteLine($"{customer.CustomerId}\t{customer.UsersMId}\t{customer.CompanyName}");
     }
 }
Example #16
0
 // Use this for initialization
 void Start()
 {
     CustomersController = GameObject.Find("CustomersManager");
     _CM  = CustomersController.GetComponent <CustomersManager> ();
     _CMB = CustomersController.GetComponent <CustomersManagerB> ();
     IconUiSushi.SetActive(true);
     IconSushi.sprite = myIcon[0];
 }
Example #17
0
        public string CancelCustomer(string customerId)
        {
            int id = 0;

            Int32.TryParse(customerId, out id);
            CustomersManager.CancelCustomer(id);
            return(DateTime.Now.ToLongDateString());
        }
Example #18
0
        public string ChangePassword(string customerId, string newPassword)
        {
            int id = 0;

            Int32.TryParse(customerId, out id);
            CustomersManager.ChangePassword(id, newPassword);
            return(DateTime.Now.ToLongDateString());
        }
Example #19
0
        static void Main(string[] args)
        {
            carsManager      = new CarsManager();
            customersManager = new CustomersManager();
            rentalsManager   = new RentalsManager();

            MainMenu();
        }
Example #20
0
        public string ActivateCustomer(string customerId)
        {
            int id = 0;

            Int32.TryParse(customerId, out id);
            string nextBillDate = CustomersManager.ActivateCustomer(id);

            return(nextBillDate);
        }
Example #21
0
        private static void CustomerAllDetails()
        {
            CustomersManager customerManager = new CustomersManager(new EfCustomerDal());

            foreach (var customer in customerManager.GetAll().Data)
            {
                Console.WriteLine("Müşteri Adı: " + customer.CustomerName + " - " + "Şirket Adı: " + customer.CompanyName);
            }
        }
Example #22
0
        public ActionResult FullForm(FullFormVM model)
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            if (!ModelState.IsValid)
            {
                model.States = LocationsManager.GetStates();
                return(View(model));
            }

            int ncid    = GetNcId();
            int visitId = GetVisitId();

            CustomerDT customer = new CustomerDT();

            customer.SiteId    = model.SiteId;
            customer.NcId      = ncid;
            customer.Email     = model.Email;
            customer.FirstName = model.FirstName;
            customer.LastName  = model.LastName;
            customer.Address   = model.Address;
            customer.City      = model.City;
            customer.StateId   = model.StateId;
            customer.ZipCode   = model.ZipCode;

            CreditCardDT cc = new CreditCardDT();

            cc.CardNumber = model.CardNumber;
            cc.CVV        = model.CVV;
            cc.ExpDate    = CreditCardHelper.GetExpDate(model.ExpMonth, model.ExpYear);
            CCType cardType = CCType.VISA;

            Enum.TryParse(model.CardType.ToString(), out cardType);
            cc.Type = cardType;

            var referrer = ReferrersManagers.GetReferrer(model.Referrer);

            try
            {
                customer = CustomersManager.NewCustomer(((SiteDT)ViewBag.Site), customer, cc, visitId, referrer.Id, false);
            }
            catch (Exception ex)
            {
                SendExceptionEmail(ex.ToString());
                CastleClub.BusinessLogic.Utils.EventViewer.Writte("CastleClub", "CastleClubFrontend", ex.Message + "\n" + ex.ToString(), System.Diagnostics.EventLogEntryType.Error);
            }

            if (customer != null)
            {
                ViewBag.Customer = customer;
            }
            else
            {
                return(View("Error"));
            }

            return(View("Welcome"));
        }
Example #23
0
        public string UpdateBalance(string customerId)
        {
            int cId = 0;

            Int32.TryParse(customerId, out cId);
            decimal balance = CustomersManager.GetCustomerBalance(cId);

            return(String.Format("{0:N2}", balance));
        }
Example #24
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance      = this;
         currentPoints = startPoints;
         Manager       = GetComponent <CustomersManager>();
     }
 }
Example #25
0
        public App()
        {
            InitializeComponent();

            C1.Xamarin.Forms.Core.LicenseManager.Key = License.Key;

            CustomersManager = new CustomersManager(new RestService());

            MainPage = new MainPage();
        }
 private void Awake()
 {
     if (CustomersManager.Instance == null)
     {
         CustomersManager.Instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
Example #27
0
        private static void CustomerTest()
        {
            CustomersManager customerManager = new CustomersManager(new EfCustomerDal());

            var listCustomers = customerManager.GetAll();

            foreach (var customer in listCustomers.Data)
            {
                Console.WriteLine(customer.CompanyName);
            }
        }
Example #28
0
        public ActionResult AddCustomerNote(string customerId, string text)
        {
            int cId = 0;

            Int32.TryParse(customerId, out cId);
            UserDT user = GetLoggedUser();
            NoteDT note = CustomersManager.AddCustomerNote(cId, user.Id, text);

            ViewBag.Note = note;
            return(View("NoteRow"));
        }
        public void GetCustomer_NotExisting()
        {
            repository
            .Setup(a => a.GetCustomer(-1))
            .Returns((Customer)null);

            var customersManager = new CustomersManager(repository.Object);

            var result = customersManager.GetCustomer(-1);

            Assert.Null(result);
        }
        public void GetCustomers_NoData()
        {
            repository
            .Setup(a => a.GetCustomers())
            .Returns(new List <Customer>());

            var customersManager = new CustomersManager(repository.Object);

            var result = customersManager.GetCustomers();

            Assert.Empty(result);
        }
Example #31
0
    private void loadDropCustomersFilter()
    {
        DropCustomersFilter.Items.Clear();
        DropCustomersFilter.Items.Add(new ListItem(base.GetLabel("CustomerFilter", "--customer--"), "0"));

        DropChangeCustomer.Items.Clear();
        DropChangeCustomer.Items.Add(new ListItem(base.GetLabel("CustomerFilter", "--customer--"), "0"));

        DropCustomers.Items.Clear();

        var filter = new CustomersFilter();
        if (Roles.IsUserInRole(SUPPORT_USER_ROLE))
            filter.Vat = PgnUserCurrent.Current.Vat;
        else
        DropCustomers.Items.Add(new ListItem(base.GetLabel("CustomerFilter", "--customer--"), "0"));

        var list = new CustomersManager().GetByFilter(filter, "CompanyName");

        foreach (var item in list)
        {
            DropCustomersFilter.Items.Add(
                new ListItem(item.CompanyName, item.Id.ToString()));

            DropChangeCustomer.Items.Add(
                new ListItem(item.CompanyName, item.Id.ToString()));

            DropCustomers.Items.Add(
                new ListItem(item.CompanyName, item.Id.ToString()));
        }
    }