Exemplo n.º 1
0
        public ActionResult dislike(int id)
        {
            Customer customer = (Customer)this.Session["user"];
            bool     status   = BussinessManager.AddDislike(customer.customerid, id);

            if (status)
            {
                return(this.RedirectToRoute("posts"));
            }
            return(View());
        }
        public ActionResult dislike(int id, string uname)
        {
            Customer customer = (Customer)this.Session["user"];
            bool     status   = BussinessManager.AddDislike(customer.customerid, id);

            if (status)
            {
                return(Redirect("/@" + uname));
            }
            return(View());
        }
Exemplo n.º 3
0
        public ActionResult addcomment(int postid, string postcommentcontent, int userid)
        {
            Customer customer = (Customer)this.Session["user"];
            bool     status   = BussinessManager.insertcomment(postid, customer.customerid, postcommentcontent, customer.customer_name, userid);

            if (status)
            {
                return(this.RedirectToRoute("posts"));
            }
            return(View());
        }
        public ActionResult unfollow(int id, string fname)
        {
            Customer customer = (Customer)this.Session["user"];
            bool     status   = BussinessManager.unFollow(customer.customerid, id, fname);

            if (status)
            {
                return(Redirect("/@" + fname));
            }
            return(View());
        }
        public ActionResult addaddress(string flat_no, string build_no, string area, string street, string city, string district, string state, string pincode)
        {
            Customer customer = (Customer)this.Session["user"];
            bool     status   = BussinessManager.addaddress(customer.customerid, flat_no, build_no, area, street, city, district, state, pincode);

            if (status)
            {
                return(this.RedirectToRoute("cart"));
            }

            return(View());
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            BussinessManager bm = new BussinessManager();

            Console.WriteLine("********ALL THE AVALIABLE JUICE FLAVOURS**********");
            Console.WriteLine("JUICEID\tJUICE_FLAVOUR\tPRICE");
            List <Juice> juicelst = bm.GetallJuiceFlavours();

            foreach (Juice js in juicelst)
            {
                Console.WriteLine("{0}\t{1}\t{2}", js.juiceid, js.juice_flavour, js.price);
            }
            BussinessManager bm1 = new BussinessManager();

            Console.Write("Enter juice_id:");
            int jid = int.Parse(Console.ReadLine());

            Console.WriteLine("Enter Quantity:");
            int qty = int.Parse(Console.ReadLine());

            bm1.PurchasedJuice(jid, qty);
            Console.WriteLine("Do u want to continue y/n");
            string s = Console.ReadLine();
            string r;

            if (s == "y")
            {
                do
                {
                    BussinessManager bm2 = new BussinessManager();
                    foreach (Juice j in juicelst)
                    {
                        Console.WriteLine("{0}\t{1}\t{2}", j.juiceid, j.juice_flavour, j.price);
                    }
                    Console.WriteLine("Enter the Juice Flavor Id:");
                    int jfid = int.Parse(Console.ReadLine());
                    Console.WriteLine("enter the quantity");
                    int Qty = int.Parse(Console.ReadLine());
                    bm1.PurchasedJuice(jfid, Qty);
                    Console.WriteLine("want to continue more y/n");
                    r = (Console.ReadLine());
                } while (r == "y");
            }
            List <JuicePurchased> j1 = bm1.GetallJuicePurchased();
            int sum = 0;

            foreach (JuicePurchased j2 in j1)
            {
                sum = sum + j2.amount;
            }
            Console.WriteLine("Total Purchase:{0}", sum);
        }
 public ActionResult Restore(string token)
 {
     if (Request.QueryString["token"] != null)
     {
         string email = BussinessManager.checkToken(token);
         //string token = Request.QueryString["token"];
         if (email != "")
         {
             this.ViewData["email"] = email;
         }
     }
     return(this.RedirectToRoute("account.login"));
 }
