Beispiel #1
0
        //----< 3rd test for functionality to manage version numbering for all files >---------------------------------
        void test3()
        {
            Thread.Sleep(500);
            Action checkIn = () =>
            {
                Console.WriteLine("\n  Demonstrating Requirement #2b - Functionality to Manage Version Numbering");
                Console.WriteLine("\n  Close the check-in for \"Sockets.h.1\"");
                Console.WriteLine("-------------------------------------------");
                fileName1.Text = "Sockets.h";
                Close.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, Close));
                Console.WriteLine("\n  Check in \"Sockets.h\" for the Second Time");
                Console.WriteLine("-----------------------------------------------");
                author.Text    = "Datan";
                descp.Text     = "Provides four classes wrap the Winsock API";
                cat.Text       = "cate2 cate3";
                dependent.Text = "";
                nameSpace.Text = "Sockets";
                Checkin.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, Checkin));
                Refresh2.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, Refresh2));

                Thread.Sleep(500);
                Console.WriteLine("\n  Check in \"Sockets.h\" for the Third Time, note that \"Sockets.h.2\" is Open");
                Console.WriteLine("----------------------------------------------------------------------------------");
                Checkin.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, Checkin));
                Refresh2.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, Refresh2));
                Console.WriteLine("\n  \"Sockets.h.2\" with open check-in can be modified without altering its version number");
                Console.WriteLine("----------------------------------------------------------------------------------------------");
            };

            Dispatcher.Invoke(checkIn, new Object[] { });
        }
Beispiel #2
0
        //----< 2nd test for functionality to check-in >---------------------------------
        void test2()
        {
            Thread.Sleep(500);
            Action checkIn = () =>
            {
                Console.WriteLine("\n  Demonstrating Requirement #2a - Functionality to check-in");
                Console.WriteLine("\n  Check in \"Sockets.h\" for the First Time");
                Console.WriteLine("----------------------------------------------");
                fileName1.Text = "Sockets.h";
                author.Text    = "Datan";
                descp.Text     = "Four classes that wrap the Winsock API";
                cat.Text       = "cate1 cate2";
                dependent.Text = "";
                nameSpace.Text = "Sockets";
                Checkin.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, Checkin));

                Thread.Sleep(500);
                Console.WriteLine("\n  Check in \"Sockets.cpp\" for the First Time");
                Console.WriteLine("----------------------------------------------");
                fileName1.Text = "Sockets.cpp";
                author.Text    = "Datan";
                descp.Text     = "Server's client handler class";
                cat.Text       = "cate1 cate2";

                FileList1.SelectedItems.Add(FileList1.Items[5]);
                nameSpace.Text = "Sockets";
                Checkin.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, Checkin));
                Refresh2.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, Refresh2));
                Console.WriteLine("\n  Meet the requirement for transfering source code text files from a local Client to Remote Code Repository.");
                Console.WriteLine("---------------------------------------------------------------------------------------------------------------");
            };

            Dispatcher.Invoke(checkIn, new Object[] { });
        }
Beispiel #3
0
        public string CreateAllCheckinsReport(List <Checkin> checkins, string directory, string fileName)
        {
            IList <Checkin> checkinsSort     = checkins.OrderBy(item => item.Beer.Brewery.Name).ThenBy(item => item.Beer.Name).ToList();
            Workbook        workbook         = new Workbook();
            Assembly        assembly         = Assembly.GetExecutingAssembly();
            string          templateFileName = $@"{assembly.GetName().Name}.Resources.AllCheckinsTemplate.xlsx";
            string          outputPath       = Path.Combine(directory, $"{fileName}{Path.GetExtension(templateFileName)}");

            using (Stream stream = assembly.GetManifestResourceStream(templateFileName))
                workbook.LoadFromStream(stream);

            Worksheet sheet = workbook.Worksheets[0];

            for (int i = 0; i < checkinsSort.Count; i++)
            {
                Checkin currentCheckin = checkinsSort[i];
                int     indexRow       = i + 2;

                sheet[indexRow, 1].Text = (i + 1).ToString();
                if (currentCheckin.Beer.Brewery.Venue != null)
                {
                    sheet[indexRow, 2].Text = currentCheckin.Beer.Brewery.Venue.Country;
                }

                sheet[indexRow, 3].Text = currentCheckin.Beer.Brewery.Name;
                sheet[indexRow, 4].Text = currentCheckin.Beer.Name;

                sheet[indexRow, 5].Text = currentCheckin.RatingScore.ToString();
                sheet[indexRow, 6].Text = currentCheckin.CreatedDate.ToString();
            }
            sheet.AutoFitColumn(3);
            sheet.AutoFitColumn(4);
            workbook.SaveToFile(outputPath);
            return(outputPath);
        }
