Exemple #1
0
        public ActionResult Create([Bind(Include = "Cust_Id,Cust_Name,Cust_Contact,Cust_EmailAddress,Cust_Address")] Customer_tbl customer_tbl)
        {
            if (ModelState.IsValid)
            {
                if (db.Customer_tbl.Where(a => a.Cust_Name == customer_tbl.Cust_Name).Count() > 0)
                {
                    TempData["message"] = "This name has been registered!";
                    return(View());
                }
                else if (db.Customer_tbl.Where(a => a.Cust_EmailAddress == customer_tbl.Cust_EmailAddress).Count() > 0)
                {
                    TempData["message"] = "This email address has been registered!";
                    return(View());
                }
                else
                {
                    db.Customer_tbl.Add(customer_tbl);
                    db.SaveChanges();
                    TempData["message"] = "New Customer Registered!";
                    return(RedirectToAction("CustomerManagement"));
                }
            }

            return(View(customer_tbl));
        }
Exemple #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Customer_tbl customer_tbl = db.Customer_tbl.Find(id);

            db.Customer_tbl.Remove(customer_tbl);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Customer_tbl customer_tbl = db.Customer_tbl.Find(id);

            db.Customer_tbl.Remove(customer_tbl);
            db.SaveChanges();
            TempData["message"] = "Delete Successful!";
            return(RedirectToAction("CustomerManagement"));
        }
Exemple #4
0
 public ActionResult Edit([Bind(Include = "Cust_Id,Cust_Name,Cust_Contact,Cust_EmailAddress,Cust_Address")] Customer_tbl customer_tbl)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer_tbl).State = EntityState.Modified;
         db.SaveChanges();
         TempData["message"] = "Edit successful!";
         return(RedirectToAction("CustomerManagement"));
     }
     return(View(customer_tbl));
 }
Exemple #5
0
        public ActionResult Edit(Customer_tbl customer_tbl)
        {
            if (ModelState.IsValid)
            {
                db.Entry(customer_tbl).State = EntityState.Modified;
                db.SaveChanges();

                SendEmail1(customer_tbl.Email, customer_tbl.FirstName, customer_tbl);
                return(RedirectToAction("Index"));
            }
            return(View(customer_tbl));
        }
 public static CustDTO  FromDal(Customer_tbl c)
 {
     return(new CustDTO
     {
         adress = c.adress,
         custFName = c.custFName,
         custId = c.custId,
         custLName = c.custLName,
         Subcribtionlist =
             c.Subcribtions.ToList().Select(s => SubcribtionDTO.FromDal(s)).ToList()
     });
 }
Exemple #7
0
        // GET: Customer/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Customer_tbl customer_tbl = db.Customer_tbl.Find(id);

            if (customer_tbl == null)
            {
                return(HttpNotFound());
            }
            return(View(customer_tbl));
        }
        public ActionResult Create([Bind(Include = "ServiceId,AirlinesName,DepratureDate,DepratureTime,ArrivalDate,ArrivalTime,BusName,BusDepratureDate,BusDepratureTime,BusArrivalDate,BusArrivalTime,CustomerId")] Service_tbl service_tbl)
        {
            if (ModelState.IsValid)
            {
                db.Service_tbl.Add(service_tbl);
                db.SaveChanges();
                Customer_tbl customer = db.Customer_tbl.FirstOrDefault(a => a.CustomerId == service_tbl.CustomerId);
                SendEmail(customer.Email, customer.FirstName, service_tbl);
                return(RedirectToAction("Index"));
            }

            ViewBag.CustomerId = new SelectList(db.Customer_tbl, "CustomerId", "FirstName", service_tbl.CustomerId);
            return(View(service_tbl));
        }
Exemple #9
0
        // GET: Customer/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Customer_tbl customer_tbl = db.Customer_tbl.Find(id);

            ViewBag.PackageId = new SelectList(db.Package_tbl, "PackageId", "PackageName", customer_tbl.PackageId);

            if (customer_tbl == null)
            {
                return(HttpNotFound());
            }
            return(View(customer_tbl));
        }
Exemple #10
0
        public void SendEmail1(string emailID, string FirstName, Customer_tbl customer_Tbl)
        {
            var    fromEmail         = new MailAddress("*****@*****.**", "Caveman International limited");
            var    toEmail           = new MailAddress(emailID);
            var    fromEmailPassword = "******"; // Replace with actual password
            string subject           = "Your information is successfully edited by manager";


            string newbody   = "<br/>Dear " + FirstName + ",<br/> Please check your full information.";
            string newbody1  = "<br/>  First Name: " + customer_Tbl.FirstName + "<br/>";
            string newbody2  = "<br/>  Last Name: " + customer_Tbl.LastName + "<br/>";
            string newbody3  = "<br/>  Email: " + customer_Tbl.Email + "<br/>";
            string newbody4  = "<br/>  City: " + customer_Tbl.City + "<br/>";
            string newbody5  = "<br/>  Postal Code: " + customer_Tbl.PostalCode + "<br/>";
            string newbody6  = "<br/> Passport: " + customer_Tbl.Passport + "<br/>";
            string newbody7  = "<br/> Designation: " + customer_Tbl.Designation + "<br/>";
            string newbody8  = "<br/> Phone: " + customer_Tbl.Phone + "<br/>";
            string newbody9  = "<br/> Number Of Adult Travellers: " + customer_Tbl.NoOfAdultTravellers + "<br/>";
            string newbody10 = "<br/> Number Of Child Travellers: " + customer_Tbl.NoOfChildTravellers + "<br/>";
            string newbody11 = "<br/> Total Price: " + customer_Tbl.TotalPrice + "<br/>";
            string newbodys  = "<br/> Thank You <br/>";
            string body      = newbody + newbody1 + newbody2 + newbody3 + newbody4 + newbody5 + newbody6 + newbody7 + newbody8 + newbody9 + newbody10 + newbody11 + newbodys;

            var smtp = new SmtpClient
            {
                Host                  = "smtp.gmail.com",
                Port                  = 587,
                EnableSsl             = true,
                DeliveryMethod        = SmtpDeliveryMethod.Network,
                UseDefaultCredentials = false,
                Credentials           = new NetworkCredential(fromEmail.Address, fromEmailPassword)
            };

            using (var message = new MailMessage(fromEmail, toEmail)
            {
                Subject = subject,
                Body = body,
                IsBodyHtml = true
            })

                smtp.Send(message);
        }
Exemple #11
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));
        }
Exemple #12
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");
        }