Exemplo n.º 1
0
        public async Task <string> CheckOutStudent(
            CheckInRec checkinRec)
        {
            var url  = new Uri($"{serviceAddress}/CheckOutStudent");
            var json = JsonConvert.SerializeObject(checkinRec);

            return(await this.PostAsString(url, json));
        }
        async Task <Tuple <bool, string> > CheckStudentInOrOut()
        {
            bool   isCheckedIn   = false;
            string checkinStatus = String.Empty;
            var    cr            = new CheckInRec();

            var rec = new Rec();

            rec.CCode = Details.CCode.ToString();
            rec.IDNum = Details.IDNumber;

            rec.Excused = "True";
            rec.Remarks = "";
            rec.PKID    = "";
            rec.Stamp   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            rec.CompID  = Details.CompID.ToString();
            cr.rec      = rec;

            this.CheckinRecord = cr;

            if (ShouldSignIn())
            {
                this.CheckinResult = await api.CheckInStudent(cr);

                if (!this.CheckinResult.Contains("success"))
                {
                    throw new Exception("Could not Check in student");
                }

                isCheckedIn   = true;
                checkinStatus = "Checked In";
            }
            else
            {
                rec.PKID           = this.LatestLog?.PKID.ToString();
                this.CheckinResult = await api.CheckOutStudent(cr);

                if (!this.CheckinResult.Contains("success"))
                {
                    throw new Exception("Could not Check in student");
                }

                isCheckedIn   = false;
                checkinStatus = "Checked Out";
            }


            return(Tuple.Create <bool, string>(isCheckedIn, checkinStatus));
        }
Exemplo n.º 3
0
        public async Task <CheckInRec> GetStudentCheckinRecord(
            int ccode,
            DateTime date)

        {
            CheckInRec checkinRec = null;

            try
            {
                var dts  = date.ToString("MM-dd-yyyy");
                var url  = $"{serviceAddress}/GetStudentCheckinRecord/{ccode}/{dts}";
                var json = await this.GetAsString(url);

                checkinRec = JsonConvert.DeserializeObject <CheckInRec>(json);
            }
            catch (Exception ex)
            {
                var p = ex.Message;
            }

            return(checkinRec);
        }