Beispiel #1
0
 public DoCheckIn(GlobalSolusindoDb db, tblM_User user, CheckInValidator checkInValidator, CheckInFactory checkInFactory, CheckInQuery checkInQuery, AccessControl accessControl) : base(db, user)
 {
     this.checkInValidator         = checkInValidator;
     this.checkInFactory           = checkInFactory;
     this.checkInQuery             = checkInQuery;
     this.checkInEntryDataProvider = new CheckInEntryDataProvider(db, user, accessControl, checkInQuery);
 }
Beispiel #2
0
        public ActionResult CheckIn(string rawBarcode)
        {
            EventQuery       eq      = new EventQuery();
            ParticipantQuery pq      = new ParticipantQuery();
            ParticipantDTO   pDTO    = new ParticipantDTO();
            CheckInQuery     ciq     = new CheckInQuery();
            CheckInDTO       ciDTO   = new CheckInDTO();
            CheckInRules     ciRules = new CheckInRules();
            BarcodeQuery     bcq     = new BarcodeQuery();

            bool   isValidBarcode  = bcq.isValidBarcode(rawBarcode);
            int    CheckInTimeCode = 0;
            bool   isDuplicate     = false;
            string colorCode       = "";

            if (isValidBarcode)
            {
                pDTO            = pq.FindParticipantByBarcode(rawBarcode);
                CheckInTimeCode = ciRules.IsValidCheckInTime(eq.QueryEventTimes(pDTO.eventId));
                isDuplicate     = ciRules.IsDuplicateCheckIn(ciq.QueryCheckInTimes(rawBarcode));
            }

            if (ModelState.IsValid && CheckInTimeCode == 0 && isDuplicate == false && isValidBarcode)
            {
                ciDTO.BarcodeId = bcq.GetBarcodeId(rawBarcode);
                ciq.CreateCheckIn(ciDTO);
                colorCode = "green";
                return(Json(new { errorColor = colorCode, error = "Checkin is Successful!" }));
            }

            string errorMessage = "";

            if (CheckInTimeCode == -1)
            {
                errorMessage += "The checkin period has not started";
                colorCode     = "red";
            }
            else if (CheckInTimeCode == 1)
            {
                errorMessage += "The checkin period has ended";
                colorCode     = "red";
            }

            else if (isDuplicate == true)
            {
                errorMessage += "This participant has already checked in";
                colorCode     = "yellow";
            }

            else if (!isValidBarcode)
            {
                errorMessage += "This is not a valid barcode";
                colorCode     = "red";
            }

            return(Json(new { errorColor = colorCode, error = errorMessage }));
        }
 public IHttpActionResult Get(int id)
 {
     //string accessType = "CheckIn_ViewAll";
     //ThrowIfUserHasNoRole(accessType);
     using (CheckInQuery checkInQuery = new CheckInQuery(Db))
     {
         var data = checkInQuery.GetByPrimaryKey(id);
         SaveLog("CheckIn", "Get", JsonConvert.SerializeObject(new { primaryKey = id }));
         return(Ok(new SuccessResponse(data)));
     }
 }
Beispiel #4
0
 public CheckInEntryDataProvider(GlobalSolusindoDb db, tblM_User user, AccessControl accessControl, CheckInQuery checkInQuery) : base(db, user)
 {
     this.accessControl = accessControl;
     this.checkInQuery  = checkInQuery;
 }