/// <summary>
        /// Call web service for send nomination
        /// </summary>
        private void CallSendNominationWebService()
        {
            
            objYourDetlginViewModel.ProgressBarVisibilty = Visibility.Visible;
            string apiUrl = RxConstants.sendNomination;
            try
            {
                string gender = "0";
                if (objYourDetlginViewModel.IsMaleSelected)
                {
                    gender = "1";
                }
                else
                {
                    gender = "0";
                }


                if (objYourDetlginViewModel.IsMailSelected)
                {
                    verifyBy = "mail";
                }
                else
                {
                    verifyBy = "sms";
                }

                string deviceUniqueID = string.Empty;
                object deviceID;

                if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out deviceID))
                {
                    byte[] myDeviceID = (byte[])deviceID;
                    deviceUniqueID = Convert.ToBase64String(myDeviceID);
                }

                string deviceName = string.Empty;
                object devicename;

                if (DeviceExtendedProperties.TryGetValue("DeviceName", out devicename))
                {
                    deviceName = devicename.ToString();
                }
                string emptyStringValue = "Choose Doctor for surgery (Optional)";
                SendNominationRequest objInputParameters = new SendNominationRequest
                {
                    pharmacyid = App.SignUpPharId.ToUpper(),
                    deviceid = deviceUniqueID,
                    model = DeviceModel,
                    os = "Windows Phone",
                    pushid = App.ApId,
                    fullname = objYourDetlginViewModel.FirstName + " " + objYourDetlginViewModel.LastName,
                    nhs = objYourDetlginViewModel.NHS,
                    birthdate = objYourDetlginViewModel.DOB.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture),
                    address1 = objYourDetlginViewModel.AddressLine1,
                    address2 = objYourDetlginViewModel.AddressLine2,
                    postcode = objYourDetlginViewModel.PostCode,
                    phone = objYourDetlginViewModel.MobileNo,
                    mail = objYourDetlginViewModel.EmailId,
                    sex = gender,
                    pin = App.HashPIN,
                    country = objYourDetlginViewModel.SelectedCountry,
                    mode = "new",
                    verifyby = verifyBy,
                    surgery = new SendNominationRequestSurgery
                    {
                        name = ((!string.IsNullOrEmpty(App.SelectedSurgen)) && (!string.IsNullOrWhiteSpace(App.SelectedSurgen)) && (App.SelectedSurgen != emptyStringValue)) ? App.SelectedSurgen : string.Empty,

                        address = ((!string.IsNullOrEmpty(App.SurgeonAddress)) && (!string.IsNullOrWhiteSpace(App.SurgeonAddress)) && (App.SelectedSurgen != emptyStringValue)) ? App.SurgeonAddress : string.Empty
                    },
                    system_version = "android",
                    app_version = "1.6",
                    branding_version = "MLP"
                };
                App.SelectedSurgen = string.Empty;
                App.SurgeonAddress = string.Empty;
                WebClient sendNominationswebservicecall = new WebClient();
                var uri = new Uri(apiUrl, UriKind.RelativeOrAbsolute);

                var json = JsonHelper.Serialize(objInputParameters);
                sendNominationswebservicecall.Headers["Content-type"] = "application/json";
                sendNominationswebservicecall.UploadStringCompleted += sendNominationswebservicecall_UploadStringCompleted;

                sendNominationswebservicecall.UploadStringAsync(uri, "POST", json);
            }
            catch (Exception)
            {

                MessageBox.Show("Sorry, Unable to process your request.");
            }
           
        }
Пример #2
0
        /// <summary>
        /// Send Nomination for changing pharmacy
        /// </summary>
        private void CallSendNominationWebService()
        {
            objSignUpViewModel.ProgressBarVisibilty = Visibility.Visible;
            string apiUrl1 = RxConstants.sendNomination;

            string deviceUniqueID = string.Empty;
            try
            {
                object deviceID;

                if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out deviceID))
                {
                    byte[] myDeviceID = (byte[])deviceID;
                    deviceUniqueID = Convert.ToBase64String(myDeviceID);
                }
                string deviceName = string.Empty;
                object devicename;

                if (DeviceExtendedProperties.TryGetValue("DeviceName", out devicename))
                {
                    deviceName = devicename.ToString();
                }
                LoginResponse objResponse = App.ObjLgResponse;
                if (objResponse != null)
                {
                    SendNominationRequest objInputParameters = new SendNominationRequest
                    {
                        pharmacyid = App.LoginPharId.ToUpper(),
                        deviceid = deviceUniqueID,
                        model = DeviceModel,
                        os = "Windows Phone",
                        pushid = App.ApId,
                        fullname = objResponse.payload.name,
                        firstname = string.Empty,
                        lastname = string.Empty,
                        forename = string.Empty,
                        surname = string.Empty,
                        nhs = objResponse.payload.nhs,
                        birthdate = objResponse.payload.birthdate,
                        address1 = objResponse.payload.address1,
                        address2 = objResponse.payload.address2,
                        postcode = objResponse.payload.postcode,
                        phone = objResponse.payload.phone,
                        mail = objResponse.payload.mail,
                        sex = Convert.ToString(objResponse.payload.sex),
                        pin = App.HashPIN,
                        country = objResponse.payload.country,
                        mode = "old",
                        verifyby = objResponse.payload.verifyby,
                        surgery = new SendNominationRequestSurgery { name = objResponse.payload.surgery.name, address = objResponse.payload.surgery.address },
                        system_version = "android",
                        app_version = "1.6",
                        branding_version = "MLP"
                    };


                    WebClient sendNominationswebservicecall = new WebClient();
                    var uri1 = new Uri(apiUrl1, UriKind.RelativeOrAbsolute);

                    var json = JsonHelper.Serialize(objInputParameters);
                    sendNominationswebservicecall.Headers["Content-type"] = "application/json";
                    sendNominationswebservicecall.UploadStringCompleted += sendNominationswebservicecall_UploadStringCompleted;

                    sendNominationswebservicecall.UploadStringAsync(uri1, "POST", json);
                }
                App.IsChangePharmacy = false;
            }
            catch (Exception)
            {

                MessageBox.Show("Sorry, Unable to process your request.");
            }

        }