private void metroButtonTransection_Click(object sender, EventArgs e)
        {
            panelEveryThingHolder.Controls.Clear();
            Transection t = new Transection();

            panelEveryThingHolder.Controls.Add(t);
        }
Beispiel #2
0
        protected override void Seed(DatabaseContext context)
        {
            List <Transection> transectionList = new List <Transection>();

            for (int i = 0; i < 1000; i++)
            {
                Transection islem = new Transection();
                islem.Amount = FakeData.NumberData.GetDouble();
                islem.Buyer  = FakeData.NameData.GetFirstName();
                islem.Seller = FakeData.NameData.GetFirstName();
                islem.Date   = FakeData.DateTimeData.GetDatetime();
                transectionList.Add(islem);
                context.Transections.Add(islem);
            }

            context.SaveChanges();

            for (int i = 0; i < 1000; i++)
            {
                Download d = new Download();
                d.CreateDate = FakeData.DateTimeData.GetDatetime();
                d.EndDate    = FakeData.DateTimeData.GetDatetime();
                d.StartDate  = FakeData.DateTimeData.GetDatetime();
                d.IsExist    = FakeData.BooleanData.GetBoolean();
                d.GuidName   = FakeData.NameData.GetCompanyName();

                context.Downloads.Add(d);
            }

            context.SaveChanges();
        }