Exemplo n.º 8
0
        public ActionResult UpdateByPrice(int bid, double bpp, double bhp, double ebp)
        {
            bool status = BussinessManager.UpdateBookbyPrice(bid, bpp, bhp, ebp);

            if (status)
            {
                return(this.RedirectToAction("dasboard", "admin"));
            }
            // TO AVOID NULL ERROR
            Books getbook = BussinessManager.GetBookdetails(bid);

            return(View(getbook));
        }
        public ActionResult Index()
        {
            Customer customer = (Customer)this.Session["user"];

            if (customer == null)
            {
                return(RedirectToRoute("account.login"));
            }

            List <Books> allbook = BussinessManager.GetWishList(customer.customerid);

            this.ViewData["books"] = allbook;
            return(View());
        }
Exemplo n.º 10
0
        public ActionResult Index()
        {
            Customer customer = (Customer)this.Session["user"];

            if (customer == null)
            {
                return(RedirectToRoute("account.login"));
            }

            List <Order> orders = BussinessManager.getOrders(customer.customerid);

            this.ViewData["orders"] = orders;
            return(View());
        }
Exemplo n.º 11
0
        public ActionResult ArchiveBook(int id)
        {
            Books getbook = BussinessManager.GetBookdetails(id);

            if (getbook.status == 1)
            {
                bool status = BussinessManager.ArchiveBook(getbook.booksID);
            }
            else
            {
                bool status = BussinessManager.CancelArchive(getbook.booksID);
            }

            return(this.RedirectToAction("dasboard", "admin"));
        }
Exemplo n.º 12
0
        public ActionResult Index()
        {
            this.ViewData["books"] = this.Session["books"];
            Customer customer = (Customer)this.Session["user"];

            if (customer == null)
            {
                return(this.RedirectToAction("login", "account"));
            }
            List <Posts> allposts = BussinessManager.GetallPosts(customer.customerid);
            List <Likes> like     = BussinessManager.GetallLikes(customer.customerid);

            ViewData["likes"] = like;
            return(View(allposts));
        }
Exemplo n.º 13
0
        public ActionResult Login(AdminLogin login)
        {
            TryValidateModel(login);

            if (ModelState.IsValid)
            {
                bool status = BussinessManager.AdminLogin(login.Username, login.Password);

                if (status)
                {
                    return(this.RedirectToRoute("admin.dashboard"));
                    //return this.RedirectToAction("dashboard","admin");
                }
            }
            return(View());
        }
Exemplo n.º 14
0
        public ActionResult Me()
        {
            Customer customer = (Customer)this.Session["user"];

            if (customer == null)
            {
                this.Session["message"] = "Please login first..";
                return(RedirectToRoute("account.login"));
            }
            List <Books> books = BussinessManager.getPurchasedBooks(customer.customerid);

            this.ViewData["books"] = books;

            List <Posts> post = BussinessManager.GetallUsersPosts(customer.customerid);

            return(View(post));
        }
Exemplo n.º 15
0
        public ActionResult Reset(string password, string password2, string email)
        {
            if (password != password2)
            {
                return(View());
            }

            Customer customer = (Customer)this.Session["user"];

            bool status = BussinessManager.updatepass(password, email);

            if (status)
            {
                return(this.RedirectToAction("login", "account"));;
            }
            return(this.RedirectToRoute("account.login"));
        }
