Exemplo n.º 1
0
        public ClockInRecorded()
        {
            InitializeComponent();

            RecordTimeModel record = new RecordTimeModel();

            location.Text = Globals.LOCATION;
            clockin.Text  = Globals.CLOCKIN;
        }
        public async Task <bool> RecordTimePost(string date, string time, string lattitude, string langitude)
        {
            bool success   = false;
            var  keyValues = new RecordTimeModel()
            {
                UserID            = Globals.UserID,
                ClientProjectID   = "1",
                CheckIndate       = date,
                checkInTime       = time,
                checkInLat        = lattitude,
                checkInLong       = langitude,
                isAutoCheckin     = "1",
                checkInReason     = "Mobile",
                CheckInComment    = "Mobile",
                projectLocationID = "1",
                DeviceToken       = Globals.DeviceToken
            };

            var    json      = JsonConvert.SerializeObject(keyValues);
            var    content   = new StringContent(json, Encoding.UTF8, "application/json");
            string myContent = await content.ReadAsStringAsync();

            var client  = new HttpClient();
            var request = await client.PostAsync("http://techsamhitasolutions.com/employeecheckinapis/ClockIn/", content);

            request.EnsureSuccessStatusCode();
            var response = await request.Content.ReadAsStringAsync();

            RootobjectRecord res    = JsonConvert.DeserializeObject <RootobjectRecord>(response);
            String           status = res.status;

            if (status == "Success")
            {
                success = true;
            }

            return(success);
        }