Exemplo n.º 1
0
        private static void GetGuestInformation()
        {
            // Capture the information about each guest (assumption is at least one guest and unknown maximum)
            // Info to capture: First name, last name, message to the host
            string moreGuestsComing = "";

            do
            {
                GuestModel guest = new GuestModel();

                guest.FirstName = GetInfoFromConsole("What is your first name: ");
                guest.LastName = GetInfoFromConsole("What is your last name: ");
                guest.MessageToHost = GetInfoFromConsole("What message would you like to tell your host: ");
                moreGuestsComing = GetInfoFromConsole("Are more guests coming (yes/no): ");

                guests.Add(guest);

                Console.Clear();

            } while (moreGuestsComing.ToLower() == "yes");
        }
Exemplo n.º 2
0
        private static void AddChoixInDoc(GuestModel guest, List <CategoryModel> categories, DocX doc)
        {
            Paragraph paraVotes = doc.InsertParagraph();

            var votes = guest.GetVotes();

            for (int i = 0; i < 24; i++)
            {
                paraVotes.Append("\r\n\r\n" + categories[i].CategoryName + ":  ").Bold();

                string strToAppend = "";
                foreach (var categoryNominee in categories[i].CategoryNominees)
                {
                    if (votes[i].Contains(categoryNominee.Letter))
                    {
                        strToAppend += (string.IsNullOrEmpty(strToAppend) ? "" : ", ") + categoryNominee.Description;
                    }
                }
                paraVotes.Append(strToAppend);
            }
        }
Exemplo n.º 3
0
 public int RegisterGuest(GuestModel _guest)
 {
     try
     {
         DataContractJsonSerializer ser = new DataContractJsonSerializer(
             typeof(GuestModel));
         MemoryStream mem = new MemoryStream();
         ser.WriteObject(mem, _guest);
         string    data      = Encoding.UTF8.GetString(mem.ToArray(), 0, (int)mem.Length);
         WebClient webClient = new WebClient();
         webClient.Headers["Content-type"] = "application/json";
         webClient.Encoding = Encoding.UTF8;
         string response = webClient.UploadString(BASE_URL + "registerGuest", "POST", data);
         int    ID       = JsonConvert.DeserializeObject <int>(response);
         return(ID);
     }
     catch
     {
         return(-1);
     }
 }
Exemplo n.º 4
0
        public async Task <ActionResult> Index(LoginModel login)
        {
            try
            {
                GuestModel Guest = null;// = new User();
                using (var httpClient = new HttpClient())
                {
                    StringContent content = new StringContent(JsonConvert.SerializeObject(login), Encoding.UTF8, "application/json");


                    using (var response = await httpClient.PostAsync("https://informatik8.ei.hv.se/GuestAPI/api/Login", content))
                    {
                        string apiResponse = await response.Content.ReadAsStringAsync();

                        Guest = JsonConvert.DeserializeObject <GuestModel>(apiResponse);
                    }
                }

                if (Guest != null)
                {
                    await SetUserAuthenticated(Guest);

                    var str = JsonConvert.SerializeObject(Guest);
                    HttpContext.Session.SetString("GuestSession", str);

                    return(Redirect("~/Booking/Create/"));
                }
                else
                {
                    ViewData["failedlogin"] = "******";
                    return(View());
                }
            }
            catch (Exception ex)
            {
                logger.LogWarning("Couldn't login.");
                System.Diagnostics.Debug.WriteLine(ex.Message);
                return(View());
            }
        }