Beispiel #4
0
 public override string ToString()
 {
     return("Quarto " + NumeroQuarto
            + ", check-in: " + Checkin.ToString("dd/MM/yyyy")
            + ", check-out: " + Checkout.ToString("dd/MM/yyyy")
            + ", " + Duration() + " noites");
 }
Beispiel #5
0
        private void gmap_OnMarkerClick(GMapMarker item, MouseEventArgs e)
        {
            double?lng = item.Position.Lng;
            double?lat = item.Position.Lat;

            // Do a google search on the place
            webBrowserGooglecheckin.Navigate(string.Format("https://www.google.co.il/search?q={0}", item.ToolTipText.Replace(" ", "+")));

            // Details about the checkin
            Predicate <Checkin> checkinFinder = (Checkin c) => { return((c.Place.Location != null) && (c.Place.Location.Latitude == lat) && (c.Place.Location.Longitude == lng)); };
            Checkin             currCheckin   = m_LoggedInUser.Checkins.Find(checkinFinder) != null?m_LoggedInUser.Checkins.Find(checkinFinder) : ((User)listBoxFriends.SelectedItem).Checkins.Find(checkinFinder);


            String names = "";

            foreach (User friend in m_LoggedInUser.Friends)
            {
                if (friend.Checkins.Find(checkinFinder) != null)
                {
                    names += (friend.Name + " ");
                }
            }

            richTextBoxCheckinDetails.Text = "Place: " + currCheckin.Place.Name + "\n" +
                                             "Time Visited: " + currCheckin.UpdateTime.ToString() + "\n" +
                                             "Friends of " + m_LoggedInUser.Name + " who were there also: " + names + "\n";
        }
        public async Task <IActionResult> CheckIn(long venueId, CheckinModel model)
        {
            var venue = await _dbContext.Venues.SingleOrDefaultAsync(x => x.Id == venueId);

            ViewBag.VenueName = venue.DisplayName;

            if (string.IsNullOrWhiteSpace(model.Name) && string.IsNullOrWhiteSpace(model.Email) && string.IsNullOrWhiteSpace(model.PhoneNumber))
            {
                ModelState.AddModelError(nameof(model.Name), "At least one detail must be provided");
            }

            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var checkin = new Checkin
            {
                CheckinAtUtc        = DateTime.UtcNow,
                VenueId             = venueId,
                IpAddress           = Request.HttpContext.Connection.RemoteIpAddress.ToString(),
                UserAgent           = Request.Headers["user-agent"],
                SuppliedEmail       = model.Email,
                SuppliedName        = model.Name,
                SuppliedPhoneNumber = model.PhoneNumber
            };

            _dbContext.Checkins.Add(checkin);

            await _dbContext.SaveChangesAsync();

            return(RedirectToAction("Thanks", new{ venueId, checkinId = checkin.Id }));
        }
Beispiel #7
0
 public ActionResult Create(Checkin checkin)
 {
     if (ModelState.IsValid)
     {
         Room ro = new Room();
         ro = (from r in db.Rooms where r.RoomType.Equals(checkin.RoomType) select r).FirstOrDefault();
         if (ro.NoRooms < checkin.Quantity)
         {
             ViewBag.Message = string.Format("Only Available Rooms:{0} {1}", ro.NoRooms, ro.RoomType);
             return(View(""));
         }
         else
         {
             db.Rooms.Attach(ro);
             ro.NoRooms = ro.NoRooms - checkin.Quantity;
             db.SaveChanges();
             checkin.TotalCost = checkin.Quantity * checkin.NoDays * ro.Price;
             checkin.Status    = true;
             db.Checkins.Add(checkin);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
     }
     return(View());
 }
        public string GetTreeViewCheckinDisplayName(Checkin checkin, int number)
        {
            string prefix   = $"#{number} {checkin.CreatedDate.ToString("yyyy-MMM-dd")} ";
            string fullName = $"{prefix}{StringHelper.GetShortName(checkin.Beer.Name)}";

            return(StringHelper.GeBreakForLongName(fullName, settingService.GetTreeItemNameMaxLength(), prefix.Length * 2 - 2));
        }
Beispiel #9
0
 private void listBoxCheckins_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listBoxCheckins.SelectedItems.Count == 1)
     {
         Checkin selectedCheckin = listBoxCheckins.SelectedItem as Checkin;
     }
 }
        public OrderDetailPage(Order order, Checkin checkin = null)
        {
            InitializeComponent();

            _order = order;
            if (_order.Checkin == null)
            {
                _order.Checkin = checkin;
            }

            this.BindingContext = _order;

            if (!string.IsNullOrEmpty(_order.ReasonDenied))
            {
                stkCanceledReason.IsVisible = true;
            }

            var printer = new ToolbarItem(AppResource.lblPrint, "", () =>
            {
                PrintNow();
            }, 0, 0);

            printer.Priority = 1;
            ToolbarItems.Add(printer);
        }