Exemplo n.º 16
0
        public ActionResult Forgot(string uemail)
        {
            Customer newcust = new Customer
            {
                email = uemail
            };

            bool status = BussinessManager.validateforgot(uemail);

            if (status)
            {
                int    number = 10;
                string str    = GenerateRandomAlphanumericString(number);



                string GenerateRandomAlphanumericString(int length)
                {
                    const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

                    var random       = new Random();
                    var randomString = new string(Enumerable.Repeat(chars, length)
                                                  .Select(s => s[random.Next(s.Length)]).ToArray());

                    return(randomString);
                }

                forgotpass newfor = new forgotpass
                {
                    email = uemail,
                    token = str
                };
                string url = "http://*****:*****@bookter.in", uemail, "Regarding password reset", "<!DOCTYPE html><html><head><title>Password Reset</title><link rel='stylesheet' href='css/font-awesome.css'><link rel='stylesheet' href='css/style.css'><link href='https://fonts.googleapis.com/css2?family=Miriam+Libre:wght@400;700&display=swap' rel='stylesheet'></head><body><div class='container' style='width: 100%;height: 100vh;min-height: 100vh;'><h1 class='p-y-medium' style='font-family: Nunito;;padding-top: 0.75rem;padding-bottom: 0.75rem;'>Hello User</h1><p class='p-y-medium' style='font-family: Nunito;;padding-top: 0.75rem;padding-bottom: 0.75rem;'>You just requested for your password reset.</p><p class='p-y-medium' style='font-family: Nunito;;padding-top: 0.75rem;padding-bottom: 0.75rem;'><a href='" + url + "'>Here's</a> the link if the button did not word.</p><p class='m-y-wide' style='font-family: Nunito;;margin-top: 1rem;margin-bottom: 1rem;'><strong>Thank you!</strong></p></div></body></html>");

                bool status1 = BussinessManager.forgotpasse(newfor);
                //return this.RedirectToRoute("index", "home");
                if (status1)
                {
                    return(this.RedirectToRoute(""));
                }
            }

            return(View());
        }
Exemplo n.º 17
0
        public ActionResult DeleteFromCart(int id)
        {
            Books book     = BussinessManager.GetBookdetails(id);
            Cart  cart     = (Cart)this.Session["carts"];
            Cart  cartCopy = cart;

            foreach (Item item in cartCopy.items)
            {
                if (item.book.booksID == id)
                {
                    cartCopy.items.Remove(item);
                    break;
                }
            }

            this.Session["cart"] = cartCopy;

            return(this.RedirectToAction("index", "cart"));
        }
Exemplo n.º 18
0
        public ActionResult Insertbook(/*int bid,*/ string bname, string bdisc, string aname, string aathor, string bpub, double bpp, double bhp, double ebp, int bpages, string blang, string bdate, string bdimen, double brat, string bimag, string bimag2, string bimag3)
        {
            Books newbook = new Books
            {
                //booksID = bid,
                bookname      = bname,
                bookdisc      = bdisc,
                bookauthor    = aname,
                aboutauthor   = aathor,
                bookpublisher = bpub,
                paperprice    = bpp,
                hardprice     = bhp,
                ebookprice    = ebp,
                bookspage     = bpages,
                booklang      = blang,
                bookdate      = bdate,
                rating        = brat,
                bookdimension = bdimen,
                image         = bimag,
                image2        = bimag2,
                image3        = bimag3
            };

            int book_id = BussinessManager.Insertbook(newbook);

            if (Request.Files.Count > 0 && Request.Files.Count <= 3)
            {
                string filePath = Server.MapPath("~/Images/Books/");

                List <string> images = Files.Upload("~/Images/Books/", 3, Server, Request);

                if (images != null)
                {
                    BussinessManager.UpdateBookImages(images, book_id);
                }
            }

            if (book_id != -1)
            {
                return(this.RedirectToAction("dasboard", "admin"));
            }
            return(View());
        }
Exemplo n.º 19
0
        public ActionResult Register(Register register)
        {
            TryValidateModel(register);


            if (ModelState.IsValid)
            {
                Customer cust = new Customer
                {
                    //customerid = uid,
                    customer_name = register.Username,
                    email         = register.Email,
                    password      = register.Password
                };
                bool status = BussinessManager.register(cust);

                if (status)
                {
                    Utils.Mailing.Send("*****@*****.**", register.Email, "Welcome " + register.Username + " !", "<!DOCTYPE html><html><head><title>Welcome</title><link rel='stylesheet' href='css/font-awesome.css'><link rel='stylesheet' href='css/style.css'><link href='https://fonts.googleapis.com/css2?family=Miriam+Libre:wght@400;700&display=swap' rel='stylesheet'></head><body><div class='container' style='width: 100%;height: 100vh;min-height: 100vh;'><h1 class='p-y-medium' style='font-family: Nunito;;padding-top: 0.75rem;padding-bottom: 0.75rem;'>Hello " + register.Username + "</h1><p class='p-y-medium' style='font-family: Nunito;;padding-top: 0.75rem;padding-bottom: 0.75rem;'>Wecome user.</p><p class='p-y-medium' style='font-family: Nunito;;padding-top: 0.75rem;padding-bottom: 0.75rem;'>Feel home here.</p><p class='m-y-wide' style='font-family: Nunito;;margin-top: 1rem;margin-bottom: 1rem;'><strong>Have a nice day!</strong></p></div></body></html>");
                    return(this.RedirectToAction("login", "account"));;
                }
            }
            return(View());
        }
