Beispiel #1
0
        private async Task <DialogTurnResult> CameraModelStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var _cameramodels = await WebServicesFactory.QueryProductData("MV", "LIC");

            var _models    = ProductUtil.FilterforHardware(_cameramodels);
            var actionlist = new List <CardAction>()
            {
            };

            _models.ForEach(model =>
            {
                actionlist.Add(new CardAction
                {
                    Title = model.SKU,
                    Type  = ActionTypes.ImBack,
                    Value = model.SKU
                });
            });

            var response = MessageFactory.Text($"Please select a model? ");

            response.SuggestedActions = new SuggestedActions()
            {
                Actions = actionlist
            };

            return(await stepContext.PromptAsync(nameof(TextPrompt), new PromptOptions
            {
                Prompt = response
            }));
        }
Beispiel #2
0
        private async Task <DialogTurnResult> SwitchModelStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var _switchmodels = await WebServicesFactory.QueryProductData("MS", "LIC");

            var actionlist = new List <CardAction>()
            {
            };

            _switchmodels.listJurumaniCloudInventory_Models.Items.ForEach(model =>
            {
                actionlist.Add(new CardAction
                {
                    Title = model.SKU,
                    Type  = ActionTypes.ImBack,
                    Value = model.SKU
                });
            });

            var response = MessageFactory.Text($"Please select a model? ");

            response.SuggestedActions = new SuggestedActions()
            {
                Actions = actionlist
            };

            return(await stepContext.PromptAsync(nameof(TextPrompt), new PromptOptions
            {
                Prompt = response
            }));
        }
Beispiel #3
0
        private async Task <DialogTurnResult> SwitchSummaryStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var _switchmodel   = new BitrixProductRowModel();
            var _switchlicense = new BitrixProductRowModel();
            var _Basket        = await _botAccessors.QuoteBasket.GetAsync(stepContext.Context, () => new QuoteBasketModel(), cancellationToken);

            var _current_rate    = _Basket.currentRate;
            var _licenseduration = _Basket.licenseDuration;
            var _title           = stepContext.Values["switchmodel"].ToString();

            var _strippedsku = ProductUtil.generateSKU(_title);
            var _quantity    = stepContext.Result.ToString();
            //return to menu if the sku wasnt found

            var _licenseparam = $"{_strippedsku}-{_licenseduration}";
            //await stepContext.Context.SendActivityAsync(_licenseparam);
            var _switchdata = await WebServicesFactory.QueryProductData(_title, "LIC");

            var _switchlicensedata = await WebServicesFactory.QueryProductData(_licenseparam, "HW");

            //await stepContext.Context.SendActivityAsync(MessageFactory.Text("sku" + _switchlicensedata.listJurumaniCloudInventory_Models.Items[0].SKU));
            if (_switchdata.listJurumaniCloudInventory_Models.Items.Count == 0)
            {
                await stepContext.Context.SendActivityAsync(MessageFactory.Text($"Product {_title} wasn't found in the catalog"));
            }
            else
            {
                var _price = double.Parse(_switchdata.listJurumaniCloudInventory_Models.Items[0].LIST_PRICE_USD) * _current_rate;
                _switchmodel.PRICE          = _price;
                _switchmodel.PRODUCT_NAME   = _title;
                _switchmodel.QUANTITY       = _quantity;
                _switchlicense.PRICE        = float.Parse(_switchlicensedata.listJurumaniCloudInventory_Models.Items[0].LIST_PRICE_USD) * _current_rate;
                _switchlicense.QUANTITY     = _quantity;
                _switchlicense.PRODUCT_NAME = _switchlicensedata.listJurumaniCloudInventory_Models.Items[0].SKU;


                await stepContext.PromptAsync(nameof(NumberPrompt <int>), new PromptOptions
                {
                    Prompt = MessageFactory.Text($"You ordered {stepContext.Result}x {stepContext.Values["switchmodel"]}s at R{_price} each")
                });

                _Basket.products.Add(_switchmodel);
                _Basket.products.Add(_switchlicense);
                await _botAccessors.QuoteBasket.SetAsync(stepContext.Context, _Basket, cancellationToken);

                await stepContext.Context.SendActivityAsync(MessageFactory.Text(_Basket.ToString()));
            }



            return(await stepContext.ReplaceDialogAsync("AddMoreDevicesDialog"));
        }