Beispiel #11
0
        public static void InsertCheckin(Checkin checkin)
        {
            string sqlStr = "INSERT INTO Checkins(year, month, day, time, business_id) " +
                            "VALUES ('" + checkin.Year + "', '" + checkin.Month + "', '" + checkin.Day + "', '" + checkin.Time + "', '" + checkin.BusinessID + "');";

            YelpDatabaseQueries.ExecuteNonQuery(sqlStr);
        }
Beispiel #12
0
        private void buttonSumbit_Click(object sender, EventArgs e)
        {
            CheckInBuilder builder       = new CheckInBuilder();
            RadioButton    selectedRadio = panelRadios.Controls.OfType <RadioButton>()
                                           .FirstOrDefault(r => r.Checked);

            List <string> selectedFriendsNames = panelCheckBox.Controls.OfType <CheckBox>()
                                                 .Where(r => r.Checked).Select(r => r.Text).ToList <string>();
            Checkin checkIn = builder
                              .PlaceId(comboBoxLocations.SelectedItem != null ? comboBoxLocations.SelectedItem.ToString() : null)
                              .Message(textBoxMessage.Text)
                              .Link(textBoxLink.Text)
                              .PicutreUrl(selectedRadio != null ? (selectedRadio.Tag as PictureBox).ImageLocation : null)
                              .TaggedFriendsNames(selectedFriendsNames)
                              .Build();

            if (checkIn == null)
            {
                MessageBox.Show("You must select a place");
            }
            else
            {
                MessageBox.Show("Checked in Succesfully");
            }
        }
Beispiel #13
0
        private void AddCheckin(Checkin checkin, CheckinsContainer checkinsContainer)
        {
            Beer beer = checkinsContainer.GetBeer(checkin.Beer.Id);

            if (beer == null)
            {
                beer = checkin.Beer;
                Brewery brewery = checkinsContainer.GetBrewery(beer.Brewery.Id);
                if (brewery == null)
                {
                    brewery = beer.Brewery;
                    Venue venue = brewery.Venue;
                    if (IsUpdateVenue(ref venue, checkinsContainer))
                    {
                        brewery.Venue = venue;
                    }

                    checkinsContainer.AddBrewery(brewery);
                }
                else
                {
                    beer.Brewery = brewery;
                }
                checkinsContainer.AddBeer(beer);
            }
            else
            {
                checkin.Beer = beer;
            }

            FillCheckinVenue(checkin, checkinsContainer);
            checkinsContainer.AddCheckin(checkin);
        }
Beispiel #14
0
 public void inserir(Checkout checkout)
 {
     if (this.Validar(checkout))
     {
         try
         {
             using (TransactionScope scope = new TransactionScope())
             {
                 checkoutDal.Inserir(checkout);
                 Checkin checkin = checkinBLL.LerPorID(checkout.idCheckin);
                 checkinBLL.AtualizarPendenciaCheckout(checkin.id);
                 quartoBLL.Desocupar(checkin.quartoId);
                 scope.Complete();
             }
         }
         catch (Exception ex)
         {
             throw new Exception(ex.Message);
         }
     }
     if (erros.Count > 0)
     {
         StringBuilder sb = new StringBuilder();
         for (int i = 0; i < erros.Count(); i++)
         {
             sb.Append(erros[i]);
         }
         throw new Exception(sb.ToString());
     }
 }
Beispiel #15
0
 private void TratarIntegridadeReferencial(Checkin checkin)
 {
     if (checkin.quartoId <= 0)
     {
         erros.Add("QUarto deve ser informado.");
     }
     else
     {
         Quarto quartoASerOcupado = quartoBll.LerPorID(checkin.quartoId);
         if (quartoASerOcupado == null)
         {
             erros.Add("QUarto deve ser informado.");
         }
         else if (quartoASerOcupado.estaOcupado && !(checkin.idReserva > 0))
         {
             erros.Add("O quarto já esta em uso.");
         }
     }
     if (checkin.clienteId <= 0)
     {
         erros.Add("Cliente deve ser informado.");
     }
     else
     {
         Cliente clienteAOcuparOQuarto = clienteBll.LerPorID(checkin.clienteId);
         if (clienteAOcuparOQuarto == null)
         {
             erros.Add("Cliente deve ser informado.");
         }
     }
 }
