Esempio n. 1
0
        // Funkcja odpowiedzialna za utworzenie zamówienia i wysłanie maila. Zapisuje wszystkie dane na temat zamówienia, produktów i adresu do bazy a następnie wysyła maila z zamówieniem.
        public void CreateOrder(OrderObject orderObject, AddressObject addressObject, List <OrderProductObject> products)
        {
            string date = orderObject.OrderDate;

            string sql = string.Format("insert into Orders (Email, Price, ProductCount, OrderDate, Attention) values ('{0}', '{1}', {2}, '{3}', '{4}')",
                                       orderObject.Email, orderObject.Price, orderObject.ProductCount, date, orderObject.AttentionToOrder);

            long orderFk = _connectDB.InsertOrderToDatabase(sql);

            orderObject.ID = (int)orderFk;

            sql = string.Format("insert into Address (Street, HouseNumber, FlatNumber, City, PhoneNumber, OrderFK) values ('{0}', '{1}', '{2}', '{3}', {4}, {5})",
                                addressObject.Street, addressObject.HouseNumber, addressObject.FlatNumber, addressObject.City, addressObject.PhoneNumber, orderFk);

            _connectDB.ExecuteSql(sql);

            foreach (OrderProductObject product in products)
            {
                sql = string.Format("insert into Product (Name, OrderFK) values ('{0}', {1})", product.Name, orderFk);
                _connectDB.ExecuteSql(sql);
            }

            string subject = string.Format(Resources.OrderNumber_Message, orderFk);
            string body    = OrderLogic.CreateOrderDetails(orderObject, addressObject, products);

            SendMail(subject, body, orderObject.Email);
        }
Esempio n. 2
0
        public OrderObject prepareParamsFromLoginRules(string instrument)
        {
            OrderObject orderObject = new OrderObject();
            O2GLoginRules loginRules = _session.Session.getLoginRules();
            O2GResponseReaderFactory factory = _session.Session.getResponseReaderFactory();
            // Gets first account from login.
            O2GResponse accountsResponse = loginRules.getTableRefeshResponse(O2GTable.Accounts);
            O2GAccountsTableResponseReader accountsReader = factory.createAccountsTableReader(accountsResponse);
            O2GAccountRow account = accountsReader.getRow(0);

            orderObject.AccountID = account.AccountID;
            // Store base iAmount
            orderObject.BaseAmount = account.BaseUnitSize;

            O2GResponse offerResponse = loginRules.getTableRefeshResponse(O2GTable.Offers);
            O2GOffersTableResponseReader offersReader = factory.createOffersTableReader(offerResponse);
            for (int i = 0; i < offersReader.Count; i++)
            {
                O2GOfferRow offer = offersReader.getRow(i);
                if (instrument.Equals(offer.Instrument))
                {
                    orderObject.OfferID = offer.OfferID;
                    orderObject.Ask = offer.Ask;
                    orderObject.Bid = offer.Bid;
                    orderObject.PointSize = offer.PointSize;
                    orderObject.Symbol = new Symbol(instrument);
                    break;
                }
            }

            return orderObject;
        }
Esempio n. 3
0
        public OrderObject prepareParamsFromLoginRules(string instrument)
        {
            OrderObject              orderObject = new OrderObject();
            O2GLoginRules            loginRules  = _session.Session.getLoginRules();
            O2GResponseReaderFactory factory     = _session.Session.getResponseReaderFactory();
            // Gets first account from login.
            O2GResponse accountsResponse = loginRules.getTableRefeshResponse(O2GTable.Accounts);
            O2GAccountsTableResponseReader accountsReader = factory.createAccountsTableReader(accountsResponse);
            O2GAccountRow account = accountsReader.getRow(0);

            orderObject.AccountID = account.AccountID;
            // Store base iAmount
            orderObject.BaseAmount = account.BaseUnitSize;

            O2GResponse offerResponse = loginRules.getTableRefeshResponse(O2GTable.Offers);
            O2GOffersTableResponseReader offersReader = factory.createOffersTableReader(offerResponse);

            for (int i = 0; i < offersReader.Count; i++)
            {
                O2GOfferRow offer = offersReader.getRow(i);
                if (instrument.Equals(offer.Instrument))
                {
                    orderObject.OfferID   = offer.OfferID;
                    orderObject.Ask       = offer.Ask;
                    orderObject.Bid       = offer.Bid;
                    orderObject.PointSize = offer.PointSize;
                    orderObject.Symbol    = new Symbol(instrument);
                    break;
                }
            }

            return(orderObject);
        }