Exemplo n.º 20
0
        public ActionResult Create()
        {
            Customer customer     = (Customer)this.Session["user"];
            Cart     existingCart = (Cart)this.Session["carts"];
            string   token        = Randoms.Pattern("ord-{HEX:6}-{HEX:2}-{HEX:6}");
            double   total        = existingCart.items.Sum(x => Convert.ToInt32(x.book.paperprice));
            int      book_id      = existingCart.items[0].book.booksID;
            int      qtt          = existingCart.items.Count;

            BussinessManager.createOrder(customer.customerid, book_id, qtt, total, token);
            int ord_i = BussinessManager.getLatestOrderId(customer.customerid);


            foreach (Item item in existingCart.items)
            {
                BussinessManager.addBook(ord_i, item.book.booksID, item.quantity);
            }

            this.Session["carts"] = new Cart();

            return(RedirectToRoute("orders.all"));

            //return View();
        }
Exemplo n.º 21
0
        public ActionResult Index(string postcontent, int postbooks)
        {
            Customer customer = (Customer)this.Session["user"];
            int      post_id  = BussinessManager.insertpost(customer.customerid, postcontent, postbooks, customer.customer_name);


            if (Request.Files.Count > 0 && Request.Files.Count <= 4)
            {
                string filePath = Server.MapPath("~/Images/Posts/");

                List <string> images = Files.Upload("~/Images/Posts/", 4, Server, Request);

                if (images != null)
                {
                    BussinessManager.UpdatePostImages(images, post_id);
                }
            }

            if (post_id != -1)
            {
                return(this.RedirectToRoute("posts"));
            }
            return(View());
        }
Exemplo n.º 22
0
        public ActionResult Details(int id)
        {
            Books thebook = BussinessManager.GetBookdetails(id);

            return(View(thebook));
        }
Exemplo n.º 23
0
        public ActionResult UpdateByPrice(int id)
        {
            Books getbook = BussinessManager.GetBookdetails(id);

            return(View(getbook));
        }