Beispiel #16
0
        public R.ResultVm <bool> AddCheckin(string serverName, Checkin checkin)
        {
            var result = new R.ResultVm <bool>().FromEmptyFailure();

            Demand <string> .That(serverName, "serverName").HasNonEmptyValue().HasMaxChars(255).Result(result);

            Demand <double> .That(checkin.RamUtilization, "checkin.RamUtilization").IsGreaterThan(0.0D).Result(result);

            Demand <double> .That(checkin.CpuUtilization, "checkin.CpuUtilization").IsGreaterThan(0.0D).IsLessThanOrEqualTo(1.0D).Result(result);

            //Demand<DateTime>.That(checkin.SampleTime, "checkin.SampleTime").IsAfter(DateTime.Now.AddMinutes(-10.0D)).IsBefore(DateTime.Now.AddMinutes(10.00D)).Result(result);

            if (result.Errors.Count == 0)
            {
                try
                {
                    result = new ResultVm <bool>().FromSuccessObject(_repo.AddCheckin(serverName, checkin));
                }
                catch (Exception ex)
                {
                    result = new ResultVm <bool>().FromException(ex);
                }
            }
            else
            {
                result.Data = false;
            }

            return(result);
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (Country.Length != 0)
            {
                hash ^= Country.GetHashCode();
            }
            if (City.Length != 0)
            {
                hash ^= City.GetHashCode();
            }
            if (checkin_ != null)
            {
                hash ^= Checkin.GetHashCode();
            }
            if (checkout_ != null)
            {
                hash ^= Checkout.GetHashCode();
            }
            if (Rooms != 0)
            {
                hash ^= Rooms.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Beispiel #18
0
        public static bool Inserir(int evento, string usuario)
        {
            try
            {
                dbEventosEntities db = new dbEventosEntities();
                Checkin           i  = new Checkin();

                /*Evento e = db.Eventoes.Find(evento);
                 * Usuario u = db.Usuarios.Find(usuario);
                 * i.Evento = e;
                 * i.Usuario = u;
                 * i.notificado = true;*/

                i.Id            = getLasId();
                i.data_criacao  = DateTime.Now;
                i.EventoId      = evento;
                i.Usuario_email = usuario;

                db.Checkin.Add(i);
                db.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public async Task <Checkin> LoadInfoCheckin()
        {
            CompanyService companyService = new CompanyService();
            Checkin        checkin        = await companyService.IsCheckedInWithCheckin(_company.Id, Helpers.Settings.DisplayUserToken);

            return(checkin);
        }
        public MainPage()
        {
            // InitializeComponent();
            Checkin checkin = new Checkin();

            // BindingContext = new AttendanceTrackerViewModel();
        }
Beispiel #21
0
        public async Task <List <Checkin> > getCheckin(Checkin checkin)
        {
            var where = new StringBuilder();
            var sql = new StringBuilder();

            if (checkin.teacherAccount != "" && checkin.teacherAccount != null)
            {
                where.Append($" and [teacherAccount] = '{checkin.teacherAccount}'");
            }
            else if (checkin.prove != 0)
            {
                where.Append($" and [prove] = '{checkin.prove}'");
            }
            sql.Append($@"select * from checkin where 1=1 {where}");

            using (var db = new SqlConnection(LinkSQL))
            {
                try
                {
                    using (var multi = await db.QueryMultipleAsync(sql.ToString()))
                    {
                        var datalist = multi.Read <Checkin>().ToList();
                        return(datalist);
                    }
                }
                catch (Exception e)
                {
                    throw e;
                }
            };
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,CheckinTitle,EnteredBy,EnteredOn")] Checkin checkin)
        {
            if (id != checkin.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(checkin);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CheckinExists(checkin.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(checkin));
        }
        public CheckinDetailPage(Checkin checkin)
        {
            InitializeComponent();

            if (Device.RuntimePlatform == "iOS")
            {
                btnAddProduct.WidthRequest = 110;
                btnCheckout.WidthRequest   = 100;
            }

            var printer = new ToolbarItem(AppResource.lblPrint, "", () =>
            {
                PrintNow();
            }, 0, 0);

            printer.Priority = 1;
            ToolbarItems.Add(printer);

            _checkin = checkin;

            this.BindingContext = _checkin;

            _hasActive = false;

            listView.ItemSelected  += ListView_ItemSelected;
            listView.RefreshCommand = new Command(() => LoadCheckin());
        }
Beispiel #24
0
        public async Task <ActionResult <Checkin> > PostCheckin(Checkin checkin)
        {
            _context.Checkin.Add(checkin);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCheckin", new { id = checkin.Id }, checkin));
        }
Beispiel #25
0
        public Photo(Dictionary<string, object> jsonDictionary)
            : base(jsonDictionary)
        {
            Sizes = new List<PhotoSize>();
            jsonDictionary = Helpers.ExtractDictionary(jsonDictionary, "response:photo");
            Id = jsonDictionary["id"].ToString();
            CreatedAt = jsonDictionary["createdAt"].ToString();
            Url = jsonDictionary["url"].ToString();

            if (jsonDictionary.ContainsKey("sizes"))
                foreach (var sizeObj in (object[]) Helpers.ExtractDictionary(jsonDictionary, "sizes")["items"])
                    Sizes.Add(new PhotoSize((Dictionary<string, object>) sizeObj));

            if (jsonDictionary.ContainsKey("source"))
            {
                Source = new Source((Dictionary<string,object>) jsonDictionary["source"]);
            }

            if (jsonDictionary.ContainsKey("user"))
                User = new User((Dictionary<string, object>) jsonDictionary["user"]);

            if (jsonDictionary.ContainsKey("venue"))
                Venue = new Venue((Dictionary<string, object>) jsonDictionary["venue"]);

            if (jsonDictionary.ContainsKey("tip"))
            {
                Tip = new Tip((Dictionary<string, object>)jsonDictionary["tip"]);
            }

            if (jsonDictionary.ContainsKey("checkin"))
                Checkin = new Checkin((Dictionary<string, object>) jsonDictionary["checkin"]);
        }
        public static List <Checkin> GetCheckins(string dataSource)
        {
            List <Checkin> checkins = new List <Checkin>();

            using (SqliteConnection conn = new SqliteConnection(dataSource))
            {
                conn.Open();

                SqliteCommand cmd = new SqliteCommand("SELECT users.Id as UserId, users.UserName as Username, adminUser.Id as AdminId, adminUser.UserName as AdminUsername, ckn.Timestamp as Timestamp FROM AspNetUsers users, Checkin ckn, AspNetUsers adminUser WHERE users.UserName = ckn.Username AND adminUser.UserName = ckn.CheckedinBy", conn);

                SqliteDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    var checkin = new Checkin
                    {
                        timestamp   = rdr["Timestamp"] == DBNull.Value ? "" : (string)rdr["Timestamp"],
                        participant = new User
                        {
                            Username = rdr["Username"] == DBNull.Value ? "" : (string)rdr["Username"],
                            Id       = rdr["UserId"] == DBNull.Value ? "" : (string)rdr["UserId"]
                        },
                        admin = new User
                        {
                            Username = rdr["AdminUsername"] == DBNull.Value ? "" : (string)rdr["AdminUsername"],
                            Id       = rdr["AdminId"] == DBNull.Value ? "" : (string)rdr["AdminId"]
                        }
                    };

                    checkins.Add(checkin);
                }
            }

            return(checkins);
        }
Beispiel #27
0
        public async Task <IActionResult> PutCheckin(int id, Checkin checkin)
        {
            if (id != checkin.Id)
            {
                return(BadRequest());
            }

            _context.Entry(checkin).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CheckinExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> Edit(int id, [Bind("CheckinId,Checkindt,FirstName,LastName,Temperature,Question1,Question2,Question3,Question4,Question5")] Checkin checkin)
        {
            if (id != checkin.CheckinId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(checkin);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CheckinExists(checkin.CheckinId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(checkin));
        }
        private static void FillCheckinsContainer(CheckinsContainer checkinsContainer, CheckinParser.CheckinParser checkinParser)
        {
            Checkin checkin = GetCheckin(checkinParser);

            checkin.VenuePurchase = GetPurchaseVenue(checkinsContainer, checkinParser);
            checkin.Venue         = GetCheckinVenue(checkinsContainer, checkinParser);
            checkinsContainer.AddCheckin(checkin);

            Beer beer = checkinsContainer.GetBeer(checkinParser.GetBeerID());

            if (beer == null)
            {
                beer = GetBeer(checkinParser);
                checkinsContainer.AddBeer(beer);

                Brewery brewery = checkinsContainer.GetBrewery(checkinParser.GetBreweryID());
                if (brewery == null)
                {
                    brewery       = GetBrewery(checkinParser);
                    brewery.Venue = GetBreweryVenue(checkinsContainer, checkinParser);
                    checkinsContainer.AddBrewery(brewery);
                }
                beer.Brewery = brewery;
            }
            checkin.Beer = beer;
        }
Beispiel #30
0
        public ListLocationBillsPage(Checkin checkin = null, Company company = null, bool back = false)
        {
            InitializeComponent();

            if (Device.RuntimePlatform == "Android")
            {
                frmXaml.CornerRadius = 30;
            }

            NavigationPage.SetHasNavigationBar(this, false);

            _checkin = checkin;
            _company = checkin.Company;
            _sub     = checkin.ActiveLocation;

            ColorPage();
            lblTitle.Text = checkin.Company.Title;

            goBackOneMore = back;

            listView.ItemSelected += ListView_ItemSelected;

            //20190409
            if (_company.CompanyType == CompanyType.Hotel)
            {
                //btnPayNow.IsVisible = true;
                //btnPayNowCard.IsVisible = true;//20190412
            }
        }
Beispiel #31
0
        public ActionResult Upload()
        {
            if (ModelState.IsValid)
            {
                var     newCheckInData         = Request.Form.ToList();
                var     userId                 = Convert.ToInt32(HttpContext.User.FindFirstValue("ID"));
                var     beerID                 = Convert.ToInt32(newCheckInData[0].Value);
                string  newCheckInText         = Convert.ToString(newCheckInData[1].Value);
                string  newCheckInRatingString = Convert.ToString(newCheckInData[2].Value);
                float   newCheckInRating       = float.Parse(newCheckInRatingString.Trim(), CultureInfo.InvariantCulture.NumberFormat);
                Checkin checkin                = new Checkin(userId, beerID, newCheckInText, newCheckInRating);
                string  fileName               = null;

                if (Request.Form.Files.Count > 0)
                {
                    IFormFile file = Request.Form.Files[0];
                    if (file.Length > 0)
                    {
                        fileName = Path.GetFileName(file.FileName);

                        using Stream imageStream = file.OpenReadStream();
                        _storageService.Save(fileName, imageStream);
                        checkin.Img = fileName;
                    }
                }

                _checkinService.InsertCheckin(userId, beerID, newCheckInText, newCheckInRating, fileName);
                _beerService.UpdateRating(newCheckInRating, beerID);
                _loggerService.LogActivity(userId, $"Check in with beer ID:{beerID}", DateTime.Now);
                return(RedirectToAction("Index"));
            }

            return(View());
        }
Beispiel #32
0
 public CheckinNotification(Checkin c, Checkin.NotificationType type)
 {
     CheckInId = c.CheckInId;
     SpaceId = c.SpaceId;
     UserId = c.UserId;
     StartTime = c.StartTime;
     EndTime = c.EndTime;
     LastModified = (type == Checkin.NotificationType.Checkout && c.EndTime.HasValue) ? c.EndTime.Value : c.StartTime;
     RegisteredBy = c.RegisteredBy;
     RegisteredFrom = c.RegisteredFrom;
     NotificationType = (int)((type == Checkin.NotificationType.Checkout && c.EndTime.HasValue) ? Checkin.NotificationType.Checkout : Checkin.NotificationType.Checkin);
 }
		public object Deserialize(JsonValue json, JsonMapper mapper)
		{
			Checkin checkin = null;
			if ( json != null && !json.IsNull )
			{
				checkin = new Checkin();
				checkin.ID          = json.ContainsName("id"          ) ? json.GetValue<string>("id"     ) : String.Empty;
				checkin.Message     = json.ContainsName("message"     ) ? json.GetValue<string>("message") : String.Empty;
				checkin.CreatedTime = json.ContainsName("created_time") ? JsonUtils.ToDateTime(json.GetValue<string>("created_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue;

				checkin.From        = mapper.Deserialize<Reference>(json.GetValue("category"   ));
				checkin.Place       = mapper.Deserialize<Page     >(json.GetValue("place"      ));
				checkin.Application = mapper.Deserialize<Reference>(json.GetValue("application"));

				checkin.Likes       = mapper.Deserialize<List<Reference>>(json.GetValue("likes"   ));
				checkin.Comments    = mapper.Deserialize<List<Comment  >>(json.GetValue("comments"));
				checkin.Tags        = mapper.Deserialize<List<Reference>>(json.GetValue("tags"    ));
			}
			return checkin;
		}
Beispiel #34
0
        /// <summary>
        /// Returns a history of checkins for the authenticated user.
        /// API Uri: https://api.foursquare.com/v2/users/USER_ID/checkins
        /// Documentation: https://developer.foursquare.com/docs/users/checkins.html
        /// </summary>
        /// <returns></returns>
        public List<Checkin> GetCheckins(TimeSpan DateRange, int Offset)
        {
            try {
                List<Checkin> userCheckins = new List<Checkin>();
                // Get the checkins
                DateTime startTime = DateTime.Now;
                DateTime endTime = DateTime.Now.AddDays(-DateRange.Days);

                String foursquareCheckinUri = String.Format("https://api.foursquare.com/v2/users/self/checkins?oauth_token={0}{1}&afterTimestamp={2}&beforeTimestamp{3}&offset={4}",
                    AccessToken,
                    EndpointHelper.GetVerifiedDateParamForApi(),
                    EndpointHelper.ToUnixTime(endTime),
                    EndpointHelper.ToUnixTime(startTime),
                    Offset);
                var responseCheckins = WebRequestHelper.WebRequest(WebRequestHelper.Method.GET, foursquareCheckinUri.ToString(), string.Empty);
                var jsonCheckins = JObject.Parse(responseCheckins);

                if (int.Parse(jsonCheckins["meta"]["code"].ToString()) == 200) {
                    JArray checkinList = (JArray)jsonCheckins["response"]["checkins"]["items"];
                    foreach (var item in checkinList) {
                        Checkin myCheckin = new Checkin();
                        myCheckin.CheckinId = item["id"] != null ? item["id"].ToString().Replace("\"", "") : "";
                        myCheckin.CreatedAt = item["createdAt"] != null ? EndpointHelper.FromUnixTime(long.Parse(item["createdAt"].ToString())) : DateTime.MinValue;
                        myCheckin.Type = item["type"] != null ? item["type"].ToString().Replace("\"", "") : "";
                        myCheckin.Shout = item["shout"] != null ? item["shout"].ToString().Replace("\"", "") : "";
                        myCheckin.TimeZone = item["timeZoneOffset"] != null ? item["timeZoneOffset"].ToString().Replace("\"", "") : "";
                        myCheckin.CheckinVenue = item["venue"] != null ? Venue.Parse(item["venue"].ToString()) : new Venue();
                        myCheckin.Photos = item["photos"] != null ? CheckinPhotos.Parse(item["photos"].ToString()) : new CheckinPhotos();
                        myCheckin.Comments = item["comments"] != null ? CheckinComments.Parse(item["comments"].ToString()) : new CheckinComments();
                        myCheckin.CheckinSource = item["source"] != null ? Source.Parse(item["source"].ToString()) : new Source();

                        userCheckins.Add(myCheckin);
                    }

                    if (userCheckins != null && userCheckins.Count > 0)
                        return userCheckins;
                }

                return null;
            } catch (Exception ex) {
                string error = ex.Message;
                return null;
            }
        }
Beispiel #35
0
        /// <summary>
        /// Returns badges for a given user.
        /// API Uri: https://api.foursquare.com/v2/users/USER_ID/badges
        /// Documentation: https://developer.foursquare.com/docs/users/badges.html
        /// </summary>
        /// <returns></returns>
        public List<UnlockedBadge> GetBadges()
        {
            try {
                List<UnlockedBadge> UnlockedBadges = new List<UnlockedBadge>();
                // Get the badges
                String foursquareBadgeUri = String.Format("https://api.foursquare.com/v2/users/self/badges?oauth_token={0}{1}",
                    AccessToken,
                    EndpointHelper.GetVerifiedDateParamForApi());
                var responseBadges = WebRequestHelper.WebRequest(WebRequestHelper.Method.GET, foursquareBadgeUri.ToString(), string.Empty);
                var jsonBadges = JObject.Parse(responseBadges);

                if (int.Parse(jsonBadges["meta"]["code"].ToString()) == 200) {
                    List<UserBadgeCategory> UnlockedBadgeIds = new List<UserBadgeCategory>();
                    JArray badgeList = (JArray)jsonBadges["response"]["sets"]["groups"];
                    foreach (var fbi in badgeList) {
                        if (fbi["type"].ToString().Replace("\"", "").ToLower() != "all") {
                            foreach (var fbid in fbi["items"]) {
                                UserBadgeCategory tempBadgeCategory = new UserBadgeCategory();
                                switch (fbi["type"].ToString().Replace("\"", "").ToLower()) {
                                    case "foursquare":
                                        tempBadgeCategory.UserBadgeId = fbid.ToString().Replace("\"", "");
                                        tempBadgeCategory.Type = BadgeType.foursquare;
                                        UnlockedBadgeIds.Add(tempBadgeCategory);
                                        break;
                                    case "expertise":
                                        tempBadgeCategory.UserBadgeId = fbid.ToString().Replace("\"", "");
                                        tempBadgeCategory.Type = BadgeType.expertise;
                                        UnlockedBadgeIds.Add(tempBadgeCategory);
                                        break;
                                    case "partner":
                                        tempBadgeCategory.UserBadgeId = fbid.ToString().Replace("\"", "");
                                        tempBadgeCategory.Type = BadgeType.partner;
                                        UnlockedBadgeIds.Add(tempBadgeCategory);
                                        break;
                                    default:
                                        break;
                                }
                            }
                        }
                    }

                    if (UnlockedBadgeIds.Count > 0) {
                        foreach (UserBadgeCategory ubc in UnlockedBadgeIds) {
                            JObject b = JObject.Parse(jsonBadges["response"]["badges"][ubc.UserBadgeId].ToString());
                            UnlockedBadge ub = new UnlockedBadge();
                            if (b["id"] != null && (b["id"].ToString().Replace("\"", "") != b["badgeId"].ToString().Replace("\"", ""))) {
                                ub.BadgeId = b["id"].ToString().Replace("\"", "");

                                Badge badge = new Badge();
                                badge.Name = b["name"] != null ? b["name"].ToString().Replace("\"", "") : "";
                                badge.Description = b["description"] != null
                                    ? b["description"].ToString().Replace("\"", "")
                                    : b["hint"].ToString() != "" ? String.Format("Hint: {0}", b["hint"].ToString().Replace("\"", ""))
                                    : "No hint";
                                badge.FoursquareBadgeId = b["badgeId"] != null ? b["badgeId"].ToString().Replace("\"", "") : "";
                                if (b["image"]["prefix"] != null && b["image"]["name"] != null) {
                                    badge.ImageUri = b["image"]["prefix"].ToString().Replace("\"", "") + "{0}" + b["image"]["name"].ToString().Replace("\"", "");
                                } else
                                    badge.ImageUri = "";
                                badge.Type = ubc.Type;

                                // Create Checkins
                                if (b["unlocks"] != null) {
                                    foreach (var u in b["unlocks"]) {
                                        if (u["checkins"] != null) {
                                            foreach (var c in u["checkins"]) {
                                                Checkin checkin = new Checkin();
                                                checkin.CheckinId = c["id"] != null ? c["id"].ToString().Replace("\"", "") : "";
                                                checkin.CreatedAt = EndpointHelper.FromUnixTime(long.Parse(c["createdAt"].ToString().Replace("\"", "")));
                                                checkin.IsMayor = c["isMayor"] != null ? bool.Parse(c["isMayor"].ToString().Replace("\"", "")) : false;
                                                String checkinType = c["type"] != null ? c["type"].ToString().Replace("\"", "") : "";
                                                checkin.Type = checkinType;

                                                if (checkinType != "venueless") {
                                                    Venue v = new Venue();
                                                    v.VenueId = c["venue"]["id"] != null ? c["venue"]["id"].ToString().Replace("\"", "") : "";
                                                    v.Name = c["venue"]["name"] != null ? c["venue"]["name"].ToString().Replace("\"", "") : "";
                                                    v.ItemId = c["venue"]["itemId"] != null ? c["venue"]["itemId"].ToString().Replace("\"", "") : "";
                                                    v.ContactInfo = c["venue"]["contact"] != null ? Contact.Parse(c["venue"]["contact"].ToString()) : null;
                                                    v.LocationInfo = c["venue"]["location"] != null ? Location.Parse(c["venue"]["location"].ToString()) : null;
                                                    if (c["venue"]["categories"] != null && c["venue"]["categories"].ToString().Replace("\"", "") != "") {
                                                        JArray categories = (JArray)c["venue"]["categories"];
                                                        if (categories.Count > 0) {
                                                            v.Categories = new List<VenueCategory>();
                                                            foreach (var vc in categories) {
                                                                v.Categories.Add(VenueCategory.Parse(vc.ToString()));
                                                            }
                                                        } else
                                                            v.Categories = null;
                                                    } else
                                                        v.Categories = null;
                                                    v.Statistics = c["venue"]["stats"] != null ? VenueStatistics.Parse(c["venue"]["stats"].ToString()) : null;
                                                    v.Verified = c["venue"]["verified"] != null ? bool.Parse(c["venue"]["verified"].ToString().Replace("\"", "")) : true;
                                                    v.VenueUri = c["venue"]["url"] != null ? c["venue"]["url"].ToString().Replace("\"", "") : "";

                                                    checkin.CheckinVenue = v;
                                                }

                                                ub.Checkin = checkin;
                                            }
                                        }
                                    }
                                }

                                ub.Badge = badge;
                                ub.Level = b["level"] != null ? int.Parse(b["level"].ToString()) : 0;
                                UnlockedBadges.Add(ub);
                            }
                            //else
                            //{
                            //    var errorId = b["badgeId"];
                            //    return null;
                            //}
                        }
                    }
                }

                if (UnlockedBadges != null && UnlockedBadges.Count > 0)
                    return UnlockedBadges;
                return null;
            } catch (Exception ex) {
                string error = ex.Message;
                return null;
            }
        }