Beispiel #4
0
        private async Task <DialogTurnResult> ModelStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var _basket = await _botAccessors.QuoteBasket.GetAsync(stepContext.Context, () => new QuoteBasketModel(), cancellationToken);

            var _licenseduration = _basket.licenseDuration;
            var _wifilicensetype = stepContext.Result.ToString();

            if (_wifilicensetype == "Advanced" || _wifilicensetype == "ADV")
            {
                _wifilicensetype = "ADV";
                stepContext.Values["wifilicense"] = $"LIC-MR-{_wifilicensetype}-{_licenseduration}";
            }
            else if (_wifilicensetype == "Enterprise" || _wifilicensetype == "ENT")
            {
                _wifilicensetype = "ENT";
                stepContext.Values["wifilicense"] = $"LIC-{_wifilicensetype}-{_licenseduration}";
            }



            //await stepContext.Context.SendActivityAsync($"{stepContext.Values["wifilicense"]}");
            var _wifimodels = await WebServicesFactory.QueryProductData("MR", "LIC");

            var _models    = ProductUtil.FilterforHardware(_wifimodels);
            var actionlist = new List <CardAction>()
            {
            };

            _models.ForEach(model =>
            {
                actionlist.Add(new CardAction
                {
                    Title = model.SKU,
                    Type  = ActionTypes.ImBack,
                    Value = model.SKU
                });
            });

            var response = MessageFactory.Text($"Please select a model? ");

            response.SuggestedActions = new SuggestedActions()
            {
                Actions = actionlist
            };

            return(await stepContext.PromptAsync(nameof(TextPrompt), new PromptOptions
            {
                Prompt = response
            }));
        }
Beispiel #5
0
        private async Task <DialogTurnResult> FirewallSummaryStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var _Basket = await _botAccessors.QuoteBasket.GetAsync(stepContext.Context, () => new QuoteBasketModel(), cancellationToken);

            var _current_rate        = _Basket.currentRate;
            var _licensduration      = _Basket.licenseDuration;
            var _firewalllicensetype = stepContext.Values["firewalllicensetype"].ToString();
            var _firewallmodel       = new  BitrixProductRowModel();
            var _firewalllicense     = new BitrixProductRowModel();
            var _title    = (string)stepContext.Values["firewallmodel"];
            var _quantity = stepContext.Result.ToString();

            //add function to request the price of the model
            _title = ProductUtil.generateSKU(_title);
            var _licensesku = $"LIC-{_title}-{_firewalllicensetype}-{_licensduration}";
            // await stepContext.Context.SendActivityAsync(MessageFactory.Text(_licensesku));
            var _firewalldata = await WebServicesFactory.QueryProductData(_title, "LIC");

            var _firewalllicensedata = await WebServicesFactory.QueryProductData(_licensesku, "HW");

            if (_firewalldata.listJurumaniCloudInventory_Models.Items.Count == 0)
            {
                await stepContext.Context.SendActivityAsync(MessageFactory.Text($"Product {_title} was not found"));
            }
            else
            {
                var _price = double.Parse(_firewalldata.listJurumaniCloudInventory_Models.Items[0].LIST_PRICE_USD);
                await stepContext.PromptAsync(nameof(NumberPrompt <int>), new PromptOptions
                {
                    Prompt = MessageFactory.Text($"You ordered {_quantity}x {_title}  at R{_price*_current_rate} each")
                });

                _firewallmodel.PRICE          = _price * _current_rate;
                _firewallmodel.QUANTITY       = _quantity;
                _firewallmodel.PRODUCT_NAME   = _title;
                _firewalllicense.PRICE        = double.Parse(_firewalllicensedata.listJurumaniCloudInventory_Models.Items[0].LIST_PRICE_USD) * _current_rate;
                _firewalllicense.PRODUCT_NAME = _firewalllicensedata.listJurumaniCloudInventory_Models.Items[0].SKU;
                _firewalllicense.QUANTITY     = _quantity;


                _Basket.products.Add(_firewallmodel);
                _Basket.products.Add(_firewalllicense);
                await _botAccessors.QuoteBasket.SetAsync(stepContext.Context, _Basket, cancellationToken);

                await stepContext.Context.SendActivityAsync(MessageFactory.Text(_Basket.ToString()));
            }
            return(await stepContext.ReplaceDialogAsync("AddMoreDevicesDialog"));
        }
