コード例 #1
0
ファイル: VehicleDetails.xaml.cs プロジェクト: kleitz/WPApp
        private async void updateVehicleInfo(string type, string motorplate, string reg_certificate)
        {
            Dictionary <string, string> postData = new Dictionary <string, string>();

            postData.Add("type", type);
            postData.Add("license_plate", motorplate);
            postData.Add("reg_certificate", reg_certificate);

            postData.Add("vehicle_img", ImageConvert.ImageConvert.convertImageToBase64(imgVehicle));
            postData.Add("license_plate_img", ImageConvert.ImageConvert.convertImageToBase64(imgLicensePlate));
            postData.Add("motor_insurance_img", ImageConvert.ImageConvert.convertImageToBase64(imgMotorInsurance));

            HttpFormUrlEncodedContent content =
                new HttpFormUrlEncodedContent(postData);

            var result = await RequestToServer.sendPutRequest("vehicle/" + Global.GlobalData.selectedVehicle.vehicle_id, content);

            JObject jsonObject = JObject.Parse(result);

            if (jsonObject.Value <bool>("error"))
            {
                MessageBox.Show(jsonObject.Value <string>("message"));
            }
            else
            {
                //Global.GlobalData.isDriver = true;
                MessageBox.Show(jsonObject.Value <string>("message"));
                // refresh lai trang
                NavigationService.Navigate(new Uri("/Refresh.xaml", UriKind.RelativeOrAbsolute));
            }
        }
コード例 #2
0
        private async void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            //validate all fields

            //update
            Dictionary <string, string> postData = new Dictionary <string, string>();

            postData.Add("driver_license", txtbDriverLicense.Text.Trim());

            postData.Add("driver_license_img", ImageConvert.ImageConvert.convertImageToBase64(imgDriverLicense));

            HttpFormUrlEncodedContent content =
                new HttpFormUrlEncodedContent(postData);
            var result = await RequestToServer.sendPutRequest("driver", content);

            JObject jsonObject = JObject.Parse(result);

            if (jsonObject.Value <bool>("error"))
            {
                MessageBox.Show(jsonObject.Value <string>("message"));
            }
            else
            {
                //Global.GlobalData.isDriver = true;
                MessageBox.Show(jsonObject.Value <string>("message"));
                // refresh lai trang
                NavigationService.Navigate(new Uri("/Refresh.xaml", UriKind.RelativeOrAbsolute));
            }
        }
コード例 #3
0
ファイル: AccountInfo.xaml.cs プロジェクト: kleitz/WPApp
        public async void updateUserInfo(string fullname, string email, string personalID, string phone)
        {
            Dictionary <string, string> postData = new Dictionary <string, string>();

            postData.Add("fullname", fullname);
            postData.Add("email", email);
            postData.Add("personalID", personalID);
            postData.Add("phone", phone);

            postData.Add("link_avatar", ImageConvert.ImageConvert.convertImageToBase64(imgAvatar));
            postData.Add("personalID_img", ImageConvert.ImageConvert.convertImageToBase64(imgPersonalID));

            HttpFormUrlEncodedContent content =
                new HttpFormUrlEncodedContent(postData);
            var result = await RequestToServer.sendPutRequest("user", content);

            JObject jsonObject = JObject.Parse(result);

            if (jsonObject.Value <bool>("error"))
            {
                MessageBox.Show(jsonObject.Value <string>("message"));
            }
            else
            {
                //Global.GlobalData.isDriver = true;
                MessageBox.Show(jsonObject.Value <string>("message"));
                // refresh lai trang
                NavigationService.Navigate(new Uri("/Refresh.xaml", UriKind.RelativeOrAbsolute));
            }
        }
コード例 #4
0
ファイル: AccountInfo.xaml.cs プロジェクト: kleitz/WPApp
        public async void updatePassword(string newPassword)
        {
            Dictionary <string, string> postData = new Dictionary <string, string>();

            postData.Add("value", newPassword);

            HttpFormUrlEncodedContent content =
                new HttpFormUrlEncodedContent(postData);
            var result = await RequestToServer.sendPutRequest("user/password", content);

            JObject jsonObject = JObject.Parse(result);

            MessageBox.Show(jsonObject.Value <string>("message"));
        }
コード例 #5
0
        public async void updateUserInfomation()
        {
            Dictionary <string, string> postData = new Dictionary <string, string>();

            postData.Add("fullname", "");
            postData.Add("phone", "");
            postData.Add("personalID", "");
            postData.Add("personalID_img", "");
            postData.Add("link_avatar", "");
            postData.Add("locked", "");
            HttpFormUrlEncodedContent content =
                new HttpFormUrlEncodedContent(postData);
            var result = await RequestToServer.sendPutRequest("user", content);

            JObject jsonObject = JObject.Parse(result);

            MessageBox.Show(jsonObject.Value <string>("message"));
        }