Beispiel #1
0
        public LoginController()
        {
            var bl = new BusinessLogic.BusinessLogic();

            _session = bl.GetSessionBL();
            _main    = bl.GetMainBL();
        }
Beispiel #2
0
        public IActionResult EditPage(int id)
        {
            CoinModel coin = null;

            using (var db = new BusinessLogic.BusinessLogic())
            {
                var players = Mapper.Map <List <CoinModel> >(db.GetCoins());
                foreach (CoinModel model in players)
                {
                    if (model.CoinId == id)
                    {
                        coin = model;
                        break;
                    }
                }
            }

            if (coin != null)
            {
                currentEditionID            = coin.CoinId;
                ViewData["CoinName"]        = coin.Name;
                ViewData["CoinCost"]        = coin.Cost;
                ViewData["CoinLink"]        = coin.Link;
                ViewData["CoinDollarPrice"] = coin.DollarPrice;
                ViewData["CoinZlotyPrice"]  = coin.ZlotyPrice;
                ViewData["CoinIsSold"]      = coin.IsSold;
                ViewData["CoinEnglishName"] = coin.EnglishName;
                ViewData["CoinPolishName"]  = coin.PolishName;
            }

            return(View());
        }
Beispiel #3
0
        public IActionResult Delete(int id)
        {
            using (var db = new BusinessLogic.BusinessLogic())
                db.RemoveOrder(id);

            return(Redirect("~/Home/Index"));
        }
Beispiel #4
0
        protected ControllerTests()
        {
            var mockPrincipal = new Mock <IBusinessLogicPrincipal>();

            mockPrincipal.Setup(x => x.IsAllowed).Returns(true);
            mockPrincipal.Setup(x => x.IsAdmin).Returns(true);
            mockPrincipal.Setup(x => x.IsVerwalter).Returns(false);
            mockPrincipal.Setup(x => x.CurrentUid).Returns("if15b032");
            var abl  = new AccessoryBusinessLogic(Dal, mockPrincipal.Object);
            var cbl  = new CustomFieldsBusinessLogic(Dal, mockPrincipal.Object);
            var dbl  = new DamageBusinessLogic(Dal, mockPrincipal.Object);
            var debl = new DeviceBusinessLogic(Dal, mockPrincipal.Object);
            var blbl = new BusinessLogic.BusinessLogic(Dal, mockPrincipal.Object);
            var obl  = new OrderBusinessLogic(Dal, mockPrincipal.Object);
            var sbl  = new SettingBusinessLogic(Dal, mockPrincipal.Object);
            var ubl  = new UserBusinessLogic(Dal, mockPrincipal.Object);

            Bl = new BusinessLogicFacade(Dal, blbl, abl, cbl, dbl, debl, obl, sbl, ubl);
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
            var subject = new ClaimsIdentity("Federation", ClaimTypes.Name, ClaimTypes.Role);

            subject.AddClaim(new Claim(ClaimTypes.Role, "Admin", ClaimValueTypes.String));
            subject.AddClaim(new Claim(ClaimTypes.Name, "if15b032", ClaimValueTypes.String));
            _controllerContext = new ControllerContext
            {
                HttpContext = new DefaultHttpContext
                {
                    User = new ClaimsPrincipal(subject)
                }
            };
        }