Exemplo n.º 5
0
        public HttpResponseMessage Put(HttpRequestMessage request, int id,
                                       [FromBody] GuestModel value)
        {
            try
            {
                var guest = service.Get(id);

                if (guest != null)
                {
                    var mapper = new MapperConfiguration(cfg => cfg.CreateMap <GuestModel, GuestDTO>()).CreateMapper();
                    var data   = mapper.Map <GuestModel, GuestDTO>(value);
                    service.Update(id, data);
                    return(request.CreateResponse(HttpStatusCode.OK));
                }

                return(request.CreateResponse(HttpStatusCode.NotFound));
            }
            catch (Exception exception)
            {
                return(request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     LoggedID = Convert.ToString(Session["ID"]);
     LevelID  = Convert.ToString(Session["Level"]);
     //disallow staff from purchasing ticket
     if (LevelID.Equals("Staff"))
     {
         ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Not Allowed to purchase tiicket, please sign-up.');", true);
         Response.Redirect("Login.aspx");
     }
     else if (LevelID.Equals("Guest")) //Guest logged in
     {
         Name    = Convert.ToString(Session["Name"]);
         Surname = Convert.ToString(Session["Surname"]);
         Email   = Convert.ToString(Session["Email"]);
         GuestServiceClient gsc = new GuestServiceClient();
         guest = gsc.findGuestbyID(LoggedID);
     }
     else if (LevelID.Equals("Host"))  //Host logged in
     {
         Name    = Convert.ToString(Session["Name"]);
         Surname = Convert.ToString(Session["Surname"]);
         Email   = Convert.ToString(Session["Email"]);
     }
     else  //new user
     {
         ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please Login or sign up first');", true);
         Response.Redirect("Login.aspx");
     }
     if (!IsPostBack)
     {
         txtU_name.Text        = Name;
         txtU_name.ReadOnly    = true;
         txtU_surname.Text     = Surname;
         txtU_surname.ReadOnly = true;
         txtU_Email.Text       = Email;
         txtU_Email.ReadOnly   = true;
     }
 }
Exemplo n.º 7
0
        private void UpdateData()
        {
            this.DoRequest(Task.Run(() =>
            {
                var letters = new List <string>();

                guests = userEventsController.Values.Where(x => x.EventId == eventDetail.Id)
                         .Join(usersController.Values,
                               x => x.UserId,
                               y => y.Id,
                               (x, y) => y)
                         .OrderBy(x => x.Name)
                         .Select(x =>
                {
                    var guestModel = new GuestModel()
                    {
                        Avatar = x.Avatar, Name = x.Name
                    };
                    var firstLetter = x.Name.FirstOrDefault().ToString();

                    if (guestModel.IsHeadLetter = letters.Any(y => y.Equals(firstLetter.ToUpper())))
                    {
                        guestModel.IsHeadLetter = false;
                    }
                    else
                    {
                        guestModel.IsHeadLetter = true;
                        letters.Add(firstLetter.ToUpper());
                    }

                    return(guestModel);
                })
                         .ToList();
            }), () =>
            {
                adapter.Guests = guests;
                recyclerView.ScheduleLayoutAnimation();
            });
        }
Exemplo n.º 8
0
        private static void AddStatistics(List <GuestModel> statistics, GuestModel choix, List <CategoryModel> categories, DocX doc)
        {
            Table statsTable = doc.AddTable(25, categories[0].CategoryNominees.Count + 1);

            foreach (Cell cell in statsTable.Rows[0].Cells)
            {
                cell.FillColor = Color.LightGray;
            }

            statsTable.Rows[0].Cells[0].Paragraphs[0].Append("CATEGORIES").Bold();

            var choixVotes = choix.GetVotes();

            foreach (var category in categories)
            {
                if (category.CategoryNb == 1)
                {
                    AddHeaders(statsTable.Rows[0], category);
                }
                string categoryName = category.CategoryName;

                statsTable.Rows[category.CategoryNb].Cells[0].Paragraphs[0].Append(categoryName);
                statsTable.Rows[category.CategoryNb].Cells[0].FillColor = Color.LightGray;

                foreach (var categoryNominee in category.CategoryNominees)
                {
                    int statisticIndex = GetIndexFromLetter(categoryNominee.Letter);

                    bool isChoice = choixVotes[category.CategoryNb - 1].Contains(categoryNominee.Letter);
                    if (statisticIndex != -1)
                    {
                        AddNbVotesInRow(statsTable.Rows, statistics[statisticIndex], category.CategoryNb, statisticIndex, isChoice);
                    }
                }
            }

            doc.InsertTable(statsTable);
        }
Exemplo n.º 9
0
        public GuestModel updateGuest(string id, GuestModel eventGuest)
        {
            using (EventrixDBDataContext db = new EventrixDBDataContext())
            {
                try
                {
                    var query = (from add in db.Guests where add.G_ID == Convert.ToInt32(id) select add);
                    if (query.Count() == 1)
                    {
                        Guest res = query.Single();
                        res.Name     = eventGuest.NAME;
                        res.Surname  = eventGuest.SURNAME;
                        res.Email    = eventGuest.EMAIL;
                        res.Password = eventGuest.PASS;
                        db.SubmitChanges();

                        eventGuest = new GuestModel()
                        {
                            ID      = res.G_ID,
                            NAME    = res.Name,
                            SURNAME = res.Surname,
                            EMAIL   = res.Email,
                            PASS    = res.Password,
                            TYPE    = res.Type
                        };
                        return(eventGuest);
                    }
                    else
                    {
                        return(null);
                    }
                }
                catch (Exception)
                {
                    return(null);
                }
            }
        }
Exemplo n.º 10
0
        public ViewResult ListAllResponses()
        {
            string            connectionString = DataAccess.GetConnectionString();
            List <GuestModel> guestList        = new List <GuestModel>();

            using (SqlConnection conn = new SqlConnection(connectionString))
            {
                conn.Open();
                string sql = "SELECT NickName, FancyMail, AnimalName FROM PartyPeople";

                SqlCommand    cmd    = new SqlCommand(sql, conn);
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    GuestModel guest = new GuestModel();
                    guest.NickName   = reader["NickName"].ToString();
                    guest.FancyMail  = reader["FancyMail"].ToString();
                    guest.AnimalName = reader["AnimalName"].ToString();

                    guestList.Add(guest);
                }
            }
            return(View(guestList));
        }
        public async void Test_Repository_Update(BookingModel booking, StayModel stay)
        {
            await _connection.OpenAsync();

            try
            {
                using (var ctx = new BookingContext(_options))
                {
                    await ctx.Database.EnsureCreatedAsync();

                    await ctx.Bookings.AddAsync(booking);

                    await ctx.Stays.AddAsync(stay);

                    await ctx.SaveChangesAsync();
                }

                using (var ctx = new BookingContext(_options))
                {
                    var bookingRentals = new List <BookingRentalModel>();
                    bookingRentals.Add(new BookingRentalModel {
                        RentalId = 1
                    });
                    booking.BookingRentals = bookingRentals;
                    var bookings = new Repository <BookingModel>(ctx);
                    var expected = await ctx.Bookings.FirstAsync();

                    expected.Status = "updated";
                    bookings.Update(expected);
                    await ctx.SaveChangesAsync();

                    var actual = await ctx.Bookings.FirstAsync();

                    Assert.Equal(expected, actual);
                }


                using (var ctx = new BookingContext(_options))
                {
                    var stays    = new Repository <StayModel>(ctx);
                    var expected = await ctx.Stays.FirstAsync();

                    expected.DateModified = DateTime.Now;
                    stays.Update(expected);
                    await ctx.SaveChangesAsync();

                    var actual = await ctx.Stays.FirstAsync();

                    Assert.Equal(expected, actual);
                }

                using (var ctx = new BookingContext(_options))
                {
                    List <GuestModel> _guests = new List <GuestModel>();
                    GuestModel        _guest  = new GuestModel
                    {
                        Age = "30"
                    };
                    _guests.Add(_guest);
                    var bookings = new BookingRepository(ctx);
                    var expected = await ctx.Bookings.FirstAsync();

                    expected.BookingRentals = null;
                    expected.Guests         = _guests;
                    bookings.Update(expected);
                    await ctx.SaveChangesAsync();

                    var actual = await ctx.Bookings.FirstAsync();

                    Assert.Equal(expected, actual);
                }
            }
            finally
            {
                _connection.Close();
            }
        }
Exemplo n.º 12
0
        string ImportData(FileUpload flInfo, int EventID, EventModel _event)
        {
            string         path                 = "";
            string         response             = "";
            bool           isValidGuestColumn   = false;
            bool           isValidStaffColumn   = false;
            bool           isValidProductColumn = false;
            int            startColumn;
            int            startRow;
            ExcelWorksheet GuestworkSheet;
            ExcelWorksheet StaffworkSheet;
            ExcelWorksheet ProductworkSheet;
            int            count = 0;

            if (flInfo.HasFile)
            {
                try
                {
                    string filename       = Path.GetFileName(flInfo.FileName);
                    string serverLocation = "~/temp/" + "/" + filename;
                    string SaveLoc        = Server.MapPath(serverLocation);
                    flInfo.SaveAs(SaveLoc);
                    path = Server.MapPath("/") + "\\temp\\" + filename;

                    var package = new ExcelPackage(new System.IO.FileInfo(path));
                    ////  package.Workbook.Worksheets["TABNAME"].View.TabSelected = true;
                    startColumn      = 1;                              //where the file in the class excel start
                    startRow         = 2;
                    GuestworkSheet   = package.Workbook.Worksheets[1]; //read sheet one
                    StaffworkSheet   = package.Workbook.Worksheets[2]; //read sheet two
                    ProductworkSheet = package.Workbook.Worksheets[3];

                    isValidGuestColumn   = ValidateGuestColumns(GuestworkSheet);
                    isValidStaffColumn   = ValidateStaffColumns(StaffworkSheet);
                    isValidProductColumn = ValidateProductColumns(ProductworkSheet);
                    // isValidColumn = true;
                }
                catch
                {
                    response = "Failed";
                    return(response);
                }
                //check staff sheet
                object data = null;
                if (isValidStaffColumn == true && isValidGuestColumn == true && isValidProductColumn == true)
                {
                    do
                    {
                        data = StaffworkSheet.Cells[startRow, startColumn].Value; //column Number
                        if (data == null)
                        {
                            continue;
                        }
                        //read column class name
                        object     Name       = StaffworkSheet.Cells[startRow, startColumn].Value;
                        object     Email      = StaffworkSheet.Cells[startRow, startColumn + 1].Value;
                        object     Occupation = StaffworkSheet.Cells[startRow, startColumn + 2].Value;
                        StaffModel _staff     = new StaffModel();
                        _staff.NAME       = Name.ToString();
                        _staff.EMAIL      = Email.ToString();
                        _staff.Occupation = Occupation.ToString();
                        _staff.PASS       = "******";
                        _staff.EventID    = EventID;
                        //import db
                        Eventrix_Client.Registration reg = new Eventrix_Client.Registration();
                        response = reg.RegisterStaff(_staff);
                        if (response.Contains("successfully"))
                        {
                            count++;
//====================-----------Send Email TO Staff-----------------=====================================//


//=========================================================================================================//
                        }
                        startRow++;
                    } while (data != null);

                    data        = null;
                    startColumn = 1;  //where the file in the class excel start
                    startRow    = 2;
                    do
                    {
                        data = GuestworkSheet.Cells[startRow, startColumn].Value; //column Number
                        if (data == null)
                        {
                            continue;
                        }
                        object     Name         = GuestworkSheet.Cells[startRow, startColumn].Value;
                        object     Surname      = GuestworkSheet.Cells[startRow, startColumn + 1].Value;
                        object     Email        = GuestworkSheet.Cells[startRow, startColumn + 2].Value;
                        object     Tyicket_Type = GuestworkSheet.Cells[startRow, startColumn + 3].Value;
                        GuestModel _guest       = new GuestModel();
                        _guest.NAME    = Name.ToString();
                        _guest.SURNAME = Surname.ToString();
                        _guest.EMAIL   = Email.ToString();
                        _guest.PASS    = "******";
                        _guest.TYPE    = Tyicket_Type.ToString();

                        Eventrix_Client.Registration reg = new Eventrix_Client.Registration();
                        int G_ID = reg.RegisterGuest(_guest);
                        //Generate OTP
                        string pass = genCode(Convert.ToString(G_ID));
                        //HashPass
                        GuestModel gWithPass = new GuestModel();
                        gWithPass.PASS = pass;
                        response       = reg.InsertOTP(gWithPass, Convert.ToString(G_ID));
                        //  response = reg.RegisterGuest(_guest);
                        if (G_ID != -1)
                        {
                            count++;
//====================-----------Send Invitation Email-----------------=====================================//

                            EmailClient email = new EmailClient();
                            email.sendMsgInvite(_guest, _event, pass, EventID);

//=========================================================================================================//
                        }
                        startRow++;
                    } while (data != null);

                    //upload product details
                    data        = null;
                    startColumn = 1;  //where the file in the class excel start
                    startRow    = 2;
                    do
                    {
                        data = ProductworkSheet.Cells[startRow, startColumn].Value; //column Number
                        if (data == null)
                        {
                            continue;
                        }
                        object       Name        = ProductworkSheet.Cells[startRow, startColumn].Value;
                        object       Description = ProductworkSheet.Cells[startRow, startColumn + 1].Value;
                        object       Quantity    = ProductworkSheet.Cells[startRow, startColumn + 2].Value;
                        object       Price       = ProductworkSheet.Cells[startRow, startColumn + 3].Value;
                        EventProduct _product    = new EventProduct();
                        _product._Name = Name.ToString();
                        //     _product._Desc = Description.ToString();
                        _product._Quantity     = Convert.ToInt32(Quantity.ToString());
                        _product.ProdRemaining = Convert.ToInt32(Quantity.ToString());
                        _product._Price        = Convert.ToInt32(Price.ToString());
                        _product.EventID       = EventID;
                        ProductServiceClient psv = new ProductServiceClient();
                        string isProductUpdated  = psv.createProduct(_product);
                        if (isProductUpdated.Contains("success"))
                        {
                            count++;
                        }
                        startRow++;
                    } while (data != null);
                    //check record
                    if (count == (GuestworkSheet.Dimension.Rows - 1) + (StaffworkSheet.Dimension.Rows - 1) + (ProductworkSheet.Dimension.Rows - 1))
                    {
                        response = "success: All Records uploaded";
                    }
                    else
                    {
                        response = "success: Not All Records uploaded";
                    }
                }
                else
                {
                    response += " Failed to upload Exceel: Check columns";
                }
            }
            else
            {
                response = "Failed: File not found";
            }

            return(response);
        }
Exemplo n.º 13
0
 public void AddNewGuest(GuestModel newGuestModel)
 {
     CallServiceClientSafely(channel => channel.AddNewGuest(newGuestModel), $"An error occurred whilst calling GuestsService to add a new guest for '{newGuestModel.FirstName} {newGuestModel.LastName}.");
 }
Exemplo n.º 14
0
 public IActionResult Put(int id, [FromBody] GuestModel model)
 {
     return(this.Ok());
 }
Exemplo n.º 15
0
 public async Task AddGuest(GuestModel guest)
 {
     var newGuest = _mapper.Map <Guest>(guest);
     await _guestRepository.Add(newGuest);
 }
Exemplo n.º 16
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string EVENT_TRACKER;
            string SUBFOLDER = "Main_Image";
            int    hostID    = Convert.ToInt32(Session["ID"].ToString());
            String request   = (Request.QueryString["EventID"]);

            if (request == null)
            {
                request = (Request.QueryString["ed"]);
            }
            EventServiceClient _eventClient = new EventServiceClient();
            EventModel         oldEvent     = new EventModel();

            oldEvent = _eventClient.findByEventID(request);

            //Editing  Address
            EventAddress  currentAdd = new EventAddress();
            EventAddress  Oldadd     = new EventAddress();
            MappingClient mc         = new MappingClient();

            currentAdd = mc.getAddressById(Convert.ToString(oldEvent.EventAddress));
            if (txtCountry.Text.Equals(""))
            {
                Oldadd.COUNTRY = currentAdd.COUNTRY;
            }
            else
            {
                Oldadd.COUNTRY = txtCountry.Text;
            }
            if (txtCity.Text.Equals(""))
            {
                Oldadd.CITY = currentAdd.CITY;
            }
            else
            {
                Oldadd.CITY = txtCity.Text;
            }
            if (txtStreet.Text.Equals(""))
            {
                Oldadd.STREET = currentAdd.STREET;
            }
            else
            {
                Oldadd.STREET = txtStreet.Text;
            }
            if (txtProvince.Text.Equals(""))
            {
                Oldadd.PROVINCE = currentAdd.PROVINCE;
            }
            else
            {
                Oldadd.PROVINCE = txtProvince.Text;
            }
            EventAddress newAddress = new EventAddress();

            newAddress = mc.EditAddress(Oldadd, Convert.ToString(oldEvent.EventAddress));

            EventModel _event = new EventModel();

            _event.HostID = oldEvent.HostID;
            _event.Name   = txtEventName.Text;  //Event Name
            if (chkBoxPrivate.Checked == true)  //Public or Private Event
            {
                _event.Type = "Private";
            }
            else
            {
                _event.Type = "Public";
            }
            _event.Desc = txtDesc.Text; //Event Description
            string startdate = "";
            string enddate   = "";

            //DateTime sDate = DateTime.ParseExact(startdate, "yyyy-MM-ddTHH:mm", CultureInfo.InvariantCulture);
            //DateTime eDate = DateTime.ParseExact(enddate, "yyyy-MM-ddTHH:mm", CultureInfo.InvariantCulture);
            //_event.sDate = sDate; //Event Start Date
            //_event.eDate = eDate; //Event End Date

            if (txtStart.Text.Equals(""))
            {
                _event.sDate = oldEvent.sDate;
            }
            else
            {
                // _event.sDate = DateTime.ParseExact(txtStart.Text, "yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture);
                //var date = DateTime.Parse(strDate,new CultureInfo("en-US", true))
                _event.sDate = Convert.ToString(DateTime.Parse(txtStart.Text, new CultureInfo("en-US", true)));
            }
            if (txtEnd.Text.Equals(""))
            {
                _event.eDate = oldEvent.eDate;
            }
            else
            {
                //  _event.eDate = DateTime.ParseExact(txtEnd.Text, "yyyy-MM-ddTHH:mm", CultureInfo.InvariantCulture);
                _event.eDate = Convert.ToString(DateTime.Parse(txtEnd.Text, new CultureInfo("en-US", true)));
            }
            _event.EventAddress = newAddress.ID;   //Event's address ID
            //check ticket field
            if (!txtE_Quantity.Text.Equals(""))
            {
                _event.EB_Quantity = Convert.ToInt32(txtE_Quantity.Text);
            }
            else
            {
                _event.EB_Quantity = 0;
            }

            if (!txtR_Quantity.Text.Equals(""))
            {
                _event.Reg_Quantity = Convert.ToInt32(txtR_Quantity.Text);
            }
            else
            {
                _event.Reg_Quantity = 0;
            }

            if (!txtV_Quantity.Text.Equals(""))
            {
                _event.VIP_Quantity = Convert.ToInt32(txtV_Quantity.Text);
            }
            else
            {
                _event.VIP_Quantity = 0;
            }
            if (!txtVV_Quantity.Text.Equals(""))
            {
                _event.VVIP_Quantity = Convert.ToInt32(txtVV_Quantity.Text);
            }
            else
            {
                _event.VVIP_Quantity = 0;
            }
            //Edit Event Event
            EventServiceClient _editEvent = new EventServiceClient();
            EventModel         newEvent   = new EventModel();

            newEvent = _editEvent.updateEvent(_event, request);
            bool isCreatedTicket = false;   //Ticket Controller

            EVENT_TRACKER = "Event Edited successfully";
            //Import users
            //string ImportSpreadsheet = "";
            //ImportSpreadsheet = ImportData(flGuest, newEvent.EventID);

            //===================Import guest,staff and products============================//

            string         path                 = "";
            string         response             = "";
            bool           isValidGuestColumn   = false;
            bool           isValidStaffColumn   = false;
            bool           isValidProductColumn = false;
            int            startColumn          = 0;
            int            startRow             = 0;
            ExcelWorksheet GuestworkSheet       = null;
            ExcelWorksheet StaffworkSheet       = null;
            ExcelWorksheet ProductworkSheet     = null;
            int            count                = 0;

            if (flGuest.HasFile)
            {
                try
                {
                    string filename       = Path.GetFileName(flGuest.FileName);
                    string serverLocation = "~/Temp/" + "/" + filename;
                    string SaveLoc        = Server.MapPath(serverLocation);
                    flGuest.SaveAs(SaveLoc);
                    path = Server.MapPath("/") + "\\Temp\\" + filename;

                    var package = new ExcelPackage(new System.IO.FileInfo(path));
                    ////  package.Workbook.Worksheets["TABNAME"].View.TabSelected = true;
                    startColumn      = 1;                              //where the file in the class excel start
                    startRow         = 2;
                    GuestworkSheet   = package.Workbook.Worksheets[1]; //read sheet one
                    StaffworkSheet   = package.Workbook.Worksheets[2]; //read sheet two
                    ProductworkSheet = package.Workbook.Worksheets[3];

                    isValidGuestColumn   = ValidateGuestColumns(GuestworkSheet);
                    isValidStaffColumn   = ValidateStaffColumns(StaffworkSheet);
                    isValidProductColumn = ValidateProductColumns(ProductworkSheet);
                    // isValidColumn = true;
                }
                catch
                {
                    response += "Failed";
                }
                //check staff sheet
                object data = null;
                if (isValidStaffColumn == true && isValidGuestColumn == true && isValidProductColumn == true)
                {
                    do
                    {
                        data = StaffworkSheet.Cells[startRow, startColumn].Value; //column Number
                        if (data == null)
                        {
                            continue;
                        }
                        //read column class name
                        object     Name       = StaffworkSheet.Cells[startRow, startColumn].Value;
                        object     Email      = StaffworkSheet.Cells[startRow, startColumn + 1].Value;
                        object     Occupation = StaffworkSheet.Cells[startRow, startColumn + 2].Value;
                        StaffModel _staff     = new StaffModel();
                        _staff.NAME       = Name.ToString();
                        _staff.EMAIL      = Email.ToString();
                        _staff.Occupation = Occupation.ToString();
                        _staff.PASS       = "******";
                        _staff.EventID    = newEvent.EventID;
                        //edit to db
                        StaffServiceClient ssv = new StaffServiceClient();
                        bool isCreated         = ssv.createStaff(_staff);
                        if (isCreated == true)
                        {
                            count++;
                        }
                        startRow++;
                    } while (data != null);

                    data        = null;
                    startColumn = 1;  //where the file in the class excel start
                    startRow    = 2;
                    do
                    {
                        data = GuestworkSheet.Cells[startRow, startColumn].Value; //column Number
                        if (data == null)
                        {
                            continue;
                        }
                        object     Name    = GuestworkSheet.Cells[startRow, startColumn].Value;
                        object     Surname = GuestworkSheet.Cells[startRow, startColumn + 1].Value;
                        object     Email   = GuestworkSheet.Cells[startRow, startColumn + 2].Value;
                        GuestModel _guest  = new GuestModel();
                        _guest.NAME    = Name.ToString();
                        _guest.SURNAME = Surname.ToString();
                        _guest.EMAIL   = Email.ToString();
                        _guest.PASS    = "******";
                        _guest.TYPE    = "Private";
                        Eventrix_Client.Registration reg = new Eventrix_Client.Registration();
                        //   response = reg.RegisterGuest(_guest);
                        sendMsg(_guest, _event);
                        if (response.Contains("successfully"))
                        {
                            count++;
                        }
                        startRow++;
                    } while (data != null);

                    //upload product details
                    data        = null;
                    startColumn = 1;  //where the file in the class excel start
                    startRow    = 2;
                    do
                    {
                        data = ProductworkSheet.Cells[startRow, startColumn].Value; //column Number
                        if (data == null)
                        {
                            continue;
                        }
                        object       Name        = ProductworkSheet.Cells[startRow, startColumn].Value;
                        object       Description = ProductworkSheet.Cells[startRow, startColumn + 1].Value;
                        object       Quantity    = ProductworkSheet.Cells[startRow, startColumn + 2].Value;
                        object       Price       = ProductworkSheet.Cells[startRow, startColumn + 3].Value;
                        EventProduct _product    = new EventProduct();
                        _product._Name = Name.ToString();
                        //     _product._Desc = Description.ToString();
                        _product._Quantity = Convert.ToInt32(Quantity.ToString());
                        _product._Price    = Convert.ToInt32(Price.ToString());
                        _product.EventID   = newEvent.EventID;
                        ProductServiceClient psv = new ProductServiceClient();
                        //  string isProductUpdated = psv.createProduct(_product);
                        string isProductUpdated = psv.createProduct(_product);
                        if (isProductUpdated.Contains("success"))
                        {
                            count++;
                        }
                        startRow++;
                    } while (data != null);
                    //check record
                    if (count == (GuestworkSheet.Dimension.Rows - 1) + (StaffworkSheet.Dimension.Rows - 1) + (ProductworkSheet.Dimension.Rows - 1))
                    {
                        response = "success: All Records uploaded";
                    }
                    else
                    {
                        response = "success: Not All Records uploaded";
                    }
                }
                else
                {
                    response += " Failed to upload Exceel: Check columns";
                }
            }
            else
            {
                response = "Failed: File not found";
            }


            //==============================================================================//
            if (response.Contains("success"))
            {
                EVENT_TRACKER += "\n Spreadsheet Uploaded";
                //Create Tickets
                isCreatedTicket = isLoadedTicket(newEvent, newEvent.EventID);
                if (isCreatedTicket == true)
                {
                    EVENT_TRACKER += "\n Ticket Created";
                }
                else
                {
                    EVENT_TRACKER += "\n Failed to upload ticket";
                }
            }
            else
            {
                EVENT_TRACKER += "\n Spreadsheet Uploaded";
                //Create Tickets
                isCreatedTicket = isLoadedTicket(newEvent, newEvent.EventID);
                if (isCreatedTicket == true)
                {
                    EVENT_TRACKER += "\n Ticket Created";
                }
                else
                {
                    EVENT_TRACKER += "\n Failed to upload ticket";
                }
                //Unable to upload guest
                EVENT_TRACKER += "\n failed to upload spreadsheet";
            }

            ////Upload images
            ImageFile mainPic = new ImageFile();

            mainPic = UploadFile(flEventImages, Convert.ToString(newEvent.EventID), SUBFOLDER); //Upload Event Main's Image to client directory
            if (mainPic != null)
            {
                FileUploadClient fuc    = new FileUploadClient();
                string           res1   = fuc.saveImage(mainPic); //Upload Event Main's Image to Database
                string           number = res1;
            }
            Response.Redirect("EventDetails.aspx?EventID=" + newEvent.EventID);

            //  Response.Write("<script> Alert("+ EVENT_TRACKER + ");</script>");
        }