Esempio n. 4
0
        protected void SendMail(OrderObject oO)
        {
            string OrderMail = $@"Dear {oO.firstName} {oO.lastName}! {Environment.NewLine}
                           “As we express our gratitude, we must never forget that the highest appreciation is not to utter words, but to live by them.”{Environment.NewLine}
                           –John F. Kennedy.{Environment.NewLine}{Environment.NewLine}
                           Order info
                           Order nummer: {oO.orderId}
                           Total Price: { oO.CalculatePrice().ToString("#.##")}{Environment.NewLine}
                           Best reguards from Group 7  
                           
                           
                           ";


            try
            {
                MailMessage       o       = new MailMessage("*****@*****.**", $"{oO.email}", "Web-Shop Group7", $"{OrderMail}");
                NetworkCredential netCred = new NetworkCredential("*****@*****.**", "olleolle12");
                SmtpClient        smtpobj = new SmtpClient("smtp.live.com", 587);
                smtpobj.EnableSsl   = true;
                smtpobj.Credentials = netCred;
                smtpobj.Send(o);
            }
            catch
            {
                Page.RegisterStartupScript("UserMsg", "<script>alert('Sending Failed...');if(alert){ window.location='SendMail.aspx';}</script>");
            }
        }
Esempio n. 5
0
        public List <OrderObject> GetOrders(string email)
        {
            List <OrderObject> orders = new List <OrderObject>();
            string             sql    = string.Empty;

            if (email.ToUpper().Trim() == "ADMIN")
            {
                sql = "select * from orders order by ID desc";
            }
            else
            {
                sql = string.Format("select * from orders where Email = '{0}' order by ID desc", email);
            }

            try
            {
                OpenConnection();
                SQLiteCommand    command = new SQLiteCommand(sql, SqliteConnection);
                SQLiteDataReader reader  = command.ExecuteReader();

                int     id;
                string  emailFromBase;
                decimal price;
                int     productCount;
                string  orderDate;
                string  attention;


                OrderObject orderObject;

                while (reader.Read())
                {
                    id            = int.Parse(reader["ID"].ToString());
                    emailFromBase = reader["Email"].ToString();
                    price         = decimal.Parse(reader["Price"].ToString());
                    productCount  = int.Parse(reader["ProductCount"].ToString());
                    orderDate     = reader["OrderDate"].ToString();
                    attention     = reader["Attention"].ToString();

                    orderObject                  = new OrderObject();
                    orderObject.ID               = id;
                    orderObject.Email            = emailFromBase;
                    orderObject.Price            = price;
                    orderObject.ProductCount     = productCount;
                    orderObject.OrderDate        = orderDate;
                    orderObject.AttentionToOrder = attention;
                    orders.Add(orderObject);
                }
            }
            catch (SQLiteException sqlEx)
            {
                MessageBox.Show(sqlEx.Message);
            }
            finally
            {
                CloseConnection();
            }

            return(orders);
        }
Esempio n. 6
0
 public OrderType GetStack(bool isleft)
 {
     if (isleft)
     {
         if (_leftOrderTypes.Count <= 0)
         {
             return(OrderType.NULL);
         }
         OrderObject oo = _leftOrderTypes.Peek();
         if (oo._gameObject.GetComponent <Arrow>()._isGround)
         {
             return(oo._orderType);
         }
         else
         {
             return(OrderType.NULL);
         }
     }
     else
     {
         if (_rightOrderTypes.Count <= 0)
         {
             return(OrderType.NULL);
         }
         OrderObject oo = _rightOrderTypes.Peek();
         if (oo._gameObject.GetComponent <Arrow>()._isGround)
         {
             return(oo._orderType);
         }
         else
         {
             return(OrderType.NULL);
         }
     }
 }
