public static string[] purchase(string username, string creditNumber, string validity, string cvv)
        {
            if (user.getUserName().Equals("guest") || !user.getUserName().Equals(username))
            {
                UserServices.addGuest();
            }
            string[] temp = BuissnessLayer.UserServices.purchase(username, creditNumber, validity, cvv);
            if (temp == null || temp[0].Equals("false"))
            {
                return(temp);
            }
            ICollection <SLreceipt> list = new List <SLreceipt>();

            for (int i = 1; i < temp.Length; i++)
            {
                SLreceipt            receipt     = ProductController.makeReceipt(convertReceipt(temp[i]));
                ICollection <string> storeOwners = StoreController.searchStore(receipt.storeName).ownerNames;
                foreach (string owner in storeOwners)
                {
                    string msg = username + "has bought the following products from the store " + receipt.storeName + ":";
                    ICollection <SLproduct> products = receipt.products;
                    foreach (SLproduct product in products)
                    {
                        msg += "\n" + product.productName + " by " + product.manufacturer + " X" + product.amount;
                    }
                    UserServices.getUser(owner).addAlarm("Purchased products", msg);
                }
                list.Add(receipt);
            }

            //     DirAppend.AddToLogger("user " + user.getUserName() + " just purchase his cart", Result.Log);
            return(ReceiptsToStringArray(list));
        }
        private static string ReceiptToString(SLreceipt receipt)
        {
            string ans = "";

            foreach (SLproduct pro in receipt.products)
            {
                ans += ProductToString(pro) + "&";
            }
            if (ans.Length > 0)
            {
                ans = ans.Substring(0, ans.Length - 1); // delete the & in the end
            }
            return(receipt.userName + "$" + receipt.storeName + "$" + receipt.price + "$" + receipt.date.ToString("dddd, dd MMMM yyyy HH:mm:ss") + "$" + receipt.receiptID + "$" + ans);
        }