Exemplo n.º 17
0
 public void AddGuest(GuestModel guest)
 {
     // AllGuests.Push(guest);
     _guestStream.OnNext(guest);
 }
Exemplo n.º 18
0
 public IHttpActionResult addGuest(GuestModel guestModel)
 {
     modelManager.addGuest(guestModel);
     return(Ok());
 }
Exemplo n.º 19
0
        string ImportData(FileUpload flInfo, int EventID)
        {
            string         path                 = "";
            string         response             = "";
            bool           isValidGuestColumn   = false;
            bool           isValidStaffColumn   = false;
            bool           isValidProductColumn = false;
            int            startColumn;
            int            startRow;
            ExcelWorksheet GuestworkSheet;
            ExcelWorksheet StaffworkSheet;
            ExcelWorksheet ProductworkSheet;
            int            count = 0;

            if (flInfo.HasFile)
            {
                try
                {
                    string filename       = Path.GetFileName(flInfo.FileName);
                    string serverLocation = "~/Temp/" + "/" + filename;
                    string SaveLoc        = Server.MapPath(serverLocation);
                    flInfo.SaveAs(SaveLoc);
                    path = Server.MapPath("/") + "\\Temp\\" + filename;

                    var package = new ExcelPackage(new System.IO.FileInfo(path));
                    ////  package.Workbook.Worksheets["TABNAME"].View.TabSelected = true;
                    startColumn      = 1;                              //where the file in the class excel start
                    startRow         = 2;
                    GuestworkSheet   = package.Workbook.Worksheets[1]; //read sheet one
                    StaffworkSheet   = package.Workbook.Worksheets[2]; //read sheet two
                    ProductworkSheet = package.Workbook.Worksheets[3];

                    isValidGuestColumn   = ValidateGuestColumns(GuestworkSheet);
                    isValidStaffColumn   = ValidateStaffColumns(StaffworkSheet);
                    isValidProductColumn = ValidateProductColumns(ProductworkSheet);
                    // isValidColumn = true;
                }
                catch
                {
                    response = "Failed";
                    return(response);
                }
                //check staff sheet
                object data = null;
                if (isValidStaffColumn == true && isValidGuestColumn == true && isValidProductColumn == true)
                {
                    do
                    {
                        data = StaffworkSheet.Cells[startRow, startColumn].Value; //column Number
                        if (data == null)
                        {
                            continue;
                        }
                        //read column class name
                        object     Name       = StaffworkSheet.Cells[startRow, startColumn].Value;
                        object     Email      = StaffworkSheet.Cells[startRow, startColumn + 1].Value;
                        object     Occupation = StaffworkSheet.Cells[startRow, startColumn + 2].Value;
                        StaffModel _staff     = new StaffModel();
                        _staff.NAME       = Name.ToString();
                        _staff.EMAIL      = Email.ToString();
                        _staff.Occupation = Occupation.ToString();
                        _staff.PASS       = "******";
                        _staff.EventID    = EventID;
                        //edit to db
                        StaffServiceClient ssv = new StaffServiceClient();
                        bool isCreated         = ssv.createStaff(_staff);
                        if (isCreated == true)
                        {
                            count++;
                        }
                        startRow++;
                    } while (data != null);

                    data        = null;
                    startColumn = 1;  //where the file in the class excel start
                    startRow    = 2;
                    do
                    {
                        data = GuestworkSheet.Cells[startRow, startColumn].Value; //column Number
                        if (data == null)
                        {
                            continue;
                        }
                        object     Name    = GuestworkSheet.Cells[startRow, startColumn].Value;
                        object     Surname = GuestworkSheet.Cells[startRow, startColumn + 1].Value;
                        object     Email   = GuestworkSheet.Cells[startRow, startColumn + 2].Value;
                        GuestModel _guest  = new GuestModel();
                        _guest.NAME    = Name.ToString();
                        _guest.SURNAME = Surname.ToString();
                        _guest.EMAIL   = Email.ToString();
                        _guest.PASS    = "******";
                        _guest.TYPE    = "Private";
                        Eventrix_Client.Registration reg = new Eventrix_Client.Registration();
                        //  response = reg.RegisterGuest(_guest);
                        if (response.Contains("successfully"))
                        {
                            count++;
                        }
                        startRow++;
                    } while (data != null);

                    //upload product details
                    data        = null;
                    startColumn = 1;  //where the file in the class excel start
                    startRow    = 2;
                    do
                    {
                        data = ProductworkSheet.Cells[startRow, startColumn].Value; //column Number
                        if (data == null)
                        {
                            continue;
                        }
                        object       Name        = ProductworkSheet.Cells[startRow, startColumn].Value;
                        object       Description = ProductworkSheet.Cells[startRow, startColumn + 1].Value;
                        object       Quantity    = ProductworkSheet.Cells[startRow, startColumn + 2].Value;
                        object       Price       = ProductworkSheet.Cells[startRow, startColumn + 3].Value;
                        EventProduct _product    = new EventProduct();
                        _product._Name     = Name.ToString();
                        _product._Desc     = Description.ToString();
                        _product._Quantity = Convert.ToInt32(Quantity.ToString());
                        _product._Price    = Convert.ToInt32(Price.ToString());
                        _product.EventID   = EventID;
                        ProductServiceClient psv = new ProductServiceClient();
                        //  string isProductUpdated = psv.createProduct(_product);
                        string isProductUpdated = psv.createProduct(_product);
                        if (isProductUpdated.Contains("success"))
                        {
                            count++;
                        }
                        startRow++;
                    } while (data != null);
                    //check record
                    if (count == (GuestworkSheet.Dimension.Rows - 1) + (StaffworkSheet.Dimension.Rows - 1) + (ProductworkSheet.Dimension.Rows - 1))
                    {
                        response = "success: All Records uploaded";
                    }
                    else
                    {
                        response = "success: Not All Records uploaded";
                    }
                }
                else
                {
                    response += " Failed to upload Exceel: Check columns";
                }
            }
            else
            {
                response = "Failed: File not found";
            }

            //Directory.Delete(path, true);
            return(response);
        }