Beispiel #5
0
        public IActionResult EditPage(int id)
        {
            OrderModel order = null;

            using (var db = new BusinessLogic.BusinessLogic())
            {
                var orders = Mapper.Map <List <OrderModel> >(db.GetOrders());
                foreach (OrderModel model in orders)
                {
                    if (model.OrderId == id)
                    {
                        order = model;
                        break;
                    }
                }
            }

            if (order != null)
            {
                //currentEditionID = order.Id;
                //ViewData["CoinName"] = order.Name;
                //ViewData["CoinCost"] = order.Cost;
                //ViewData["CoinLink"] = order.Link;
                //ViewData["CoinDollarPrice"] = order.DollarPrice;
                //ViewData["CoinZlotyPrice"] = order.ZlotyPrice;
                //ViewData["CoinIsSold"] = order.IsSold;
                //ViewData["CoinEnglishName"] = order.EnglishName;
                //ViewData["CoinPolishName"] = order.PolishName;
            }

            return(View());
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            IDataAccess dal = new DataAccess.DataAccess();

            BusinessLogic.BusinessLogic bl = new BusinessLogic.BusinessLogic(dal);

            User u = new User {
                Email = "email", Username = "******", Password = "******", Role = "user"
            };

            try
            {
                // bl.UserLogic.AddUser(u);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.InnerException.InnerException.Message);
                Console.WriteLine(DateTime.Now.ToString());
                Console.WriteLine(DateTime.Now.AddHours(2));
            }

            //   bl.FormLogic.AddCategory("politics");

            Console.WriteLine(DateTime.Now);
            //      Form form = new Form() { CreatedDate = DateTime.Now, Deadline = DateTime.Now, State = "state", Title = "title",CategoryID=1 ,UserID=6};
            //  bl.FormLogic.AddForm(form);
            // Console.WriteLine(bl.AuthLogic.VerifyTokenDate("A7-AB-5B-E1-B4-0D-FC-F4-C2-EC-9C-19-9B-91-D8-47"));
            //Console.WriteLine(bl.AdminLogic.GetUserID("geo"));
        }
Beispiel #7
0
 public ControllerModel()
 {
     IUnityContainer objContainer = new UnityContainer();
     objContainer.RegisterType<BusinessLogic.BusinessLogic>();
     objContainer.RegisterType<DataAccess.IDataAccess, DataAccess.DataAccess>();
     bl = objContainer.Resolve<BusinessLogic.BusinessLogic>();
 }
Beispiel #8
0
        static void Main(string[] args)
        {
            IDataAccess dal = new DataAccess.DataAccess();
            BusinessLogic.BusinessLogic bl = new BusinessLogic.BusinessLogic(dal);

            User u = new User { Email = "email", Username = "******", Password = "******", Role = "user" };
            try
            {
               // bl.UserLogic.AddUser(u);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.InnerException.InnerException.Message);
                Console.WriteLine(DateTime.Now.ToString());
                Console.WriteLine(DateTime.Now.AddHours(2));
            }

            //   bl.FormLogic.AddCategory("politics");

            Console.WriteLine(DateTime.Now);
              //      Form form = new Form() { CreatedDate = DateTime.Now, Deadline = DateTime.Now, State = "state", Title = "title",CategoryID=1 ,UserID=6};
              //  bl.FormLogic.AddForm(form);
            // Console.WriteLine(bl.AuthLogic.VerifyTokenDate("A7-AB-5B-E1-B4-0D-FC-F4-C2-EC-9C-19-9B-91-D8-47"));
            //Console.WriteLine(bl.AdminLogic.GetUserID("geo"));
        }
 public void BindData()
 {
     bobject = new UserInformation();
     blogic = new BusinessLogic.BusinessLogic();
     List<UserInformation> lst = blogic.ShowData(bobject);
     grd_show.DataSource = lst;
     grd_show.DataBind();
 }
Beispiel #10
0
        public CategoryModel()
        {
            IUnityContainer objContainer = new UnityContainer();

            objContainer.RegisterType <BusinessLogic.BusinessLogic>();
            objContainer.RegisterType <DataAccess.IDataAccess, DataAccess.DataAccess>();
            bl = objContainer.Resolve <BusinessLogic.BusinessLogic>();
        }
Beispiel #11
0
        /// <summary>
        /// Constructor. Initializeaza Unity container si injecteaza dependenta in BLL si DAL
        /// </summary>
        public AuthModel()
        {
            IUnityContainer objContainer = new UnityContainer();

            objContainer.RegisterType <BusinessLogic.BusinessLogic>();
            objContainer.RegisterType <AzureDataAccess.IAzureDataAccess, AzureDataAccess.AzureDataAccess>();
            bl = objContainer.Resolve <BusinessLogic.BusinessLogic>();
        }
