コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            tblLogin_HMS03_Team7 tblLogin_HMS03_Team7 = db.tblLogin_HMS03_Team7.Find(id);

            db.tblLogin_HMS03_Team7.Remove(tblLogin_HMS03_Team7);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "LoginID,uname,pwd,roles")] tblLogin_HMS03_Team7 tblLogin_HMS03_Team7)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblLogin_HMS03_Team7).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tblLogin_HMS03_Team7));
 }
コード例 #3
0
        // GET: tblLogin_HMS03_Team7/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblLogin_HMS03_Team7 tblLogin_HMS03_Team7 = db.tblLogin_HMS03_Team7.Find(id);

            if (tblLogin_HMS03_Team7 == null)
            {
                return(HttpNotFound());
            }
            return(View(tblLogin_HMS03_Team7));
        }
コード例 #4
0
        public ActionResult credit([Bind(Include = "CustomerID,LoginID,Title,FirstName,LastName,DateOfBirth,Gender,StreetAddress,City,State,ZipCode,Nationality,MobileNumber,AlternateNumber,PhoneNumber,Email,CompanyName,OfficeAddress,BonusMilePoints")] tblCustomer_HMS03_Team7 tblCustomer_HMS03_Team7)
        {
            //if (ModelState.IsValid)
            //{
            tblLogin_HMS03_Team7 lg = new tblLogin_HMS03_Team7();

            lg.uname = Request["username"];
            lg.pwd   = Request["password"];
            lg.roles = "Customer";
            db.tblLogin_HMS03_Team7.Add(lg);
            db.SaveChanges();
            MessageBox.Show("Proceeding to Register");
            Session["newID"] = lg.LoginID;

            return(RedirectToAction("Create", "tblCustomer_HMS03_Team7"));
            //}

            //ViewBag.LoginID = new SelectList(db.tblLogin_HMS03_Team7, "LoginID", "uname", tblCustomer_HMS03_Team7.LoginID);
            //return RedirectToAction("Create", "tblCustomer_HMS03_Team7");
        }
コード例 #5
0
        public ActionResult Log([Bind(Include = "LoginID,uname,pwd,roles")] tblLogin_HMS03_Team7 tblLogin_HMS03_Team7)
        {
            List <tblLogin_HMS03_Team7> ulist = db.tblLogin_HMS03_Team7.ToList();

            foreach (var i in ulist)
            {
                if (i.uname.Equals(tblLogin_HMS03_Team7.uname) && i.pwd.Equals(tblLogin_HMS03_Team7.pwd) && i.roles.Equals("Customer"))
                {
                    FormsAuthentication.SetAuthCookie(i.uname, false);
                    MessageBox.Show("Logged in successfully as: " + tblLogin_HMS03_Team7.uname);
                    Session["username"] = i.uname;
                    Session["userid"]   = i.LoginID;
                    ViewBag.uname       = i.uname;

                    List <tblCustomer_HMS03_Team7> clist = db.tblCustomer_HMS03_Team7.ToList();

                    foreach (var customer in clist)
                    {
                        if (i.LoginID == customer.LoginID)
                        {
                            Session["cid"] = customer.CustomerID;
                        }
                    }

                    if (Session["ScheduleId"] == null)
                    {
                        return(RedirectToAction("Create", "tblSearch_HMS03_Team7"));
                    }
                    else
                    {
                        int jid = int.Parse(Session["jour"].ToString());
                        List <tblJourney_HMS03_Team7> jlist = db.tblJourney_HMS03_Team7.ToList();

                        int cust = int.Parse((Session["cid"]).ToString());
                        tblJourney_HMS03_Team7 journeys = db.tblJourney_HMS03_Team7.Find(jid);
                        journeys.CustomerID = cust;
                        db.SaveChanges();


                        return(RedirectToAction("Details", "tblJourney_HMS03_Team7", new { id = jid }));
                    }
                }


                else if (i.uname.Equals(tblLogin_HMS03_Team7.uname) && i.pwd.Equals(tblLogin_HMS03_Team7.pwd) && i.roles.Equals("Manager"))
                {
                    FormsAuthentication.SetAuthCookie(i.uname, false);

                    List <tblEmployee_HMS03_Team7> elist = db.tblEmployee_HMS03_Team7.ToList();
                    foreach (var item in elist)
                    {
                        if (i.LoginID == item.LoginID)
                        {
                            Session["FMID"]      = item.EmployeeID;
                            Session["FMAirline"] = item.Airlines;
                        }
                    }

                    MessageBox.Show("Logged in successfully as: " + tblLogin_HMS03_Team7.uname);
                    return(RedirectToAction("Index", "tblAeroplane_HMS03_Team7"));
                }

                else if (i.uname.Equals(tblLogin_HMS03_Team7.uname) && i.pwd.Equals(tblLogin_HMS03_Team7.pwd) && i.roles.Equals("Flight"))
                {
                    FormsAuthentication.SetAuthCookie(i.uname, false);

                    List <tblEmployee_HMS03_Team7> elist = db.tblEmployee_HMS03_Team7.ToList();
                    foreach (var item in elist)
                    {
                        if (i.LoginID == item.LoginID)
                        {
                            Session["FSID"] = item.EmployeeID;
                        }
                    }

                    MessageBox.Show("Logged in successfully as: " + tblLogin_HMS03_Team7.uname);
                    return(RedirectToAction("VeiwScheduleToScheduler", "tblSchedule_HMS03_Team7"));
                }
            }

            MessageBox.Show("Invalid");
            return(RedirectToAction("Log"));
            //}
        }