I have a requirement where i need to save the contacts of the user and i have the following issues.
I have a user table where i would save the "user1" and i also the save the users in his contact in the same table.
And say another user "user2" has to be saved along with his contacts in user table. Consider "user2" has few contacts same as "user1"(i.e., the contact number is same but the naming is different). And i should not repeat the user who is already present. In this case i can check with contact number so if that contact number is already present i can skip saving the contact and use that id instead.
But another situation is, consider "user1" has saved his contact as "9999444494" and "user2" also has "9999444494" but they both belongs to different country say "country code +91 and +92 respectively" but it looks as if the contacts were same if they do not specify the country code and how could i get these differentiations and save it in the table.
I am stuck with this issue. Please help me. Thanks in advance.
There is no reason to assume that just because two people have the same phone number, that they will change that phone number at the same time.
Say your two users are employees of the same company and they give the main switchboard number as their contact number. When one quits the company their contact info will change but the other will stay the same. The same could happen if your users are members of a family who share a phone. When one leaves (child moves out, parents divorce,...) the contact numbers for each user will be different.
Therefore: don't try to rationalize contact numbers down to a single record. Repeated entries are not the same as duplicate entries when that repetition is coincidental.
Regarding country code, you need to include that in your contact information in either the same column or a separate column. If that country code is nullable then keeping it separately might be helpful so that you can see plainly that the information is missing.
Related
I am trying to make small POS system, using FDMem table to fill items for the customer.
In case the customer forget his money or go to change a product .. and the customers in the line move and new customer shows up asking to start sale process, how can I save or freeze the current state of the FDMem table holding the products of the previous customer and start a new order and finish the sale. Then, when the first customer comes back, how can I resume the previous sales process and reactivate the previous FDMem table with it's items?
Add one more column in the FDMem table. That column could take 3 values: 'Finalized', 'Opened' and 'Paused' depending how the "status" of the sales is going. You can then navigate between the records.
So if I understand you correctly you want to be able to handle multiple customers or orders at the same time.
One solution one would guess would be to assign each customer unique number and them add that number as additional field to each record in your database. Now assigning unique values to online customers isn't particularly difficult. In fact you already have such information in form of session ID. But doing something like this for customers in a physical store is not feasible.
But there is another similar solution. Most Tax authorities require any shops to issue a receipt for any purchase made. And each of those receipts needs to have a unique number. So you could reserve a new receipt number when customer gets to your POS for the first time and you start adding its items to the system. Then you might want to have another table with all reserved receipt numbers and their current status, so you can know which receipt has been finished which one is still pending completion or which one was cancelled.
I have two indexes, Profile and Company. In profile it consists of user details along with userId. I have reference of userId in company index. Can I search users on company index by full name with the help of userId reference?
Company
userId:0WhaoyZhSKb6aUp181MHadWoBMM2
objectID:-Kr7JI35Zh_jSkIJw87z0WhaoyZhSKb6aUp181MHadWoBMM2
Profile
objectID::0WhaoyZhSKb6aUp181MHadWoBMM2
userName:dhcjcj
fullname:kurt angle
accountType:3
category:1
dob:996689700
email:tester31#gmail.com
fname:Kurt
gender:1
lname:Angle
What I would suggest you is to perform two calls then:
First one with the name as a search query to your Profile index to retrieve its userId
Second one with the userId as as search query to your Company index to retrieve the company
However, keep it mind that Algolia is a search engine and hence, will not provide you all the features of an RDBMS such as a JOIN that you would need in your case.
If I misunderstood your issue, could you provide us more details and your application ID in an email addressed to support#algolia.com, so that it would be easier to discuss about your specific use-case.
When I invoke discoverAllContactUserInfosWithCompletionHandler: the returned array of CKDiscoveredUserInfo has three distinct userRecordIDs but these are all for a person with the same firstName + lastName. The three userRecordIDs share the same recordName but differ by zoneID. As best I can figure this is the same person with three 'iCloud' email addresses: icloud.com, me.com, mac.com. Presenting all three in my App's UI is a non-starter given that they are indistinguishable.
Is there any reason to choose one of the multiple records over another? Is my presumption that they are indeed different iCloud mail addresses correct? Can I go from userRecordID to email?
[I know the email accounts; presumably I could query with discoverUserInfoWithEmailAddress:completionHandler and correlate the results myself.
The recordName is the only part that really matters here, but it's odd that the userRecordIDs have different zoneIDs. They should all be in the default public zone, so you might be hitting a bug. What zone IDs are you seeing?
If you have to pick one record ID, go with the one in -[CKRecordZone defaultRecordZone]
I have a custom membership provider which I extended - added a couple of fields, first name, last name, adress, zip code and city.
now, these fields reside in the aspnet_Membership table so that I can easily access them when using the static Membership asp.net class.
now, I want to be able so save customer purchase order data (first name, last name, adress, zip code and city) to the database.
should I in my order model/table use a new set of fields - first name, last name, adress, zip code, city or should I create a relationship between my asp_Membershihp table and my Orders table?
Also, If i have dupe data, once a users asks for his account to be removed I wont have any orphan rows in my Orders table if I use the first method.
so, which is best, to have the user data, first name, last name, adress, zipcode, city in only one table and create a relationship between aspnet_Membership table and Orders table OR create the dupe fields in my Orders table with no relationship to the aspnet_Membership table? Pros cons?
Thanks!
/P
In this scenario, i would rather have the relationship.
Also being the data you are storing Orders (i assume at least, from the name :)) i would maintain a separate set of data on the Order, so one would optionally be able to specify different billing/shipping data than it's Identity on the site.
Another valid reason for duplicate at least some data on the Order table is to have all the necessary data relevant to an Order in the table, thus avoiding problems if the Client request his data to be deleted, and maintain the original values for that data on the order if the customer data were to change in time.
If you are able to, though, you should not actually delete User data, but have a field in which you specify if the User isActive or isDeleted.
I would like to show information on my website based on user's geography. In my current design would not want the user to enter their location/zip code.
Using IP I can find user's location but how do i leverage this information to show relevant events/information from surrounding cities/town.
Thanks
Based on IPs, you only have a certain accuracy with showing location. You should have a option that lets them enter their city/state or zip code.
Once you have long/lat, you just need to run a query to find records in your database a specific distance from that long/lat.
PHP/MySQL: Select locations close to a given location from DB
http://www.ipinfodb.com/ip_location_api.php
this will send you an xml response with the pertinent information
Lets say you can get their City from the IP address. You would need a database of cities with ID's that would pertain to other database entries. Like:
database table cities database table restaurants
--------------------- --------------------------
ID City ID city_id name
1 Los Angelos 1 1 Big Al's
Then you could search for restaurants that have the city_id of the city you got from their IP.
There are so many different approaches to relational databases. This is just one small example.