Beispiel #12
0
        // GET: Login
        public RegisterController()
        {
            var bl = new BusinessLogic.BusinessLogic();

            _register = bl.GetRegisterBL();
            var ss = new BusinessLogic.BusinessLogic();

            _session = ss.GetSessionBL();
        }
Beispiel #13
0
        public IActionResult ShowAllPage()
        {
            List <OrderModel> list = null;

            using (var db = new BusinessLogic.BusinessLogic())
                list = Mapper.Map <List <OrderModel> >(db.GetOrders());
            list.Reverse();
            return(View(list));
        }
        public void DeleteData()
        {
            bobject = new UserInformation();
            blogic = new BusinessLogic.BusinessLogic();

            bobject.Id = Convert.ToInt32(Request.QueryString["Id"]);
            blogic.DeleteData(bobject.Id);
            BindData();
        }
Beispiel #15
0
        static void Main(string[] args)
        {
            IAzureDataAccess dal = new AzureDataAccess.AzureDataAccess();

            BusinessLogic.BusinessLogic bl = new BusinessLogic.BusinessLogic(dal);

            User u = new User {
                Email = "email", Username = "******", Password = "******", Role = "user"
            };

            Console.WriteLine(NetworkInterface.GetAllNetworkInterfaces().Where(nic => nic.OperationalStatus == OperationalStatus.Up).Select(nic => nic.GetPhysicalAddress().ToString()).FirstOrDefault());
        }
Beispiel #16
0
        public IActionResult DeleteAllCoins()
        {
            using (var db = new BusinessLogic.BusinessLogic())
            {
                foreach (CoinModel coin in Mapper.Map <List <CoinModel> >(db.GetCoins()))
                {
                    db.RemoveCoin(coin.CoinId);
                }
            }

            return(Redirect("~/Home/Index"));
        }
Beispiel #17
0
        public IActionResult DeleteAllOrders()
        {
            using (var db = new BusinessLogic.BusinessLogic())
            {
                foreach (OrderModel order in Mapper.Map <List <OrderModel> >(db.GetOrders()))
                {
                    db.RemoveCoin(order.OrderId);
                }
            }

            return(Redirect("~/Home/Index"));
        }
Beispiel #18
0
        public IActionResult SaveChanges(int id, string name, string surname, string year, bool health, int salary)
        {
            OrderModel order = new OrderModel()
            {
                //Id = currentEditionID,
                //Name = name,
            };

            using (var db = new BusinessLogic.BusinessLogic())
                db.UpdateOrder(Mapper.Map <OrderBL>(order));

            return(Redirect("~/Home/Index"));
        }
Beispiel #19
0
        public IActionResult SaveChanges(int id, string name, string surname, string year, bool health, int salary)
        {
            CoinModel coin = new CoinModel()
            {
                CoinId = currentEditionID,
                Name   = name,
            };

            using (var db = new BusinessLogic.BusinessLogic())
                db.UpdateCoin(Mapper.Map <CoinBL>(coin));

            return(Redirect("~/Home/Index"));
        }
Beispiel #20
0
        public IActionResult AddOrder(string title, int cost, string link)
        {
            OrderModel order = new OrderModel()
            {
                //Name = title,
                //Link = link,
                //Cost = cost
            };

            using (var db = new BusinessLogic.BusinessLogic())
                db.AddOrder(Mapper.Map <OrderBL>(order));

            return(Redirect("~/Home/Index"));
        }
Beispiel #21
0
        public IActionResult AddCoin(string title, int cost, string link)
        {
            CoinModel coin = new CoinModel()
            {
                Name = title,
                Link = link,
                Cost = cost
            };

            using (var db = new BusinessLogic.BusinessLogic())
                db.AddCoin(Mapper.Map <CoinBL>(coin));

            return(Redirect("~/Home/Index"));
        }
