Esempio n. 1
0
        //public async Task<List<Address>> GetAddresses()

        public async Task <ObservableCollection <Address> > GetAddresses()
        {
            //List<Address> Addresses = null;
            var app = Application.Current as App;

            try
            {
                Dictionary <string, object> payload = new Dictionary <string, object>();
                payload.Add("merchant_id", app.Merchantid);
                payload.Add("phone_number", app.UserPhoneNumber);
                payload.Add("access_key", app.SecurityAccessKey);
                AddressListResponse <Address> robject = await this.Post <AddressListResponse <Address> >(this.getAuthUrl("getCustomerAddress"), payload, null);

                if (robject.Status.ToLower() == "success")
                {
                    return(robject.Data);
                }
                else
                {
                    return(null);
                }

                /* Addresses = new List<Address>
                 * {
                 *   new Address
                 *   {
                 *       Name = "Samar Jeet",
                 *       MobileNo = "9706821681",
                 *       DoorNo = "123",
                 *       Area = "Sarjapur",
                 *       City = "Bangalore",
                 *       State = "Karnataka",
                 *       Country = "India",
                 *       PostalCode = "560035",
                 *       AddressType = "Home"
                 *   },
                 *   new Address
                 *   {
                 *       Name = "Samar Jeet",
                 *       MobileNo = "9706821681",
                 *       DoorNo = "123",
                 *       Area = "Sarjapur",
                 *       City = "Bangalore",
                 *       State = "Karnataka",
                 *       Country = "India",
                 *       PostalCode = "560035",
                 *       AddressType = "Office"
                 *   }
                 * };*/
            }
            catch (Exception ex)
            {
                throw ex;
            }

            //return await Task.FromResult(Addresses);
        }
Esempio n. 2
0
        /// <summary>
        /// Populates the data for view model from json file.
        /// </summary>
        /// <typeparam name="T">Type of view model.</typeparam>
        /// <param name="fileName">Json file to fetch data.</param>
        /// <returns>Returns the view model object.</returns>
        ///

        public async Task <bool> SaveAddressInfo(Address Profile)
        {
            var app = App.Current as App;
            Dictionary <string, object> payload = new Dictionary <string, object>();

            payload.Add("access_key", app.SecurityAccessKey);
            payload.Add("merchant_id", app.Merchantid);
            payload.Add("phone_number", app.UserPhoneNumber);
            payload.Add("secondPhone_number", Profile.AlternatePhone);
            payload.Add("address1", Profile.Address1);
            payload.Add("address2", Profile.Address2);
            payload.Add("longitude", Profile.Longitude);
            payload.Add("latitude", Profile.Latitude);
            payload.Add("tag_name", Profile.TagName);
            payload.Add("first_name", Profile.FirstName);
            payload.Add("society_buildingNo", Profile.SocietyBuildingNo);
            payload.Add("flatno_doorno", Profile.FlatNoDoorNo);
            payload.Add("city", Profile.City);
            payload.Add("state", Profile.State);
            payload.Add("country", Profile.Country);
            payload.Add("area", Profile.Area);
            payload.Add("postalcode_zipcode", Profile.PostalCodeZipCode);

            /*
             * {
             * "merchant_id":"180",
             * "phone_number":"9972792530",
             * "address1":"Silver Spirit tech park, near Infosys",
             * "address2":"Mysuru",
             * "longitude":"76.593869",
             * "latitude":"12.363465",
             * "tag_name":"Office",
             * "first_name":"gyvgv",
             * "society_buildingNo":"biuu5655",
             * "flatno_doorno":"216",
             * "city":"gguygug",
             * "state":"vyug",
             * "country":"guigu",
             * "area":"buuguyf",
             * "postalcode_zipcode":"563333"
             * }
             *
             */

            AddressListResponse <Dictionary <string, object> > response = await this.Post <AddressListResponse <Dictionary <string, object> > >(this.getAuthUrl("SetCustomerAddress"), payload, null);

            if (response.Status.ToLower() == "success")
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
        public async Task <bool> SaveCustomerInfo(CustomerProfile Profile)
        {
            var app = Application.Current as App;

            try
            {
                Dictionary <string, object> payload = new Dictionary <string, object>();
                payload.Add("access_key", app.SecurityAccessKey);
                payload.Add("phone_number", app.UserPhoneNumber);
                payload.Add("secondphone_number", Profile.SecondaryPhone);
                payload.Add("merchant_id", app.Merchantid);
                payload.Add("first_name", Profile.FirstName);
                payload.Add("last_name", Profile.LastName);
                payload.Add("device", "");
                payload.Add("latitude", "");
                payload.Add("longitude", "");
                payload.Add("email_id", Profile.Email);
                payload.Add("address1", "");
                payload.Add("address2", "");
                payload.Add("city", Profile.City);
                payload.Add("gst_number", Profile.GSTNumber);
                payload.Add("state", Profile.State);
                payload.Add("country", Profile.Country);
                AddressListResponse <Dictionary <string, object> > response = await this.Post <AddressListResponse <Dictionary <string, object> > >(this.getAuthUrl("setcustInfo"), payload, null);

                if (response.Status.ToLower() == "success")
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch
            {
                return(false);
            }
        }