Esempio n. 1
0
        public void populatingCustomerDb()
        {
            EstablishConnection();
            OracleCommand command = new OracleCommand();

            command.Connection = conn;
            List <int> idList = jsonQueryList();

            foreach (var temp in idList)
            {
                ProfilePullHelper helper       = new ProfilePullHelper();
                ProfilePull       customerPull = ProfilePullHelper.PullProfile(Convert.ToString(temp));

                command.CommandText = "INSERT INTO fin_customer_data VALUES(:customerIDP, :firstNameP, :lastNameP, :customerStatusP, :streetNameP, :zipCodeP, :cityP, :stateP, :countryP, :emailP, :contactNumberP, :dateOfBirthP)";
                command.Parameters.Add(":customerIDP", customerPull.customerdetails.customerid);
                command.Parameters.Add(":firstNameP", customerPull.customerdetails.fname);
                command.Parameters.Add(":lastNameP", customerPull.customerdetails.lname);
                command.Parameters.Add(":customerStatusP", customerPull.customerdetails.customerstatus);
                command.Parameters.Add(":streetNameP", customerPull.customerdetails.connectionaddress.streetname);
                command.Parameters.Add(":zipCodeP", customerPull.customerdetails.connectionaddress.zipcode);
                command.Parameters.Add(":cityP", customerPull.customerdetails.connectionaddress.city);
                command.Parameters.Add(":stateP", customerPull.customerdetails.connectionaddress.state);
                command.Parameters.Add(":countryP", customerPull.customerdetails.connectionaddress.country);
                command.Parameters.Add(":emailP", customerPull.customerdetails.email);
                command.Parameters.Add(":contactNumberP", customerPull.customerdetails.contactnumber);
                command.Parameters.Add(":dateOfBirthP", customerPull.customerdetails.dateofbirth);
                //command.Parameters.Add(":billAmountP", customerPull.)
                command.ExecuteNonQuery();
            }
            conn.Close();
        }
        public static Profile PullProfile(string customerId)
        {
            Profile customProfile = null;
            string  profileJson   = GetJsonFromUrl(String.Format(@"{0}/{1}", PROFILE_PULL_URL, customerId));

            if (!String.IsNullOrWhiteSpace(profileJson) && profileJson != "null")
            {
                ProfilePull fullProfile = GetObjectFromJson <ProfilePull>(profileJson);
                customProfile = fullProfile.GetCustomProfile();
            }

            return(customProfile);
        }
Esempio n. 3
0
 public static Profile PullProfile(string customerId)
 {
     Profile customProfile = null;
     //string profileJson = GetJsonFromUrl(String.Format(@"{0}/{1}", PROFILE_PULL_URL, customerId));
     string profileJson = File.ReadAllText("");//give json file path here
     if(!String.IsNullOrWhiteSpace(profileJson))
     {
         ProfilePull fullProfile = GetObjectFromJson<ProfilePull>(profileJson);
         customProfile = fullProfile.GetCustomProfile();
     }
     
     return customProfile;
 }
Esempio n. 4
0
        public static ProfilePull PullProfile(string customerId)
        {
            ProfilePull customerProfile     = null;
            string      url                 = profilePullUrl + "42";//customerid
            string      customerProfileJson = GetJsonFromUrl(url);

            //string customerProfileJson = File.ReadAllText("D:\\profile.json");//give json file path here
            if (!String.IsNullOrWhiteSpace(customerProfileJson))
            {
                customerProfile = GetObjectFromJson <ProfilePull>(customerProfileJson);
            }

            return(customerProfile);
        }
Esempio n. 5
0
        public void populatingCustomerDb()
        {
            List <int> idList = jsonQueryList();

            foreach (var temp in idList)
            {
                ProfilePull customerPull = ProfilePullHelper.PullProfile(Convert.ToString(temp));
                if (customerPull != null)
                {
                    try
                    {
                        OracleCommand command = new OracleCommand();
                        command.Connection = conn;
                        EstablishConnection();
                        command.CommandText = @"INSERT INTO fincustomerdata VALUES(:customerIDP, :firstNameP, :lastNameP, :customerStatusP, :streetNameP, :zipCodeP, :cityP, :stateP, :countryP, :emailP, :contactNumberP, TO_DATE(:dateOfBirthP,'YYYY-MM-DD'))";
                        command.Parameters.Add(":customerIDP", customerPull.customerdetails.customerid);
                        command.Parameters.Add(":firstNameP", customerPull.customerdetails.fname);
                        command.Parameters.Add(":lastNameP", customerPull.customerdetails.lname);
                        command.Parameters.Add(":customerStatusP", customerPull.customerdetails.customerstatus);
                        command.Parameters.Add(":streetNameP", customerPull.customerdetails.connectionaddress.streetname);
                        command.Parameters.Add(":zipCodeP", customerPull.customerdetails.connectionaddress.zipcode);
                        command.Parameters.Add(":cityP", customerPull.customerdetails.connectionaddress.city);
                        command.Parameters.Add(":stateP", customerPull.customerdetails.connectionaddress.state);
                        command.Parameters.Add(":countryP", customerPull.customerdetails.connectionaddress.country);
                        command.Parameters.Add(":emailP", customerPull.customerdetails.email);
                        command.Parameters.Add(":contactNumberP", customerPull.customerdetails.contactnumber);
                        command.Parameters.Add(":dateOfBirthP", customerPull.customerdetails.dateofbirth);

                        command.ExecuteNonQuery();
                        conn.Close();
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e.Message);
                    }
                }
            }
        }