Beispiel #6
0
        private async Task <DialogTurnResult> FirewallModelStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var _firewalllicensetype = stepContext.Result.ToString();

            if (_firewalllicensetype == "Enterprise")
            {
                stepContext.Values["firewalllicensetype"] = "ENT";
            }
            else
            {
                stepContext.Values["firewalllicensetype"] = "SEC";
            }



            var _firewallmodels = await WebServicesFactory.QueryProductData("MX", "LIC");

            //filter for only hardware SKU
            var actionlist = new List <CardAction>()
            {
            };
            var _models = ProductUtil.FilterforHardware(_firewallmodels);

            _models.ForEach(model =>
            {
                actionlist.Add(new CardAction
                {
                    Title = model.SKU,

                    Type  = ActionTypes.ImBack,
                    Value = model.SKU
                });
            });

            var response = MessageFactory.Text($"Please select a model? ");

            response.SuggestedActions = new SuggestedActions()
            {
                Actions = actionlist
            };

            return(await stepContext.PromptAsync(nameof(TextPrompt), new PromptOptions
            {
                Prompt = response
            }));
        }
Beispiel #7
0
        private async Task <DialogTurnResult> CameraSummaryStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var _Basket = await _botAccessors.QuoteBasket.GetAsync(stepContext.Context, () => new QuoteBasketModel(), cancellationToken);

            var _current_rate    = _Basket.currentRate;
            var _licenseduration = _Basket.licenseDuration;
            var _licensesku      = $"LIC-MV-{_licenseduration}";
            var _cameramodel     = new BitrixProductRowModel();
            var _cameralicense   = new BitrixProductRowModel();
            var _title           = (string)stepContext.Values["cameramodel"];
            var _quantity        = float.Parse(stepContext.Result.ToString());

            _cameramodel.PRODUCT_NAME = _title;
            _cameramodel.QUANTITY     = _quantity.ToString();
            var _cameraresponse = await WebServicesFactory.QueryProductData(_title, "LIC");

            var _cameralicensedata = await WebServicesFactory.QueryProductData(_licensesku, "HW");

            //convert the usd price to zar
            var camera_zar_price = double.Parse(_cameraresponse.listJurumaniCloudInventory_Models.Items[0].LIST_PRICE_USD) * _current_rate;
            await stepContext.Context.SendActivityAsync(MessageFactory.Text($"The camera price is {_cameraresponse.listJurumaniCloudInventory_Models.Items[0].LIST_PRICE_USD}"));

            var camera_license_price = double.Parse(_cameralicensedata.listJurumaniCloudInventory_Models.Items[0].LIST_PRICE_USD) * _current_rate;

            _cameramodel.PRICE          = camera_zar_price;
            _cameralicense.PRODUCT_NAME = _licensesku;
            _cameralicense.PRICE        = camera_license_price;
            _cameralicense.QUANTITY     = _quantity.ToString();
            //calculate the zar equivalence of the license price
            await stepContext.PromptAsync(nameof(NumberPrompt <int>), new PromptOptions
            {
                Prompt = MessageFactory.Text($"You ordered {stepContext.Result}x {stepContext.Values["cameramodel"]}  at R{camera_zar_price} each")
            });

            _Basket.products.Add(_cameramodel);
            _Basket.products.Add(_cameralicense);
            await _botAccessors.QuoteBasket.SetAsync(stepContext.Context, _Basket, cancellationToken);

            await stepContext.Context.SendActivityAsync(MessageFactory.Text(_Basket.ToString()));

            return(await stepContext.ReplaceDialogAsync("AddMoreDevicesDialog"));
        }