Exemplo n.º 20
0
        protected void btnLogin_Click1(object sender, EventArgs e)
        {
            string         RSVPEventID = Request.QueryString["e_ID"];
            UserLogin      LoginClient = new UserLogin();
            GuestModel     guest       = new GuestModel();
            EventHostModel host        = new EventHostModel();
            StaffModel     staff       = new StaffModel();
            string         pass        = txtLogPass.Text;



            string email = txtUserName.Text;

            host = LoginClient.hostLogin(email, pass);
            if (host == null)  //if user is not a host then check guest and host
            {
                guest = LoginClient.Guestlogin(email, pass);
                if (guest == null) //user is not a host nor a guest
                {
                    staff = LoginClient.staffLogin(email, pass);
                    if (staff == null) //the user is neither staff, guest nor host
                    {
                        // Response.Redirect("Login.aspx");
                        Popup(false, "Login.aspx");
                    }
                    else    //the user is a staff
                    {
                        SetSessions(staff);
                        int    LogID     = Convert.ToInt32(Session["ID"]);
                        string homeIndex = "Index.aspx?LoggedID=" + LogID + "&Type=All";
                        Popup(true, homeIndex);
                        //  Response.Redirect(homeIndex);
                    }
                }
                else   //the user is a guest
                {
                    string survey = Request.QueryString["purp"];

                    if (survey != null && RSVPEventID != null)
                    {
                        SetSessions(guest);
                        string strURL = "EventSurvey.aspx?eventID=" + RSVPEventID;
                        //   Response.Redirect("EventSurvey.aspx?eventID="+ RSVPEventID);
                        GetProfilePicture(guest.ID.ToString()); //Get guest image or default picture
                        Popup(true, strURL);
                    }
                    else
                    if (RSVPEventID != null)
                    {
                        SetSessions(guest);
                        GetProfilePicture(guest.ID.ToString()); //Get guest image or default picture
                        string strURL = "EventRSVP.aspx?ev=" + RSVPEventID;
                        //    Response.Redirect("EventRSVP.aspx?EventID=" + RSVPEventID);
                        Popup(true, strURL);
                    }
                    else
                    {
                        SetSessions(guest);
                        int LogID = Convert.ToInt32(Session["ID"]);
                        GetProfilePicture(LogID.ToString()); //Get guest image or default picture
                        string homeIndex = "Index.aspx?LoggedID=" + LogID + "&Type=Guest";
                        Popup(true, homeIndex);
                    }
                }
            }
            else  //the user is a host
            {
                // txtLogName.Text = host.NAME;

                SetSessions(host);
                int    LogID     = Convert.ToInt32(Session["ID"]);
                string homeIndex = "Index.aspx?LoggedID=" + LogID + "&Type=Host";
                Popup(true, homeIndex);
            }
        }
