コード例 #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string email = TextBox1.Text;
            string pass  = TextBox2.Text;

            if (email == "*****@*****.**" && pass == "admin")
            {
                Session["UserId"]   = "1004";
                Session["UserName"] = "******";
                Session["Email"]    = "*****@*****.**";
                Response.Redirect("ManageSlots.aspx");
            }
            UserService.UserServiceClient userService = new UserService.UserServiceClient();
            UserService.User user = userService.loginUser(email, pass);
            if (user.Id == -1)
            {
                Label1.Text = "Incorrect Credentials";
            }
            else
            {
                Session["UserId"]   = user.Id.ToString();
                Session["UserName"] = user.UserName;
                Session["Email"]    = user.Email;
                Response.Redirect("Main.aspx");
            }
        }
コード例 #2
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     UserService.UserServiceClient client = new UserService.UserServiceClient();
     client.deleteUser(Session["Email"].ToString());
     Session["UserId"]   = null;
     Session["UserName"] = null;
     Session["Email"]    = null;
     Response.Redirect("Login.aspx");
 }
コード例 #3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            User user1 = new User();

            user1.Email    = TextBox2.Text;
            user1.Password = TextBox3.Text;
            user1.UserName = TextBox1.Text;
            //Response.Write(@"<script langauge='text/javascript'>alert('" +Session["Email"].ToString()+" "
            //   + user1.UserName + " " +
            //   user1.Password + " " + user1.Email +" ');</script>");
            UserService.UserServiceClient client = new UserService.UserServiceClient();
            client.updateUser(user1, Session["Email"].ToString());
            Session["UserName"] = user1.UserName;
            Session["Email"]    = user1.Email;
            Response.Redirect(Request.RawUrl);
        }
コード例 #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     //Session["Email"] = "*****@*****.**";
     if (Session["UserId"] == null)
     {
         Response.Redirect("Login.aspx");
     }
     if (!Page.IsPostBack)
     {
         UserService.UserServiceClient client = new UserService.UserServiceClient();
         User user = client.viewUser(Session["UserId"].ToString());
         TextBox1.Text = user.UserName;
         TextBox2.Text = user.Email;
         TextBox3.Text = user.Password;
     }
 }
コード例 #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["UserId"] == null)
     {
         Response.Redirect("Login.aspx");
     }
     SlotService.SlotServiceClient client = new SlotService.SlotServiceClient();
     Booking1[] bookings = client.showAllBookings();
     Response.Write("<br /><div><h1  style='color:#dcdcdc;font-size:35px;text-align:center;'>BOOKINGS HISTORY</h1><br />");
     Response.Write("<center><table style='border:3px solid #fff;background:#dcdcdc;text-align:center;'>");
     Response.Write("<tr style='font-size:18px;'><th style='padding:10px 15px;'>Booking Id</th><th style='padding:10px 15px;'>User Id</th><th style='padding:10px 15px;'>Slot Id</th><th style='padding:10px 15px;'>Plate Number</th><th style='padding:10px 75px;'>Arrival Time</th><th style='padding:10px 75px;'>Exit Time</th></tr>");
     if (bookings == null)
     {
         Response.Write("<tr colspan='4'>You Haven't booked any slots yet</tr>");
     }
     else
     {
         foreach (Booking1 b in bookings)
         {
             Response.Write("<tr style='font-size:18px;'><td style='padding:10px 0px;'>" + b.BookingId + "</td><td style='padding:10px 0px;'>" + b.UserId + "</td><td style='padding:10px 0px;'>" + b.SlotId + "</td><td style='padding:10px 0px;'>" + b.PlateNumber + "</td><td style='padding:10px 0px;'>"
                            + b.Arrival + "</td><td style='padding:10px 0px;'>" + b.Exit + "</td></tr>");
         }
     }
     Response.Write("</table></center></div></br>");
     Response.Write("<div><h1  style='color:#dcdcdc;font-size:35px;text-align:center;'>ACTIVE BOOKINGS</h1><br />");
     Response.Write("<center><table style='border:3px solid #fff;background:#dcdcdc;text-align:center;'>");
     Response.Write("<tr style='font-size:18px;'><th style='padding:10px 15px;'>Booking Id</th><th style='padding:10px 15px;'>User Id</th><th style='padding:10px 15px;'>Slot Id</th><th style='padding:10px 15px;'>Plate Number</th><th style='padding:10px 75px;'>Arrival Time</th><th style='padding:10px 75px;'>Exit Time</th></tr>");
     UserService.UserServiceClient client2 = new UserService.UserServiceClient();
     String[] users = client2.getUsers();
     foreach (string u in users)
     {
         Booking[] bookings1 = client.showBookings(Int32.Parse(u));
         if (bookings1 == null)
         {
             Response.Write("<tr colspan='4'>You Haven't booked any slots yet</tr>");
         }
         else
         {
             foreach (Booking b in bookings1)
             {
                 Response.Write("<tr style='font-size:18px;'><td style='padding:10px 0px;'>" + b.BookingId + "</td><td style='padding:10px 0px;'>" + u + "</td><td style='padding:10px 0px;'>" + b.SlotId + "</td><td style='padding:10px 0px;'>" + b.PlateNumber + "</td><td style='padding:10px 0px;'>"
                                + b.Arrival + "</td><td style='padding:10px 0px;'>" + b.Exit + "</td></tr>");
             }
         }
     }
     Response.Write("</table></center></div></br>");
 }
コード例 #6
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            User user = new User();

            user.Email    = TextBox3.Text;
            user.Password = TextBox2.Text;
            user.UserName = TextBox1.Text;
            UserService.UserServiceClient client = new UserService.UserServiceClient();
            client.registerUser(user);
            //Response.Write(@"<script langauge='text/javascript'>alert('You are registered successfully. Please login to access your account');</script>");
            User user1 = client.viewUser1(user.Email);

            Session["Email"]    = user1.Email;
            Session["UserId"]   = user1.Id;
            Session["UserName"] = user1.UserName;
            Response.Redirect("Main.aspx");
        }
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserId"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            Response.Write("<br /><div><h1  style='color:#dcdcdc;font-size:35px;text-align:center;'>ADMIN PANEL</h1><br />");

            UserService.UserServiceClient client = new UserService.UserServiceClient();
            string[] users = client.getUsers();
            Response.Write("<center><table style='border:3px solid #fff;background:#dcdcdc;text-align:center;'><tr><th colspan='3' style='padding:12px 10px;font-size:21px;'>END USER DETAILS</th></tr>");
            Response.Write("<tr style='font-size:18px;'><th style='padding:12px 20px;'>User Id</th><th style='padding:12px 20px;'>User Name</th><th style='padding:12px 80px;'>Email Address</th>");

            foreach (string u in users)
            {
                User b = client.viewUser(u);
                Response.Write("<tr style='font-size:18px;'><td style='padding:10px 0px;'>" + b.Id + "</td><td style='padding:10px 0px;'>" + b.UserName + "</td><td style='padding:10px 0px;'>" + b.Email + "</td></tr>");
            }

            Response.Write("</table></center></div></br></br>");
        }