Beispiel #8
0
        private async Task <DialogTurnResult> SummaryStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var _wifiProduct = new BitrixProductRowModel();
            var _wifilicense = new BitrixProductRowModel();
            var Basket       = await _botAccessors.QuoteBasket.GetAsync(stepContext.Context, () => new QuoteBasketModel(), cancellationToken);

            var _current_rate   = Basket.currentRate;
            var _wifilicensesku = stepContext.Values["wifilicense"].ToString();
            var _wifimodel      = (string)stepContext.Values["wifimodel"];
            var _wifiquantity   = stepContext.Result.ToString();
            var _wifidata       = await WebServicesFactory.QueryProductData(_wifimodel, "LIC");

            var _price = double.Parse(_wifidata.listJurumaniCloudInventory_Models.Items[0].LIST_PRICE_USD);
            //get the license for the  device
            var _strippedsku = ProductUtil.generateSKU(_wifimodel);

            _strippedsku = _strippedsku += Basket.licenseDuration;

            var _licensedata = await WebServicesFactory.QueryProductData(_wifilicensesku, "HW");

            await stepContext.PromptAsync(nameof(NumberPrompt <int>), new PromptOptions
            {
                Prompt = MessageFactory.Text($"You ordered {_wifiquantity}x {_wifimodel} at R{_price*_current_rate} each")
            });

            var zar_price = _price * _current_rate;

            _wifiProduct.PRICE        = zar_price;
            _wifiProduct.PRODUCT_NAME = _wifimodel;
            _wifiProduct.QUANTITY     = _wifiquantity;
            _wifilicense.PRICE        = double.Parse(_licensedata.listJurumaniCloudInventory_Models.Items[0].LIST_PRICE_USD) * _current_rate;
            _wifilicense.PRODUCT_NAME = _wifilicensesku;
            _wifilicense.QUANTITY     = _wifiquantity;
            Basket.products.Add(_wifiProduct);
            Basket.products.Add(_wifilicense);


            await _botAccessors.QuoteBasket.SetAsync(stepContext.Context, Basket, cancellationToken);

            return(await stepContext.ReplaceDialogAsync(nameof(AddMoreDevicesDialog), Basket));
        }
        } // ConfigureAppName

        public IHttpHandler GetHandler(HttpContext context, string verb, string url, string filePath)
        {
            // REMACT:
            // If this is a request to the root vdir, we will route it to the activation
            //   handler instead.
            //if (context.Request.ApplicationPath.Equals("/"))
            //{
            //    if (s_remActType == null)
            //        s_remActType = Type.GetType("System.Runtime.Remoting.Channels.Http.RemotingActivationHandler, System.Runtime.Remoting.Activation");
            //
            //    if (s_remActType != null)
            //        return (IHttpHandler)Activator.CreateInstance(s_remActType);
            //}

            //if (CompModSwitches.Remote.TraceVerbose) DumpRequest(context);
            //System.Diagnostics.Debugger.Break();

            InternalRemotingServices.DebugOutChnl("HttpRemotingHandlderFactory::GetHanlder: IN");

            DumpRequest(context);  //

            HttpRequest httpRequest = context.Request;

            ConfigureAppName(httpRequest);

            string queryString = httpRequest.QueryString[null];

            bool bVerbIsGET  = (String.Compare(httpRequest.HttpMethod, "GET", StringComparison.OrdinalIgnoreCase) == 0);
            bool bFileExists = File.Exists(httpRequest.PhysicalPath);

            if (bVerbIsGET && bFileExists && queryString == null)
            {
                InternalRemotingServices.DebugOutChnl("HttpRemotingHandlderFactory::GetHanlder: non-post -- send to WebServices");
                return(WebServicesFactory.GetHandler(context, verb, url, filePath));
            }
            else
            {
                InternalRemotingServices.DebugOutChnl("HttpRemotingHandlderFactory::GetHandler: post -- handling with Remoting");

                if (bFileExists)
                {
                    Type type = WebServiceParser.GetCompiledType(
                        url, context);

                    String machineAndAppName = Dns.GetHostName() + httpRequest.ApplicationPath;

                    // determine last part of url
                    String[] urlComponents = httpRequest.PhysicalPath.Split(new char[] { '\\' });
                    String   uri           = urlComponents[urlComponents.Length - 1];

                    // register the type if it has changed or hasn't been registered yet.
                    Type lastType = (Type)s_registeredDynamicTypeTable[uri];
                    if (lastType != type)
                    {
                        RegistrationHelper.RegisterType(machineAndAppName, type, uri);
                        s_registeredDynamicTypeTable[uri] = type;
                    }

                    return(new HttpRemotingHandler());
                }
                else
                {
                    return(new HttpRemotingHandler());
                }
            }
        }