Exemplo n.º 21
0
 public async Task UpdateGuest(GuestModel guest)
 {
     await _guestRepository.Update(
         _mapper.Map <Guest>(guest));
 }
Exemplo n.º 22
0
 public GuestViewModel()
 {
     Guest      = new GuestModel();
     Categories = new List <CategoryViewModel>();
 }
Exemplo n.º 23
0
        public void Test_Validate_GuestModel(GuestModel guest)
        {
            var validationContext = new ValidationContext(guest);

            Assert.Empty(guest.Validate(validationContext));
        }
Exemplo n.º 24
0
 public static void AddGuest(int year, GuestModel guest)
 {
     GuestRepository.AddGuest(year, guest);
 }
Exemplo n.º 25
0
 public static void EditGuest(int year, GuestModel guest)
 {
     GuestRepository.EditGuest(year, guest);
 }
Exemplo n.º 26
0
        public async Task <IActionResult> UpdateUserDetails([FromBody] GuestModel guest)
        {
            var resonse = await _guestReg.AddGuest(guest);

            return(Ok(resonse));
        }
Exemplo n.º 27
0
 public async Task <int> AddGuestAsync(GuestModel guestModel, int tenantId)
 {
     CustomerModel = guestModel;
     return(123);
 }
Exemplo n.º 28
0
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            GuestModel newGuest = new GuestModel();

            if (txtNewPas.Text.Equals("") && txtConfirmPas.Text.Equals("") && txtOldpassword.Text.Equals(""))
            {
                //newGuest.NAME = txtName.Text;
                //newGuest.SURNAME = txtLastname.Text;
                //newGuest.EMAIL = txtEmail.Text;
                //newGuest.PASS = guestClient.getGuestByGuestID(guestId).PASS;
                //newGuest.USERTYPE = txtUserType.Text;
                //guestClient.updateGuest(guestId, newGuest);
                proxy    = new WebClient();
                guestUrl =
                    string.Format("http://localhost:53056/GuestEdit.svc/editGuest/{0},{1},{2},{3},{4},{5},{6}", guestId, txtName.Text, txtLastname.Text, txtEmail.Text, pasword, pasword, pasword);
                byte[] _data  = proxy.DownloadData(guestUrl);
                Stream memory = new MemoryStream(_data);
                var    reader = new StreamReader(memory);
                string result = reader.ReadToEnd().Replace("editGuest", "").Replace("Result", "").Replace(quote + "", "").Replace("{", "").Replace("}", "").Replace(":", "");
                btnEdit.Visible = false;
                //Changing the profile picture
                if (profilePic.HasFile)
                {
                    string response = updateProfilePic(profilePic); //Store attribute of the new profile pic in the WCF database
                    if (response.Contains("Success"))
                    {
                        string filename       = Path.GetFileName(profilePic.FileName);
                        string serverLocation = "~/Events/" + guestId + "/" + SUBFOLDER + "/" + filename;
                        string SaveLoc        = Server.MapPath(serverLocation); //Get the full image directory location

                        profilePic.SaveAs(SaveLoc);                             //Save the picture in the given directory
                        img = guestClient.getImageById(guestId);
                        if (img == null)
                        {
                            Session["DEFAULT_IMAGE"] = "ProfilePic.png";
                        }
                        else
                        {
                            imgLocation = img.Location;
                            Session["PROFILE_IMAGE"] = imgLocation.Substring(imgLocation.IndexOf('E'));
                        }
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Profile picture failed to update.');", true);
                    }
                }
                //Check if the edit is successful or not
                if (result.Contains("successfully"))
                {
                    lblWarning.ForeColor = System.Drawing.Color.White;
                    lblWarning.Text      = result; lblWarning.Visible = true;
                    Response.Redirect("EditGuest.aspx"); // Refresh the page to display the updated picture
                }
            }
            else
            {
                //Response.Write("<script>alert('Cant edit with null values');</script>");
                lblWarning.Text    = "Cannot edit with empty values";
                lblWarning.Visible = true;
            }
        }
        public static BookingModel SetFinalBooking(BookingModel booking, RoomModel room, GuestModel str)
        {
            BookingModel finalBooking = new BookingModel();

            finalBooking.Id        = booking.Id;
            finalBooking.StartDate = booking.StartDate;
            finalBooking.EndDate   = booking.EndDate;
            finalBooking.RoomId    = room.Id;
            finalBooking.GuestId   = str.Id;
            return(finalBooking);
        }
