Ejemplo n.º 1
0
        public ActionResult DishesRestaurant(int id)
        {
            if (HttpContext.Session.GetString("User") != null)
            {
                var restaurant = RestaurantsManager.GetRestaurant(id);
                ViewData["Address"] = restaurant;
                int idRestaurantCity = CitiesManager.GetRestaurantCity(id);
                HttpContext.Session.SetInt32("idCityRestaurant", idRestaurantCity);

                var order_dishes = new List <OrderDishmodel>();
                var dishes       = DishesManager.GetDishes(id);

                foreach (var item in dishes)
                {
                    var dishOrder = new Models.OrderDishmodel();
                    dishOrder.dish      = DishesManager.GetDish(item.IdDishes);
                    dishOrder.dish.Name = item.Name;

                    order_dishes.Add(dishOrder);
                }

                return(View(order_dishes));
            }
            else
            {
                return(RedirectToAction("Index", "Login"));
            }
        }
Ejemplo n.º 2
0
        private void DisplayCities()
        {
            var cities = CitiesManager.GetCities();

            citiesGridView.DataSource = cities.ToList();
            citiesGridView.DataBind();
        }
Ejemplo n.º 3
0
        //Display cities in our Network
        public ActionResult Index()
        {
            ViewBag.username = HttpContext.Session.GetString("username");
            ViewBag.userType = HttpContext.Session.GetInt32("userType");
            CitiesManager cManager = new CitiesManager(Configuration);

            return(View(cManager.GetCities()));
        }
Ejemplo n.º 4
0
 protected void logisticCenterButton_Click(object sender, EventArgs e)
 {
     cityValidationLabel.Text = String.Empty;
     try
     {
         logisticCenterLabel.Text = CitiesManager.GetLogisticCentername();
     }
     catch (Exception ex)
     {
         cityValidationLabel.Text = ex.Message;
     }
 }
Ejemplo n.º 5
0
 public AdminController()
 {
     _userM    = new UserManager();
     _postM    = new PostManager();
     _catM     = new CategoryManager();
     _siteM    = new SiteSettingManager();
     _contentM = new ContentViewManager();
     _menuM    = new MainMenuManager();
     _proM     = new ProductManager();
     _pageM    = new PagesManager();
     _cityM    = new CitiesManager();
 }
Ejemplo n.º 6
0
        protected void addCityButton_Click(object sender, EventArgs e)
        {
            var city = new DTO.City();

            city.Name = cityNameTextBox.Text;
            try
            {
                CitiesManager.AddCity(city);
            }
            catch (Exception ex)
            {
                cityValidationLabel.Text = ex.Message;
            }

            cityNameTextBox.Text = String.Empty;
            DisplayCities();
        }
Ejemplo n.º 7
0
        private static void CreationalMenu()
        {
            Console.WriteLine("************************** Creational Design Patterns **************************");
            Console.WriteLine("Select one option to study: ");
            Console.WriteLine("1. Factory ");
            Console.WriteLine("2. Singleton ");

            switch (Console.ReadLine())
            {
            case "1":
                FactoryTestCase.DrawShapes();
                break;

            case "2":
                CitiesManager.ReadAllCities();
                break;
            }
        }
Ejemplo n.º 8
0
        private void LoadCityDropDownLists()
        {
            var cities = CitiesManager.GetCities();

            cities.Insert(0, new DTO.City {
                Id = 0, Name = "Select.."
            });
            if (cityOneDropDownList.SelectedIndex < 1)
            {
                cityOneDropDownList.DataSource     = cities.ToList();
                cityOneDropDownList.DataTextField  = "Name";
                cityOneDropDownList.DataValueField = "Id";
                cityOneDropDownList.DataBind();
            }
            if (cityTwoDropDownList.SelectedIndex < 1)
            {
                cityTwoDropDownList.DataSource     = cities.ToList();
                cityTwoDropDownList.DataTextField  = "Name";
                cityTwoDropDownList.DataValueField = "Id";
                cityTwoDropDownList.DataBind();
            }
        }
