Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Payment_tbl payment_tbl = db.Payment_tbl.Find(id);

            db.Payment_tbl.Remove(payment_tbl);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public ActionResult Create(Payment_tbl payment_tbl)
        {
            if (ModelState.IsValid)
            {
                db.Payment_tbl.Add(payment_tbl);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CustomerId = new SelectList(db.Customer_tbl, "CustomerId", "FirstName", payment_tbl.CustomerId);
            return(View(payment_tbl));
        }
Esempio n. 3
0
        // GET: Payment_tbl/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Payment_tbl payment_tbl = db.Payment_tbl.Find(id);

            if (payment_tbl == null)
            {
                return(HttpNotFound());
            }
            return(View(payment_tbl));
        }
Esempio n. 4
0
        // GET: Payment_tbl/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Payment_tbl payment_tbl = db.Payment_tbl.Find(id);

            if (payment_tbl == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CustomerId = new SelectList(db.Customer_tbl, "CustomerId", "FirstName", payment_tbl.CustomerId);
            return(View(payment_tbl));
        }
        public void Add_Payment(int P_Id, DateTime date, float Amount, int Supplier_Id)
        {
            try {
                Payment_tbl new_payment = new Payment_tbl();


                new_payment.Payment_Invoice_Id = P_Id;
                new_payment.Payment_Date       = date.Date;
                new_payment.Amount             = Amount;
                new_payment.Supplier_Id        = Supplier_Id;

                Namal_S.Payment_tbls.InsertOnSubmit(new_payment);

                Namal_S.SubmitChanges();
            }
            catch (Exception e)
            {
            }
        }
Esempio n. 6
0
        public ActionResult Edit(Payment_tbl payment_tbl)
        {
            if (ModelState.IsValid)
            {
                db.Entry(payment_tbl).State = EntityState.Modified;
                db.SaveChanges();

                if (payment_tbl.Status == 1)
                {
                    Customer_tbl customer = db.Customer_tbl.FirstOrDefault(a => a.CustomerId == payment_tbl.CustomerId);
                    SendEmail(payment_tbl.Customer_tbl.Email, payment_tbl.Customer_tbl.FirstName, payment_tbl.CustomerId, payment_tbl.PaymentId);
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(RedirectToAction("Index"));
                }
            }
            ViewBag.CustomerId = new SelectList(db.Customer_tbl, "CustomerId", "FirstName", payment_tbl.CustomerId);
            return(View(payment_tbl));
        }
Esempio n. 7
0
        public ActionResult Create(int id, string FirstName, string LastName, string Email, string City, string PostalCode, string Passport, string Designation, string PackageName, string PackageType, int PackagePrice, int Phone, int NoOfAdultTravellers, int?NoOfChildTravellers, int?TotalPrice)
        {
            if (Email != null)
            {
                Customer_tbl customer = new Customer_tbl();
                customer.FirstName           = FirstName;
                customer.LastName            = LastName;
                customer.Email               = Email;
                customer.City                = City;
                customer.PostalCode          = PostalCode;
                customer.Passport            = Passport;
                customer.Designation         = Designation;
                customer.Phone               = Phone;
                customer.NoOfAdultTravellers = NoOfAdultTravellers;
                customer.NoOfChildTravellers = NoOfChildTravellers;
                customer.TotalPrice          = TotalPrice;
                customer.PackageId           = id;

                db.Customer_tbl.Add(customer);
                db.SaveChanges();
                Payment_tbl payment = new Payment_tbl();
                payment.Status     = 0;
                payment.CustomerId = customer.CustomerId;
                db.Payment_tbl.Add(payment);
                db.SaveChanges();
                SendEmail(Email, FirstName);
                Customer_tbl lastCustomer = db.Customer_tbl.OrderByDescending(a => a.CustomerId).FirstOrDefault();
                return(RedirectToAction("Details" + "/" + lastCustomer.CustomerId));;
            }
            else
            {
                return(RedirectToAction("Create" + "/" + id));;
            }
            //var list = db.Package_tbl.Where(x => x.PackageId == id).FirstOrDefault();
            //return RedirectToAction("Index");
        }