Beispiel #3
0
        public async Task <IActionResult> Edit(string id, [Bind("Id,ParentId,TransectionTypeId,ProductId,Price,Vat,Quantity,RemainingQuantity,ExpireDate,CreatedBy,UpdatedBy,DeletedBy,CreatedAt,DeletedAt")] Transection transection)
        {
            if (id != transection.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(transection);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TransectionExists(transection.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProductId"]         = new SelectList(_context.Products, "Id", "Id", transection.ProductId);
            ViewData["TransectionTypeId"] = new SelectList(_context.TransectionType, "Id", "Id", transection.TransectionTypeId);
            return(View(transection));
        }
        public ActionResult refill_by_wallet(Transection tr)
        {
            if (ModelState.IsValid)
            {
                //updating wallet money info
                var x = db.userprofiles.Where(r => r.username == tr.username).FirstOrDefault();
                x.wallet_money    = x.wallet_money - tr.transection_ammount;
                db.Entry(x).State = EntityState.Modified;
                db.SaveChanges();

                //updating refill history
                transection_final tf = new transection_final();
                //User_refill_history r_h = new User_refill_history();
                tf.ammount   = tr.transection_ammount;
                tf.send_to   = tr.mo_number;
                tf.sent_date = tr.transection_date;
                tf.status    = "Pending";
                tf.username  = tr.username;
                db.transection_finals.Add(tf);
                db.SaveChanges();
                return(RedirectToAction("myprofile"));
            }
            else
            {
                ModelState.AddModelError(" ", "Please provide valid data");
            }
            return(PartialView(tr));
        }
        public ActionResult wallet_refill(Transection tr)
        {
            if (ModelState.IsValid)
            {
                var v = db.wallet_deposit_temp.Where(r => r.username == tr.username).ToList();
                if (v.Count() > 0)
                {
                    var v1 = v.ToArray();
                    //wallet_deposit_temp wdt = new wallet_deposit_temp();
                    v1[0].deposit_ammount = tr.transection_ammount;
                    //wdt.deposit_ammount = tr.transection_ammount;
                    db.Entry(v1[0]).State = EntityState.Modified;
                    db.SaveChanges();
                    string url   = paypal_wallet.paypal_wallet_pay(tr);
                    string email = db.userprofiles.
                                   Where(r => r.username == User.Identity.Name).Select(r => r.e_mail).FirstOrDefault();
                    url += "&email=" + email;
                    Response.Redirect(url);

                    //return RedirectToAction("Thank_You");
                }
                else
                {
                    wallet_deposit_temp wdt = new wallet_deposit_temp();
                    wdt.username        = tr.username;
                    wdt.deposit_date    = tr.transection_date;
                    wdt.deposit_ammount = tr.transection_ammount;
                    db.wallet_deposit_temp.Add(wdt);
                    db.SaveChanges();
                    string url   = paypal_wallet.paypal_wallet_pay(tr);
                    string email = db.userprofiles.
                                   Where(r => r.username == User.Identity.Name).Select(r => r.e_mail).FirstOrDefault();
                    url += "&email=" + email;
                    Response.Redirect(url);

                    //return RedirectToAction("Thank_You");
                }

                /*user_deposit_history udh = new user_deposit_history();
                 * udh.username = tr.username;
                 * udh.deposit_date = tr.transection_date;
                 * udh.deposit_ammount = tr.transection_ammount;
                 * udh.deposit_status = "Approved";
                 * db.deposit_history.Add(udh);
                 *
                 * var d = db.userprofiles
                 *  .Where(r => r.username == tr.username).FirstOrDefault();
                 * d.wallet_money = d.wallet_money + udh.deposit_ammount;
                 * db.Entry(d).State = EntityState.Modified;*/
                //db.SaveChanges();
                //string url = paypal_wallet.paypal_wallet_pay(tr);
                //Response.Redirect(url);
                //return RedirectToAction("Thank_You");
            }
            else
            {
                ModelState.AddModelError(" ", "Please provide valid data");
            }
            return(PartialView(tr));
        }
 public ActionResult Instant_refill(Transection tr)
 {
     if (ModelState.IsValid)
     {
         var v = db.refil_history.Where(r => r.username == tr.username).ToList();
         if (v.Count() > 0)
         {
             var v1 = v.ToArray();
             //User_refill_history rh = new User_refill_history();
             v1[0].ammount = tr.transection_ammount;
             //rh.ammount = tr.transection_ammount;
             db.Entry(v1[0]).State = EntityState.Modified;
             db.SaveChanges();
             string url = paypal.paypal_pay(tr);
             if (Request.IsAuthenticated)
             {
                 string email = db.userprofiles.
                                Where(r => r.username == User.Identity.Name).Select(r => r.e_mail).FirstOrDefault();
                 url += "&email=" + email;
                 Response.Redirect(url);
             }
             else
             {
                 url += "&email=" + "*****@*****.**";
                 Response.Redirect(url);
             }
         }
         else
         {
             User_refill_history rh = new User_refill_history();
             rh.username  = tr.username;
             rh.send_to   = tr.mo_number;
             rh.sent_date = tr.transection_date;
             rh.status    = "Pending";
             rh.ammount   = tr.transection_ammount;
             db.refil_history.Add(rh);
             //db.transections.Add(tr);
             db.SaveChanges();
             string url = paypal.paypal_pay(tr);
             Response.Redirect(url);
             //return RedirectToAction("Thank_You");
         }
         //if (Request.IsAuthenticated)
         //{
         //  return RedirectToAction("myprofile");
         //}
         //else
         //{
         //  return RedirectToAction("Index");
         //}
         //}
     }
     else
     {
         ModelState.AddModelError("", "Please provide valid data.");
     }
     return(PartialView(tr));
 }
Beispiel #7
0
        public async Task <IActionResult> Create([Bind("Id,ParentId,TransectionTypeId,ProductId,Price,Vat,Quantity,RemainingQuantity,ExpireDate,CreatedBy,UpdatedBy,DeletedBy,CreatedAt,DeletedAt")] Transection transection)
        {
            if (ModelState.IsValid)
            {
                _context.Add(transection);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProductId"]         = new SelectList(_context.Products, "Id", "Id", transection.ProductId);
            ViewData["TransectionTypeId"] = new SelectList(_context.TransectionType, "Id", "Id", transection.TransectionTypeId);
            return(View(transection));
        }
        public ActionResult wallet_refill(Transection tr)
        {
            if (ModelState.IsValid)
            {
                var z = db.refil_history.ToList();
                if (z.Count() > 0)
                {
                    foreach (var i1 in z)
                    {
                        db.refil_history.Remove(i1);
                    }
                }
                var v = db.wallet_deposit_temp.Where(r => r.username == tr.username).ToList();
                if (v.Count() > 0)
                {
                    var v1 = v.ToArray();
                    v1[0].deposit_ammount = tr.transection_ammount;
                    db.Entry(v1[0]).State = EntityState.Modified;
                    db.SaveChanges();
                    string url   = paypal_wallet.paypal_wallet_pay(tr);
                    string email = db.userprofiles.
                                   Where(r => r.username == User.Identity.Name).Select(r => r.e_mail).FirstOrDefault();
                    url += "&email=" + email;
                    Response.Redirect(url);

                    //return RedirectToAction("Thank_You");
                }
                else
                {
                    wallet_deposit_temp wdt = new wallet_deposit_temp();
                    wdt.username        = tr.username;
                    wdt.deposit_date    = tr.transection_date;
                    wdt.deposit_ammount = tr.transection_ammount;
                    db.wallet_deposit_temp.Add(wdt);
                    db.SaveChanges();
                    string url   = paypal_wallet.paypal_wallet_pay(tr);
                    string email = db.userprofiles.
                                   Where(r => r.username == User.Identity.Name).Select(r => r.e_mail).FirstOrDefault();
                    url += "&email=" + email;
                    Response.Redirect(url);

                    //return RedirectToAction("Thank_You");
                }
            }
            else
            {
                ModelState.AddModelError(" ", "Please provide valid data");
            }
            return(PartialView(tr));
        }
        public ActionResult AllowDownload(int tid)
        {
            var   emailid = User.Identity.Name.ToString();
            Users obj     = dbobj.Users.Where(x => x.EmailID == emailid).FirstOrDefault();

            Transection deal = dbobj.Transection.Where(x => x.ID == tid).FirstOrDefault();

            deal.IsAllowed = true;

            dbobj.Entry(deal).State = System.Data.Entity.EntityState.Modified;
            dbobj.SaveChanges();
            NotifyBuyer(deal.Users.EmailID, deal.Users.FirstName, obj.FirstName);

            return(RedirectToAction("BuyerRequest"));
        }
        public ActionResult wallet_refill()
        {
            List <decimal> li1 = new List <decimal> {
                2000, 3000, 4000, 5000
            };

            ViewBag.ammount = li1;
            Transection tr = new Transection();

            tr.username         = User.Identity.Name;
            tr.mo_number        = "walletrefil";
            tr.ConfirmNumber    = "walletrefil";
            tr.transection_date = DateTime.Now;
            return(PartialView(tr));
        }
Beispiel #11
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Transection = await _context.Transections
                          .Include(t => t.Member).FirstOrDefaultAsync(m => m.TransectionId == id);

            if (Transection == null)
            {
                return(NotFound());
            }
            return(Page());
        }
        public ActionResult refill_by_wallet_bangla(Transection tr)
        {
            if (ModelState.IsValid)
            {
                //updating wallet money info
                var x = db.userprofiles.Where(r => r.username == tr.username).FirstOrDefault();
                x.wallet_money    = x.wallet_money - tr.transection_ammount;
                db.Entry(x).State = EntityState.Modified;
                db.SaveChanges();

                //updating refill history
                transection_final tf = new transection_final();
                //User_refill_history r_h = new User_refill_history();
                tf.ammount   = tr.transection_ammount;
                tf.send_to   = tr.mo_number;
                tf.sent_date = tr.transection_date;
                tf.status    = "Pending";
                tf.username  = tr.username;
                db.transection_finals.Add(tf);
                db.SaveChanges();

                //send mail
                MailMessage  message      = new MailMessage();
                var          fromAddress  = "*****@*****.**";
                var          toAddress    = "*****@*****.**";
                const string fromPassword = "******";
                string       subject      = "Wallet refill-bangla";
                string       body         = string.Format("{0} has sent {1} to {2}", User.Identity.Name, tr.transection_ammount, tr.mo_number);
                SmtpClient   smtp         = new SmtpClient
                {
                    Host        = "mail.paymobd.com",
                    Port        = 587,
                    EnableSsl   = false,
                    Credentials = new NetworkCredential(fromAddress, fromPassword)
                };
                smtp.Send(fromAddress, toAddress, subject, body);

                Thread.Sleep(2000);
                return(RedirectToAction("order_confirm_bangla"));
            }
            else
            {
                ModelState.AddModelError(" ", "Please provide valid data");
            }
            return(PartialView(tr));
        }
Beispiel #13
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Transection = await _context.Transections.FindAsync(id);

            if (Transection != null)
            {
                _context.Transections.Remove(Transection);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Beispiel #14
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Transection = await _context.Transections
                          .Include(t => t.Member).FirstOrDefaultAsync(m => m.TransectionId == id);

            if (Transection == null)
            {
                return(NotFound());
            }
            ViewData["MemberId"] = new SelectList(_context.Members, "MemberId", "MemberName");
            return(Page());
        }
        public ActionResult NoteDetails(int nid)
        {
            var   emailid = User.Identity.Name.ToString();
            Users obj     = dbobj.Users.Where(x => x.EmailID == emailid).FirstOrDefault();

            SellerNotes Note = dbobj.SellerNotes.Where(x => x.ID == nid).FirstOrDefault();

            if (obj != null)
            {
                Transection deal = dbobj.Transection.Where(x => x.ID == nid && x.BuyerID == obj.ID).FirstOrDefault();
                ViewBag.CurrentUserID   = obj.ID;
                ViewBag.CurrentUserName = obj.FirstName;
                if (deal != null)
                {
                    ViewBag.IsDealAvailable = deal.IsAllowed;
                }

                ViewBag.ProfilePicture = dbobj.UserProfile.Where(x => x.UserID == obj.ID).Select(x => x.ProfilePicture).FirstOrDefault();
            }

            var reviews     = dbobj.SellerNotesReviews.Where(x => x.NoteID == nid);
            var ReviewsList = new List <DisplayReview>();

            foreach (var item in reviews)
            {
                var ReviewByUser = dbobj.UserProfile.Where(x => x.UserID == item.ReviewedByID).FirstOrDefault();
                ReviewsList.Add(new DisplayReview()
                {
                    ReviewBy  = ReviewByUser.Users.FirstName,
                    UserImage = ReviewByUser.ProfilePicture,
                    Stars     = item.Ratings * 20,
                    Comment   = item.Comments
                });
            }

            ViewBag.Reviews = ReviewsList.OrderByDescending(x => x.Stars);
            return(View(Note));
        }
        public ActionResult Download(int nid)
        {
            var   emailid = User.Identity.Name.ToString();
            Users obj     = dbobj.Users.Where(x => x.EmailID == emailid).FirstOrDefault();

            SellerNotes noteobj = dbobj.SellerNotes.Where(x => x.ID == nid).FirstOrDefault();

            Users sellerobj = dbobj.Users.Where(x => x.ID == noteobj.SellerID).FirstOrDefault();

            Transection deal = dbobj.Transection.Where(x => x.NoteID == nid && x.BuyerID == obj.ID).FirstOrDefault();

            if (obj.ID == noteobj.SellerID)     // Users own book
            {
                using (ZipFile zip = new ZipFile())
                {
                    zip.AddDirectory(Server.MapPath("~/Members/" + noteobj.SellerID + "/" + nid + "/" + "Attachment"));

                    MemoryStream output = new MemoryStream();
                    zip.Save(output);
                    return(File(output.ToArray(), "Attachment/zip", noteobj.Title + ".zip"));
                }
            }
            else
            {
                if (deal == null)                // New Transection
                {
                    if (noteobj.IsPaid == false) // Download Free Notes
                    {
                        Transection tobj = new Transection();
                        tobj.NoteID       = nid;
                        tobj.Title        = noteobj.Title;
                        tobj.Category     = noteobj.NoteCategories.Name;
                        tobj.IsPaid       = false;
                        tobj.Price        = noteobj.SellingPrice;
                        tobj.BuyerID      = obj.ID;
                        tobj.SellerID     = noteobj.SellerID;
                        tobj.IsAllowed    = true;
                        tobj.IsDownloaded = true;
                        tobj.DownloadDate = DateTime.Now;
                        tobj.Status       = noteobj.ReferenceData.Value;
                        tobj.CreatedDate  = DateTime.Now;

                        dbobj.Transection.Add(tobj);
                        dbobj.SaveChanges();

                        using (ZipFile zip = new ZipFile())
                        {
                            zip.AddDirectory(Server.MapPath("~/Members/" + noteobj.SellerID + "/" + nid + "/" + "Attachment"));

                            MemoryStream output = new MemoryStream();
                            zip.Save(output);
                            return(File(output.ToArray(), "Attachment/zip", noteobj.Title + ".zip"));
                        }
                    }
                    else    // Download Paid Notes
                    {
                        Transection tobj = new Transection();
                        tobj.NoteID       = nid;
                        tobj.Title        = noteobj.Title;
                        tobj.Category     = noteobj.NoteCategories.Name;
                        tobj.IsPaid       = true;
                        tobj.Price        = noteobj.SellingPrice;
                        tobj.BuyerID      = obj.ID;
                        tobj.SellerID     = noteobj.SellerID;
                        tobj.IsAllowed    = false;
                        tobj.IsDownloaded = false;
                        tobj.DownloadDate = null;
                        tobj.Status       = noteobj.ReferenceData.Value;
                        tobj.CreatedDate  = DateTime.Now;

                        dbobj.Transection.Add(tobj);
                        dbobj.SaveChanges();
                        NotifySeller(sellerobj.EmailID, obj.FirstName, sellerobj.FirstName);
                        //return RedirectToAction("NoteDetails", new { nid });
                        ViewBag.CurrentUserName = obj.FirstName;
                        return(RedirectToAction("NoteDetails", new { nid }));
                        //return PartialView("ThanksPopup", noteobj);
                    }
                }
                else                             // Old Transection Available
                {
                    if (noteobj.IsPaid == false) // Download Free Notes
                    {
                        using (ZipFile zip = new ZipFile())
                        {
                            zip.AddDirectory(Server.MapPath("~/Members/" + noteobj.SellerID + "/" + nid + "/" + "Attachment"));

                            MemoryStream output = new MemoryStream();
                            zip.Save(output);
                            return(File(output.ToArray(), "Attachment/zip", noteobj.Title + ".zip"));
                        }
                    }
                    else    // Download Paid Notes
                    {
                        if ((bool)deal.IsAllowed)
                        {
                            deal.IsDownloaded = true;
                            deal.DownloadDate = DateTime.Now;

                            dbobj.Entry(deal).State = System.Data.Entity.EntityState.Modified;
                            dbobj.SaveChanges();

                            using (ZipFile zip = new ZipFile())
                            {
                                zip.AddDirectory(Server.MapPath("~/Members/" + noteobj.SellerID + "/" + nid + "/" + "Attachment"));

                                MemoryStream output = new MemoryStream();
                                zip.Save(output);
                                return(File(output.ToArray(), "Attachment/zip", noteobj.Title + ".zip"));
                            }
                        }
                        else
                        {
                            return(RedirectToAction("NoteDetails", nid));
                        }
                    }
                }
            }
        }