Beispiel #22
0
        public IActionResult SearchResult()
        {
            List <OrderModel> orders = new List <OrderModel>();

            using (var db = new BusinessLogic.BusinessLogic())
            {
                foreach (OrderModel order in Mapper.Map <List <OrderModel> >(db.GetOrders()))
                {
                    //if (order.Name == title && order.Link == link)
                    orders.Add(order);
                }
            }
            return(View("ShowAllPage", orders));
        }
Beispiel #23
0
        public IActionResult SearchResult(string title, string link)
        {
            List <CoinModel> coins = new List <CoinModel>();

            using (var db = new BusinessLogic.BusinessLogic())
            {
                foreach (CoinModel coin in Mapper.Map <List <CoinModel> >(db.GetCoins()))
                {
                    if (coin.Name == title && coin.Link == link)
                    {
                        coins.Add(coin);
                    }
                }
            }
            return(View("ShowAllPage", coins));
        }
        public IActionResult Contact(ContactUsViewModel contactUsViewModel)
        {
            try
            {
                BusinessLogic.BusinessLogic businessLogic = new BusinessLogic.BusinessLogic();
                ContactUs contactUs = new ContactUs
                {
                    Name        = contactUsViewModel.Name,
                    Email       = contactUsViewModel.Email,
                    Contact     = contactUsViewModel.Contact,
                    Porpose     = contactUsViewModel.Porpose,
                    Description = contactUsViewModel.Description
                };
                int    saveResult  = businessLogic.InsertContactDetail(contactUs);
                string mailMessage = businessLogic.SendMail(contactUsViewModel.Email, ConstantFields.SenderMail, contactUsViewModel.Description, contactUsViewModel.Porpose);

                ViewBag.Message = saveResult > 0 ? "Thank You For Contacting Us" : "!Sorry currently we unable to capture your request";
                return(View(contactUsViewModel));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #25
0
        public AdminMod()
        {
            var bl = new BusinessLogic.BusinessLogic();

            _session = bl.GetSessionBL();
        }
        public AdminController()
        {
            var bl = new BusinessLogic.BusinessLogic();

            _posts = bl.GetPosts();
        }
Beispiel #27
0
        public ProductController()
        {
            var bl = new BusinessLogic.BusinessLogic();

            _product = bl.GetProductsBL();
        }
Beispiel #28
0
        public BaseController()
        {
            var bl = new BusinessLogic.BusinessLogic();

            _session = bl.GetSessionBL();
        }
Beispiel #29
0
        public AdminModeAttribute()
        {
            var businessLogic = new BusinessLogic.BusinessLogic();

            _sessionBusinessLogic = businessLogic.GetSessionBL();
        }
Beispiel #30
0
        public TopicController()
        {
            var bl = new BusinessLogic.BusinessLogic();

            _forum = bl.GetForumBL();
        }
Beispiel #31
0
        public IActionResult SearchPage()
        {
            //SpreadsheetsService myService = new SpreadsheetsService("CoinsOrganizer");
            //myService.setUserCredentials("*****@*****.**", "POBEDAnotabt9865122879");

            //SpreadsheetQuery query = new SpreadsheetQuery();
            //SpreadsheetFeed feed = myService.Query(query);

            //Console.WriteLine("Your spreadsheets: ");
            //foreach (SpreadsheetEntry entry in feed.Entries)
            //{
            //    Console.WriteLine(entry.Title.Text);
            //}

            DeleteAllOrders();

            string[] Scopes          = { SheetsService.Scope.SpreadsheetsReadonly };
            string   ApplicationName = "Google Sheets API .NET Quickstart";

            UserCredential credential;

            using (var stream =
                       new FileStream("credentials.json", FileMode.Open, FileAccess.Read))
            {
                string credPath = "token.json";
                credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                    GoogleClientSecrets.Load(stream).Secrets,
                    Scopes,
                    "user",
                    CancellationToken.None,
                    new FileDataStore(credPath, true)).Result;
                Console.WriteLine("Credential file saved to: " + credPath);
            }

            // Create Google Sheets API service.
            var service = new SheetsService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName       = ApplicationName,
            });

            // Define request parameters.
            String spreadsheetId = "13Hh_x_kU9BhBryuIwwGvB6r0PpztjZaVu8y5-5BbeTk";
            String range         = "'Висилка'!A909:I971";

            SpreadsheetsResource.ValuesResource.GetRequest request =
                service.Spreadsheets.Values.Get(spreadsheetId, range);

            // Prints the names and majors of students in a sample spreadsheet:
            // https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit
            ValueRange response            = request.Execute();
            IList <IList <Object> > values = response.Values;

            if (values != null && values.Count > 0)
            {
                //Console.WriteLine("Name, Major");
                foreach (var row in values)
                {
                    OrderModel orders = new OrderModel();

                    if (row.Count == 9)
                    {
                        var    index = int.Parse(row[8].ToString() == "." ? "0" : row[8].ToString());
                        var    title = row[0].ToString();
                        var    paid  = row[1].ToString() == "т";
                        double price = 0d;

                        var isDollar = row[4].ToString().Contains("$");
                        var isZloty  = row[4].ToString().Contains("zł");
                        //if (row[4].ToString() != "")
                        //{
                        //    price = double.Parse(row[4].ToString().Replace("$.", "").Replace(",", "").Replace(" zł", ""));
                        //}

                        var email    = row[3].ToString();
                        var nickname = row[2].ToString();

                        double soldprice = 0d;
                        if (row[4].ToString() != "")
                        {
                            soldprice = double.Parse(row[4].ToString().Replace(" zł", "").Replace(",", "").Replace("$", ""));
                        }

                        var trackNumber  = row[5].ToString();
                        var orderdetails = row[6].ToString() + " " + row[7].ToString();
                        //double dollarPrice = 0d;
                        //if (row[11].ToString() != "")
                        //{
                        //    dollarPrice = double.Parse(row[11].ToString().Replace("$", "").Replace(",", ""));
                        //}
                        //var englishName = row[12].ToString();

                        //bool isInStock = row[7].ToString() != "#N/A";
                        //var avers = row[1].ToString();
                        //var revers = row[2].ToString();

                        //if (avers == "foto")
                        //{
                        //    avers = string.Empty;
                        //}

                        //if (revers == "foto")
                        //{
                        //    revers = string.Empty;
                        //}

                        orders = new OrderModel()
                        {
                            NickName     = nickname,
                            IsPaid       = paid,
                            TrackNumber  = trackNumber,
                            OrderDetails = orderdetails,
                            Email        = email,
                            OrderId      = index,
                            Name         = title,
                            SalePrice    = soldprice,
                            SaleCurrency = isZloty ? "zł" : "$",
                            WhereSold    = isZloty ? "Allegro" : "Ebay",
                            Link         = string.Empty
                                           //CoinId = index,
                                           //Name = title,
                                           //Cost = price,
                                           //Link = link,
                                           //ZlotyPrice = allegroPrice,
                                           //PolishName = allegroName,
                                           //DollarPrice = dollarPrice,
                                           //EnglishName = englishName,
                                           //IsInStock = isInStock,
                                           //AversFotoLink = avers,
                                           //ReversFotoLink = revers
                        };
                    }
                    else
                    {
                    }
                    // Print columns A and E, which correspond to indices 0 and 4.
                    //Console.WriteLine("{0}, {1}", row[0], row[4]);
                    if (orders.Link == null)
                    {
                    }
                    if (orders.OrderId != 1018 && orders.OrderId != 0)
                    {
                        using (var db = new BusinessLogic.BusinessLogic())
                            db.AddOrder(Mapper.Map <OrderBL>(orders));
                    }
                }
            }
            //else
            //{
            //    Console.WriteLine("No data found.");
            //}
            //Console.Read();

            return(View());
        }
Beispiel #32
0
        public RegisterController()
        {
            var bl = new BusinessLogic.BusinessLogic();

            _session = bl.GetRegisterBL();
        }
Beispiel #33
0
        public GalerieController()
        {
            var bl = new BusinessLogic.BusinessLogic();

            _galerie = bl.GetGalerieBL();
        }