public FrontpadOrder ConvertToFrontpadOrder()
        {
            List <string> productsId     = new List <string>();
            List <string> productsNumber = new List <string>();

            getProductIdAndNumberArrays(Products, ref productsId, ref productsNumber);

            string phone         = Helper.ParsePhone(ClientInfo.Phone);
            var    frontpadOrder = new FrontpadOrder
            {
                Secret         = "", //устанавливается после выполнения метода уровнем выше
                ClientName     = ClientInfo.Name,
                ClientPhone    = phone,
                ProductsId     = productsId,
                ProductsNumber = productsNumber,
                Email          = Email,
                FullAddress    = ClientInfo.City + ", " + ClientInfo.Street,
                Description    = "Заказ " + OrderNumber.ToString() + ". " + Comment
            };

            return(frontpadOrder);
        }
Пример #2
0
        public static Dictionary <string, string> CreateFrontpadResponseDicDictionary(FrontpadOrder frontpadOrder, List <Product> items)
        {
            Dictionary <string, string> frontpadResponseBody = new Dictionary <string, string>();

            frontpadResponseBody.Add("secret", frontpadOrder.Secret);
            frontpadResponseBody.Add("name", frontpadOrder.ClientName);
            frontpadResponseBody.Add("phone", frontpadOrder.ClientPhone);
            frontpadResponseBody.Add("mail", frontpadOrder.Email);
            frontpadResponseBody.Add("street", frontpadOrder.FullAddress);
            frontpadResponseBody.Add("descr", frontpadOrder.Description);

            for (int i = 0; i < items.Count; i++)
            {
                frontpadResponseBody.Add("product[" + i + "]", items[i].Id);
                frontpadResponseBody.Add("product_kol[" + i + "]", items[i].Quantity);
            }

            return(frontpadResponseBody);
        }