Esempio n. 7
0
        // Pobieranie z bazy produktów oraz adresu na podstawie ID zamówienia wybranego z historii zamówień
        public string GetOrderDetails(OrderObject orderObject)
        {
            AddressObject             address  = _conDB.GetAddress(orderObject.ID);
            List <OrderProductObject> products = _conDB.GetProducts(orderObject.ID);

            return(OrderLogic.CreateOrderDetails(orderObject, address, products));
        }
Esempio n. 8
0
        public async Task <IActionResult> addToCart(string Id, string DishName, int Price, int PrepTime, string Category, int portion)
        {
            ViewBag.hasPending = false;

            if (HttpHelper.HttpContext.Session.GetString("currentUser") != null)
            {
                String      username   = HttpHelper.HttpContext.Session.GetString("currentUser");
                String      identifier = HttpHelper.HttpContext.Session.GetString("identifier");
                OrderObject odrObj     = new OrderObject();
                odrObj.DishName   = DishName;
                odrObj.Category   = Category;
                odrObj.Price      = Price;
                odrObj.Portion    = portion;
                odrObj.PrepTime   = PrepTime;
                odrObj.Username   = username;
                odrObj.Identifier = identifier;

                OrderObjectsController OControls = new OrderObjectsController(_context);
                await OControls.addOrder(odrObj);

                return(RedirectToAction(nameof(Index)));
            }

            return(View());
        }
        public void OnGet(int orderId)
        {
            // make input available to web page:
            order = new OrderObject();
            Console.WriteLine(orderId);

            // clear exception:
            EX = null;

            try
            {
                if (orderId >= 0)
                {
                    //retreive order info

                    string sqlInfo = string.Format("SELECT * FROM ordermanagementdb.orders WHERE order_id = '{0}';", orderId);

                    DataSet dsInfo = DataAccessTier.DB.ExecuteNonScalarQuery(sqlInfo);

                    foreach (DataRow row in dsInfo.Tables[0].Rows)
                    {
                        order.orderId = Convert.ToInt32(row["order_id"]);
                        order.userId  = Convert.ToInt32(row["user_id"]);
                    }

                    //retrieve all items of the order
                    string sql = string.Format("SELECT * FROM services INNER JOIN order_items ON services.service_id = order_items.service_id WHERE order_id={0};", order.orderId);

                    DataSet ds = DataAccessTier.DB.ExecuteNonScalarQuery(sql);

                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        Services  S    = new Services(Convert.ToInt32(row["service_id"]), Convert.ToString(row["service_name"]), Convert.ToString(row["service_description"]), Convert.ToInt32(row["service_price"]));
                        OrderItem item = new OrderItem(S, Convert.ToInt32(row["quantity"]));
                        order.total = order.total + (Convert.ToInt32(row["quantity"]) * Convert.ToInt32(row["service_price"]));
                        order.items.Add(item);
                    }
                }

                //retrieve customer info
                string sqlCustomer = string.Format(@"SELECT email, first_name, middle_name, last_name, phone FROM ordermanagementdb.users WHERE user_id = '{0}';", order.userId);

                DataSet dsCustomer = DataAccessTier.DB.ExecuteNonScalarQuery(sqlCustomer);

                foreach (DataRow row in dsCustomer.Tables[0].Rows)
                {
                    order.fullName = Convert.ToString(row["first_name"]) + " " + Convert.ToString(row["middle_name"]) + " " + Convert.ToString(row["last_name"]);
                    order.email    = Convert.ToString(row["email"]);
                    order.phone    = Convert.ToString(row["phone"]);
                }
            }
            catch (Exception ex)
            {
                EX = ex;
            }
            finally
            {
                // nothing at the moment
            }
        }
Esempio n. 10
0
 private void deleteObject(OrderObject obj)
 {
     foreach (OrderObject child in obj.ChildObjects)
     {
         OrdersContext.Current.Context.OrderObjects.Detach(child);
     }
 }
