Example #1
0
        public static string getDesc(this ShirtSize t)
        {
            switch (t)
            {
            case ShirtSize.Child_Small:
                return("Child Small");

            case ShirtSize.Child_Medium:
                return("Child Medium");

            case ShirtSize.Child_Large:
                return("Child Large");

            case ShirtSize.Adult_Small:
                return("Adult Small");

            case ShirtSize.Adult_Medium:
                return("Adult Medium");

            case ShirtSize.Adult_Large:
                return("Adult Large");

            case ShirtSize.Adult_XLarge:
                return("Adult XLarge");

            case ShirtSize.None:
            default:
                return("None");
            }
        }
Example #2
0
 public Member(
     string firstName,
     string lastName,
     MemberType type,
     uint uiStudentNumber,
     int iFaculty,
     string instrument,
     string otherInstrument,
     string email,
     string comments,
     int iShirt)
 {
     // declare basic information about user
     this.firstName = firstName;
     this.lastName = lastName;
     this.type = type;
     this.uiStudentNumber = uiStudentNumber;
     this.memberFaculty = (Faculty)iFaculty;
     this.curInstrument = ParseInstrument(instrument);
     if (this.curInstrument == Instrument.Other && String.IsNullOrEmpty(otherInstrument))
         this.otherInstrument = instrument;
     else
         this.otherInstrument = otherInstrument;
     this.email = email;
     this.comments = comments;
     this.sID = ClsStorage.currentClub.iMember;
     this.signupTime = DateTime.Now;
     this.size = (ShirtSize)iShirt;
     this.bMultipleInstruments = false;
 }
Example #3
0
        static void Main(string[] args)
        {
            byte byteValue1    = 200;
            int  integerValue1 = byteValue1;

            Console.Write("Byte Value1: {0}", byteValue1);
            Console.WriteLine(" IntegerValue: {0}", integerValue1);

            int  integerValue2 = 250;
            byte byteValue2    = (byte)integerValue2;

            Console.WriteLine();
            Console.Write("Byte Value2: {0}", byteValue2);
            Console.WriteLine(" IntegerValue2: {0}", integerValue2);

            ShirtSize size        = ShirtSize.Medium;
            int       integerSize = (int)size;

            Console.WriteLine();
            Console.Write("Interger Size: {0}", integerSize);
            Console.WriteLine(" Enum Size: {0}", size);

            object objInteger   = 100;
            int    integerValue = (int)objInteger;

            Console.WriteLine();
            Console.WriteLine("casted Integer: {0}", integerValue);

            Console.ReadKey();
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            ShirtSize shirtSize = await db.ShirtSizes.FindAsync(id);

            db.ShirtSizes.Remove(shirtSize);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Example #5
0
 public Registration(DateTime timeStamp, Route route, User user, bool orderedShirt, ShirtSize shirtSize, Privacy privacy, bool paid = false)
 {
     Id           = Guid.NewGuid();
     TimeStamp    = timeStamp;
     RouteId      = route.Id;
     OrderedShirt = orderedShirt;
     ShirtSize    = shirtSize;
     Privacy      = privacy;
     user.Registrations.Add(this);
     Paid = paid;
 }
        public async Task <ActionResult> Create([Bind(Include = "Id,Name")] ShirtSize shirtSize)
        {
            if (ModelState.IsValid)
            {
                db.ShirtSizes.Add(shirtSize);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(shirtSize));
        }
        public Attendee Convert(AttendeeForCreationDto attendeeForCreationDto, Attendee attendee, ResolutionContext context)
        {
            attendee = new Attendee();

            var attendeeMeritBadges    = new List <AttendeeMeritBadge>();
            var attendeeAccommodations = new List <AttendeeAccommodation>();

            if (attendeeForCreationDto.MeritBadges != null)
            {
                var sortOrder = 1;
                foreach (var meritBadge in attendeeForCreationDto.MeritBadges)
                {
                    attendeeMeritBadges.Add(new AttendeeMeritBadge
                    {
                        Attendee     = attendee,
                        MeritBadgeId = meritBadge.Id,
                        SortOrder    = sortOrder++
                    });
                }
            }

            if (attendeeForCreationDto.Accommodations != null)
            {
                foreach (var accommodation in attendeeForCreationDto.Accommodations)
                {
                    attendeeAccommodations.Add(new AttendeeAccommodation
                    {
                        Attendee        = attendee,
                        AccommodationId = accommodation.Id
                    });
                }
            }

            // TODO: Get ShirtSize from repo because this will create a duplicate
            var shirtSize = new ShirtSize {
                Size = attendeeForCreationDto.ShirtSize
            };

            attendee.SubgroupId  = attendeeForCreationDto.SubgroupId;
            attendee.FirstName   = attendeeForCreationDto.FirstName;
            attendee.LastName    = attendeeForCreationDto.LastName;
            attendee.IsAdult     = attendeeForCreationDto.IsAdult;
            attendee.DateOfBirth = attendeeForCreationDto.DateOfBirth;
            attendee.Triathlon   = attendeeForCreationDto.Triathlon;
            attendee.IsWithMinor = attendeeForCreationDto.IsWithMinor;
            attendee.ShirtSize   = shirtSize;
            attendee.Attendance  = Mapper.Map <Attendance>(attendeeForCreationDto.Attendance);

            attendee.AttendeeMeritBadges    = attendeeMeritBadges;
            attendee.AttendeeAccommodations = attendeeAccommodations;

            return(attendee);
        }
        // GET: ShirtSizes/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ShirtSize shirtSize = await db.ShirtSizes.FindAsync(id);

            if (shirtSize == null)
            {
                return(HttpNotFound());
            }
            return(View(shirtSize));
        }
        public async Task <ActionResult> Edit([Bind(Include = "Id,Name")] ShirtSize shirtSize)
        {
            string newNum = Request.Params["unum"];
            int    num    = 0;
            bool   res    = int.TryParse(newNum, out num);

            if (ModelState.IsValid)
            {
                db.Entry(shirtSize).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index", new { unum = num }));
            }
            return(View(shirtSize));
        }
