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)); }
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)); }
// 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."; } }
//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)); }
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); }
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); }
//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)); }
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)); }
// // GET: /Customers/ public ActionResult Index() { ViewBag.CustomersCount = CustomersManager.GetCustomersCount().ToString(); ViewBag.SitesName = SitesManager.GetSites().GroupBy(x => x.Name).Select(x => x.Key); return(View()); }
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)); }
private static void CustomerAdd() { CustomersManager customerManager = new CustomersManager(new EfCustomerDal()); customerManager.Add(new Customer { CompanyName = "SoganSoft1", CustomerName = "Yilmaz1" }); }
/**/ 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()); }
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}"); } }
// 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]; }
public string CancelCustomer(string customerId) { int id = 0; Int32.TryParse(customerId, out id); CustomersManager.CancelCustomer(id); return(DateTime.Now.ToLongDateString()); }
public string ChangePassword(string customerId, string newPassword) { int id = 0; Int32.TryParse(customerId, out id); CustomersManager.ChangePassword(id, newPassword); return(DateTime.Now.ToLongDateString()); }
static void Main(string[] args) { carsManager = new CarsManager(); customersManager = new CustomersManager(); rentalsManager = new RentalsManager(); MainMenu(); }
public string ActivateCustomer(string customerId) { int id = 0; Int32.TryParse(customerId, out id); string nextBillDate = CustomersManager.ActivateCustomer(id); return(nextBillDate); }
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); } }
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")); }
public string UpdateBalance(string customerId) { int cId = 0; Int32.TryParse(customerId, out cId); decimal balance = CustomersManager.GetCustomerBalance(cId); return(String.Format("{0:N2}", balance)); }
private void Awake() { if (Instance == null) { Instance = this; currentPoints = startPoints; Manager = GetComponent <CustomersManager>(); } }
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); } }
private static void CustomerTest() { CustomersManager customerManager = new CustomersManager(new EfCustomerDal()); var listCustomers = customerManager.GetAll(); foreach (var customer in listCustomers.Data) { Console.WriteLine(customer.CompanyName); } }
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); }
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())); } }