//Admin Login Method private void Login(object sender, RoutedEventArgs e) { username = Username.Text; password = Password.Password; RentalCarModel RCM = new RentalCarModel(); _Admin a = new _Admin(RCM); /*Admin data called and loop through. * Because we only have one admin this method should work. If more admins existed this method wouldn't be ideal*/ List <Admin> adminlist = a.GetData(); foreach (Admin i in adminlist) { if (username == i.Name && password == i.Surname) { MessageBox.Show("Login Succesful"); Status s = new Status(); s.Show(); this.Close(); } else { MessageBox.Show("Please Try Again"); } } }
protected void Page_Load(object sender, EventArgs e) { // Check User is sign in if (Session["adminsignin"] != null) { admin = Session["adminsignin"] as _Admin; if (!IsPostBack) { GetData(); } } else { Response.Redirect("/Home"); } if (Session["success"] != null) { pnlResponseSuccess.Visible = true; Session["success"] = null; } else { pnlResponseSuccess.Visible = false; } }
public void GetData() { admin = Session["adminsignin"] as _Admin; if (admin != null) { ltrfname.Text = admin.User.FullName; ltruname.Text = admin.User.Username; ltrcontact.Text = admin.User.Contact; ltrgender.Text = admin.User.Gender; ltrcnic.Text = admin.User.CNIC; ltremail.Text = admin.User.Email; } }
protected void Page_Load(object sender, EventArgs e) { // Check User is sign in if (Session["adminsignin"] != null) { admin = Session["adminsignin"] as _Admin; if (!IsPostBack) { GetData(); } } else { Response.Redirect("/Home"); } }
public async Task <ActionResult> Edit([Bind(Include = "Id,Email,Password,NewPassword,Image")] _Admin admin, HttpPostedFileBase photo) { var adminDb = db.Admin.Find(admin.Id); if (photo != null) { if (!photo.IsImage()) { ModelState.AddModelError("Photo", "Photo is not valid"); return(View(admin)); } //RemoveImage(adminDb.Image, "~/Assets/img"); adminDb.Image = photo.SaveImage("e-commerce", "~/Assets/img"); } if (admin.NewPassword != null) { adminDb.Password = Crypto.HashPassword(admin.NewPassword); } await db.SaveChangesAsync(); return(RedirectToAction("Index", "MainHeader")); }
protected void Page_Load(object sender, EventArgs e) { // Check User is sign in if (Session["adminsignin"] != null) { admin = Session["adminsignin"] as _Admin; // Check If Password Updated if (Session["success"] != null) { pnlResponseSuccess.Visible = true; Session.Remove("success"); } else if (Session["fail"] != null) { pnlResponseFail.Visible = true; Session.Remove("fail"); } } else { Response.Redirect("/Home"); } }
public kUtils() { Admin = new _Admin(); }