Exemplo n.º 30
0
        public ActionResult AddGuest(GuestModel gmodel)
        {
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["connBae"].ToString());

            con.Open();
            SqlCommand cmd = new SqlCommand("AddNewGuest", con);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@lname", gmodel.LastName);
            cmd.Parameters.AddWithValue("@fname", gmodel.FirstName);
            cmd.Parameters.AddWithValue("@email", gmodel.Email);
            cmd.Parameters.AddWithValue("@comment", gmodel.Comment);
            cmd.Parameters.AddWithValue("@guestfn_1", gmodel.Guest_1_Fname);
            cmd.Parameters.AddWithValue("@guestln_1", gmodel.Guest_1_Lname);
            cmd.Parameters.AddWithValue("@guestfn_2", gmodel.Guest_2_Fname);
            cmd.Parameters.AddWithValue("@guestln_2", gmodel.Guest_2_Lname);
            cmd.Parameters.AddWithValue("@guestfn_3", gmodel.Guest_3_Fname);
            cmd.Parameters.AddWithValue("@guestln_3", gmodel.Guest_3_Lname);
            cmd.Parameters.AddWithValue("@guestfn_4", gmodel.Guest_4_Fname);
            cmd.Parameters.AddWithValue("@guestln_4", gmodel.Guest_4_Lname);
            cmd.Parameters.AddWithValue("@guestfn_5", gmodel.Guest_5_Fname);
            cmd.Parameters.AddWithValue("@guestln_5", gmodel.Guest_5_Lname);
            cmd.Parameters.AddWithValue("@guestfn_6", gmodel.Guest_6_Fname);
            cmd.Parameters.AddWithValue("@guestln_6", gmodel.Guest_6_Lname);
            cmd.Parameters.AddWithValue("@guestfn_7", gmodel.Guest_7_Fname);
            cmd.Parameters.AddWithValue("@guestln_7", gmodel.Guest_7_Lname);
            cmd.Parameters.AddWithValue("@guestfn_8", gmodel.Guest_8_Fname);
            cmd.Parameters.AddWithValue("@guestln_8", gmodel.Guest_8_Lname);
            cmd.Parameters.AddWithValue("@guestfn_9", gmodel.Guest_9_Fname);
            cmd.Parameters.AddWithValue("@guestln_9", gmodel.Guest_9_Lname);
            cmd.Parameters.AddWithValue("@guestfn_10", gmodel.Guest_10_Fname);
            cmd.Parameters.AddWithValue("@guestln_10", gmodel.Guest_10_Lname);
            cmd.Parameters.AddWithValue("@attending", gmodel.Attending);

            //cmd.Parameters.AddWithValue("@lname", gmodel.LastName);
            //cmd.Parameters.AddWithValue("@fname", "test");
            //cmd.Parameters.AddWithValue("@email", "*****@*****.**");
            //cmd.Parameters.AddWithValue("@comment", "test");
            //cmd.Parameters.AddWithValue("@guestfn_1", "test");
            //cmd.Parameters.AddWithValue("@guestln_1", "test");
            //cmd.Parameters.AddWithValue("@guestfn_2", "test");
            //cmd.Parameters.AddWithValue("@guestln_2", "test");
            //cmd.Parameters.AddWithValue("@guestfn_3", "test");
            //cmd.Parameters.AddWithValue("@guestln_3", "test");
            //cmd.Parameters.AddWithValue("@guestfn_4", "test");
            //cmd.Parameters.AddWithValue("@guestln_4", "test");
            //cmd.Parameters.AddWithValue("@guestfn_5", "test");
            //cmd.Parameters.AddWithValue("@guestln_5", "test");
            //cmd.Parameters.AddWithValue("@guestfn_6", "test");
            //cmd.Parameters.AddWithValue("@guestln_6", "test");
            //cmd.Parameters.AddWithValue("@guestfn_7", "test");
            //cmd.Parameters.AddWithValue("@guestln_7", "test");
            //cmd.Parameters.AddWithValue("@guestfn_8", "test");
            //cmd.Parameters.AddWithValue("@guestln_8", "test");
            //cmd.Parameters.AddWithValue("@guestfn_9", "test");
            //cmd.Parameters.AddWithValue("@guestln_9", "test");
            //cmd.Parameters.AddWithValue("@guestfn_10", "test");
            //cmd.Parameters.AddWithValue("@guestln_10", "test");
            //cmd.Parameters.AddWithValue("@attending", true);
            cmd.ExecuteNonQuery();

            con.Close();

            return(View("_RSVP"));
        }