Exemplo n.º 24
0
        public ActionResult Get(string token)
        {
            MemoryStream ms = new MemoryStream();

            PdfWriter   pw          = new PdfWriter(ms);
            PdfDocument pdfDocument = new PdfDocument(pw);
            Document    doc         = new Document(pdfDocument, PageSize.LETTER);

            doc.SetMargins(75, 35, 70, 35);

            string pathLogo = Server.MapPath("~/Content/logo.jpg");
            Image  img      = new Image(ImageDataFactory.Create(pathLogo));

            pdfDocument.AddEventHandler(PdfDocumentEvent.START_PAGE, new HeaderEventHandler(img));
            pdfDocument.AddEventHandler(PdfDocumentEvent.END_PAGE, new FooterEventHandler());


            Table table = new Table(1).UseAllAvailableWidth();
            Cell  cell  = new Cell().Add(new Paragraph("INVOICE").SetFontSize(14)).SetTextAlignment(TextAlignment.CENTER).SetBorder(Border.NO_BORDER);

            table.AddCell(cell);

            doc.Add(table);

            Table _table = new Table(1).UseAllAvailableWidth();

            _table.AddCell(new Cell().Add(new Paragraph("For,")).SetTextAlignment(TextAlignment.RIGHT).SetBorder(Border.NO_BORDER));
            _table.AddCell(new Cell().Add(new Paragraph("Aditya Gaikwad")).SetTextAlignment(TextAlignment.RIGHT).SetBorder(Border.NO_BORDER));
            _table.AddCell(new Cell().Add(new Paragraph("Akurdi, Pune")).SetTextAlignment(TextAlignment.RIGHT).SetBorder(Border.NO_BORDER));


            doc.Add(_table);

            Style styleCell = new Style().SetBackgroundColor(ColorConstants.LIGHT_GRAY).SetTextAlignment(TextAlignment.CENTER);

            _table = new Table(5).UseAllAvailableWidth();
            Cell _cell = new Cell().Add(new Paragraph("#")).SetBorder(Border.NO_BORDER).SetBorderBottom(new SolidBorder(ColorConstants.BLACK, 1)).SetBorderTop(new SolidBorder(ColorConstants.BLACK, 1));

            _table.AddHeaderCell(_cell.AddStyle(styleCell));
            _cell = new Cell().Add(new Paragraph("Book Name")).SetBorder(Border.NO_BORDER).SetBorderBottom(new SolidBorder(ColorConstants.BLACK, 1)).SetBorderTop(new SolidBorder(ColorConstants.BLACK, 1));
            _table.AddHeaderCell(_cell.AddStyle(styleCell));
            _cell = new Cell().Add(new Paragraph("Quantity")).SetBorder(Border.NO_BORDER).SetBorderBottom(new SolidBorder(ColorConstants.BLACK, 1)).SetBorderTop(new SolidBorder(ColorConstants.BLACK, 1));
            _table.AddHeaderCell(_cell.AddStyle(styleCell));
            _cell = new Cell().Add(new Paragraph("Price")).SetBorder(Border.NO_BORDER).SetBorderBottom(new SolidBorder(ColorConstants.BLACK, 1)).SetBorderTop(new SolidBorder(ColorConstants.BLACK, 1));
            _table.AddHeaderCell(_cell.AddStyle(styleCell));
            _cell = new Cell().Add(new Paragraph("Total")).SetBorder(Border.NO_BORDER).SetBorderBottom(new SolidBorder(ColorConstants.BLACK, 1)).SetBorderTop(new SolidBorder(ColorConstants.BLACK, 1));
            _table.AddHeaderCell(_cell.AddStyle(styleCell));

            Customer          customer = (Customer)this.Session["user"];
            List <OrderBooks> books    = BussinessManager.getOrderBooks(token, customer.customerid);

            int    x     = 0;
            double total = 0;

            foreach (OrderBooks book in books)
            {
                x++;
                _cell = new Cell().Add(new Paragraph(x.ToString())).SetBorder(Border.NO_BORDER);
                _table.AddCell(_cell);
                _cell = new Cell().Add(new Paragraph(book.book_name)).SetBorder(Border.NO_BORDER);
                _table.AddCell(_cell);
                _cell = new Cell().Add(new Paragraph(book.quantity.ToString()).SetTextAlignment(TextAlignment.RIGHT)).SetBorder(Border.NO_BORDER);
                _table.AddCell(_cell);
                _cell = new Cell().Add(new Paragraph("₹ " + book.price.ToString()).SetTextAlignment(TextAlignment.RIGHT)).SetBorder(Border.NO_BORDER);
                _table.AddCell(_cell);
                _cell = new Cell().Add(new Paragraph("₹ " + (book.price * book.quantity)).SetTextAlignment(TextAlignment.RIGHT)).SetBorder(Border.NO_BORDER);
                _table.AddCell(_cell);
                total += book.price * book.quantity;
            }

            doc.Add(_table);

            _table = new Table(1).UseAllAvailableWidth();
            _table.AddCell(new Cell().Add(new Paragraph("Total: " + total)).SetTextAlignment(TextAlignment.RIGHT).SetBorder(Border.NO_BORDER).SetBorderBottom(new SolidBorder(ColorConstants.BLACK, 1)).SetBorderTop(new SolidBorder(ColorConstants.BLACK, 1)));

            doc.Add(_table);

            doc.Close();

            byte[] byteStream = ms.ToArray();
            ms = new MemoryStream();
            ms.Write(byteStream, 0, byteStream.Length);
            ms.Position = 0;

            return(new FileStreamResult(ms, "application/pdf"));
        }