Esempio n. 11
0
        // Zdarzenie wysyłania zamówienia. Występuje formatka do wprowadzania adresu. Utworzenie zamówienia w bazie danych plus wysłanie maila.
        private void uiBtnSendOrder_Click(object sender, EventArgs e)
        {
            string message;

            if (!_orderLogic.Validate(out message, uiTxtEmail.Text, uiClbShopingCard.Items.Count))
            {
                MessageBox.Show(message, Resources.Attention, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            AddressObject addressObject = _orderLogic.CreateAddress();

            if (addressObject == null)
            {
                MessageBox.Show(Resources.NotSetEmailAddress, Resources.Attention, MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
                return;
            }

            List <OrderProductObject> orderProductObjects = new List <OrderProductObject>();

            foreach (object obj in uiClbShopingCard.Items)
            {
                orderProductObjects.Add(new OrderProductObject(obj.ToString()));
            }

            OrderObject orderObject = CreateOrderObject();

            _orderLogic.CreateOrder(orderObject, addressObject, orderProductObjects);
            Close();
        }
        public IActionResult Update(int id, [FromBody] OrderObject item)
        {
            if (item == null || item.ObjectId != id)
            {
                return(BadRequest());
            }

            var todo = _context.OrderObject.FirstOrDefault(t => t.ObjectId == id);

            if (todo == null)
            {
                return(NotFound());
            }

            todo.ObjectId       = item.ObjectId;
            todo.Name           = item.Name;
            todo.Price          = item.Price;
            todo.Availability   = item.Availability;
            todo.ManufacturerId = item.ManufacturerId;
            todo.TypeId         = item.TypeId;
            todo.Image          = item.Image;
            //todo.Pengine = item.Pengine;
            //todo.Punishments = item.Punishments;

            _context.OrderObject.Update(todo);
            _context.SaveChanges();
            return(new NoContentResult());
        }
Esempio n. 13
0
        protected void refreshTrees()
        {
            OrderObject root = (from OrderObject o in OrdersContext.Current.Context.OrderObjects where o.ObjectID == 0 select o).First();

            treeObjects.ItemsSource = new List <OrderObject> {
                root
            };
        }
Esempio n. 14
0
        private void treeObjects_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            OrderObject obj = treeObjects.SelectedItem as OrderObject;

            if ((obj != null) && (!CurrentFilter.SelectedObjects.Contains(obj)))
            {
                CurrentFilter.SelectedObjects.Add(obj);
            }
        }
Esempio n. 15
0
        private void ListBox_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            OrderObject obj = lstSelectedObjects.SelectedItem as OrderObject;

            if (obj != null)
            {
                CurrentFilter.SelectedObjects.Remove(obj);
            }
        }
Esempio n. 16
0
        private void ClearCart()
        {
            HiddenField hdnID = (HiddenField)Page.Master.FindControl("Cart");

            Session["Cart"] = new OrderObject();
            var JsonObj = JsonConvert.SerializeObject(Session["Cart"]);

            hdnID.Value = JsonObj;
        }
Esempio n. 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.ClientScript.RegisterClientScriptBlock(GetType(), "isPostBack", String.Format("var isPostback = {0};", IsPostBack.ToString().ToLower()), true);

            UserPages.Visible = false;

            if (Session["Cart"] == null)
            {
                Session["Cart"] = new OrderObject();
            }

            if (Session["User"] != null)
            {
                UserObject user = userDal.GetUserById((int)Session["User"]);

                UserPages.Visible = true;
                login.Visible     = false;
                label_user.Text   = $"Välkommen tillbaka {user.firstName}";
                pricegroup        = user.priceGroup;
            }



            if (!IsPostBack)
            {
                Pages pageDal = new Pages();

                foreach (PageObject page in pageDal.ListAllPagesList())
                {
                    if (page.name != "Startpage" && page.name != "Start" && page.name != "Erbjudande")
                    {
                        pageMeny.InnerHtml += $"<li><a href=\"page.aspx?id={page.pageId}\">{page.name}</a></li>";
                    }
                }

                Brand brandDal = new Brand();

                foreach (BrandObject brand in brandDal.ListAllBrandsList())
                {
                    brandMenu.InnerHtml += $"<li><a href=\"brand.aspx?id={brand.brandID}\">{brand.name}</a></li>";
                }
                brandMenu.InnerHtml += $"<li role = \"separator\" class=\"divider\" ></li><li><a href = \"brand.aspx\" >Alla</a></li>";

                Category categoryDal = new Category();

                foreach (CategoryObject category in categoryDal.ListAllCategoryList())
                {
                    categoryMenu.InnerHtml += $"<li><a href=\"category.aspx?id={category.categoryID}\">{category.name}</a></li>";
                }
                categoryMenu.InnerHtml += $"<li role =\"separator\" class=\"divider\" ></li><li><a href = \"category.aspx\" >Alla</a></li>";
            }

            HiddenField hdnID = (HiddenField)Page.Master.FindControl("Cart");


            BuildCart();
        }