Example #10
0
        public async Task <IActionResult> OnGetAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            ShirtSize = await _context.ShirtSize
                        .Include(s => s.Shirt).FirstOrDefaultAsync(m => m.Id == id);

            if (ShirtSize == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Example #11
0
        public async Task <IActionResult> OnGetAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            ShirtSize = await _context.ShirtSize
                        .Include(s => s.Shirt).FirstOrDefaultAsync(m => m.Id == id);

            if (ShirtSize == null)
            {
                return(NotFound());
            }
            ViewData["ShirtId"] = new SelectList(_context.Shirt, "Id", "Id");
            return(Page());
        }
Example #12
0
        public async Task <IActionResult> OnPostAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            ShirtSize = await _context.ShirtSize.FindAsync(id);

            if (ShirtSize != null)
            {
                _context.ShirtSize.Remove(ShirtSize);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
        public Attendee Convert(AttendeeForUpdateDto attendeeForUpdateDto, Attendee attendee, ResolutionContext context)
        {
            var shirtSize = new ShirtSize {
                Size = attendeeForUpdateDto.ShirtSize
            };

            attendee.SubgroupId  = attendeeForUpdateDto.SubgroupId;
            attendee.FirstName   = attendeeForUpdateDto.FirstName;
            attendee.LastName    = attendeeForUpdateDto.LastName;
            attendee.IsAdult     = attendeeForUpdateDto.IsAdult;
            attendee.DateOfBirth = attendeeForUpdateDto.DateOfBirth;
            attendee.Triathlon   = attendeeForUpdateDto.Triathlon;
            attendee.IsWithMinor = attendeeForUpdateDto.IsWithMinor;
            attendee.ShirtSize   = shirtSize;
            attendee.Attendance  = Mapper.Map <Attendance>(attendeeForUpdateDto.Attendance);

            return(attendee);
        }
Example #14
0
        public static Registration MapToRegistration(this RouteRegistrationDTO model, User user, Route route)
        {
            ShirtSize modelShirtSize = ShirtSize.GEEN;

            Enum.TryParse(model.ShirtSize, out modelShirtSize);
            Privacy modelPrivacy = user.Privacy;

            Enum.TryParse(model.Privacy, out modelPrivacy);
            user.Privacy = modelPrivacy;

            return(new Registration(
                       timeStamp: DateTime.Now,
                       route: route,
                       user: user,
                       orderedShirt: model.OrderedShirt,
                       shirtSize: modelShirtSize,
                       privacy: modelPrivacy
                       ));
        }
        // GET: ShirtSizes/ToggleActive/5
        public async Task <ActionResult> ToggleActive(int?id)
        {
            ShirtSize shirtSize = await db.ShirtSizes.FindAsync(id);

            if (shirtSize.Active == null)
            {
                shirtSize.Active  = true;
                TempData["click"] = "Hide";
            }
            else if (shirtSize.Active == true)
            {
                shirtSize.Active  = false;
                TempData["click"] = "Show";
            }
            else if (shirtSize.Active == false)
            {
                shirtSize.Active  = true;
                TempData["click"] = "Hide";
            }
            await db.SaveChangesAsync();

            return(Redirect(Request.UrlReferrer.PathAndQuery));
        }
Example #16
0
        public Member(
            string firstName,
            string lastName,
            MemberType type,
            uint uiStudentNumber,
            int iFaculty,
            string instrument,
            string email,
            string comment,
            short clubID,
            DateTime time,
            int iShirt,
            bool[] bMultiple = null)
        {
            // declare basic information about user
            this.firstName = firstName;
            this.lastName = lastName;
            this.type = type;
            this.uiStudentNumber = uiStudentNumber;
            this.memberFaculty = (Faculty)iFaculty;

            // this is legacy support
            // let's bring it to the Marimba 2 standards
            // take the members instrument, try to recognize it
            // if we fail, mark it as other
            this.curInstrument = ParseInstrument(instrument);
            if (this.curInstrument == Instrument.Other)
                this.otherInstrument = instrument;
            else
                this.otherInstrument = String.Empty;

            this.email = email;
            this.comments = comment;
            this.sID = clubID;
            this.signupTime = time;
            this.size = (ShirtSize)iShirt;

            // multiple instruments
            if (bMultiple == null)
                this.bMultipleInstruments = false;
            else
            {
                this.bMultipleInstruments = true;
                this.playsInstrument = new bool[Enum.GetValues(typeof(Member.Instrument)).Length];
                Array.Copy(bMultiple, this.playsInstrument, Enum.GetValues(typeof(Member.Instrument)).Length);
            }
        }
Example #17
0
        public Member(
            string firstName,
            string lastName,
            MemberType type,
            uint uiStudentNumber,
            int iFaculty,
            string instrument,
            string otherInstrument,
            string email,
            string comment,
            int iShirt,
            bool[] bMultiple)
        {
            // declare basic information about user
            this.firstName = firstName;
            this.lastName = lastName;
            this.type = type;
            this.uiStudentNumber = uiStudentNumber;
            this.memberFaculty = (Faculty)iFaculty;
            this.curInstrument = ParseInstrument(instrument);
            if (this.curInstrument == Instrument.Other && String.IsNullOrEmpty(otherInstrument))
                this.otherInstrument = instrument;
            else
                this.otherInstrument = otherInstrument;
            this.email = email;
            this.comments = comment;
            this.sID = ClsStorage.currentClub.iMember;
            this.signupTime = DateTime.Now;
            this.size = (ShirtSize)iShirt;

            // handle the multiple instruments here
            this.bMultipleInstruments = true;
            this.playsInstrument = new bool[Enum.GetValues(typeof(Member.Instrument)).Length];
            Array.Copy(bMultiple, this.playsInstrument, Enum.GetValues(typeof(Member.Instrument)).Length);
        }
Example #18
0
        public Member(StreamReader sr)
        {
            firstName = sr.ReadLine();
            lastName = sr.ReadLine();
            type = (MemberType)Convert.ToInt32(sr.ReadLine());
            uiStudentNumber = Convert.ToUInt32(sr.ReadLine());
            memberFaculty = (Faculty)Convert.ToInt32(sr.ReadLine());

            otherInstrument = sr.ReadLine();
            curInstrument = (Instrument)Convert.ToInt32(sr.ReadLine());

            this.bMultipleInstruments = Convert.ToBoolean(sr.ReadLine());

            // write if the member plays multiple instruments
            // write any other instruments that the member plays (or does not play)
            int numberOfInstruments = Enum.GetValues(typeof(Member.Instrument)).Length;
            if (this.bMultipleInstruments)
            {
                playsInstrument = new bool[Enum.GetValues(typeof(Member.Instrument)).Length];
                for (int j = 0; j < numberOfInstruments; j++)
                    playsInstrument[j] = Convert.ToBoolean(sr.ReadLine());
            }

            email = sr.ReadLine();
            comments = ClsStorage.ReverseCleanNewLine(sr.ReadLine());
            sID = Convert.ToInt16(sr.ReadLine());
            signupTime = new DateTime(Convert.ToInt64(sr.ReadLine()));
            size = (ShirtSize)Convert.ToInt32(sr.ReadLine());
        }
Example #19
0
 /// <summary>
 /// Edit the details of a member
 /// </summary>
 /// <param name="strFName">First name</param>
 /// <param name="strLName">Last name</param>
 /// <param name="type">Type of member</param>
 /// <param name="uiStudentNumber">Student number</param>
 /// <param name="iFaculty">Faculty of member</param>
 /// <param name="strInstrument">Instrument which this member plays</param>
 /// <param name="strOtherInstrument">Other Instrument</param>
 /// <param name="strEmail">Email of user</param>
 /// <param name="strOther">Other info</param>
 /// <param name="time">Signup time</param>
 /// <param name="iShirt">Shirt size</param>
 public void EditMember(
     string strFName,
     string strLName,
     MemberType type,
     uint uiStudentNumber,
     int iFaculty,
     string strInstrument,
     string strOtherInstrument,
     string strEmail,
     string strOther,
     DateTime time,
     int iShirt)
 {
     this.firstName = strFName;
     this.lastName = strLName;
     this.type = type;
     this.uiStudentNumber = uiStudentNumber;
     this.memberFaculty = (Faculty)iFaculty;
     this.otherInstrument = strOtherInstrument;
     this.curInstrument = ParseInstrument(strInstrument);
     this.email = strEmail;
     this.comments = strOther;
     this.signupTime = time;
     this.size = (ShirtSize)iShirt;
 }
Example #20
0
 public Member(
     string firstName,
     string lastName,
     MemberType type,
     uint uiStudentNumber,
     int iFaculty,
     string instrument,
     string email,
     string comment,
     DateTime time,
     int iShirt)
 {
     // declare basic information about user
     this.firstName = firstName;
     this.lastName = lastName;
     this.type = type;
     this.uiStudentNumber = uiStudentNumber;
     this.memberFaculty = (Faculty)iFaculty;
     this.otherInstrument = instrument;
     this.curInstrument = ParseInstrument(instrument);
     this.email = email;
     this.comments = comment;
     this.sID = ClsStorage.currentClub.iMember;
     this.signupTime = time;
     this.size = (ShirtSize)iShirt;
 }