Ejemplo n.º 9
0
        public Dictionary <int, string> LoadData(CacheManager.CacheType cacheType)
        {
            switch (cacheType)
            {
            case CacheManager.CacheType.Fields:
            {
                return(_sp.GetService <IProfessionsBL>().GetProfessionsHierarchy().Fields.ToDictionary(kp => kp.Key, kp => kp.Value.Title));
            }
            break;

            case CacheManager.CacheType.Professions:
            {
                return(_sp.GetService <IProfessionsBL>().GetProfessionsHierarchy().Fields.Values
                       .SelectMany(item => item.Professions)
                       .ToDictionary(kp => kp.Key, kp => kp.Value.Title));
            }
            break;

            //case CacheType.SubProfessions:
            //  {
            //    return ProfessionsBL.GetProfessionHierarchy().Fields.Values
            //      .SelectMany(item => item.Professions)
            //      .SelectMany(item => item.Value.SubProfessions)
            //      .ToDictionary(kp => kp.Key, kp => kp.Value.Profession.Title);
            //  }
            //  break;
            case CacheManager.CacheType.Cities:
            {
                int idx = 0;
                return(CitiesManager.LoadAll().ToDictionary(kp => idx++, kp => kp));
            }
            break;

            case CacheManager.CacheType.Unspecified:
            default:
                throw new ArgumentOutOfRangeException(nameof(cacheType), cacheType, null);
            }
        }
Ejemplo n.º 10
0
        public ActionResult GetAllOrdersDeliver()
        {
            List <OrderDetails> results = null;
            var orders = OrderManager.GetOrders((int)HttpContext.Session.GetInt32("idDeliver"));

            foreach (var o in orders)
            {
                if (results == null)
                {
                    results = new List <OrderDetails>();
                }


                var Details = new OrderDetails();

                Details.IdOrder = o.IdOrder;
                Details.Status  = o.Status;
                Details.Price   = o.OrderPrice;

                var customer = CustomerManager.GetCustomer(o.IdCustomer);

                Details.CustomerName   = customer.Name + customer.Firstname;
                Details.CustumerAdress = customer.Adress;

                var city = CitiesManager.GetCity(customer.IdCity);

                Details.Npa  = city.Npa;
                Details.City = city.Name;


                results.Add(Details);
            }


            return(View(results));
        }
 public ProfileController()
 {
     _regM  = new RegisterManager();
     _userM = new UserManager();
     _cityM = new CitiesManager();
 }
 public IndividualsController(IFileManager fileManager, IndividualsManager individualsManager, CitiesManager citiesManager)
 {
     _individualsManager = individualsManager;
     _citiesManager      = citiesManager;
     _fileManager        = fileManager;
 }
 public SupplierController()
 {
     _menuM = new MainMenuManager();
     _cityM = new CitiesManager();
     _supM  = new SupplierManager();
 }
Ejemplo n.º 14
0
        static void Main(string[] args)
        {
            /*--Customers--*/

            var customerDBManager = new CustomersManager(Configuration);

            //Add new customer
            Console.WriteLine("--Add customer --");
            customerDBManager.AddCustomer(new Customers {
                Firstname = "Ludovic", Lastname = "Sahraoui", Login = "******", Password = "******", Country_code = 1, Address = "Chemin des Salines 40"
            });;
            //var customers = customerDBManager.GetCustomer(1);
            //Console.WriteLine(customers.Firstname);

            /*
             * //Update new customer
             * var newCustomer = customerDBManager.GetCustomer(1);
             * newCustomer.Firstname = "Léo";
             * newCustomer.Lastname = "Favre";
             * customerDBManager.UpdateCustomer(newCustomer);
             *
             * /*
             * //Delete customer
             * Console.WriteLine("--Delete customer --");
             * customerDBManager.DeleteCustomer(1);
             */

            /*--Cities--*/
            //Get Cities
            Console.WriteLine("--Get cities --");
            var citiesDBManager = new CitiesManager(Configuration);
            var cities          = citiesDBManager.GetCities();

            foreach (var city in cities)
            {
                Console.WriteLine(city.Name);
            }


            /*--Courier--*/
            Console.WriteLine("--Get courier 1 --");
            var courierDBManager = new CourierManager(Configuration);
            var courier          = courierDBManager.GetCourier(1);

            Console.WriteLine(courier.Firstname);

            /*--Dishes--*/


            //Get dishes
            Console.WriteLine("--Get dishes --");
            var dishesDBManager = new DishesManager(Configuration);
            var dishes          = dishesDBManager.GetDishes();

            foreach (var dish in dishes)
            {
                Console.WriteLine(dish.Name);
            }

            /*--OrderDishes--*/



            /*--Orders--*/

            //add order
            Console.WriteLine("--Add order --");
            var ordersDBManager = new OrdersManager(Configuration);

            ordersDBManager.AddOrder(new Order {
                Status = "Ready", Created_at = 02042019, Delivery_time = 2, IdCourier = 1, IdCustomer = 1
            });;


            /*--Restaurants--*/
        }