Esempio n. 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            oO        = Session["Cart"] as OrderObject;
            OrderMail = $@"Dear {oO.usr.firstName} {oO.usr.lastName}! {Environment.NewLine} Hope your prushase fill your needs.{Environment.NewLine}
                           Your order nummer is {oO.orderId}{Environment.NewLine}{Environment.NewLine}";

            FillValues();
            SendMail();
            ClearCart();
        }
Esempio n. 19
0
        public async Task <IActionResult> Create([Bind("Username,Identifier,ID,DishName,Price,PrepTime,Category,Portion")] OrderObject orderObject)
        {
            if (ModelState.IsValid)
            {
                _context.Add(orderObject);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(orderObject));
        }
        private void treeObjects_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            OrderObject obj = treeObjects.SelectedItem as OrderObject;

            if (obj != null)
            {
                //CurrentOrder.SelOrderObject = obj;
                CurrentOrder.SelOrderObjectID   = obj.ObjectID;
                CurrentOrder.SelOrderObjectText = obj.FullName;
            }
        }
Esempio n. 21
0
        // Tworzenie obiektu zamówienia
        private OrderObject CreateOrderObject()
        {
            OrderObject orderObject = new OrderObject();

            orderObject.Email            = uiTxtEmail.Text;
            orderObject.ProductCount     = uiClbShopingCard.Items.Count;
            orderObject.Price            = _orderCost;
            orderObject.OrderDate        = string.Format("{0} {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString());
            orderObject.AttentionToOrder = uiTxtAttentionToOrder.Text;

            return(orderObject);
        }
        public IActionResult Create([FromBody] OrderObject item)
        {
            if (item == null)
            {
                return(BadRequest());
            }

            _context.OrderObject.Add(item);
            _context.SaveChanges();

            return(CreatedAtRoute("GetObj", new { id = item.ObjectId }, item));
        }
Esempio n. 23
0
        private void uiBtnLook_Click(object sender, EventArgs e)
        {
            OrderObject order = uiDgvOrderHistory.CurrentRow.DataBoundItem as OrderObject;

            if (order != null)
            {
                using (OrderDetails orderDetails = new OrderDetails(order))
                {
                    orderDetails.ShowDialog();
                }
            }
        }
Esempio n. 24
0
        private void btnAddItem_Click(object sender, RoutedEventArgs e)
        {
            refreshSelObject();
            OrderObject newObj = new OrderObject();

            newObj.ObjectID        = CurrentObjectNumber--;
            SelParentOrderObject   = SelObject;
            newObj.ParentObjectID  = SelObject.ObjectID;
            objectForm.CurrentItem = newObj;
            isNew     = true;
            SelObject = newObj;
        }
Esempio n. 25
0
        protected void refreshSelObject()
        {
            OrderObject selectedObject = treeObjects.SelectedItem as OrderObject;

            cancelEdit();
            if (selectedObject != null)
            {
                SelObject            = selectedObject;
                SelParentOrderObject = selectedObject.ParentObject;
            }
            isNew = false;
        }
Esempio n. 26
0
        /// <summary>
        ///     Adds a new order line to the database.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (orderIdInput.Text.Equals("") || productIdInput.Text.Equals("") || quantityInput.Text.Equals(""))
                {
                    MessageBox.Show("Please input all text boxes.");
                    orderIdInput.Focus();
                    return;
                }
                else if ((!Regex.IsMatch(orderIdInput.Text, "^[0-9]*$")) || (!Regex.IsMatch(productIdInput.Text, "^[0-9]*$")) || (!Regex.IsMatch(quantityInput.Text, "^[0-9]*$")))
                {
                    MessageBox.Show("Please input only numerical characters into all text boxes.");
                    orderIdInput.Focus();
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error has occurred, please contact your administrator." + "\n\n" + "The error message is: " + "\n\n" + ex.ToString());
            }

            OrderLineObject orderLine;
            OrderObject     order   = businessLogicLayer.CheckOrdersByID(int.Parse(orderIdInput.Text));
            ProductObject   product = businessLogicLayer.CheckProductsByID(int.Parse(productIdInput.Text));

            try
            {
                if (!int.Parse(orderIdInput.Text).Equals(order.order_id))
                {
                    MessageBox.Show("The Order ID provided does not exist.");
                    orderIdInput.Focus();
                    return;
                }
                else if (!int.Parse(productIdInput.Text).Equals(product.product_id))
                {
                    MessageBox.Show("The Product ID provided does not exist.");
                    productIdInput.Focus();
                    return;
                }
                else
                {
                    orderLine = businessLogicLayer.InsertNewOrderLine(int.Parse(orderIdInput.Text), int.Parse(productIdInput.Text), int.Parse(quantityInput.Text));
                    MessageBox.Show("The provided Order Line has been added to the system.");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error has occurred, please contact your administrator." + "\n\n" + "The error message is: " + "\n\n" + ex.ToString());
            }
        }
Esempio n. 27
0
        public void TestInputProperCatLength10()
        {
            Program p = new Program();
            bool    res;
            string  data = p.returnOrderData("012345678901234567890123456789012345678", out res);

            System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
            OrderObject oo1 = new OrderObject();
            OrderObject oo  = null;

            oo = (OrderObject)js.Deserialize(data, oo1.GetType());
            Assert.AreEqual(oo.Code.Length, 10);
        }
Esempio n. 28
0
        static void Main(string[] args)
        {
            ProxyOrderRepository repository = new ProxyOrderRepository();

            OrderObject order = repository.GetOrder(1);

            Console.WriteLine("Order Id: {0}", order.Id);
            Console.WriteLine("Date: {0}", order.OrderDate);
            Console.WriteLine("Customer: {0}, {1}", order.Customer.LastName, order.Customer.FirstName);
            Console.WriteLine("# of items: {0}", order.Details.Count());

            AccountChargeTests();
            OverchargeTests();
        }
Esempio n. 29
0
 private string GenerateHash(string Contact, string tick, ref OrderObject order)
 {
     try
     {
         var Milis = (long)(((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds));
         //var Milis = (DateTime.UtcNow - (new DateTime(1970, 1, 1))).Milliseconds;
         var TheFirst = order;//;orders.FirstOrDefault();
         var name     = TheFirst.issueId.Replace(" ", "");
         return(Milis.ToString() + Contact + name + TheFirst.quantity.ToString() + TheFirst.capitalOrderTypeId.ToString());
     }
     catch (Exception)
     {
         return("");
     }
 }
Esempio n. 30
0
        protected void Application_Start()
        {
            Logger.init(Server.MapPath("/logs/"), "orders");
            OrderObject.init();

            Order.init();
            CranTaskInfo.initTaskNumbers();
            CranTaskInfo.PathFiles = Server.MapPath("/Data/");

            AreaRegistration.RegisterAllAreas();


            Logger.info(System.Configuration.ConfigurationManager.AppSettings["smtpServer"], Logger.LoggerSource.client);
            RegisterRoutes(RouteTable.Routes);
        }
Esempio n. 31
0
        public async Task <IActionResult> addOrder(OrderObject orderObject)
        {
            var breakerPolicy = Policy
                                .Handle <Exception>()
                                .CircuitBreakerAsync(2, TimeSpan.FromSeconds(10));

            _context.Add(orderObject);

            await breakerPolicy.ExecuteAsync(async() =>
            {
                await _context.SaveChangesAsync();
            });

            return(View());
        }