示例#1
0
        public void Initialize()
        {
            //Connects to classes that handles RabbitMQ
            rmq_order        = RMQ_Order.GetInstance();
            rmq_orderdetail  = RMQ_OrderDetail.GetInstance();
            rmq_product      = RMQ_Product.GetInstance();
            rmq_user         = RMQ_User.GetInstance();
            rmq_userproduct  = RMQ_UserProduct.GetInstance();
            rmq_specialcalls = RMQ_SpecialCalls.GetInstance();
            rmq_sender       = RMQ_Sender.GetInstance();

            //Connects to classes that lies in the Control layer.
            ctr_order       = new CTR_Order();
            ctr_orderdetail = new CTR_OrderDetail();
            ctr_product     = new CTR_Product();
            ctr_userproduct = new CTR_UserProduct();
            ctr_user        = new CustomUserController();

            //Gets the products for the tests
            List <Product> part_products = ctr_product.ListAll();

            products      = new List <int>();
            product_price = 0.0;

            //Calsulate the total price for the products
            foreach (Product product in part_products)
            {
                products.Add(product.Id);
                product_price += product.Price;
            }
        }
示例#2
0
 /// <summary>
 /// This is the constructor for the class RMQ_Order.
 /// </summary>
 private RMQ_Order()
 {
     ctr_order       = new CTR_Order();
     ctr_orderdetail = new CTR_OrderDetail();
     ctr_userproduct = new CTR_UserProduct();
     ctr_user        = new CustomUserController();
 }
示例#3
0
 /// <summary>
 /// This is the constructor for the class RMQ_SpecialCalls.
 /// </summary>
 private RMQ_SpecialCalls()
 {
     this.ctr_order       = new CTR_Order();
     this.ctr_orderdetail = new CTR_OrderDetail();
     this.ctr_product     = new CTR_Product();
     this.ctr_user        = new CustomUserController();
     this.ctr_userproduct = new CTR_UserProduct();
 }
        /// <summary>
        /// Validates a given password.
        /// </summary>
        /// <param name="user"></param>
        /// <returns>bool</returns>
        public bool ValidatePassword(CustomUser user)
        {
            CustomUserController ctrl = new CustomUserController();

            CustomUser storedUser = ctrl.FindByUsername(user.Username);

            string storedHash = storedUser.Password;

            if (user.Password == storedHash && storedUser.IsActive == true)
            {
                return(true);
            }

            else
            {
                return(false);
            }
        }
示例#5
0
 /// <summary>
 /// This is the conctructor for the class RMQ_User.
 /// </summary>
 private RMQ_User()
 {
     ctr_user = new CustomUserController();
 }